@goodfellow-cms/broker 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,234 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-C2zb_90U.js","./store-BJ3bMnko.js","./setup-host-BAQmd0y1.js","./git-eGyMXUIu.js","./scheduled-builds-BPfDaBYt.js","./dist-DJGm2ktT.js","./preload-helper-9CpHFPb-.js","./content-repository-setup-0zqQHkZ9.js","./dist-86wrqcsN.js"])))=>i.map(i=>d[i]);
2
- import{d as e,f as t,i as n,l as r,m as i,o as a,p as o,s,u as c}from"./store-BJ3bMnko.js";import{n as l,r as u,t as d}from"./preload-helper-9CpHFPb-.js";function f(e){if(e)try{let t=new URL(e.url),n=t.hostname===`localhost`||t.hostname===`127.0.0.1`;return(t.protocol===`https:`||t.protocol===`http:`&&n)&&t.pathname===`/`&&!t.search&&!t.hash?t.origin:void 0}catch{return}}var p=/^[ \t]*admin:[ \t]*\{[^\n]*\},?[ \t]*\n/m;function m(e){let t=p.exec(e)?.[0],n=t&&/url:\s*"([^"\\]+)"/.exec(t)?.[1];if(t&&n)return{url:n,.../checked:\s*true/.test(t)&&{checked:!0}}}function h(e,t,{start:n=!0,end:r=!0}={}){let i=0,a=e.length;for(;n&&i<a&&t.includes(e.charAt(i));)i++;for(;r&&a>i&&t.includes(e.charAt(a-1));)a--;return e.slice(i,a)}var g={site:1,menus:1,page:1,layout:1,collection:1,entry:1,updates:1,redirects:1,media:1,theme:1,storage:1,permissions:1},_={site:[],menus:[],page:[],layout:[],collection:[],entry:[],updates:[],redirects:[],media:[],theme:[],storage:[],permissions:[]},v=class extends Error{name=`MigrationError`};function y(e,t,n={}){let r=n.registry??_,i=n.currentVersion??g[e],a=t.version;if(typeof a!=`number`||!Number.isInteger(a)||a<1)throw new v(`is missing its "version" number.`);if(a>i)throw new v(`was saved by a newer version of Goodfellow (file version ${a}, this version reads up to ${i}). Update Goodfellow to use it.`);let o=t;for(let t=a;t<i;t++){let n=r[e].find(e=>e.from===t);if(!n)throw new v(`can't be upgraded from version ${t}: no migration exists.`);o={...n.up(o),version:t+1}}return o}function ee(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function b(e,t=`|`){return e.map(e=>we(e)).join(t)}function x(e,t){return typeof t==`bigint`?t.toString():t}var te=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ne(e){return new te(e)}function re(e){return e==null}function ie(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ae(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function oe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function se(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ce(e){return se(e._zod.def)??e._zod.def.shape}function le(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return oe(this,t,e),e},enumerable:!0,configurable:!0})}function ue(e,t,n){t in e?oe(e,t,n):e[t]=n}function de(e,t,n,r){let i=ce(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?le(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ue(e,a,r?r(n.value,a):n.value))}}function fe(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?le(e,n,()=>t[n]):ue(e,n,r.value))}}function pe(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function me(e){return JSON.stringify(e)}function he(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ge=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function _e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ve=ne(()=>{if(pt.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ye(e){if(_e(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return _e(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function be(e){return ye(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var xe=new Set([`string`,`number`,`symbol`]);function Se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ce(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function we(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Te(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Ee={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},De={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Oe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return de(i,e,ke(e,t)),Ce(e,pe(n,{shape:i,checks:[]}))}function ke(e,t){let n=ce(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Ae(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(ke(e,t)),a={};return de(a,e,Reflect.ownKeys(ce(e)).filter(e=>!i.has(e))),Ce(e,pe(n,{shape:a,checks:[]}))}function je(e,t){if(!ye(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ce(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ce(e,pe(e._zod.def,{shape:Me(e,t)}))}function Me(e,t){let n={};return de(n,e,Reflect.ownKeys(ce(e))),fe(n,t),n}function Ne(e,t){if(!ye(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ce(e,pe(e._zod.def,{shape:Me(e,t)}))}function Pe(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return de(n,e,Reflect.ownKeys(ce(e))),de(n,t,Reflect.ownKeys(ce(t))),Ce(e,pe(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Fe(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(ke(t,n)):void 0,o={};return de(o,t,Reflect.ownKeys(ce(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Ce(t,pe(t._zod.def,{shape:o,checks:[]}))}function Ie(e,t,n){let r=n?new Set(ke(t,n)):void 0,i={};return de(i,t,Reflect.ownKeys(ce(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Ce(t,pe(t._zod.def,{shape:i}))}function Le(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Re(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ze(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Be(e){return typeof e==`string`?e:e?.message}function Ve(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function He(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ue(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Be(e.inst?._zod.def?.error?.(e))??Be(a?.(e))??Be(t?.error?.(e))??Be(n.customError?.(e))??Be(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var We=/[\uD800-\uDBFF]/;function Ge(e){let t=e.length;if(!We.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ke(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function qe(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Je(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ye(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):$e(e,n,r.value)}}function Xe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ze(e,t,n){return Xe(e,t,n,!1)}function Qe(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Xe(this,n,r(this))},set(e){Xe(this,n,e)}})}return t}function $e(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Xe(this,t,n.bind(this))},set(e){Xe(this,t,e)}})}function et(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var tt,nt=!1,rt={configurable:!0,get(){nt=!0}};function C(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&tt!==e._zod){tt=void 0;return}tt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,rt);let e=nt;nt=!1;try{let r=n(this);return nt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),nt||=e,r}catch(n){throw delete this[t],nt||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function it(e,t,n,r){let i=et(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var at=`~constantCatch`;function ot(e){let t=()=>e;return t[at]=!0,t}var st,ct={value:void 0,enumerable:!1},lt=`captureStackTrace`in Error?Error:null;function ut(e){let t=lt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return lt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function w(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){ct.value=new a(r);try{Object.defineProperty(n,"_zod",ct)}finally{ct.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Ye(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ut(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var dt=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ft=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(st=globalThis).__zod_globalConfig??(st.__zod_globalConfig={});var pt=globalThis.__zod_globalConfig;function mt(e){return e&&Object.assign(pt,e),pt}function ht(){let e=this._zod;return e.message??=JSON.stringify(e.def,x,2),e.message}function gt(e){this._zod.message=e}var _t={get:ht,set:gt,enumerable:!0,configurable:!0},vt={value:void 0,enumerable:!1},yt=new WeakSet([Object.prototype,Error.prototype]),bt=(e,t)=>{e.name=`$ZodError`,vt.value=t,Object.defineProperty(e,"issues",vt),vt.value=void 0,Object.defineProperty(e,"message",_t);let n=Object.getPrototypeOf(e);yt.has(n)||(yt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},xt=w(`$ZodError`,bt);w(`$ZodError`,bt,void 0,{Parent:Error});function St(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Ct(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?St(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function wt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Tt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Et=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new dt;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ue(e,o,mt())));throw ge(n,a?.callee??t),n}return s.value};return t},Dt=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ue(e,o,mt())));throw ge(n,a?.callee??t),n}return s.value};return t},Ot=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new dt;return a.issues.length?kt(e,a.issues,i):{success:!0,data:a.value}};function kt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ue(e,n,mt()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var At=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?kt(e,a.issues,i):{success:!0,data:a.value}},jt=Symbol.for(`zod.compile.invalid`),Mt=Symbol.for(`zod.compile.fallback`),Nt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==jt)return!0;if(r.definite===!0&&n===void 0)return!1}return Pt(e,t,n)});function Pt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Mt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new dt;return a.issues.length===0}var Ft=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},It=e=>{let t=Et(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Tt(n,a))};return n},Lt=e=>{let t=Et(e),n=(e,r,i,a)=>t(e,r,i,Tt(n,a));return n},Rt=e=>{let t=Dt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Tt(n,a))};return n},zt=e=>{let t=Dt(e),n=async(e,r,i,a)=>await t(e,r,i,Tt(n,a));return n},Bt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ot(e)(t,n,i)},Vt=e=>(t,n,r)=>Ot(e)(t,n,r),Ht=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return At(e)(t,n,i)},Ut=e=>async(t,n,r)=>At(e)(t,n,r),Wt=/^[cC][0-9a-z]{6,}$/,Gt=/^[0-9a-z]+$/,Kt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,qt=/^[0-9a-vA-V]{20}$/,Jt=/^[A-Za-z0-9]{27}$/,Yt=/^[a-zA-Z0-9_-]{21}$/;function Xt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Zt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$t=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,en=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tn=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function nn(){return new RegExp(tn,`u`)}var rn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,an=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,on=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,sn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ln=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,un=/^https?$/,dn=/^\+[1-9]\d{6,14}$/,fn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function pn(e){return RegExp(`^${e}$`)}var mn=pn(fn);function hn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gn(e){return RegExp(`^${hn(e)}$`)}function _n(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${hn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${hn({precision:e.precision})}`:n;return RegExp(`^${fn}T(?:${r})$`)}var vn=/^[\s\S]{0,}$/,yn=/^-?\d+$/,bn=/^-?\d+(?:\.\d+)?$/,xn=/^(?:true|false)$/i,Sn=/^[^A-Z]*$/,Cn=/^[^a-z]*$/,wn=w(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tn=e=>{let t=e.value;return!re(t)&&t.length!==void 0},En={number:`number`,bigint:`bigint`,object:`date`},Dn=w(`$ZodCheckLessThan`,(e,t)=>{wn.init(e,t);let n=En[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:En[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),On=w(`$ZodCheckGreaterThan`,(e,t)=>{wn.init(e,t);let n=En[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:En[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kn=w(`$ZodCheckMultipleOf`,(e,t)=>{wn.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ae(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),An=w(`$ZodCheckNumberFormat`,(e,t)=>{wn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ee[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),jn=w(`$ZodCheckMaxLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=Tn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ge(r):i)<=t.maximum)return;let a=Ke(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mn=w(`$ZodCheckMinLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=Tn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ge(r):i)>=t.minimum)return;let a=Ke(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Nn=w(`$ZodCheckLengthEquals`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=Tn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ge(r):i;if(a===t.length)return;let o=Ke(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Pn=w(`$ZodCheckStringFormat`,(e,t)=>{var n,r;wn.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Fn=w(`$ZodCheckRegex`,(e,t)=>{Pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),In=w(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Sn,Pn.init(e,t)}),Ln=w(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Cn,Pn.init(e,t)}),Rn=w(`$ZodCheckIncludes`,(e,t)=>{wn.init(e,t);let n=Se(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),zn=w(`$ZodCheckStartsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`^${Se(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Bn=w(`$ZodCheckEndsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`.*${Se(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Vn=w(`$ZodCheckOverwrite`,(e,t)=>{wn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Hn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
4
- `)}\n};`)(...Object.values(this.closed))}},Un={major:4,minor:6,patch:6},T=w(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Un;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Le(t),a;for(let o of n){if(o._zod.def.when){if(Re(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new dt;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(He(t.issues,n,e),i||=Le(t,n))});else{if(t.issues.length===n)continue;He(t.issues,n,e),i||=Le(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Le(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new dt;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new dt;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ze(this,`~standard`,Kn(this))},set"~standard"(e){Xe(this,`~standard`,e)}}),Wn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Ue(e,t,mt()))}:{value:e.value};async function Gn(e,t){let n={async:!0};return Wn(await e._zod.run({value:t,issues:[]},n),n)}function Kn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Wn(r,n)}catch{}return Gn(e,t)},vendor:`zod`,version:1}}var qn=w(`$ZodString`,(e,t)=>{T.init(e,t),e._zod.pattern=t.pattern??vn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),E=w(`$ZodStringFormat`,(e,t)=>{Pn.init(e,t),qn.init(e,t)}),Jn=w(`$ZodGUID`,(e,t)=>{t.pattern??=Qt,E.init(e,t)}),Yn=w(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=$t(e)}else t.pattern??=$t();E.init(e,t)}),Xn=w(`$ZodEmail`,(e,t)=>{t.pattern??=en,E.init(e,t)});function Zn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Qn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Zn(e)||2:$n(e,t)}function $n(e,t){if(!t.normalize&&t.protocol?.source===un.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var er=/[\t\n\r]/g;function tr(e){return e.replace(er,``)}function nr(e,t){return t.lastIndex=0,t.test(e.hostname)}function rr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var ir=w(`$ZodURL`,(e,t)=>{E.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Qn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=tr(r);return}t.hostname&&!nr(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!rr(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:tr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ar=w(`$ZodEmoji`,(e,t)=>{t.pattern??=nn(),E.init(e,t)}),or=w(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Yt:Xt(t.length),E.init(e,t)}),sr=w(`$ZodCUID`,(e,t)=>{t.pattern??=Wt,E.init(e,t)}),cr=w(`$ZodCUID2`,(e,t)=>{t.pattern??=Gt,E.init(e,t)}),lr=w(`$ZodULID`,(e,t)=>{t.pattern??=Kt,E.init(e,t)}),ur=w(`$ZodXID`,(e,t)=>{t.pattern??=qt,E.init(e,t)}),dr=w(`$ZodKSUID`,(e,t)=>{t.pattern??=Jt,E.init(e,t)}),fr=w(`$ZodISODateTime`,(e,t)=>{t.pattern??=_n(t),E.init(e,t)}),pr=w(`$ZodISODate`,(e,t)=>{t.pattern??=mn,E.init(e,t)}),mr=w(`$ZodISOTime`,(e,t)=>{t.pattern??=gn(t),E.init(e,t)}),hr=w(`$ZodISODuration`,(e,t)=>{t.pattern??=Zt,E.init(e,t)}),gr=w(`$ZodIPv4`,(e,t)=>{t.pattern??=rn,E.init(e,t)}),_r=/^[0-9a-fA-F:.]+$/;function vr(e){return _r.test(e)?Zn(`http://[${e}]`):!1}var yr=w(`$ZodIPv6`,(e,t)=>{t.pattern??=an,E.init(e,t),e._zod.check=n=>{vr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),br=w(`$ZodCIDRv4`,(e,t)=>{t.pattern??=on,E.init(e,t)});function xr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:vr(n)}var Sr=w(`$ZodCIDRv6`,(e,t)=>{t.pattern??=sn,E.init(e,t),e._zod.check=n=>{xr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Cr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var wr=/^[0-9a-zA-Z+/]*={0,2}$/,Tr=w(`$ZodBase64`,(e,t)=>{t.pattern??=wr,E.init(e,t),e._zod.check=n=>{Cr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Er=/^[A-Za-z0-9_-]*$/;function Dr(e){if(!Er.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Cr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Or=w(`$ZodBase64URL`,(e,t)=>{t.pattern??=Er,E.init(e,t),e._zod.check=n=>{Dr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),kr=w(`$ZodE164`,(e,t)=>{t.pattern??=dn,E.init(e,t)});function Ar(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var jr=w(`$ZodJWT`,(e,t)=>{E.init(e,t),e._zod.check=n=>{Ar(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Mr=w(`$ZodNumber`,(e,t)=>{T.init(e,t),e._zod.pattern=bn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Nr=w(`$ZodNumberFormat`,(e,t)=>{An.init(e,t),Mr.init(e,t)}),Pr=w(`$ZodBoolean`,(e,t)=>{T.init(e,t),e._zod.pattern=xn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Fr=w(`$ZodUnknown`,(e,t)=>{T.init(e,t),e._zod.parse=e=>e}),Ir=w(`$ZodNever`,(e,t)=>{T.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Lr(e,t){let n=Ve(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ve(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,He(n.issues,t,e),n}}return i(n,a)}}var Rr=e=>Array.isArray(e)?e.length:-1;function zr(e,t,n){e.issues.length&&t.issues.push(...ze(n,e.issues)),t.value[n]=e.value}var Br=w(`$ZodArray`,(e,t)=>{T.init(e,t);let n=pt.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>zr(t,r,e)));else if(zr(c,r,e),s&&c.issues.length!==0&&Le(c))break}return o.length?Promise.all(o).then(()=>r):r},Lr(e,Rr)});function Vr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ze(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Hr=[];function Ur(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Hr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Te(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Wr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Le(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Vr(e,n,i,t,d,f))):Vr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Gr=w(`$ZodObject`,(e,t)=>{T.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ne(()=>Ur(t));C(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||oe(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=_e,o=t.catchall,s,c=pt.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Le(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Vr(n,t,e,r,a,o))):Vr(s,t,e,r,a,o)}return o?Wr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Kr=w(`$ZodObjectJIT`,(e,t)=>{Gr.init(e,t);let n=e._zod.parse,r=ne(()=>Ur(t)),i=pt.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Hn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
5
- let ${e}_ab = false;
6
- for (let i = 0; i < ${e}.issues.length; i++) {
7
- const iss = ${e}.issues[i];
8
- iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
9
- payload.issues.push(iss);
10
- if (iss.continue !== true) ${e}_ab = true;
11
- }
12
- if (${e}_ab && ctx && ctx.abortEarly) {
13
- payload.value = newResult;
14
- return payload;
15
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:me(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
16
- const ${n}_present = ${i};
17
- if (!${n}.issues.length || ${n}_present) {
18
- if (${n}.issues.length) {${c(n,r)}
19
- }
20
-
21
- if (${e}) {
22
- newResult[${r}] = ${n}.value;
23
- }
24
- }
25
-
26
- `)}else f?(o.write(`
27
- if (${n}.issues.length) {${c(n,r)}
28
- }
29
- `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
30
- if (${n}.value !== undefined || ${i}) {
31
- newResult[${r}] = ${n}.value;
32
- }
33
- `)):o.write(`
34
- const ${n}_present = ${i};
35
- if (${n}.issues.length) {${c(n,r)}
36
- }
37
- if (!${n}_present && !${n}.issues.length) {
38
- payload.issues.push({
39
- code: "invalid_type",
40
- expected: "nonoptional",
41
- input: undefined,
42
- path: [${r}]
43
- });
44
- if (ctx && ctx.abortEarly) {
45
- payload.value = newResult;
46
- return payload;
47
- }
48
- }
49
-
50
- if (${n}_present) {
51
- newResult[${r}] = ${n}.value;
52
- }
53
-
54
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=_e,c=!pt.jitless,l=c&&ve.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Wr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function qr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Le(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ue(e,r,mt())))}),t)}var Jr=w(`$ZodUnion`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),C(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),C(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),C(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>ie(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>qr(t,r,e,i)):qr(o,r,e,i)}}),Yr=w(`$ZodIntersection`,(e,t)=>{T.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Zr(e,t,n)):Zr(e,i,a)}});function Xr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ye(e)&&ye(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Xr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Xr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Zr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Xr(t.value,n.value);if(!c.valid){if(Le(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Qr=w(`$ZodRecord`,(e,t)=>{T.init(e,t);let n=pt.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ye(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ue(e,i,mt())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ze(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ze(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&bn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Ue(e,i,mt())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ze(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ze(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),$r=w(`$ZodEnum`,(e,t)=>{T.init(e,t);let n=ee(t.entries),r=new Set(n);e._zod.values=r,C(e,`pattern`,e=>{let t=ee(e.def.entries).filter(e=>xe.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Se(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),ei=w(`$ZodLiteral`,(e,t)=>{T.init(e,t);let n=new Set(t.values);e._zod.values=n,C(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Se(e):e?Se(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ti=w(`$ZodTransform`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,pt.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ft(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new dt;return n.value=i,n}});function ni(e,t){return e.value=t.issues.length?void 0:t.value,e}var ri=w(`$ZodOptional`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,C(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ie(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ni(e,t)):ni(e,r)}return t.innerType._zod.run(e,n)}}),ii=w(`$ZodExactOptional`,(e,t)=>{ri.init(e,t),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ai=w(`$ZodNullable`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin),C(e,`optout`,e=>e.def.innerType._zod.optout),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ie(t.source)}|null)$`):void 0}),C(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),oi=w(`$ZodDefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,C(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>si(e,t)):si(r,t)}});function si(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ci=w(`$ZodPrefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,C(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),li=w(`$ZodNonOptional`,(e,t)=>{T.init(e,t),C(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ui(t,e)):ui(i,e)}});function ui(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function di(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ue(e,r,mt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var fi=w(`$ZodCatch`,(e,t)=>{T.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),C(e,`optout`,e=>e.def.innerType._zod.optout),C(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>di(e,r,t,n)):di(e,r,t,n)}}),pi=w(`$ZodPipe`,(e,t)=>{T.init(e,t),C(e,`values`,e=>e.def.in._zod.values),C(e,`optin`,e=>e.def.in._zod.optin),C(e,`optout`,e=>e.def.out._zod.optout),C(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>mi(e,t.in,n)):mi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>mi(e,t.out,n)):mi(r,t.out,n)}});function mi(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var hi=w(`$ZodReadonly`,(e,t)=>{T.init(e,t),C(e,`propValues`,e=>e.def.innerType._zod.propValues),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`optin`,e=>e.def.innerType?._zod?.optin),C(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(gi):gi(r)}});function gi(e){return e.memo||(e.value=Object.freeze(e.value)),e}var _i=w(`$ZodCustom`,(e,t)=>{wn.init(e,t),T.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>vi(t,n,r,e));vi(i,n,r,e)}});function vi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Je(e))}}var yi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},bi=`~memo`,xi=[];function Si(e){return typeof e==`object`&&!!e}function Ci(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var wi=new WeakMap,Ti=0,Ei=1,Di=2;function Oi(e,t,n){let r=wi.get(e);if(r!==void 0)return r?Di:Ti;if(t.has(e))return Di;t.add(e);let i=Ti,a=e=>{if(i!==Di&&e?._zod){let r=Oi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Ti;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ei:o.value?._zod?Oi(o.value,t,n):Ti;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=se(c);s(e?o(e,!0):Ei),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Oi(r,t,!1):Ei);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ki(e,i)}function ki(e,t){return t!==Ei&&wi.set(e,t===Di),t}function Ai(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var ji,Mi=[],Ni={alloc(e,t,n){let r=ji;if(!r)return n;ji=void 0;let i={value:n,issues:null};return r.set(t.value,i),Mi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Fi(n,e.value))throw new yi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Oi(e,new Set,!1);if(i===Ti)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Di||r?n=!0:r=!0}let l=s.value;if(!Si(l))return t(s,c);let u=c[bi];u||(u={buckets:new WeakMap,backEdges:void 0},c[bi]=u);let d;i===c?d=a:(d=Ai(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Ci(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;ji=d;let p=Mi.length,m=t(s,c);ji=void 0;let h=Mi.length>p?Mi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Ci(e.issues):xi),e)):(h&&(h.issues=m.issues.length?Ci(m.issues):xi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Pi(){return Ni}function Fi(e,t){let n=e[bi]?.backEdges;return n!==void 0&&Si(t)&&n.has(t)}var Ii=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(qe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${we(e.values[0])}`:`Invalid option: expected one of ${b(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${b(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Li(){return{localeError:Ii()}}var Ri,zi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Bi(){return new zi}(Ri=globalThis).__zod_globalRegistry??(Ri.__zod_globalRegistry=Bi());var Vi=globalThis.__zod_globalRegistry;function Hi(e){return e.checks&&=[...e.checks],e}function Ui(e,t){return new e(Hi({type:`string`,...S(t)}))}function Wi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...S(t)})}function Gi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...S(t)})}function Ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...S(t)})}function qi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...S(t)})}function Ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...S(t)})}function Yi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...S(t)})}function Xi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...S(t)})}function Zi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...S(t)})}function Qi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...S(t)})}function $i(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...S(t)})}function ea(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...S(t)})}function ta(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...S(t)})}function na(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...S(t)})}function ra(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...S(t)})}function ia(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...S(t)})}function aa(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...S(t)})}function oa(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...S(t)})}function sa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...S(t)})}function ca(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...S(t)})}function la(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...S(t)})}function ua(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...S(t)})}function da(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...S(t)})}function fa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...S(t)})}function pa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...S(t)})}function ma(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...S(t)})}function ha(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...S(t)})}function ga(e,t){return new e(Hi({type:`number`,checks:[],...S(t)}))}function _a(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...S(t)})}function va(e,t){return new e({type:`boolean`,...S(t)})}function ya(e){return new e({type:`unknown`})}function ba(e,t){return new e({type:`never`,...S(t)})}function xa(e,t){return new Dn({check:`less_than`,...S(t),value:e,inclusive:!1})}function Sa(e,t){return new Dn({check:`less_than`,...S(t),value:e,inclusive:!0})}function Ca(e,t){return new On({check:`greater_than`,...S(t),value:e,inclusive:!1})}function wa(e,t){return new On({check:`greater_than`,...S(t),value:e,inclusive:!0})}function Ta(e,t){return new kn({check:`multiple_of`,...S(t),value:e})}function Ea(e,t){return new jn({check:`max_length`,...S(t),maximum:e})}function Da(e,t){return new Mn({check:`min_length`,...S(t),minimum:e})}function Oa(e,t){return new Nn({check:`length_equals`,...S(t),length:e})}function ka(e,t){return new Fn({check:`string_format`,format:`regex`,...S(t),pattern:e})}function Aa(e){return new In({check:`string_format`,format:`lowercase`,...S(e)})}function ja(e){return new Ln({check:`string_format`,format:`uppercase`,...S(e)})}function Ma(e,t){return new Rn({check:`string_format`,format:`includes`,...S(t),includes:e})}function Na(e,t){return new zn({check:`string_format`,format:`starts_with`,...S(t),prefix:e})}function Pa(e,t){return new Bn({check:`string_format`,format:`ends_with`,...S(t),suffix:e})}function Fa(e){return new Vn({check:`overwrite`,tx:e})}function Ia(e){return Fa(t=>t.normalize(e))}function La(){return Fa(e=>e.trim())}function Ra(){return Fa(e=>e.toLowerCase())}function za(){return Fa(e=>e.toUpperCase())}function Ba(){return Fa(e=>he(e))}function Va(e,t,n){return new e({type:`array`,element:t,...S(n)})}function Ha(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...S(n)})}function Ua(e,t){let n=Wa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Je(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Je(r))}},e(t.value,t)),t);return n}function Wa(e,t){let n=new wn({check:`custom`,...S(t)});return n._zod.check=e,n}function Ga(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&oe(e,t,n[t]);return e}function Ka(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Vi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function qa(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,D(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ga(o.schema,c),t.io===`input`&&O(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ja(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ya(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ja(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ja(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
55
-
56
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Xa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Xa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Za=new Set([`type`,`properties`,`required`,`additionalProperties`]),Qa=[`oneOf`,`anyOf`];function $a(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function eo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Za.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??$a(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}oe(n,r,e.length===1?e[0]:eo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=$a(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function to(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Za)if(t in e)return;let n=t.filter(e=>Qa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=eo(t);else{let e=n[0],i=Qa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>eo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ga(e,r))}function no(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ga(i,s),Ga(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Xa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])to(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ga(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,oe(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:io(t,`input`,e.processors),output:io(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function O(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return O(r.element,n);if(r.type===`set`)return O(r.valueType,n);if(r.type===`lazy`)return O(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return O(r.innerType,n);if(r.type===`intersection`)return O(r.left,n)||O(r.right,n);if(r.type===`record`||r.type===`map`)return O(r.keyType,n)||O(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:O(r.in,n)||O(r.out,n);if(r.type===`object`){for(let e in r.shape)if(O(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(O(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(O(e,n))return!0;return!!(r.rest&&O(r.rest,n))}return!1}var ro=(e,t={})=>n=>{let r=Ka({...n,processors:t});return D(e,r),Ya(r,e),no(r,e)},io=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ka({...i??{},target:a,io:t,processors:n});return D(e,o),Ya(o,e),no(o,e)},ao=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},oo=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},so=(e,t)=>{ao(e,`minimum`,t),oo(e,`maximum`,t)},co=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},lo=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},uo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},fo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},po=(e,t)=>ao(e,`minimum`,t.minimum),mo=(e,t)=>oo(e,`maximum`,t.maximum),ho=e=>(t,n)=>{fo(t,n.format);let[r,i]=e[n.format];ao(t,`minimum`,r),oo(t,`maximum`,i)},go={greater_than:(e,t)=>ao(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>oo(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>co(e,t.value),number_format:ho(Ee),bigint_format:ho(De),min_length:po,max_length:mo,length_equals:(e,t)=>so(e,t.length),min_size:po,max_size:mo,size_equals:(e,t)=>so(e,t.size),string_format:(e,t)=>{fo(e,t.format),t.pattern&&lo(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>uo(e,t.mime)};function _o(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)go[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ao(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ao(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&oo(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&oo(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&co(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&uo(t,i.mime);for(let e of i.patterns??[])lo(t,e);return t}var vo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},yo=new Map([[wr,cn],[Er,ln]]),bo=e=>yo.get(e)??e,xo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=_o(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=vo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(bo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},So=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=_o(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):qa(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Co=(e,t,n,r)=>{n.type=`boolean`},wo=(e,t,n,r)=>{n.not={}},To=(e,t,n,r)=>{let i=e._zod.def,a=ee(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Eo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(qa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(qa(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Do=(e,t,n,r)=>{qa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{qa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=_o(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=D(a.element,t,{...r,path:[...r.path,`items`]})};function Ao(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ao(t.out):t.type===`catch`?Ao(t.innerType):e._zod.optin}var jo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&qa(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)oe(i.properties,e,D(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ao(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Mo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},No=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Po(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Po(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Po(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?bn:yn).source),p):p}var Fo=new WeakMap;function Io(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Fo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Po(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=_o(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=D(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)oe(i.patternProperties,bo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Fo.get(t);n||(n=[],Fo.set(t,n),t.deferred.push(()=>Io(t))),n.push(e)}i.additionalProperties=D(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ao(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ro=(e,t,n,r)=>{let i=e._zod.def,a=D(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},zo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=Symbol();function Vo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(qa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Bo):JSON.parse(o)}var Ho=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Vo(i.defaultValue,e,t,n,r);o!==Bo&&(n.default=o)},Uo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Vo(i.defaultValue,e,t,n,r);o!==Bo&&(n._prefault=o)},Wo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{qa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Go=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;D(o,t,r);let s=t.seen.get(e);s.ref=o},Ko=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},qo=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Jo=new WeakSet([Object.prototype,Error.prototype]);function Yo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Xo=w(`ZodError`,(e,t)=>{xt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Jo.has(n)||(Jo.add(n),Yo(n,`format`,e=>t=>wt(e,t)),Yo(n,`flatten`,e=>t=>Ct(e,t)),Yo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,x,2)}),Yo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,x,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Zo=Et(Xo),Qo=Dt(Xo),$o=Ot(Xo),es=At(Xo),ts=It(Xo),ns=Lt(Xo),rs=Rt(Xo),is=zt(Xo),as=Bt(Xo),os=Vt(Xo),ss=Ht(Xo),cs=Ut(Xo);function ls(){pt.localeError||mt(Li())}function us(){pt.memoizer||mt({memoizer:Pi()})}var k=w(`ZodType`,(e,t)=>(ls(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(pe(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ce(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Oc(e,t))},superRefine(e,t){return this.check(kc(e,t))},overwrite(e){return this.check(Fa(e))},optional(){return uc(this)},exactOptional(){return fc(this)},nullable(){return mc(this)},nullish(){return uc(mc(this))},nonoptional(e){return bc(this,e)},array(){return M(this)},or(e){return Zs([this,e])},and(e){return $s(this,e)},transform(e){return wc(this,cc(e))},default(e){return gc(this,e)},prefault(e){return vc(this,e)},catch(e){return Sc(this,e)},pipe(e){return wc(this,e)},readonly(){return Ec(this)},describe(e){let t=this.clone();return Vi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Vi.get(this);let t=this.clone();return Vi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ze(this,`~standard`,{...Kn(this),jsonSchema:{input:io(this,`input`),output:io(this,`output`)}})},set"~standard"(e){Xe(this,`~standard`,e)},parse:function e(t,n){return Zo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Qo(this,t,n,{callee:e})},safeParse(e,t){return $o(this,e,t)},async safeParseAsync(e,t){return es(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Xe(this,`spa`,e)},validate(e,t){return Nt(this,e,t)},validateAsync(e,t){return Ft(this,e,t)},encode:function e(t,n){return ts(this,t,n,{callee:e})},decode:function e(t,n){return ns(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await rs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await is(this,t,n,{callee:e})},safeEncode(e,t){return as(this,e,t)},safeDecode(e,t){return os(this,e,t)},async safeEncodeAsync(e,t){return ss(this,e,t)},async safeDecodeAsync(e,t){return cs(this,e,t)},toJSONSchema(e){return ro(this,{})(e)},get description(){return Vi.get(this)?.description},get _def(){return this._zod.def}}),ds=w(`_ZodString`,(e,t)=>{qn.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)},Qe({format:e=>_o(e).format??null,minLength:e=>_o(e).minimum??null,maxLength:e=>_o(e).maximum??null},{regex(...e){return this.check(ka(...e))},includes(...e){return this.check(Ma(...e))},startsWith(...e){return this.check(Na(...e))},endsWith(...e){return this.check(Pa(...e))},min(...e){return this.check(Da(...e))},max(...e){return this.check(Ea(...e))},length(...e){return this.check(Oa(...e))},nonempty(...e){return this.check(Da(1,...e))},lowercase(e){return this.check(Aa(e))},uppercase(e){return this.check(ja(e))},trim(){return this.check(La())},normalize(...e){return this.check(Ia(...e))},toLowerCase(){return this.check(Ra())},toUpperCase(){return this.check(za())},slugify(){return this.check(Ba())}})),fs=w(`ZodString`,(e,t)=>{qn.init(e,t),ds.init(e,t)},{email(e){return this.check(Wi(_s,e))},url(e){return this.check(Xi(bs,e))},jwt(e){return this.check(da(Is,e))},emoji(e){return this.check(Zi(Ss,e))},guid(e){return this.check(Gi(vs,e))},uuid(e){return this.check(Ki(ys,e))},uuidv4(e){return this.check(qi(ys,e))},uuidv6(e){return this.check(Ji(ys,e))},uuidv7(e){return this.check(Yi(ys,e))},nanoid(e){return this.check(Qi(Cs,e))},cuid(e){return this.check($i(ws,e))},cuid2(e){return this.check(ea(Ts,e))},ulid(e){return this.check(ta(Es,e))},base64(e){return this.check(ca(Ns,e))},base64url(e){return this.check(la(Ps,e))},xid(e){return this.check(na(Ds,e))},ksuid(e){return this.check(ra(Os,e))},ipv4(e){return this.check(ia(ks,e))},ipv6(e){return this.check(aa(As,e))},cidrv4(e){return this.check(oa(js,e))},cidrv6(e){return this.check(sa(Ms,e))},e164(e){return this.check(ua(Fs,e))},datetime(e){return this.check(fa(ps,e))},date(e){return this.check(pa(ms,e))},time(e){return this.check(ma(hs,e))},duration(e){return this.check(ha(gs,e))}});function A(e){return Ui(fs,e)}var j=w(`ZodStringFormat`,(e,t)=>{E.init(e,t),ds.init(e,t)}),ps=w(`ZodISODateTime`,(e,t)=>{fr.init(e,t),j.init(e,t)}),ms=w(`ZodISODate`,(e,t)=>{pr.init(e,t),j.init(e,t)}),hs=w(`ZodISOTime`,(e,t)=>{mr.init(e,t),j.init(e,t)}),gs=w(`ZodISODuration`,(e,t)=>{hr.init(e,t),j.init(e,t)}),_s=w(`ZodEmail`,(e,t)=>{Xn.init(e,t),j.init(e,t)}),vs=w(`ZodGUID`,(e,t)=>{Jn.init(e,t),j.init(e,t)}),ys=w(`ZodUUID`,(e,t)=>{Yn.init(e,t),j.init(e,t)}),bs=w(`ZodURL`,(e,t)=>{ir.init(e,t),j.init(e,t)});function xs(e){return Xi(bs,e)}var Ss=w(`ZodEmoji`,(e,t)=>{ar.init(e,t),j.init(e,t)}),Cs=w(`ZodNanoID`,(e,t)=>{or.init(e,t),j.init(e,t)}),ws=w(`ZodCUID`,(e,t)=>{sr.init(e,t),j.init(e,t)}),Ts=w(`ZodCUID2`,(e,t)=>{cr.init(e,t),j.init(e,t)}),Es=w(`ZodULID`,(e,t)=>{lr.init(e,t),j.init(e,t)}),Ds=w(`ZodXID`,(e,t)=>{ur.init(e,t),j.init(e,t)}),Os=w(`ZodKSUID`,(e,t)=>{dr.init(e,t),j.init(e,t)}),ks=w(`ZodIPv4`,(e,t)=>{gr.init(e,t),j.init(e,t)}),As=w(`ZodIPv6`,(e,t)=>{yr.init(e,t),j.init(e,t)}),js=w(`ZodCIDRv4`,(e,t)=>{br.init(e,t),j.init(e,t)}),Ms=w(`ZodCIDRv6`,(e,t)=>{Sr.init(e,t),j.init(e,t)}),Ns=w(`ZodBase64`,(e,t)=>{Tr.init(e,t),j.init(e,t)}),Ps=w(`ZodBase64URL`,(e,t)=>{Or.init(e,t),j.init(e,t)}),Fs=w(`ZodE164`,(e,t)=>{kr.init(e,t),j.init(e,t)}),Is=w(`ZodJWT`,(e,t)=>{jr.init(e,t),j.init(e,t)}),Ls=w(`ZodNumber`,(e,t)=>{Mr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.isFinite=!0},Qe({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=_o(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=_o(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=_o(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>_o(e).format??null},{gt(e,t){return this.check(Ca(e,t))},gte(e,t){return this.check(wa(e,t))},min(e,t){return this.check(wa(e,t))},lt(e,t){return this.check(xa(e,t))},lte(e,t){return this.check(Sa(e,t))},max(e,t){return this.check(Sa(e,t))},int(e){return this.check(Bs(e))},safe(e){return this.check(Bs(e))},positive(e){return this.check(Ca(0,e))},nonnegative(e){return this.check(wa(0,e))},negative(e){return this.check(xa(0,e))},nonpositive(e){return this.check(Sa(0,e))},multipleOf(e,t){return this.check(Ta(e,t))},step(e,t){return this.check(Ta(e,t))},finite(){return this}}));function Rs(e){return ga(Ls,e)}var zs=w(`ZodNumberFormat`,(e,t)=>{Nr.init(e,t),Ls.init(e,t)});function Bs(e){return _a(zs,e)}var Vs=w(`ZodBoolean`,(e,t)=>{Pr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function Hs(e){return va(Vs,e)}var Us=w(`ZodUnknown`,(e,t)=>{Fr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ws(){return ya(Us)}var Gs=w(`ZodNever`,(e,t)=>{Ir.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Ks(e){return ba(Gs,e)}var qs=w(`ZodArray`,(e,t)=>{us(),Br.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Da(e,t))},nonempty(e){return this.check(Da(1,e))},max(e,t){return this.check(Ea(e,t))},length(e,t){return this.check(Oa(e,t))},unwrap(){return this.element}});function M(e,t){return Va(qs,e,t)}var Js=w(`ZodObject`,(e,t)=>{us(),Kr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),it(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ic(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(pe(this._zod.def,{catchall:e}))},passthrough(){return this.clone(pe(this._zod.def,{catchall:Ws()}))},loose(){return this.clone(pe(this._zod.def,{catchall:Ws()}))},strict(){return this.clone(pe(this._zod.def,{catchall:Ks()}))},strip(){return this.clone(pe(this._zod.def,{catchall:void 0}))},extend(e){return je(this,e)},safeExtend(e){return Ne(this,e)},merge(e){return Pe(this,e)},pick(e){return Oe(this,e)},omit(e){return Ae(this,e)},partial(...e){return Fe(lc,this,e[0])},exactPartial(...e){return Fe(dc,this,e[0],`exactPartial`)},required(...e){return Ie(yc,this,e[0])}});function N(e,t){return new Js({type:`object`,shape:e??{},...S(t)})}function Ys(e,t){return new Js({type:`object`,shape:e,catchall:Ws(),...S(t)})}var Xs=w(`ZodUnion`,(e,t)=>{Jr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.options=t.options});function Zs(e,t){return new Xs({type:`union`,options:e,...S(t)})}var Qs=w(`ZodIntersection`,(e,t)=>{Yr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r)});function $s(e,t){return new Qs({type:`intersection`,left:e,right:t})}var ec=w(`ZodRecord`,(e,t)=>{us(),Qr.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function tc(e,t,n){return!t||!t._zod?new ec({type:`record`,keyType:A(),valueType:e,...S(t)}):new ec({type:`record`,keyType:e,valueType:t,...S(n)})}function nc(e,t,n){return new ec({type:`record`,keyType:e,valueType:t,...S(n),partial:!0})}var rc=w(`ZodEnum`,(e,t)=>{$r.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new rc({...t,checks:[],...S(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new rc({...t,checks:[],...S(r),entries:i})}});function ic(e,t){return new rc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...S(t)})}var ac=w(`ZodLiteral`,(e,t)=>{ei.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function oc(e,t){return new ac({type:`literal`,values:Array.isArray(e)?e:[e],...S(t)})}var sc=w(`ZodTransform`,(e,t)=>{us(),ti.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ft(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Je(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Je(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function cc(e){return new sc({type:`transform`,transform:e})}var lc=w(`ZodOptional`,(e,t)=>{ri.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uc(e){return new lc({type:`optional`,innerType:e})}var dc=w(`ZodExactOptional`,(e,t)=>{ii.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fc(e){return new dc({type:`optional`,innerType:e})}var pc=w(`ZodNullable`,(e,t)=>{ai.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e){return new pc({type:`nullable`,innerType:e})}var hc=w(`ZodDefault`,(e,t)=>{oi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gc(e,t){return new hc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():be(t)}})}var _c=w(`ZodPrefault`,(e,t)=>{ci.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vc(e,t){return new _c({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():be(t)}})}var yc=w(`ZodNonOptional`,(e,t)=>{li.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bc(e,t){return new yc({type:`nonoptional`,innerType:e,...S(t)})}var xc=w(`ZodCatch`,(e,t)=>{fi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Sc(e,t){return new xc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ot(t)})}var Cc=w(`ZodPipe`,(e,t)=>{pi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.in=t.in,e.out=t.out});function wc(e,t){return new Cc({type:`pipe`,in:e,out:t})}var Tc=w(`ZodReadonly`,(e,t)=>{hi.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ec(e){return new Tc({type:`readonly`,innerType:e})}var Dc=w(`ZodCustom`,(e,t)=>{_i.init(e,t),k.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function Oc(e,t={}){return Ha(Dc,e,t)}function kc(e,t){return Ua(e,t)}var Ac=class e{static fromString(t){return new e(t)}constructor(e){this.value=e}icaltype=`binary`;decodeValue(){return this._b64_decode(this.value)}setEncodedValue(e){this.value=this._b64_encode(e)}_b64_encode(e){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,n,r,i,a,o,s,c,l,u=0,d=0,f=``,p=[];if(!e)return e;do n=e.charCodeAt(u++),r=e.charCodeAt(u++),i=e.charCodeAt(u++),l=n<<16|r<<8|i,a=l>>18&63,o=l>>12&63,s=l>>6&63,c=l&63,p[d++]=t.charAt(a)+t.charAt(o)+t.charAt(s)+t.charAt(c);while(u<e.length);f=p.join(``);let m=e.length%3;return(m?f.slice(0,m-3):f)+`===`.slice(m||3)}_b64_decode(e){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,n,r,i,a,o,s,c,l,u=0,d=0,f=``,p=[];if(!e)return e;e+=``;do a=t.indexOf(e.charAt(u++)),o=t.indexOf(e.charAt(u++)),s=t.indexOf(e.charAt(u++)),c=t.indexOf(e.charAt(u++)),l=a<<18|o<<12|s<<6|c,n=l>>16&255,r=l>>8&255,i=l&255,s==64?p[d++]=String.fromCharCode(n):c==64?p[d++]=String.fromCharCode(n,r):p[d++]=String.fromCharCode(n,r,i);while(u<e.length);return f=p.join(``),f}toString(){return this.value}},jc=/([PDWHMTS]{1,1})/,Mc=[`weeks`,`days`,`hours`,`minutes`,`seconds`,`isNegative`],Nc=class e{static fromSeconds(t){return new e().fromSeconds(t)}static isValueString(e){return e[0]===`P`||e[1]===`P`}static fromString(t){let n=0,r=Object.create(null),i=0;for(;(n=t.search(jc))!==-1;){let e=t[n],a=t.slice(0,Math.max(0,n));t=t.slice(n+1),i+=Pc(e,a,r)}if(i<2)throw Error(`invalid duration value: Not enough duration components in "`+t+`"`);return new e(r)}static fromData(t){return new e(t)}constructor(e){this.wrappedJSObject=this,this.fromData(e)}weeks=0;days=0;hours=0;minutes=0;seconds=0;isNegative=!1;icalclass=`icalduration`;icaltype=`duration`;clone(){return e.fromData(this)}toSeconds(){let e=this.seconds+60*this.minutes+3600*this.hours+86400*this.days+604800*this.weeks;return this.isNegative?-e:e}fromSeconds(e){let t=Math.abs(e);return this.isNegative=e<0,this.days=z(t/86400),this.days%7==0?(this.weeks=this.days/7,this.days=0):this.weeks=0,t-=(this.days+7*this.weeks)*86400,this.hours=z(t/3600),t-=this.hours*3600,this.minutes=z(t/60),t-=this.minutes*60,this.seconds=t,this}fromData(e){for(let t of Mc)this[t]=e&&t in e?e[t]:0}reset(){this.isNegative=!1,this.weeks=0,this.days=0,this.hours=0,this.minutes=0,this.seconds=0}compare(e){let t=this.toSeconds(),n=e.toSeconds();return(t>n)-(t<n)}normalize(){this.fromSeconds(this.toSeconds())}toString(){if(this.toSeconds()==0)return`PT0S`;{let e=``;this.isNegative&&(e+=`-`),e+=`P`;let t=!1;return this.weeks?this.days||this.hours||this.minutes||this.seconds?e+=this.weeks*7+this.days+`D`:(e+=this.weeks+`W`,t=!0):this.days&&(e+=this.days+`D`),t||(this.hours||this.minutes||this.seconds)&&(e+=`T`,this.hours&&(e+=this.hours+`H`),this.minutes&&(e+=this.minutes+`M`),this.seconds&&(e+=this.seconds+`S`)),e}}toICALString(){return this.toString()}};function Pc(e,t,n){let r;switch(e){case`P`:n.isNegative=!!(t&&t===`-`);break;case`D`:r=`days`;break;case`W`:r=`weeks`;break;case`H`:r=`hours`;break;case`M`:r=`minutes`;break;case`S`:r=`seconds`;break;default:return 0}if(r){if(!t&&t!==0)throw Error(`invalid duration value: Missing number before "`+e+`"`);let i=parseInt(t,10);if(qc(i))throw Error(`invalid duration value: Invalid number "`+t+`" before "`+e+`"`);n[r]=i}return 1}var Fc=class e{static fromString(t,n){let r=t.split(`/`);if(r.length!==2)throw Error(`Invalid string value: "`+t+`" must contain a "/" char.`);let i={start:P.fromDateTimeString(r[0],n)},a=r[1];return Nc.isValueString(a)?i.duration=Nc.fromString(a):i.end=P.fromDateTimeString(a,n),new e(i)}static fromData(t){return new e(t)}static fromJSON(t,n,r){function i(e,t){return r?P.fromString(e,t):P.fromDateTimeString(e,t)}return Nc.isValueString(t[1])?e.fromData({start:i(t[0],n),duration:Nc.fromString(t[1])}):e.fromData({start:i(t[0],n),end:i(t[1],n)})}constructor(e){if(this.wrappedJSObject=this,e&&`start`in e){if(e.start&&!(e.start instanceof P))throw TypeError(`.start must be an instance of ICAL.Time`);this.start=e.start}if(e&&e.end&&e.duration)throw Error(`cannot accept both end and duration`);if(e&&`end`in e){if(e.end&&!(e.end instanceof P))throw TypeError(`.end must be an instance of ICAL.Time`);this.end=e.end}if(e&&`duration`in e){if(e.duration&&!(e.duration instanceof Nc))throw TypeError(`.duration must be an instance of ICAL.Duration`);this.duration=e.duration}}start=null;end=null;duration=null;icalclass=`icalperiod`;icaltype=`period`;clone(){return e.fromData({start:this.start?this.start.clone():null,end:this.end?this.end.clone():null,duration:this.duration?this.duration.clone():null})}getDuration(){return this.duration?this.duration:this.end.subtractDate(this.start)}getEnd(){if(this.end)return this.end;{let e=this.start.clone();return e.addDuration(this.duration),e}}compare(e){return e.compare(this.start)<0?1:e.compare(this.getEnd())>0?-1:0}toString(){return this.start+`/`+(this.end||this.duration)}toJSON(){return[this.start.toString(),(this.end||this.duration).toString()]}toICALString(){return this.start.toICALString()+`/`+(this.end||this.duration).toICALString()}},P=class e{static _dowCache={};static _wnCache={};static daysInMonth(t,n){let r=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=30;return t<1||t>12?i:(i=r[t],t==2&&(i+=e.isLeapYear(n)),i)}static isLeapYear(e){return e<=1752?e%4==0:e%4==0&&e%100!=0||e%400==0}static fromDayOfYear(t,n){let r=n,i=t,a=new e;a.auto_normalize=!1;let o=+!!e.isLeapYear(r);if(i<1)return r--,o=+!!e.isLeapYear(r),i+=e.daysInYearPassedMonth[o][12],e.fromDayOfYear(i,r);if(i>e.daysInYearPassedMonth[o][12])return o=+!!e.isLeapYear(r),i-=e.daysInYearPassedMonth[o][12],r++,e.fromDayOfYear(i,r);a.year=r,a.isDate=!0;for(let t=11;t>=0;t--)if(i>e.daysInYearPassedMonth[o][t]){a.month=t+1,a.day=i-e.daysInYearPassedMonth[o][t];break}return a.auto_normalize=!0,a}static fromStringv2(t){return new e({year:parseInt(t.slice(0,4),10),month:parseInt(t.slice(5,7),10),day:parseInt(t.slice(8,10),10),isDate:!0})}static fromDateString(t){return new e({year:R(t.slice(0,4)),month:R(t.slice(5,7)),day:R(t.slice(8,10)),isDate:!0})}static fromDateTimeString(t,n){if(t.length<19)throw Error(`invalid date-time value: "`+t+`"`);let r,i;t.slice(-1)===`Z`?r=I.utcTimezone:n&&(i=n.getParameter(`tzid`),n.parent&&(n.parent.name===`standard`||n.parent.name===`daylight`?r=I.localTimezone:i&&(r=n.parent.getTimeZoneByID(i))));let a={year:R(t.slice(0,4)),month:R(t.slice(5,7)),day:R(t.slice(8,10)),hour:R(t.slice(11,13)),minute:R(t.slice(14,16)),second:R(t.slice(17,19))};return i&&!r&&(a.timezone=i),new e(a,r)}static fromString(t,n){return t.length>10?e.fromDateTimeString(t,n):e.fromDateString(t)}static fromJSDate(t,n){return new e().fromJSDate(t,n)}static fromData=function(t,n){return new e().fromData(t,n)};static now(){return e.fromJSDate(new Date,!1)}static weekOneStarts(t,n){let r=e.fromData({year:t,month:1,day:1,isDate:!0}),i=r.dayOfWeek(),a=n||e.DEFAULT_WEEK_START;return i>e.THURSDAY&&(r.day+=7),a>e.THURSDAY&&(r.day-=7),r.day-=i-a,r}static getDominicalLetter(t){let n=`GFEDCBA`,r=(t+(t/4|0)+(t/400|0)-(t/100|0)-1)%7;return e.isLeapYear(t)?n[(r+6)%7]+n[r]:n[r]}static#e=null;static get epochTime(){return this.#e||=e.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:`Z`}),this.#e}static _cmp_attr(e,t,n){return e[n]>t[n]?1:e[n]<t[n]?-1:0}static daysInYearPassedMonth=[[0,31,59,90,120,151,181,212,243,273,304,334,365],[0,31,60,91,121,152,182,213,244,274,305,335,366]];static SUNDAY=1;static MONDAY=2;static TUESDAY=3;static WEDNESDAY=4;static THURSDAY=5;static FRIDAY=6;static SATURDAY=7;static DEFAULT_WEEK_START=2;constructor(e,t){this.wrappedJSObject=this,this._time=Object.create(null),this._time.year=0,this._time.month=1,this._time.day=1,this._time.hour=0,this._time.minute=0,this._time.second=0,this._time.isDate=!1,this.fromData(e,t)}icalclass=`icaltime`;_cachedUnixTime=null;get icaltype(){return this.isDate?`date`:`date-time`}zone=null;_pendingNormalization=!1;get year(){return this._getTimeAttr(`year`)}set year(e){this._setTimeAttr(`year`,e)}get month(){return this._getTimeAttr(`month`)}set month(e){this._setTimeAttr(`month`,e)}get day(){return this._getTimeAttr(`day`)}set day(e){this._setTimeAttr(`day`,e)}get hour(){return this._getTimeAttr(`hour`)}set hour(e){this._setTimeAttr(`hour`,e)}get minute(){return this._getTimeAttr(`minute`)}set minute(e){this._setTimeAttr(`minute`,e)}get second(){return this._getTimeAttr(`second`)}set second(e){this._setTimeAttr(`second`,e)}get isDate(){return this._getTimeAttr(`isDate`)}set isDate(e){this._setTimeAttr(`isDate`,e)}_getTimeAttr(e){return this._pendingNormalization&&=(this._normalize(),!1),this._time[e]}_setTimeAttr(e,t){e===`isDate`&&t&&!this._time.isDate&&this.adjust(0,0,0,0),this._cachedUnixTime=null,this._pendingNormalization=!0,this._time[e]=t}clone(){return new e(this._time,this.zone)}reset(){this.fromData(e.epochTime),this.zone=I.utcTimezone}resetTo(e,t,n,r,i,a,o){this.fromData({year:e,month:t,day:n,hour:r,minute:i,second:a,zone:o})}fromJSDate(e,t){return e?t?(this.zone=I.utcTimezone,this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()):(this.zone=I.localTimezone,this.year=e.getFullYear(),this.month=e.getMonth()+1,this.day=e.getDate(),this.hour=e.getHours(),this.minute=e.getMinutes(),this.second=e.getSeconds()):this.reset(),this._cachedUnixTime=null,this}fromData(e,t){if(e)for(let[t,n]of Object.entries(e))t!==`icaltype`&&(this[t]=n);if(t&&(this.zone=t),e&&!(`isDate`in e)?this.isDate=!(`hour`in e):e&&`isDate`in e&&(this.isDate=e.isDate),e&&`timezone`in e){let t=Gc.get(e.timezone);this.zone=t||I.localTimezone}return e&&`zone`in e&&(this.zone=e.zone),this.zone||=I.localTimezone,this._cachedUnixTime=null,this}dayOfWeek(t){let n=t||e.SUNDAY,r=(this.year<<12)+(this.month<<8)+(this.day<<3)+n;if(r in e._dowCache)return e._dowCache[r];let i=this.day,a=this.month+(this.month<3?12:0),o=this.year-+(this.month<3),s=i+o+z((a+1)*26/10)+z(o/4);return s+=z(o/100)*6+z(o/400),s=(s+7-n)%7+1,e._dowCache[r]=s,s}dayOfYear(){let t=+!!e.isLeapYear(this.year);return e.daysInYearPassedMonth[t][this.month-1]+this.day}startOfWeek(t){let n=t||e.SUNDAY,r=this.clone();return r.day-=(this.dayOfWeek()+7-n)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r}endOfWeek(t){let n=t||e.SUNDAY,r=this.clone();return r.day+=(7-this.dayOfWeek()+n-e.SUNDAY)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r}startOfMonth(){let e=this.clone();return e.day=1,e.isDate=!0,e.hour=0,e.minute=0,e.second=0,e}endOfMonth(){let t=this.clone();return t.day=e.daysInMonth(t.month,t.year),t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t}startOfYear(){let e=this.clone();return e.day=1,e.month=1,e.isDate=!0,e.hour=0,e.minute=0,e.second=0,e}endOfYear(){let e=this.clone();return e.day=31,e.month=12,e.isDate=!0,e.hour=0,e.minute=0,e.second=0,e}startDoyWeek(t){let n=t||e.SUNDAY,r=this.dayOfWeek()-n;return r<0&&(r+=7),this.dayOfYear()-r}getDominicalLetter(){return e.getDominicalLetter(this.year)}nthWeekDay(t,n){let r=e.daysInMonth(this.month,this.year),i,a=n,o=0,s=this.clone();if(a>=0){s.day=1,a!=0&&a--,o=s.day;let e=t-s.dayOfWeek();e<0&&(e+=7),o+=e,o-=t,i=t}else{s.day=r;let e=s.dayOfWeek();a++,i=e-t,i<0&&(i+=7),i=r-i}return i+=a*7,o+i}isNthWeekDay(e,t){let n=this.dayOfWeek();return t===0&&n===e||this.nthWeekDay(e,t)===this.day}weekNumber(t){let n=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(n in e._wnCache)return e._wnCache[n];let r,i=this.clone();i.isDate=!0;let a=this.year;i.month==12&&i.day>25?(r=e.weekOneStarts(a+1,t),i.compare(r)<0?r=e.weekOneStarts(a,t):a++):(r=e.weekOneStarts(a,t),i.compare(r)<0&&(r=e.weekOneStarts(--a,t)));let o=z(i.subtractDate(r).toSeconds()/86400/7)+1;return e._wnCache[n]=o,o}addDuration(e){let t=e.isNegative?-1:1,n=this.second,r=this.minute,i=this.hour,a=this.day;n+=t*e.seconds,r+=t*e.minutes,i+=t*e.hours,a+=t*e.days,a+=t*7*e.weeks,this.second=n,this.minute=r,this.hour=i,this.day=a,this._cachedUnixTime=null}subtractDate(e){let t=this.toUnixTime()+this.utcOffset(),n=e.toUnixTime()+e.utcOffset();return Nc.fromSeconds(t-n)}subtractDateTz(e){let t=this.toUnixTime(),n=e.toUnixTime();return Nc.fromSeconds(t-n)}compare(e){if(e instanceof Fc)return-1*e.compare(this);{let t=this.toUnixTime(),n=e.toUnixTime();return t>n?1:n>t?-1:0}}compareDateOnlyTz(t,n){let r=this.convertToZone(n),i=t.convertToZone(n),a=0;return(a=e._cmp_attr(r,i,`year`))!=0||(a=e._cmp_attr(r,i,`month`))!=0||(a=e._cmp_attr(r,i,`day`)),a}convertToZone(e){let t=this.clone(),n=this.zone.tzid==e.tzid;return!this.isDate&&!n&&I.convert_time(t,this.zone,e),t.zone=e,t}utcOffset(){return this.zone==I.localTimezone||this.zone==I.utcTimezone?0:this.zone.utcOffset(this)}toICALString(){let e=this.toString();return e.length>10?H.icalendar.value[`date-time`].toICAL(e):H.icalendar.value.date.toICAL(e)}toString(){let e=this.year+`-`+$c(this.month)+`-`+$c(this.day);return this.isDate||(e+=`T`+$c(this.hour)+`:`+$c(this.minute)+`:`+$c(this.second),this.zone===I.utcTimezone&&(e+=`Z`)),e}toJSDate(){return this.zone==I.localTimezone?this.isDate?new Date(this.year,this.month-1,this.day):new Date(this.year,this.month-1,this.day,this.hour,this.minute,this.second,0):new Date(this.toUnixTime()*1e3)}_normalize(){return this._time.isDate&&(this._time.hour=0,this._time.minute=0,this._time.second=0),this.adjust(0,0,0,0),this}adjust(t,n,r,i,a){let o,s,c=0,l=0,u,d,f,p,m,h=a||this._time;if(h.isDate||(u=h.second+i,h.second=u%60,o=z(u/60),h.second<0&&(h.second+=60,o--),d=h.minute+r+o,h.minute=d%60,s=z(d/60),h.minute<0&&(h.minute+=60,s--),f=h.hour+n+s,h.hour=f%24,c=z(f/24),h.hour<0&&(h.hour+=24,c--)),h.month>12?l=z((h.month-1)/12):h.month<1&&(l=z(h.month/12)-1),h.year+=l,h.month-=12*l,p=h.day+t+c,p>0)for(;m=e.daysInMonth(h.month,h.year),!(p<=m);)h.month++,h.month>12&&(h.year++,h.month=1),p-=m;else for(;p<=0;)h.month==1?(h.year--,h.month=12):h.month--,p+=e.daysInMonth(h.month,h.year);return h.day=p,this._cachedUnixTime=null,this}fromUnixTime(e){this.zone=I.utcTimezone;let t=new Date(e*1e3);this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this._time.isDate?(this.hour=0,this.minute=0,this.second=0):(this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()),this._cachedUnixTime=null}toUnixTime(){if(this._cachedUnixTime!==null)return this._cachedUnixTime;let e=this.utcOffset(),t=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second-e);return this._cachedUnixTime=t/1e3,this._cachedUnixTime}toJSON(){let e=[`year`,`month`,`day`,`hour`,`minute`,`second`,`isDate`],t=Object.create(null),n=0,r=e.length,i;for(;n<r;n++)i=e[n],t[i]=this[i];return this.zone&&(t.timezone=this.zone.tzid),t}},Ic=/[^ \t]/,Lc=`:`,Rc=`;`,zc=`=`,Bc=`unknown`,Vc=`text`,Hc={"^'":`"`,"^n":`
57
- `,"^^":`^`};function F(e){let t={},n=t.component=[];if(t.stack=[n],F._eachLine(e,function(e,n){F._handleContentLine(n,t)}),t.stack.length>1)throw new Uc(`invalid ical body. component began but did not end`);return t=null,n.length==1?n[0]:n}F.property=function(e,t){let n={component:[[],[]],designSet:t||H.defaultSet};return F._handleContentLine(e,n),n.component[1][0]},F.component=function(e){return F(e)};var Uc=class extends Error{name=this.constructor.name};F.ParserError=Uc,F._handleContentLine=function(e,t){let n=e.indexOf(Lc),r=e.indexOf(Rc),i,a,o,s,c={};r!==-1&&n!==-1&&r>n&&(r=-1);let l;if(r!==-1){if(o=e.slice(0,Math.max(0,r)).toLowerCase(),l=F._parseParameters(e.slice(Math.max(0,r)),0,t.designSet),l[2]==-1)throw new Uc(`Invalid parameters in '`+e+`'`);c=l[0];let n;if(n=typeof l[1]==`string`?l[1].length:l[1].reduce((e,t)=>e+t.length,0),i=n+l[2]+r,(a=e.slice(Math.max(0,i)).indexOf(Lc))!==-1)s=e.slice(Math.max(0,i+a+1));else throw new Uc(`Missing parameter value in '`+e+`'`)}else if(n!==-1){if(o=e.slice(0,Math.max(0,n)).toLowerCase(),s=e.slice(Math.max(0,n+1)),o===`begin`){let e=[s.toLowerCase(),[],[]];t.stack.length===1?t.component.push(e):t.component[2].push(e),t.stack.push(t.component),t.component=e,t.designSet||=H.getDesignSet(t.component[0]);return}if(o===`end`){t.component=t.stack.pop();return}}else throw new Uc(`invalid line (no token ";" or ":") "`+e+`"`);let u,d=!1,f=!1,p,m,h;t.designSet.propertyGroups&&o.indexOf(`.`)!==-1?(m=o.split(`.`),c.group=m[0],h=m[1]):h=o,h in t.designSet.property&&(p=t.designSet.property[h],`multiValue`in p&&(d=p.multiValue),`structuredValue`in p&&(f=p.structuredValue),s&&`detectType`in p&&(u=p.detectType(s))),u||=`value`in c?c.value.toLowerCase():p?p.defaultType:Bc,delete c.value;let g;d&&f?(s=F._parseMultiValue(s,f,u,[],d,t.designSet,f),g=[h,c,u,s]):d?(g=[h,c,u],F._parseMultiValue(s,d,u,g,null,t.designSet,!1)):f?(s=F._parseMultiValue(s,f,u,[],null,t.designSet,f),g=[h,c,u,s]):(s=F._parseValue(s,u,t.designSet,!1),g=[h,c,u,s]),t.component[0]===`vcard`&&t.component[1].length===0&&(o!==`version`||s!==`4.0`)&&(t.designSet=H.getDesignSet(`vcard3`)),t.component[1].push(g)},F._parseValue=function(e,t,n,r){return t in n.value&&`fromICAL`in n.value[t]?n.value[t].fromICAL(e,r):e},F._parseParameters=function(e,t,n){let r=t,i=0,a=zc,o={},s,c,l,u=-1,d,f,p;for(;i!==!1&&(i=e.indexOf(a,i+1))!==-1;){if(s=e.slice(r+1,i),s.length==0)throw new Uc(`Empty parameter name in '`+e+`'`);if(c=s.toLowerCase(),p=!1,f=!1,d=c in n.param&&n.param[c].valueType?n.param[c].valueType:Vc,c in n.param&&(f=n.param[c].multiValue,n.param[c].multiValueSeparateDQuote&&(p=F._rfc6868Escape(`"`+f+`"`))),e[i+1]===`"`){if(u=i+2,i=e.indexOf(`"`,u),f&&i!=-1){let t=!0;for(;t;)e[i+1]==f&&e[i+2]==`"`?i=e.indexOf(`"`,i+3):t=!1}if(i===-1)throw new Uc(`invalid line (no matching double quote) "`+e+`"`);l=e.slice(u,i),r=e.indexOf(Rc,i);let t=e.indexOf(Lc,i);(r===-1||t!==-1&&r>t)&&(i=!1)}else{u=i+1;let t=e.indexOf(Rc,u),n=e.indexOf(Lc,u);n!==-1&&t>n?(t=n,i=!1):t===-1?(t=n===-1?e.length:n,i=!1):(r=t,i=t),l=e.slice(u,t)}let t=l.length;if(l=F._rfc6868Escape(l),u+=t-l.length,f){let e=p||f;l=F._parseMultiValue(l,e,d,[],null,n)}else l=F._parseValue(l,d,n);f&&c in o?Array.isArray(o[c])?o[c].push(l):o[c]=[o[c],l]:o[c]=l}return[o,l,u]},F._rfc6868Escape=function(e){return e.replace(/\^['n^]/g,function(e){return Hc[e]})},F._parseMultiValue=function(e,t,n,r,i,a,o){let s=0,c=0,l;if(t.length===0)return e;for(;(s=Yc(e,t,c))!==-1;)l=e.slice(c,s),l=i?F._parseMultiValue(l,i,n,[],null,a,o):F._parseValue(l,n,a,o),r.push(l),c=s+t.length;return l=e.slice(c),l=i?F._parseMultiValue(l,i,n,[],null,a,o):F._parseValue(l,n,a,o),r.push(l),r.length==1?r[0]:r},F._eachLine=function(e,t){let n=e.length,r=e.search(Ic),i=r,a,o,s;do i=e.indexOf(`
58
- `,r)+1,s=i>1&&e[i-2]===`\r`?2:1,i===0&&(i=n,s=0),o=e[r],o===` `||o===` `?a+=e.slice(r+1,i-s):(a&&t(null,a),a=e.slice(r,i-s)),r=i;while(i!==n);a=a.trim(),a.length&&t(null,a)};var Wc=[`tzid`,`location`,`tznames`,`latitude`,`longitude`],I=class e{static _compare_change_fn(e,t){return e.year<t.year?-1:e.year>t.year?1:e.month<t.month?-1:e.month>t.month?1:e.day<t.day?-1:e.day>t.day?1:e.hour<t.hour?-1:e.hour>t.hour?1:e.minute<t.minute?-1:e.minute>t.minute?1:e.second<t.second?-1:+(e.second>t.second)}static convert_time(t,n,r){if(t.isDate||n.tzid==r.tzid||n==e.localTimezone||r==e.localTimezone)return t.zone=r,t;let i=n.utcOffset(t);return t.adjust(0,0,0,-i),i=r.utcOffset(t),t.adjust(0,0,0,i),null}static fromData(t){return new e().fromData(t)}static#e=null;static get utcTimezone(){return this.#e||=e.fromData({tzid:`UTC`}),this.#e}static#t=null;static get localTimezone(){return this.#t||=e.fromData({tzid:`floating`}),this.#t}static adjust_change(e,t,n,r,i){return P.prototype.adjust.call(e,t,n,r,i,e)}static _minimumExpansionYear=-1;static EXTRA_COVERAGE=5;constructor(e){this.wrappedJSObject=this,this.fromData(e)}tzid=``;location=``;tznames=``;latitude=0;longitude=0;component=null;expandedUntilYear=0;icalclass=`icaltimezone`;fromData(e){if(this.expandedUntilYear=0,this.changes=[],e instanceof ru)this.component=e;else{if(e&&`component`in e){if(typeof e.component==`string`){let t=F(e.component);this.component=new ru(t)}else this.component=e.component instanceof ru?e.component:null}for(let t of Wc)e&&t in e&&(this[t]=e[t])}return this.component instanceof ru&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue(`tzid`)),this}utcOffset(t){if(this==e.utcTimezone||this==e.localTimezone||(this._ensureCoverage(t.year),!this.changes.length))return 0;let n={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},r=this._findNearbyChange(n),i=-1,a=1;for(;;){let t=Zc(this.changes[r],!0);if(t.utcOffset<t.prevUtcOffset?e.adjust_change(t,0,0,0,t.utcOffset):e.adjust_change(t,0,0,0,t.prevUtcOffset),e._compare_change_fn(n,t)>=0?i=r:a=-1,a==-1&&i!=-1)break;if(r+=a,r<0)return 0;if(r>=this.changes.length)break}let o=this.changes[i];if(o.utcOffset-o.prevUtcOffset<0&&i>0){let t=Zc(o,!0);if(e.adjust_change(t,0,0,0,t.prevUtcOffset),e._compare_change_fn(n,t)<0){let e=this.changes[i-1];o.is_daylight!=0&&e.is_daylight==0&&(o=e)}}return o.utcOffset}_findNearbyChange(t){let n=Xc(this.changes,t,e._compare_change_fn);return n>=this.changes.length?this.changes.length-1:n}_ensureCoverage(t){if(e._minimumExpansionYear==-1){let t=P.now();e._minimumExpansionYear=t.year}let n=t;if(n<e._minimumExpansionYear&&(n=e._minimumExpansionYear),n+=e.EXTRA_COVERAGE,!this.changes.length||this.expandedUntilYear<t){let t=this.component.getAllSubcomponents(),r=t.length,i=0;for(;i<r;i++)this._expandComponent(t[i],n,this.changes);this.changes.sort(e._compare_change_fn),this.expandedUntilYear=n}}_expandComponent(t,n,r){if(!t.hasProperty(`dtstart`)||!t.hasProperty(`tzoffsetto`)||!t.hasProperty(`tzoffsetfrom`))return null;let i=t.getFirstProperty(`dtstart`).getFirstValue(),a;function o(e){return e.factor*(e.hours*3600+e.minutes*60)}function s(){let e={};return e.is_daylight=t.name==`daylight`,e.utcOffset=o(t.getFirstProperty(`tzoffsetto`).getFirstValue()),e.prevUtcOffset=o(t.getFirstProperty(`tzoffsetfrom`).getFirstValue()),e}if(!t.hasProperty(`rrule`)&&!t.hasProperty(`rdate`))a=s(),a.year=i.year,a.month=i.month,a.day=i.day,a.hour=i.hour,a.minute=i.minute,a.second=i.second,e.adjust_change(a,0,0,0,-a.prevUtcOffset),r.push(a);else{let o=t.getAllProperties(`rdate`);for(let t of o){let n=t.getFirstValue();a=s(),a.year=n.year,a.month=n.month,a.day=n.day,n.isDate?(a.hour=i.hour,a.minute=i.minute,a.second=i.second,i.zone!=e.utcTimezone&&e.adjust_change(a,0,0,0,-a.prevUtcOffset)):(a.hour=n.hour,a.minute=n.minute,a.second=n.second,n.zone!=e.utcTimezone&&e.adjust_change(a,0,0,0,-a.prevUtcOffset)),r.push(a)}let c=t.getFirstProperty(`rrule`);if(c){c=c.getFirstValue(),a=s(),c.until&&c.until.zone==e.utcTimezone&&(c.until.adjust(0,0,0,a.prevUtcOffset),c.until.zone=e.localTimezone);let t=c.iterator(i),o;for(;(o=t.next())&&(a=s(),!(o.year>n||!o));)a.year=o.year,a.month=o.month,a.day=o.day,a.hour=o.hour,a.minute=o.minute,a.second=o.second,a.isDate=o.isDate,e.adjust_change(a,0,0,0,-a.prevUtcOffset),r.push(a)}}return r}toString(){return this.tznames?this.tznames:this.tzid}},L=null,Gc={get count(){return L===null?0:Object.keys(L).length},reset:function(){L=Object.create(null);let e=I.utcTimezone;L.Z=e,L.UTC=e,L.GMT=e},_hard_reset:function(){L=null},has:function(e){return L!==null&&!!L[e]},get:function(e){return L===null&&this.reset(),L[e]},register:function(e,t){if(L===null&&this.reset(),typeof e==`string`&&t instanceof I&&([e,t]=[t,e]),t||(e instanceof I?t=e.tzid:e.name===`vtimezone`&&(e=new I(e),t=e.tzid)),!t)throw TypeError(`Neither a timezone nor a name was passed`);if(e instanceof I)L[t]=e;else throw TypeError(`timezone must be ICAL.Timezone or ICAL.Component`)},remove:function(e){return L===null?null:delete L[e]}};function Kc(e){let t,n,r,i,a;if(!e||e.name!==`vcalendar`)return e;for(t=e.getAllSubcomponents(),n=[],r={},a=0;a<t.length;a++)if(t[a].name===`vtimezone`){let e=t[a].getFirstProperty(`tzid`).getFirstValue();r[e]=t[a]}else n=n.concat(t[a].getAllProperties());for(i={},a=0;a<n.length;a++){let e=n[a].getParameter(`tzid`);e&&(i[e]=!0)}for(let[t,n]of Object.entries(r))i[t]||e.removeSubcomponent(n);for(let t of Object.keys(i))!r[t]&&Gc.has(t)&&e.addSubcomponent(Gc.get(t).component);return e}function qc(e){return typeof e==`number`&&isNaN(e)}function R(e){let t=parseInt(e,10);if(qc(t))throw Error(`Could not extract integer from "`+e+`"`);return t}function Jc(e,t){if(e!==void 0)return e instanceof t?e:new t(e)}function Yc(e,t,n){for(;(n=e.indexOf(t,n))!==-1;)if(n>0&&e[n-1]===`\\`)n+=1;else return n;return-1}function Xc(e,t,n){if(!e.length)return 0;let r=0,i=e.length-1,a,o;for(;r<=i;)if(a=r+Math.floor((i-r)/2),o=n(t,e[a]),o<0)i=a-1;else if(o>0)r=a+1;else break;return o<0?a:o>0?a+1:a}function Zc(e,t){if(!e||typeof e!=`object`)return e;if(e instanceof Date)return new Date(e.getTime());if(`clone`in e)return e.clone();if(Array.isArray(e)){let n=[];for(let r=0;r<e.length;r++)n.push(t?Zc(e[r],!0):e[r]);return n}{let n={};for(let[r,i]of Object.entries(e))n[r]=t?Zc(i,!0):i;return n}}function Qc(e){let t=``,n=e||``,r=0,i=0;for(;n.length;){let e=n.codePointAt(r);e<128?++i:i+=e<2048?2:e<65536?3:4,i<su.foldLength+1?r+=e>65535?2:1:(t+=su.newLineChar+` `+n.slice(0,Math.max(0,r)),n=n.slice(Math.max(0,r)),r=i=0)}return t.slice(su.newLineChar.length+1)}function $c(e){switch(typeof e!=`string`&&(typeof e==`number`&&(e=parseInt(e)),e=String(e)),e.length){case 0:return`00`;case 1:return`0`+e;default:return e}}function z(e){return e<0?Math.ceil(e):Math.floor(e)}function el(e,t){for(let n in e){let r=Object.getOwnPropertyDescriptor(e,n);r&&!Object.getOwnPropertyDescriptor(t,n)&&Object.defineProperty(t,n,r)}return t}var tl=Object.freeze({__proto__:null,binsearchInsert:Xc,clone:Zc,extend:el,foldline:Qc,formatClassType:Jc,isStrictlyNaN:qc,pad2:$c,strictParseInt:R,trunc:z,unescapedIndexOf:Yc,updateTimezones:Kc}),nl=class e{static fromString(t){let n={};return n.factor=t[0]===`+`?1:-1,n.hours=R(t.slice(1,3)),n.minutes=R(t.slice(4,6)),new e(n)}static fromSeconds(t){let n=new e;return n.fromSeconds(t),n}constructor(e){this.fromData(e)}hours=0;minutes=0;factor=1;icaltype=`utc-offset`;clone(){return e.fromSeconds(this.toSeconds())}fromData(e){if(e)for(let[t,n]of Object.entries(e))this[t]=n;this._normalize()}fromSeconds(e){let t=Math.abs(e);return this.factor=e<0?-1:1,this.hours=z(t/3600),t-=this.hours*3600,this.minutes=z(t/60),this}toSeconds(){return this.factor*(60*this.minutes+3600*this.hours)}compare(e){let t=this.toSeconds(),n=e.toSeconds();return(t>n)-(n>t)}_normalize(){let e=this.toSeconds(),t=this.factor;for(;e<-43200;)e+=97200;for(;e>50400;)e-=97200;this.fromSeconds(e),e==0&&(this.factor=t)}toICALString(){return H.icalendar.value[`utc-offset`].toICAL(this.toString())}toString(){return(this.factor==1?`+`:`-`)+$c(this.hours)+`:`+$c(this.minutes)}},rl=class e extends P{static fromDateAndOrTimeString(t,n){function r(e,t,n){return e?R(e.slice(t,t+n)):null}let i=t.split(`T`),a=i[0],o=i[1],s=o?H.vcard.value.time._splitZone(o):[],c=s[0],l=s[1],u=a?a.length:0,d=l?l.length:0,f=a&&a[0]==`-`&&a[1]==`-`,p=l&&l[0]==`-`,m={year:f?null:r(a,0,4),month:f&&(u==4||u==7)?r(a,2,2):u==7||u==10?r(a,5,2):null,day:u==5?r(a,3,2):u==7&&f?r(a,5,2):u==10?r(a,8,2):null,hour:p?null:r(l,0,2),minute:p&&d==3?r(l,1,2):d>4?p?r(l,1,2):r(l,3,2):null,second:d==4?r(l,2,2):d==6?r(l,4,2):d==8?r(l,6,2):null};return c=c==`Z`?I.utcTimezone:c&&c[3]==`:`?nl.fromString(c):null,new e(m,c,n)}constructor(e,t,n){super(e,t),this.icaltype=n||`date-and-or-time`}icalclass=`vcardtime`;icaltype=`date-and-or-time`;clone(){return new e(this._time,this.zone,this.icaltype)}_normalize(){return this}utcOffset(){return this.zone instanceof nl?this.zone.toSeconds():P.prototype.utcOffset.apply(this,arguments)}toICALString(){return H.vcard.value[this.icaltype].toICAL(this.toString())}toString(){let e=this.year,t=this.month,n=this.day,r=this.hour,i=this.minute,a=this.second,o=e!==null,s=t!==null,c=n!==null,l=r!==null,u=i!==null,d=a!==null,f=(o?$c(e)+(s||c?`-`:``):s||c?`--`:``)+(s?$c(t):``)+(c?`-`+$c(n):``),p=(l?$c(r):`-`)+(l&&u?`:`:``)+(u?$c(i):``)+(!l&&!u?`-`:``)+(u&&d?`:`:``)+(d?$c(a):``),m;switch(m=this.zone===I.utcTimezone?`Z`:this.zone instanceof nl?this.zone.toString():this.zone===I.localTimezone?``:this.zone instanceof I?nl.fromSeconds(this.zone.utcOffset(this)).toString():``,this.icaltype){case`time`:return p+m;case`date-and-or-time`:case`date-time`:return f+(p==`--`?``:`T`+p+m);case`date`:return f}return null}},il=class e{static _indexMap={BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8};static _expandMap={SECONDLY:[1,1,1,1,1,1,1,1],MINUTELY:[2,1,1,1,1,1,1,1],HOURLY:[2,2,1,1,1,1,1,1],DAILY:[2,2,2,1,1,1,1,1],WEEKLY:[2,2,2,2,3,3,1,1],MONTHLY:[2,2,2,2,2,3,3,1],YEARLY:[2,2,2,2,2,2,2,2]};static UNKNOWN=0;static CONTRACT=1;static EXPAND=2;static ILLEGAL=3;constructor(e){this.fromData(e)}completed=!1;rule=null;dtstart=null;last=null;occurrence_number=0;by_indices=null;initialized=!1;by_data=null;days=null;days_index=0;fromData(e){if(this.rule=Jc(e.rule,dl),!this.rule)throw Error(`iterator requires a (ICAL.Recur) rule`);if(this.dtstart=Jc(e.dtstart,P),!this.dtstart)throw Error(`iterator requires a (ICAL.Time) dtstart`);if(this.by_data=e.by_data?e.by_data:Zc(this.rule.parts,!0),e.occurrence_number&&(this.occurrence_number=e.occurrence_number),this.days=e.days||[],e.last&&(this.last=Jc(e.last,P)),this.by_indices=e.by_indices,this.by_indices||={BYSECOND:0,BYMINUTE:0,BYHOUR:0,BYDAY:0,BYMONTH:0,BYWEEKNO:0,BYMONTHDAY:0},this.initialized=e.initialized||!1,!this.initialized)try{this.init()}catch(e){if(e instanceof al)this.completed=!0;else throw e}}init(){this.initialized=!0,this.last=this.dtstart.clone();let e=this.by_data;if(`BYDAY`in e&&this.sort_byday_rules(e.BYDAY),`BYYEARDAY`in e&&(`BYMONTH`in e||`BYWEEKNO`in e||`BYMONTHDAY`in e))throw Error(`Invalid BYYEARDAY rule`);if(`BYWEEKNO`in e&&`BYMONTHDAY`in e)throw Error(`BYWEEKNO does not fit to BYMONTHDAY`);if(this.rule.freq==`MONTHLY`&&(`BYYEARDAY`in e||`BYWEEKNO`in e))throw Error(`For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear`);if(this.rule.freq==`WEEKLY`&&(`BYYEARDAY`in e||`BYMONTHDAY`in e))throw Error(`For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear`);if(this.rule.freq!=`YEARLY`&&`BYYEARDAY`in e)throw Error(`BYYEARDAY may only appear in YEARLY rules`);if(this.last.second=this.setup_defaults(`BYSECOND`,`SECONDLY`,this.dtstart.second),this.last.minute=this.setup_defaults(`BYMINUTE`,`MINUTELY`,this.dtstart.minute),this.last.hour=this.setup_defaults(`BYHOUR`,`HOURLY`,this.dtstart.hour),this.last.day=this.setup_defaults(`BYMONTHDAY`,`DAILY`,this.dtstart.day),this.last.month=this.setup_defaults(`BYMONTH`,`MONTHLY`,this.dtstart.month),this.rule.freq==`WEEKLY`){if(`BYDAY`in e){let[,t]=this.ruleDayOfWeek(e.BYDAY[0],this.rule.wkst),n=t-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)<t&&n>=0||n<0)&&(this.last.day+=n)}else e.BYDAY=[dl.numericDayToIcalDay(this.dtstart.dayOfWeek())]}if(this.rule.freq==`YEARLY`){let e=this.rule.until?this.rule.until.year:2e4;for(;this.last.year<=e&&(this.expand_year_days(this.last.year),!(this.days.length>0));)this.increment_year(this.rule.interval);if(this.days.length==0||!this._nextByYearDay()&&!this.next_year()&&!this.next_year()&&!this.next_year())throw new al}if(this.rule.freq==`MONTHLY`){if(this.has_by_data(`BYDAY`)){let e=null,t=this.last.clone(),n=P.daysInMonth(this.last.month,this.last.year);for(let r of this.by_data.BYDAY){this.last=t.clone();let[i,a]=this.ruleDayOfWeek(r),o=this.last.nthWeekDay(a,i);if(i>=6||i<=-6)throw Error(`Malformed values in BYDAY part`);if(o>n||o<=0){if(e&&e.month==t.month)continue;for(;o>n||o<=0;)this.increment_month(),n=P.daysInMonth(this.last.month,this.last.year),o=this.last.nthWeekDay(a,i)}this.last.day=o,(!e||this.last.compare(e)<0)&&(e=this.last.clone())}if(this.last=e.clone(),this.has_by_data(`BYMONTHDAY`)&&this._byDayAndMonthDay(!0),this.last.day>n||this.last.day==0)throw Error(`Malformed values in BYDAY part`)}else if(this.has_by_data(`BYMONTHDAY`)){this.last.day=1;let e=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY).filter(e=>e>=this.last.day);if(e.length)this.last.day=e[0],this.by_data.BYMONTHDAY=e;else if(!this.next_month()&&!this.next_month()&&!this.next_month())throw new al}}}next(e=!1){let t=this.last?this.last.clone():null;if((this.rule.count&&this.occurrence_number>=this.rule.count||this.rule.until&&this.last.compare(this.rule.until)>0)&&(this.completed=!0),this.completed)return null;if(this.occurrence_number==0&&this.last.compare(this.dtstart)>=0)return this.occurrence_number++,this.last;let n,r=0;do switch(n=1,this.rule.freq){case`SECONDLY`:this.next_second();break;case`MINUTELY`:this.next_minute();break;case`HOURLY`:this.next_hour();break;case`DAILY`:this.next_day();break;case`WEEKLY`:this.next_week();break;case`MONTHLY`:if(n=this.next_month(),n)r=0;else if(++r==336)return this.completed=!0,null;break;case`YEARLY`:if(n=this.next_year(),n)r=0;else if(++r==28)return this.completed=!0,null;break;default:return null}while(!this.check_contracting_rules()||this.last.compare(this.dtstart)<0||!n);if(this.last.compare(t)==0){if(e)throw Error(`Same occurrence found twice, protecting you from death by recursion`);this.next(!0)}return this.rule.until&&this.last.compare(this.rule.until)>0?(this.completed=!0,null):(this.occurrence_number++,this.last)}next_second(){return this.next_generic(`BYSECOND`,`SECONDLY`,`second`,`minute`)}increment_second(e){return this.increment_generic(e,`second`,60,`minute`)}next_minute(){return this.next_generic(`BYMINUTE`,`MINUTELY`,`minute`,`hour`,`next_second`)}increment_minute(e){return this.increment_generic(e,`minute`,60,`hour`)}next_hour(){return this.next_generic(`BYHOUR`,`HOURLY`,`hour`,`monthday`,`next_minute`)}increment_hour(e){this.increment_generic(e,`hour`,24,`monthday`)}next_day(){let e=this.rule.freq==`DAILY`;return this.next_hour()==0||(e?this.increment_monthday(this.rule.interval):this.increment_monthday(1)),0}next_week(){let e=0;if(this.next_weekday_by_week()==0)return e;if(this.has_by_data(`BYWEEKNO`)){this.by_indices.BYWEEKNO++,this.by_indices.BYWEEKNO==this.by_data.BYWEEKNO.length&&(this.by_indices.BYWEEKNO=0,e=1),this.last.month=1,this.last.day=1;let t=this.by_data.BYWEEKNO[this.by_indices.BYWEEKNO];this.last.day+=7*t,e&&this.increment_year(1)}else this.increment_monthday(7*this.rule.interval);return e}normalizeByMonthDayRules(e,t,n){let r=P.daysInMonth(t,e),i=[],a=0,o=n.length,s;for(;a<o;a++){if(s=parseInt(n[a],10),isNaN(s))throw Error(`Invalid BYMONTHDAY value`);if(!(Math.abs(s)>r)){if(s<0)s=r+(s+1);else if(s===0)continue;i.indexOf(s)===-1&&i.push(s)}}return i.sort(function(e,t){return e-t})}_byDayAndMonthDay(e){let t,n=this.by_data.BYDAY,r,i=0,a,o=n.length,s=0,c,l=this,u=this.last.day;function d(){for(c=P.daysInMonth(l.last.month,l.last.year),t=l.normalizeByMonthDayRules(l.last.year,l.last.month,l.by_data.BYMONTHDAY),a=t.length;t[i]<=u&&!(e&&t[i]==u)&&i<a-1;)i++}function f(){u=0,l.increment_month(),i=0,d()}d(),e&&--u;let p=48;for(;!s&&p;){if(p--,r=u+1,r>c){f();continue}let e=t[i++];if(e>=r)u=e;else{f();continue}for(let e=0;e<o;e++){let t=this.ruleDayOfWeek(n[e]),r=t[0],i=t[1];if(this.last.day=u,this.last.isNthWeekDay(i,r)){s=1;break}}if(!s&&i===a){f();continue}}if(p<=0)throw Error(`Malformed values in BYDAY combined with BYMONTHDAY parts`);return s}next_month(){let e=1;if(this.next_hour()==0)return e;if(this.has_by_data(`BYDAY`)&&this.has_by_data(`BYMONTHDAY`))e=this._byDayAndMonthDay();else if(this.has_by_data(`BYDAY`)){let t=P.daysInMonth(this.last.month,this.last.year),n=0,r=0;if(this.has_by_data(`BYSETPOS`)){let e=this.last.day;for(let i=1;i<=t;i++)this.last.day=i,this.is_day_in_byday(this.last)&&(r++,i<=e&&n++);this.last.day=e}e=0;let i;for(i=this.last.day+1;i<=t;i++)if(this.last.day=i,this.is_day_in_byday(this.last)&&(!this.has_by_data(`BYSETPOS`)||this.check_set_position(++n)||this.check_set_position(n-r-1))){e=1;break}i>t&&(this.last.day=1,this.increment_month(),this.is_day_in_byday(this.last)?(!this.has_by_data(`BYSETPOS`)||this.check_set_position(1))&&(e=1):e=0)}else if(this.has_by_data(`BYMONTHDAY`)){if(this.by_indices.BYMONTHDAY++,this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length&&(this.by_indices.BYMONTHDAY=0,this.increment_month(),this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length))return 0;let t=P.daysInMonth(this.last.month,this.last.year),n=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY];n<0&&(n=t+n+1),n>t?(this.last.day=1,e=this.is_day_in_byday(this.last)):this.last.day=n}else{this.increment_month();let t=P.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>t?e=0:this.last.day=this.by_data.BYMONTHDAY[0]}return e}next_weekday_by_week(){let e=0;if(this.next_hour()==0)return e;if(!this.has_by_data(`BYDAY`))return 1;for(;;){let t=new P;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,e=1);let n=this.by_data.BYDAY[this.by_indices.BYDAY],r=this.ruleDayOfWeek(n)[1];r-=this.rule.wkst,r<0&&(r+=7),t.year=this.last.year,t.month=this.last.month,t.day=this.last.day;let i=t.startDoyWeek(this.rule.wkst);if(r+i<1&&!e)continue;let a=P.fromDayOfYear(i+r,this.last.year);return this.last.year=a.year,this.last.month=a.month,this.last.day=a.day,e}}next_year(){return this.next_hour()==0||(this.days.length==0||++this.days_index==this.days.length)&&(this.days_index=0,this.increment_year(this.rule.interval),this.has_by_data(`BYMONTHDAY`)&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY)),this.expand_year_days(this.last.year),this.days.length==0)?0:this._nextByYearDay()}_nextByYearDay(){let e=this.days[this.days_index],t=this.last.year;if(Math.abs(e)==366&&!P.isLeapYear(this.last.year))return 0;e<1&&(e+=1,t+=1);let n=P.fromDayOfYear(e,t);return this.last.day=n.day,this.last.month=n.month,1}ruleDayOfWeek(e,t){let n=e.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);if(n){let r=parseInt(n[1]||0,10);return e=dl.icalDayToNumericDay(n[2],t),[r,e]}return[0,0]}next_generic(e,t,n,r,i){let a=e in this.by_data,o=this.rule.freq==t,s=0;if(i&&this[i]()==0)return s;if(a){this.by_indices[e]++;let t=this.by_data[e];this.by_indices[e]==t.length&&(this.by_indices[e]=0,s=1),this.last[n]=t[this.by_indices[e]]}else o&&this[`increment_`+n](this.rule.interval);return a&&s&&o&&this[`increment_`+r](1),s}increment_monthday(e){for(let t=0;t<e;t++){let e=P.daysInMonth(this.last.month,this.last.year);this.last.day++,this.last.day>e&&(this.last.day-=e,this.increment_month())}}increment_month(){if(this.last.day=1,this.has_by_data(`BYMONTH`))this.by_indices.BYMONTH++,this.by_indices.BYMONTH==this.by_data.BYMONTH.length&&(this.by_indices.BYMONTH=0,this.increment_year(1)),this.last.month=this.by_data.BYMONTH[this.by_indices.BYMONTH];else{this.rule.freq==`MONTHLY`?this.last.month+=this.rule.interval:this.last.month++,this.last.month--;let e=z(this.last.month/12);this.last.month%=12,this.last.month++,e!=0&&this.increment_year(e)}this.has_by_data(`BYMONTHDAY`)&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY))}increment_year(e){this.last.day=1,this.last.year+=e}increment_generic(e,t,n,r){this.last[t]+=e;let i=z(this.last[t]/n);this.last[t]%=n,i!=0&&this[`increment_`+r](i)}has_by_data(e){return e in this.rule.parts}expand_year_days(e){let t=new P;this.days=[];let n={};for(let e of[`BYDAY`,`BYWEEKNO`,`BYMONTHDAY`,`BYMONTH`,`BYYEARDAY`])e in this.rule.parts&&(n[e]=this.rule.parts[e]);if(`BYMONTH`in n&&`BYWEEKNO`in n){let r=1,i={};t.year=e,t.isDate=!0;for(let n=0;n<this.by_data.BYMONTH.length;n++){let r=this.by_data.BYMONTH[n];t.month=r,t.day=1;let a=t.weekNumber(this.rule.wkst);t.day=P.daysInMonth(r,e);let o=t.weekNumber(this.rule.wkst);for(n=a;n<o;n++)i[n]=1}for(let e=0;e<this.by_data.BYWEEKNO.length&&r;e++)this.by_data.BYWEEKNO[e]<52?r&=i[e]:r=0;r?delete n.BYMONTH:delete n.BYWEEKNO}let r=Object.keys(n).length;if(r==0){let e=this.dtstart.clone();e.year=this.last.year,this.days.push(e.dayOfYear())}else if(r==1&&`BYMONTH`in n)for(let t of this.by_data.BYMONTH){let n=this.dtstart.clone();n.year=e,n.month=t,n.isDate=!0,this.days.push(n.dayOfYear())}else if(r==1&&`BYMONTHDAY`in n)for(let t of this.by_data.BYMONTHDAY){let n=this.dtstart.clone();if(t<0){let r=P.daysInMonth(n.month,e);t=t+r+1}n.day=t,n.year=e,n.isDate=!0,this.days.push(n.dayOfYear())}else if(r==2&&`BYMONTHDAY`in n&&`BYMONTH`in n)for(let n of this.by_data.BYMONTH){let r=P.daysInMonth(n,e);for(let i of this.by_data.BYMONTHDAY)i<0&&(i=i+r+1),t.day=i,t.month=n,t.year=e,t.isDate=!0,this.days.push(t.dayOfYear())}else if(!(r==1&&`BYWEEKNO`in n)&&!(r==2&&`BYWEEKNO`in n&&`BYMONTHDAY`in n)){if(r==1&&`BYDAY`in n)this.days=this.days.concat(this.expand_by_day(e));else if(r==2&&`BYDAY`in n&&`BYMONTH`in n){for(let n of this.by_data.BYMONTH){let r=P.daysInMonth(n,e);t.year=e,t.month=n,t.day=1,t.isDate=!0;let i=t.dayOfWeek(),a=t.dayOfYear()-1;t.day=r;let o=t.dayOfWeek();if(this.has_by_data(`BYSETPOS`)){let e=[];for(let n=1;n<=r;n++)t.day=n,this.is_day_in_byday(t)&&e.push(n);for(let t=0;t<e.length;t++)(this.check_set_position(t+1)||this.check_set_position(t-e.length))&&this.days.push(a+e[t])}else for(let e of this.by_data.BYDAY){let t=this.ruleDayOfWeek(e),n=t[0],s=t[1],c,l=(s+7-i)%7+1,u=r-(o+7-s)%7;if(n==0)for(let e=l;e<=r;e+=7)this.days.push(a+e);else n>0?(c=l+(n-1)*7,c<=r&&this.days.push(a+c)):(c=u+(n+1)*7,c>0&&this.days.push(a+c))}}this.days.sort(function(e,t){return e-t})}else if(r==2&&`BYDAY`in n&&`BYMONTHDAY`in n){let t=this.expand_by_day(e);for(let n of t){let t=P.fromDayOfYear(n,e);this.by_data.BYMONTHDAY.indexOf(t.day)>=0&&this.days.push(n)}}else if(r==3&&`BYDAY`in n&&`BYMONTHDAY`in n&&`BYMONTH`in n){let t=this.expand_by_day(e);for(let n of t){let t=P.fromDayOfYear(n,e);this.by_data.BYMONTH.indexOf(t.month)>=0&&this.by_data.BYMONTHDAY.indexOf(t.day)>=0&&this.days.push(n)}}else if(r==2&&`BYDAY`in n&&`BYWEEKNO`in n){let t=this.expand_by_day(e);for(let n of t){let t=P.fromDayOfYear(n,e).weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(t)&&this.days.push(n)}}else if(!(r==3&&`BYDAY`in n&&`BYWEEKNO`in n&&`BYMONTHDAY`in n)){if(r==1&&`BYYEARDAY`in n)this.days=this.days.concat(this.by_data.BYYEARDAY);else if(r==2&&`BYYEARDAY`in n&&`BYDAY`in n){let t=P.isLeapYear(e)?366:365,n=new Set(this.expand_by_day(e));for(let e of this.by_data.BYYEARDAY)e<0&&(e+=t+1),n.has(e)&&this.days.push(e)}else this.days=[]}}let i=P.isLeapYear(e)?366:365;return this.days.sort((e,t)=>(e<0&&(e+=i+1),t<0&&(t+=i+1),e-t)),0}expand_by_day(e){let t=[],n=this.last.clone();n.year=e,n.month=1,n.day=1,n.isDate=!0;let r=n.dayOfWeek();n.month=12,n.day=31,n.isDate=!0;let i=n.dayOfWeek(),a=n.dayOfYear();for(let e of this.by_data.BYDAY){let n=this.ruleDayOfWeek(e),o=n[0],s=n[1];if(o==0){let e=(s+7-r)%7+1;for(let n=e;n<=a;n+=7)t.push(n)}else if(o>0){let e;e=s>=r?s-r+1:s-r+8,t.push(e+(o-1)*7)}else{let e;o=-o,e=s<=i?a-i+s:a-i+s-7,t.push(e-(o-1)*7)}}return t}is_day_in_byday(e){if(this.by_data.BYDAY)for(let t of this.by_data.BYDAY){let n=this.ruleDayOfWeek(t),r=n[0],i=n[1],a=e.dayOfWeek();if(r==0&&i==a||e.nthWeekDay(i,r)==e.day)return 1}return 0}check_set_position(e){return this.has_by_data(`BYSETPOS`)?this.by_data.BYSETPOS.indexOf(e)!==-1:!1}sort_byday_rules(e){for(let t=0;t<e.length;t++)for(let n=0;n<t;n++)if(this.ruleDayOfWeek(e[n],this.rule.wkst)[1]>this.ruleDayOfWeek(e[t],this.rule.wkst)[1]){let r=e[t];e[t]=e[n],e[n]=r}}check_contract_restriction(t,n){let r=e._indexMap[t],i=e._expandMap[this.rule.freq][r],a=!1;if(t in this.by_data&&i==e.CONTRACT){let e=this.by_data[t];for(let t of e)if(t==n){a=!0;break}}else a=!0;return a}check_contracting_rules(){let e=this.last.dayOfWeek(),t=this.last.weekNumber(this.rule.wkst),n=this.last.dayOfYear();return this.check_contract_restriction(`BYSECOND`,this.last.second)&&this.check_contract_restriction(`BYMINUTE`,this.last.minute)&&this.check_contract_restriction(`BYHOUR`,this.last.hour)&&this.check_contract_restriction(`BYDAY`,dl.numericDayToIcalDay(e))&&this.check_contract_restriction(`BYWEEKNO`,t)&&this.check_contract_restriction(`BYMONTHDAY`,this.last.day)&&this.check_contract_restriction(`BYMONTH`,this.last.month)&&this.check_contract_restriction(`BYYEARDAY`,n)}setup_defaults(t,n,r){let i=e._indexMap[t];return e._expandMap[this.rule.freq][i]!=e.CONTRACT&&(t in this.by_data||(this.by_data[t]=[r]),this.rule.freq!=n)?this.by_data[t][0]:r}toJSON(){let e=Object.create(null);return e.initialized=this.initialized,e.rule=this.rule.toJSON(),e.dtstart=this.dtstart.toJSON(),e.by_data=this.by_data,e.days=this.days,e.last=this.last.toJSON(),e.by_indices=this.by_indices,e.occurrence_number=this.occurrence_number,e}},al=class extends Error{constructor(){super(`Recurrence rule has no valid occurrences`)}},ol=/^(SU|MO|TU|WE|TH|FR|SA)$/,sl=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,cl={SU:P.SUNDAY,MO:P.MONDAY,TU:P.TUESDAY,WE:P.WEDNESDAY,TH:P.THURSDAY,FR:P.FRIDAY,SA:P.SATURDAY},ll=Object.fromEntries(Object.entries(cl).map(e=>e.reverse())),ul=[`SECONDLY`,`MINUTELY`,`HOURLY`,`DAILY`,`WEEKLY`,`MONTHLY`,`YEARLY`],dl=class e{static fromString(t){let n=this._stringToData(t,!1);return new e(n)}static fromData(t){return new e(t)}static _stringToData(e,t){let n=Object.create(null),r=e.split(`;`),i=r.length;for(let e=0;e<i;e++){let i=r[e].split(`=`),a=i[0].toUpperCase(),o=i[0].toLowerCase(),s=t?o:a,c=i[1];if(a in ml){let e=c.split(`,`),t=new Set;for(let n of e)t.add(ml[a](n));e=[...t],n[s]=e.length==1?e[0]:e}else a in pl?pl[a](c,n,t):n[o]=c}return n}static icalDayToNumericDay(e,t){let n=t||P.SUNDAY;return(cl[e]-n+7)%7+1}static numericDayToIcalDay(e,t){let n=e+(t||P.SUNDAY)-P.SUNDAY;return n>7&&(n-=7),ll[n]}constructor(e){this.wrappedJSObject=this,this.parts={},e&&typeof e==`object`&&this.fromData(e)}parts=null;interval=1;wkst=P.MONDAY;until=null;count=null;freq=null;icalclass=`icalrecur`;icaltype=`recur`;iterator(e){return new il({rule:this,dtstart:e})}clone(){return new e(this.toJSON())}isFinite(){return!!(this.count||this.until)}isByCount(){return!(!this.count||this.until)}addComponent(e,t){let n=e.toUpperCase();n in this.parts?this.parts[n].push(t):this.parts[n]=[t]}setComponent(e,t){this.parts[e.toUpperCase()]=t.slice()}getComponent(e){let t=e.toUpperCase();return t in this.parts?this.parts[t].slice():[]}getNextOccurrence(e,t){let n=this.iterator(e),r;do r=n.next();while(r&&r.compare(t)<=0);return r&&t.zone&&(r.zone=t.zone),r}fromData(t){for(let e in t){let n=e.toUpperCase();n in ml?Array.isArray(t[e])?this.parts[n]=t[e]:this.parts[n]=[t[e]]:this[e]=t[e]}this.interval&&typeof this.interval!=`number`&&pl.INTERVAL(this.interval,this),this.wkst&&typeof this.wkst!=`number`&&(this.wkst=e.icalDayToNumericDay(this.wkst)),this.until&&!(this.until instanceof P)&&(this.until=P.fromString(this.until))}toJSON(){let t=Object.create(null);t.freq=this.freq,this.count&&(t.count=this.count),this.interval>1&&(t.interval=this.interval);for(let[e,n]of Object.entries(this.parts))Array.isArray(n)&&n.length==1?t[e.toLowerCase()]=n[0]:t[e.toLowerCase()]=Zc(n);return this.until&&(t.until=this.until.toString()),`wkst`in this&&this.wkst!==P.DEFAULT_WEEK_START&&(t.wkst=e.numericDayToIcalDay(this.wkst)),t}toString(){let t=`FREQ=`+this.freq;this.count&&(t+=`;COUNT=`+this.count),this.interval>1&&(t+=`;INTERVAL=`+this.interval);for(let[e,n]of Object.entries(this.parts))t+=`;`+e+`=`+n;return this.until&&(t+=`;UNTIL=`+this.until.toICALString()),`wkst`in this&&this.wkst!==P.DEFAULT_WEEK_START&&(t+=`;WKST=`+e.numericDayToIcalDay(this.wkst)),t}};function fl(e,t,n,r){let i=r;if(r[0]===`+`&&(i=r.slice(1)),i=R(i),t!==void 0&&r<t)throw Error(e+`: invalid value "`+r+`" must be > `+t);if(n!==void 0&&r>n)throw Error(e+`: invalid value "`+r+`" must be < `+t);return i}var pl={FREQ:function(e,t,n){if(ul.indexOf(e)!==-1)t.freq=e;else throw Error(`invalid frequency "`+e+`" expected: "`+ul.join(`, `)+`"`)},COUNT:function(e,t,n){t.count=R(e)},INTERVAL:function(e,t,n){t.interval=R(e),t.interval<1&&(t.interval=1)},UNTIL:function(e,t,n){t.until=e.length>10?H.icalendar.value[`date-time`].fromICAL(e):H.icalendar.value.date.fromICAL(e),n||(t.until=P.fromString(t.until))},WKST:function(e,t,n){if(ol.test(e))t.wkst=dl.icalDayToNumericDay(e);else throw Error(`invalid WKST value "`+e+`"`)}},ml={BYSECOND:fl.bind(void 0,`BYSECOND`,0,60),BYMINUTE:fl.bind(void 0,`BYMINUTE`,0,59),BYHOUR:fl.bind(void 0,`BYHOUR`,0,23),BYDAY:function(e){if(sl.test(e))return e;throw Error(`invalid BYDAY value "`+e+`"`)},BYMONTHDAY:fl.bind(void 0,`BYMONTHDAY`,-31,31),BYYEARDAY:fl.bind(void 0,`BYYEARDAY`,-366,366),BYWEEKNO:fl.bind(void 0,`BYWEEKNO`,-53,53),BYMONTH:fl.bind(void 0,`BYMONTH`,1,12),BYSETPOS:fl.bind(void 0,`BYSETPOS`,-366,366)},hl=/\\\\|\\;|\\,|\\[Nn]/g,gl=/\\|;|,|\n/g,_l=/\\\\|\\,|\\[Nn]/g,vl=/\\|,|\n/g;function yl(e,t){return{matches:/.*/,fromICAL:function(t,n){return Al(t,e,n)},toICAL:function(e,n){let r=t;return n&&(r=RegExp(r.source+`|`+n,r.flags)),e.replace(r,function(e){switch(e){case`\\`:return`\\\\`;case`;`:return`\\;`;case`,`:return`\\,`;case`
59
- `:return`\\n`;default:return e}})}}}var B={defaultType:`text`},bl={defaultType:`text`,multiValue:`,`},xl={defaultType:`text`,structuredValue:`;`},Sl={defaultType:`integer`},Cl={defaultType:`date-time`,allowedTypes:[`date-time`,`date`]},wl={defaultType:`date-time`},Tl={defaultType:`uri`},El={defaultType:`utc-offset`},Dl={defaultType:`recur`},Ol={defaultType:`date-and-or-time`,allowedTypes:[`date-time`,`date`,`text`]};function kl(e){switch(e){case`\\\\`:return`\\`;case`\\;`:return`;`;case`\\,`:return`,`;case`\\n`:case`\\N`:return`
60
- `;default:return e}}function Al(e,t,n){return e.indexOf(`\\`)===-1?e:(n&&(t=RegExp(t.source+`|\\\\`+n,t.flags)),e.replace(t,kl))}var jl={categories:bl,url:Tl,version:B,uid:B},Ml={boolean:{values:[`TRUE`,`FALSE`],fromICAL:function(e){switch(e){case`TRUE`:return!0;case`FALSE`:return!1;default:return!1}},toICAL:function(e){return e?`TRUE`:`FALSE`}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(e){let t=parseFloat(e);return qc(t)?0:t},toICAL:function(e){return String(e)}},integer:{fromICAL:function(e){let t=parseInt(e);return qc(t)?0:t},toICAL:function(e){return String(e)}},"utc-offset":{toICAL:function(e){return e.length<7?e.slice(0,3)+e.slice(4,6):e.slice(0,3)+e.slice(4,6)+e.slice(7,9)},fromICAL:function(e){return e.length<6?e.slice(0,3)+`:`+e.slice(3,5):e.slice(0,3)+`:`+e.slice(3,5)+`:`+e.slice(5,7)},decorate:function(e){return nl.fromString(e)},undecorate:function(e){return e.toString()}}},Nl={cutype:{values:[`INDIVIDUAL`,`GROUP`,`RESOURCE`,`ROOM`,`UNKNOWN`],allowXName:!0,allowIanaToken:!0},"delegated-from":{valueType:`cal-address`,multiValue:`,`,multiValueSeparateDQuote:!0},"delegated-to":{valueType:`cal-address`,multiValue:`,`,multiValueSeparateDQuote:!0},encoding:{values:[`8BIT`,`BASE64`]},fbtype:{values:[`FREE`,`BUSY`,`BUSY-UNAVAILABLE`,`BUSY-TENTATIVE`],allowXName:!0,allowIanaToken:!0},member:{valueType:`cal-address`,multiValue:`,`,multiValueSeparateDQuote:!0},partstat:{values:[`NEEDS-ACTION`,`ACCEPTED`,`DECLINED`,`TENTATIVE`,`DELEGATED`,`COMPLETED`,`IN-PROCESS`],allowXName:!0,allowIanaToken:!0},range:{values:[`THISANDFUTURE`]},related:{values:[`START`,`END`]},reltype:{values:[`PARENT`,`CHILD`,`SIBLING`],allowXName:!0,allowIanaToken:!0},role:{values:[`REQ-PARTICIPANT`,`CHAIR`,`OPT-PARTICIPANT`,`NON-PARTICIPANT`],allowXName:!0,allowIanaToken:!0},rsvp:{values:[`TRUE`,`FALSE`]},"sent-by":{valueType:`cal-address`},tzid:{matches:/^\//},value:{values:[`binary`,`boolean`,`cal-address`,`date`,`date-time`,`duration`,`float`,`integer`,`period`,`recur`,`text`,`time`,`uri`,`utc-offset`],allowXName:!0,allowIanaToken:!0}},V=el(Ml,{text:yl(hl,gl),uri:{},binary:{decorate:function(e){return Ac.fromString(e)},undecorate:function(e){return e.toString()}},"cal-address":{},date:{decorate:function(e,t){return H.strict?P.fromDateString(e,t):P.fromString(e,t)},undecorate:function(e){return e.toString()},fromICAL:function(e){return!H.strict&&e.length>=15?V[`date-time`].fromICAL(e):e.slice(0,4)+`-`+e.slice(4,6)+`-`+e.slice(6,8)},toICAL:function(e){let t=e.length;return t==10?e.slice(0,4)+e.slice(5,7)+e.slice(8,10):t>=19?V[`date-time`].toICAL(e):e}},"date-time":{fromICAL:function(e){if(!H.strict&&e.length==8)return V.date.fromICAL(e);{let t=e.slice(0,4)+`-`+e.slice(4,6)+`-`+e.slice(6,8)+`T`+e.slice(9,11)+`:`+e.slice(11,13)+`:`+e.slice(13,15);return e[15]&&e[15]===`Z`&&(t+=`Z`),t}},toICAL:function(e){let t=e.length;if(t==10&&!H.strict)return V.date.toICAL(e);if(t>=19){let t=e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19);return e[19]&&e[19]===`Z`&&(t+=`Z`),t}return e},decorate:function(e,t){return H.strict?P.fromDateTimeString(e,t):P.fromString(e,t)},undecorate:function(e){return e.toString()}},duration:{decorate:function(e){return Nc.fromString(e)},undecorate:function(e){return e.toString()}},period:{fromICAL:function(e){let t=e.split(`/`);return t[0]=V[`date-time`].fromICAL(t[0]),Nc.isValueString(t[1])||(t[1]=V[`date-time`].fromICAL(t[1])),t},toICAL:function(e){return e=e.slice(),!H.strict&&e[0].length==10?e[0]=V.date.toICAL(e[0]):e[0]=V[`date-time`].toICAL(e[0]),Nc.isValueString(e[1])||(!H.strict&&e[1].length==10?e[1]=V.date.toICAL(e[1]):e[1]=V[`date-time`].toICAL(e[1])),e.join(`/`)},decorate:function(e,t){return Fc.fromJSON(e,t,!H.strict)},undecorate:function(e){return e.toJSON()}},recur:{fromICAL:function(e){return dl._stringToData(e,!0)},toICAL:function(e){let t=``;for(let[n,r]of Object.entries(e))n==`until`?r=r.length>10?V[`date-time`].toICAL(r):V.date.toICAL(r):n==`wkst`?typeof r==`number`&&(r=dl.numericDayToIcalDay(r)):Array.isArray(r)&&(r=r.join(`,`)),t+=n.toUpperCase()+`=`+r+`;`;return t.slice(0,Math.max(0,t.length-1))},decorate:function(e){return dl.fromData(e)},undecorate:function(e){return e.toJSON()}},time:{fromICAL:function(e){if(e.length<6)return e;let t=e.slice(0,2)+`:`+e.slice(2,4)+`:`+e.slice(4,6);return e[6]===`Z`&&(t+=`Z`),t},toICAL:function(e){if(e.length<8)return e;let t=e.slice(0,2)+e.slice(3,5)+e.slice(6,8);return e[8]===`Z`&&(t+=`Z`),t}}}),Pl=el(jl,{action:B,attach:{defaultType:`uri`},attendee:{defaultType:`cal-address`},calscale:B,class:B,comment:B,completed:wl,contact:B,created:wl,description:B,dtend:Cl,dtstamp:wl,dtstart:Cl,due:Cl,duration:{defaultType:`duration`},exdate:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],multiValue:`,`},exrule:Dl,freebusy:{defaultType:`period`,multiValue:`,`},geo:{defaultType:`float`,structuredValue:`;`},"last-modified":wl,location:B,method:B,organizer:{defaultType:`cal-address`},"percent-complete":Sl,priority:Sl,prodid:B,"related-to":B,repeat:Sl,rdate:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`,`period`],multiValue:`,`,detectType:function(e){return e.indexOf(`/`)===-1?e.indexOf(`T`)===-1?`date`:`date-time`:`period`}},"recurrence-id":Cl,resources:bl,"request-status":xl,rrule:Dl,sequence:Sl,status:B,summary:B,transp:B,trigger:{defaultType:`duration`,allowedTypes:[`duration`,`date-time`]},tzoffsetfrom:El,tzoffsetto:El,tzurl:Tl,tzid:B,tzname:B}),Fl=el(Ml,{text:yl(_l,vl),uri:yl(_l,vl),date:{decorate:function(e){return rl.fromDateAndOrTimeString(e,`date`)},undecorate:function(e){return e.toString()},fromICAL:function(e){return e.length==8?V.date.fromICAL(e):e[0]==`-`&&e.length==6?e.slice(0,4)+`-`+e.slice(4):e},toICAL:function(e){return e.length==10?V.date.toICAL(e):e[0]==`-`&&e.length==7?e.slice(0,4)+e.slice(5):e}},time:{decorate:function(e){return rl.fromDateAndOrTimeString(`T`+e,`time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){let t=Fl.time._splitZone(e,!0),n=t[0],r=t[1];return r.length==6?r=r.slice(0,2)+`:`+r.slice(2,4)+`:`+r.slice(4,6):r.length==4&&r[0]!=`-`?r=r.slice(0,2)+`:`+r.slice(2,4):r.length==5&&(r=r.slice(0,3)+`:`+r.slice(3,5)),n.length==5&&(n[0]==`-`||n[0]==`+`)&&(n=n.slice(0,3)+`:`+n.slice(3)),r+n},toICAL:function(e){let t=Fl.time._splitZone(e),n=t[0],r=t[1];return r.length==8?r=r.slice(0,2)+r.slice(3,5)+r.slice(6,8):r.length==5&&r[0]!=`-`?r=r.slice(0,2)+r.slice(3,5):r.length==6&&(r=r.slice(0,3)+r.slice(4,6)),n.length==6&&(n[0]==`-`||n[0]==`+`)&&(n=n.slice(0,3)+n.slice(4)),r+n},_splitZone:function(e,t){let n=e.length-1,r=e.length-(t?5:6),i=e[r],a,o;return e[n]==`Z`?(a=e[n],o=e.slice(0,Math.max(0,n))):e.length>6&&(i==`-`||i==`+`)?(a=e.slice(r),o=e.slice(0,Math.max(0,r))):(a=``,o=e),[a,o]}},"date-time":{decorate:function(e){return rl.fromDateAndOrTimeString(e,`date-time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){return Fl[`date-and-or-time`].fromICAL(e)},toICAL:function(e){return Fl[`date-and-or-time`].toICAL(e)}},"date-and-or-time":{decorate:function(e){return rl.fromDateAndOrTimeString(e,`date-and-or-time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){let t=e.split(`T`);return(t[0]?Fl.date.fromICAL(t[0]):``)+(t[1]?`T`+Fl.time.fromICAL(t[1]):``)},toICAL:function(e){let t=e.split(`T`);return Fl.date.toICAL(t[0])+(t[1]?`T`+Fl.time.toICAL(t[1]):``)}},timestamp:V[`date-time`],"language-tag":{matches:/^[a-zA-Z0-9-]+$/},"phone-number":{fromICAL:function(e){return Array.from(e).filter(function(e){return e===`\\`?void 0:e}).join(``)},toICAL:function(e){return Array.from(e).map(function(e){return e===`,`||e===`;`?`\\`+e:e}).join(``)}}}),Il={type:{valueType:`text`,multiValue:`,`},value:{values:[`text`,`uri`,`date`,`time`,`date-time`,`date-and-or-time`,`timestamp`,`boolean`,`integer`,`float`,`utc-offset`,`language-tag`],allowXName:!0,allowIanaToken:!0}},Ll=el(jl,{adr:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},anniversary:Ol,bday:Ol,caladruri:Tl,caluri:Tl,clientpidmap:xl,email:B,fburl:Tl,fn:B,gender:xl,geo:Tl,impp:Tl,key:Tl,kind:B,lang:{defaultType:`language-tag`},logo:Tl,member:Tl,n:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},nickname:bl,note:B,org:{defaultType:`text`,structuredValue:`;`},photo:Tl,related:Tl,rev:{defaultType:`timestamp`},role:B,sound:Tl,source:Tl,tel:{defaultType:`uri`,allowedTypes:[`uri`,`text`]},title:B,tz:{defaultType:`text`,allowedTypes:[`text`,`utc-offset`,`uri`]},xml:B}),Rl=el(Ml,{binary:V.binary,date:Fl.date,"date-time":Fl[`date-time`],"phone-number":Fl[`phone-number`],uri:V.uri,text:Fl.text,time:V.time,vcard:V.text,"utc-offset":{toICAL:function(e){return e.slice(0,7)},fromICAL:function(e){return e.slice(0,7)},decorate:function(e){return nl.fromString(e)},undecorate:function(e){return e.toString()}}}),zl={type:{valueType:`text`,multiValue:`,`},value:{values:[`text`,`uri`,`date`,`date-time`,`phone-number`,`time`,`boolean`,`integer`,`float`,`utc-offset`,`vcard`,`binary`],allowXName:!0,allowIanaToken:!0}},Bl=el(jl,{fn:B,n:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},nickname:bl,photo:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},bday:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],detectType:function(e){return e.indexOf(`T`)===-1?`date`:`date-time`}},adr:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},label:B,tel:{defaultType:`phone-number`},email:B,mailer:B,tz:{defaultType:`utc-offset`,allowedTypes:[`utc-offset`,`text`]},geo:{defaultType:`float`,structuredValue:`;`},title:B,role:B,logo:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},agent:{defaultType:`vcard`,allowedTypes:[`vcard`,`text`,`uri`]},org:xl,note:bl,prodid:B,rev:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],detectType:function(e){return e.indexOf(`T`)===-1?`date`:`date-time`}},"sort-string":B,sound:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},class:B,key:{defaultType:`binary`,allowedTypes:[`binary`,`text`]}}),Vl={name:`ical`,value:V,param:Nl,property:Pl,propertyGroups:!1},Hl={name:`vcard4`,value:Fl,param:Il,property:Ll,propertyGroups:!0},Ul={name:`vcard3`,value:Rl,param:zl,property:Bl,propertyGroups:!0},H={strict:!0,defaultSet:Vl,defaultType:`unknown`,components:{vcard:Hl,vcard3:Ul,vevent:Vl,vtodo:Vl,vjournal:Vl,valarm:Vl,vtimezone:Vl,daylight:Vl,standard:Vl},icalendar:Vl,vcard:Hl,vcard3:Ul,getDesignSet:function(e){return e&&e in H.components?H.components[e]:H.defaultSet}},Wl=`\r
61
- `,Gl=`unknown`,Kl={'"':`^'`,"\n":`^n`,"^":`^^`};function U(e){typeof e[0]==`string`&&(e=[e]);let t=0,n=e.length,r=``;for(;t<n;t++)r+=U.component(e[t])+Wl;return r}U.component=function(e,t){let n=e[0].toUpperCase(),r=`BEGIN:`+n+Wl,i=e[1],a=0,o=i.length,s=e[0];for(s===`vcard`&&e[1].length>0&&(e[1][0][0]!==`version`||e[1][0][3]!==`4.0`)&&(s=`vcard3`),t||=H.getDesignSet(s);a<o;a++)r+=U.property(i[a],t)+Wl;let c=e[2]||[],l=0,u=c.length;for(;l<u;l++)r+=U.component(c[l],t)+Wl;return r+=`END:`+n,r},U.property=function(e,t,n){let r=e[0].toUpperCase(),i=e[0],a=e[1];t||=H.defaultSet;let o=a.group,s;s=t.propertyGroups&&o?o.toUpperCase()+`.`+r:r;for(let[e,n]of Object.entries(a)){if(t.propertyGroups&&e==`group`)continue;let r=t.param[e],i=r&&r.multiValue;i&&Array.isArray(n)?(n=n.map(function(e){return e=U._rfc6868Unescape(e),e=U.paramPropertyValue(e,r.multiValueSeparateDQuote),e}),n=U.multiValue(n,i,`unknown`,null,t)):(n=U._rfc6868Unescape(n),n=U.paramPropertyValue(n)),s+=`;`+e.toUpperCase()+`=`+n}if(e.length===3)return s+`:`;let c=e[2],l,u=!1,d=!1,f=!1;return i in t.property?(l=t.property[i],`multiValue`in l&&(u=l.multiValue),`structuredValue`in l&&Array.isArray(e[3])&&(d=l.structuredValue),`defaultType`in l?c===l.defaultType&&(f=!0):c===Gl&&(f=!0)):c===Gl&&(f=!0),f||(s+=`;VALUE=`+c.toUpperCase()),s+=`:`,s+=u&&d?U.multiValue(e[3],d,c,u,t,d):u?U.multiValue(e.slice(3),u,c,null,t,!1):d?U.multiValue(e[3],d,c,null,t,d):U.value(e[3],c,t,!1),n?s:Qc(s)},U.paramPropertyValue=function(e,t){return!t&&e.indexOf(`,`)===-1&&e.indexOf(`:`)===-1&&e.indexOf(`;`)===-1?e:`"`+e+`"`},U.multiValue=function(e,t,n,r,i,a){let o=``,s=e.length,c=0;for(;c<s;c++)r&&Array.isArray(e[c])?o+=U.multiValue(e[c],r,n,null,i,a):o+=U.value(e[c],n,i,a),c!==s-1&&(o+=t);return o},U.value=function(e,t,n,r){return t in n.value&&`toICAL`in n.value[t]?n.value[t].toICAL(e,r):e},U._rfc6868Unescape=function(e){return e.replace(/[\n^"]/g,function(e){return Kl[e]})};var ql=0,Jl=1,Yl=2,Xl=3,Zl=class e{static fromString(t,n){return new e(F.property(t,n))}constructor(e,t){this._parent=t||null,typeof e==`string`?(this.jCal=[e,{},H.defaultType],this.jCal[Yl]=this.getDefaultType()):this.jCal=e,this._updateType()}get type(){return this.jCal[Yl]}get name(){return this.jCal[ql]}get parent(){return this._parent}set parent(e){let t=!this._parent||e&&e._designSet!=this._parent._designSet;this._parent=e,this.type==H.defaultType&&t&&(this.jCal[Yl]=this.getDefaultType(),this._updateType())}get _designSet(){return this.parent?this.parent._designSet:H.defaultSet}_updateType(){let e=this._designSet;this.type in e.value&&(this.isDecorated=`decorate`in e.value[this.type],this.name in e.property&&(this.isMultiValue=`multiValue`in e.property[this.name],this.isStructuredValue=`structuredValue`in e.property[this.name]))}_hydrateValue(e){return this._values&&this._values[e]?this._values[e]:this.jCal.length<=Xl+e?null:this.isDecorated?(this._values||=[],this._values[e]=this._decorate(this.jCal[Xl+e])):this.jCal[Xl+e]}_decorate(e){return this._designSet.value[this.type].decorate(e,this)}_undecorate(e){return this._designSet.value[this.type].undecorate(e,this)}_setDecoratedValue(e,t){this._values||=[],typeof e==`object`&&`icaltype`in e?(this.jCal[Xl+t]=this._undecorate(e),this._values[t]=e):(this.jCal[Xl+t]=e,this._values[t]=this._decorate(e))}getParameter(e){if(e in this.jCal[Jl])return this.jCal[Jl][e]}getFirstParameter(e){let t=this.getParameter(e);return Array.isArray(t)?t[0]:t}setParameter(e,t){let n=e.toLowerCase();typeof t==`string`&&n in this._designSet.param&&`multiValue`in this._designSet.param[n]&&(t=[t]),this.jCal[Jl][e]=t}removeParameter(e){delete this.jCal[Jl][e]}getDefaultType(){let e=this.jCal[ql],t=this._designSet;if(e in t.property){let n=t.property[e];if(`defaultType`in n)return n.defaultType}return H.defaultType}resetType(e){this.removeAllValues(),this.jCal[Yl]=e,this._updateType()}getFirstValue(){return this._hydrateValue(0)}getValues(){let e=this.jCal.length-Xl;if(e<1)return[];let t=0,n=[];for(;t<e;t++)n[t]=this._hydrateValue(t);return n}removeAllValues(){this._values&&(this._values.length=0),this.jCal.length=3}setValues(e){if(!this.isMultiValue)throw Error(this.name+`: does not not support mulitValue.
62
- override isMultiValue`);let t=e.length,n=0;if(this.removeAllValues(),t>0&&typeof e[0]==`object`&&`icaltype`in e[0]&&this.resetType(e[0].icaltype),this.isDecorated)for(;n<t;n++)this._setDecoratedValue(e[n],n);else for(;n<t;n++)this.jCal[Xl+n]=e[n]}setValue(e){this.removeAllValues(),typeof e==`object`&&`icaltype`in e&&this.resetType(e.icaltype),this.isDecorated?this._setDecoratedValue(e,0):this.jCal[Xl]=e}toJSON(){return this.jCal}toICALString(){return U.property(this.jCal,this._designSet,!0)}},Ql=0,$l=1,eu=2,tu=0,nu=3,ru=class e{static fromString(t){return new e(F.component(t))}constructor(e,t){typeof e==`string`&&(e=[e,[],[]]),this.jCal=e,this.parent=t||null,!this.parent&&this.name===`vcalendar`&&(this._timezoneCache=new Map)}_hydratedPropertyCount=0;_hydratedComponentCount=0;_timezoneCache=null;_components=null;_properties=null;get name(){return this.jCal[Ql]}get _designSet(){let e=this.parent&&this.parent._designSet;if(!e&&this.name==`vcard`){let e=this.jCal[$l]?.[0];if(e&&e[tu]==`version`&&e[nu]==`3.0`)return H.getDesignSet(`vcard3`)}return e||H.getDesignSet(this.name)}_hydrateComponent(t){if(this._components||(this._components=[],this._hydratedComponentCount=0),this._components[t])return this._components[t];let n=new e(this.jCal[eu][t],this);return this._hydratedComponentCount++,this._components[t]=n}_hydrateProperty(e){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[e])return this._properties[e];let t=new Zl(this.jCal[$l][e],this);return this._hydratedPropertyCount++,this._properties[e]=t}getFirstSubcomponent(e){if(e){let t=0,n=this.jCal[eu],r=n.length;for(;t<r;t++)if(n[t][Ql]===e)return this._hydrateComponent(t)}else if(this.jCal[eu].length)return this._hydrateComponent(0);return null}getAllSubcomponents(e){let t=this.jCal[eu].length,n=0;if(e){let r=this.jCal[eu],i=[];for(;n<t;n++)e===r[n][Ql]&&i.push(this._hydrateComponent(n));return i}if(!this._components||this._hydratedComponentCount!==t)for(;n<t;n++)this._hydrateComponent(n);return this._components||[]}hasProperty(e){let t=this.jCal[$l],n=t.length,r=0;for(;r<n;r++)if(t[r][Ql]===e)return!0;return!1}getFirstProperty(e){if(e){let t=0,n=this.jCal[$l],r=n.length;for(;t<r;t++)if(n[t][Ql]===e)return this._hydrateProperty(t)}else if(this.jCal[$l].length)return this._hydrateProperty(0);return null}getFirstPropertyValue(e){let t=this.getFirstProperty(e);return t?t.getFirstValue():null}getAllProperties(e){let t=this.jCal[$l].length,n=0;if(e){let r=this.jCal[$l],i=[];for(;n<t;n++)e===r[n][Ql]&&i.push(this._hydrateProperty(n));return i}if(!this._properties||this._hydratedPropertyCount!==t)for(;n<t;n++)this._hydrateProperty(n);return this._properties||[]}_removeObjectByIndex(e,t,n){if(t||=[],t[n]){let e=t[n];`parent`in e&&(e.parent=null)}t.splice(n,1),this.jCal[e].splice(n,1)}_removeObject(e,t,n){let r=0,i=this.jCal[e],a=i.length,o=this[t];if(typeof n==`string`){for(;r<a;r++)if(i[r][Ql]===n)return this._removeObjectByIndex(e,o,r),!0}else if(o){for(;r<a;r++)if(o[r]&&o[r]===n)return this._removeObjectByIndex(e,o,r),!0}return!1}_removeAllObjects(e,t,n){let r=this[t],i=this.jCal[e],a=i.length-1;for(;a>=0;a--)(!n||i[a][Ql]===n)&&this._removeObjectByIndex(e,r,a)}addSubcomponent(e){this._components||(this._components=[],this._hydratedComponentCount=0),e.parent&&e.parent.removeSubcomponent(e);let t=this.jCal[eu].push(e.jCal);return this._components[t-1]=e,this._hydratedComponentCount++,e.parent=this,e}removeSubcomponent(e){let t=this._removeObject(eu,`_components`,e);return t&&this._hydratedComponentCount--,t}removeAllSubcomponents(e){let t=this._removeAllObjects(eu,`_components`,e);return this._hydratedComponentCount=0,t}addProperty(e){if(!(e instanceof Zl))throw TypeError(`must be instance of ICAL.Property`);this._properties||(this._properties=[],this._hydratedPropertyCount=0),e.parent&&e.parent.removeProperty(e);let t=this.jCal[$l].push(e.jCal);return this._properties[t-1]=e,this._hydratedPropertyCount++,e.parent=this,e}addPropertyWithValue(e,t){let n=new Zl(e);return n.setValue(t),this.addProperty(n),n}updatePropertyWithValue(e,t){let n=this.getFirstProperty(e);return n?n.setValue(t):n=this.addPropertyWithValue(e,t),n}removeProperty(e){let t=this._removeObject($l,`_properties`,e);return t&&this._hydratedPropertyCount--,t}removeAllProperties(e){let t=this._removeAllObjects($l,`_properties`,e);return this._hydratedPropertyCount=0,t}toJSON(){return this.jCal}toString(){return U.component(this.jCal,this._designSet)}getTimeZoneByID(e){if(this.parent)return this.parent.getTimeZoneByID(e);if(!this._timezoneCache)return null;if(this._timezoneCache.has(e))return this._timezoneCache.get(e);let t=this.getAllSubcomponents(`vtimezone`);for(let n of t)if(n.getFirstProperty(`tzid`).getFirstValue()===e){let t=new I({component:n,tzid:e});return this._timezoneCache.set(e,t),t}return null}},iu=class{constructor(e){this.ruleDates=[],this.exDates=[],this.fromData(e)}complete=!1;ruleIterators=null;ruleDates=null;exDates=null;ruleDateInc=0;exDateInc=0;exDate=null;ruleDate=null;dtstart=null;last=null;fromData(e){let t=Jc(e.dtstart,P);if(t)this.dtstart=t;else throw Error(`.dtstart (ICAL.Time) must be given`);if(e.component)this._init(e.component);else{if(this.last=Jc(e.last,P)||t.clone(),!e.ruleIterators)throw Error(`.ruleIterators or .component must be given`);this.ruleIterators=e.ruleIterators.map(function(e){return Jc(e,il)}),this.ruleDateInc=e.ruleDateInc,this.exDateInc=e.exDateInc,e.ruleDates&&(this.ruleDates=e.ruleDates.map(e=>Jc(e,P)),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.exDates&&(this.exDates=e.exDates.map(e=>Jc(e,P)),this.exDate=this.exDates[this.exDateInc]),e.complete!==void 0&&(this.complete=e.complete)}}_compare_special(e,t){return!e.isDate&&t.isDate?new P({year:e.year,month:e.month,day:e.day}).compare(t):e.compare(t)}next(){let e,t,n,r=0;for(;;){if(r++>500)throw Error(`max tries have occurred, rule may be impossible to fulfill.`);if(t=this.ruleDate,e=this._nextRecurrenceIter(this.last),!t&&!e){this.complete=!0;break}if((!t||e&&t.compare(e.last)>0)&&(t=e.last.clone(),e.next()),this.ruleDate===t&&this._nextRuleDay(),this.last=t,this.exDate&&(n=this._compare_special(this.last,this.exDate),n>0&&this._nextExDay(),n===0)){this._nextExDay();continue}return this.last}}toJSON(){function e(e){return e.toJSON()}let t=Object.create(null);return t.ruleIterators=this.ruleIterators.map(e),this.ruleDates&&(t.ruleDates=this.ruleDates.map(e)),this.exDates&&(t.exDates=this.exDates.map(e)),t.ruleDateInc=this.ruleDateInc,t.exDateInc=this.exDateInc,t.last=this.last.toJSON(),t.dtstart=this.dtstart.toJSON(),t.complete=this.complete,t}_extractDates(e,t){let n=[],r=e.getAllProperties(t);for(let e=0,t=r.length;e<t;e++)for(let t of r[e].getValues()){let e=Xc(n,t,(e,t)=>e.compare(t));n.splice(e,0,t)}return n}_init(e){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!e.hasProperty(`rdate`)&&!e.hasProperty(`rrule`)&&!e.hasProperty(`recurrence-id`)){this.ruleDate=this.last.clone(),this.complete=!0;return}if(e.hasProperty(`rdate`)&&(this.ruleDates=this._extractDates(e,`rdate`),this.ruleDates[0]&&this.ruleDates[0].compare(this.dtstart)<0?(this.ruleDateInc=0,this.last=this.ruleDates[0].clone()):this.ruleDateInc=Xc(this.ruleDates,this.last,(e,t)=>e.compare(t)),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.hasProperty(`rrule`)){let t=e.getAllProperties(`rrule`),n=0,r=t.length,i,a;for(;n<r;n++)i=t[n].getFirstValue(),a=i.iterator(this.dtstart),this.ruleIterators.push(a),a.next()}e.hasProperty(`exdate`)&&(this.exDates=this._extractDates(e,`exdate`),this.exDateInc=Xc(this.exDates,this.last,this._compare_special),this.exDate=this.exDates[this.exDateInc])}_nextExDay(){this.exDate=this.exDates[++this.exDateInc]}_nextRuleDay(){this.ruleDate=this.ruleDates[++this.ruleDateInc]}_nextRecurrenceIter(){let e=this.ruleIterators;if(e.length===0)return null;let t=e.length,n,r,i=0,a;for(;i<t;i++){if(n=e[i],r=n.last,n.completed){t--,i!==0&&i--,e.splice(i,1);continue}(!a||a.last.compare(r)>0)&&(a=n)}return a}},au=class e{constructor(e,t){e instanceof ru||(t=e,e=null),this.component=e||new ru(`vevent`),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],t&&t.strictExceptions&&(this.strictExceptions=t.strictExceptions),t&&t.exceptions?t.exceptions.forEach(this.relateException,this):this.component.parent&&!this.isRecurrenceException()&&this.component.parent.getAllSubcomponents(`vevent`).forEach(function(e){e.hasProperty(`recurrence-id`)&&this.relateException(e)},this)}static THISANDFUTURE=`THISANDFUTURE`;exceptions=null;strictExceptions=!1;relateException(t){if(this.isRecurrenceException())throw Error(`cannot relate exception to exceptions`);if(t instanceof ru&&(t=new e(t)),this.strictExceptions&&t.uid!==this.uid)throw Error(`attempted to relate unrelated exception`);let n=t.recurrenceId.toString();if(this.exceptions[n]=t,t.modifiesFuture()){let e=[t.recurrenceId.toUnixTime(),n],r=Xc(this.rangeExceptions,e,ou);this.rangeExceptions.splice(r,0,e)}}modifiesFuture(){return this.component.hasProperty(`recurrence-id`)?this.component.getFirstProperty(`recurrence-id`).getParameter(`range`)===e.THISANDFUTURE:!1}findRangeException(e){if(!this.rangeExceptions.length)return null;let t=e.toUnixTime(),n=Xc(this.rangeExceptions,[t],ou);if(--n,n<0)return null;let r=this.rangeExceptions[n];return t<r[0]?null:r[1]}getOccurrenceDetails(e){let t=e.toString(),n=e.convertToZone(I.utcTimezone).toString(),r,i={recurrenceId:e};if(t in this.exceptions)r=i.item=this.exceptions[t],i.startDate=r.startDate,i.endDate=r.endDate,i.item=r;else if(n in this.exceptions)r=this.exceptions[n],i.startDate=r.startDate,i.endDate=r.endDate,i.item=r;else{let t=this.findRangeException(e),n;if(t){let r=this.exceptions[t];i.item=r;let a=this._rangeExceptionCache[t];if(!a){let e=r.recurrenceId.clone(),n=r.startDate.clone();e.zone=n.zone,a=n.subtractDate(e),this._rangeExceptionCache[t]=a}let o=e.clone();o.zone=r.startDate.zone,o.addDuration(a),n=o.clone(),n.addDuration(r.duration),i.startDate=o,i.endDate=n}else n=e.clone(),n.addDuration(this.duration),i.endDate=n,i.startDate=e,i.item=this}return i}iterator(e){return new iu({component:this.component,dtstart:e||this.startDate})}isRecurring(){let e=this.component;return e.hasProperty(`rrule`)||e.hasProperty(`rdate`)}isRecurrenceException(){return this.component.hasProperty(`recurrence-id`)}getRecurrenceTypes(){let e=this.component.getAllProperties(`rrule`),t=0,n=e.length,r=Object.create(null);for(;t<n;t++){let n=e[t].getFirstValue();r[n.freq]=!0}return r}get uid(){return this._firstProp(`uid`)}set uid(e){this._setProp(`uid`,e)}get startDate(){return this._firstProp(`dtstart`)}set startDate(e){this._setTime(`dtstart`,e)}get endDate(){let e=this._firstProp(`dtend`);if(!e){let t=this._firstProp(`duration`);e=this.startDate.clone(),t?e.addDuration(t):e.isDate&&(e.day+=1)}return e}set endDate(e){this.component.hasProperty(`duration`)&&this.component.removeProperty(`duration`),this._setTime(`dtend`,e)}get duration(){return this._firstProp(`duration`)||this.endDate.subtractDateTz(this.startDate)}set duration(e){this.component.hasProperty(`dtend`)&&this.component.removeProperty(`dtend`),this._setProp(`duration`,e)}get location(){return this._firstProp(`location`)}set location(e){this._setProp(`location`,e)}get attendees(){return this.component.getAllProperties(`attendee`)}get summary(){return this._firstProp(`summary`)}set summary(e){this._setProp(`summary`,e)}get description(){return this._firstProp(`description`)}set description(e){this._setProp(`description`,e)}get color(){return this._firstProp(`color`)}set color(e){this._setProp(`color`,e)}get organizer(){return this._firstProp(`organizer`)}set organizer(e){this._setProp(`organizer`,e)}get sequence(){return this._firstProp(`sequence`)}set sequence(e){this._setProp(`sequence`,e)}get recurrenceId(){return this._firstProp(`recurrence-id`)}set recurrenceId(e){this._setTime(`recurrence-id`,e)}_setTime(e,t){let n=this.component.getFirstProperty(e);n||(n=new Zl(e),this.component.addProperty(n)),t.zone===I.localTimezone||t.zone===I.utcTimezone?n.removeParameter(`tzid`):n.setParameter(`tzid`,t.zone.tzid),n.setValue(t)}_setProp(e,t){this.component.updatePropertyWithValue(e,t)}_firstProp(e){return this.component.getFirstPropertyValue(e)}toString(){return this.component.toString()}};function ou(e,t){return e[0]>t[0]?1:t[0]>e[0]?-1:0}var su={foldLength:75,debug:!1,newLineChar:`\r
63
- `,Binary:Ac,Component:ru,ComponentParser:class{constructor(e){e===void 0&&(e={});for(let[t,n]of Object.entries(e))this[t]=n}parseEvent=!0;parseTimezone=!0;oncomplete=function(){};onerror=function(e){};ontimezone=function(e){};onevent=function(e){};process(e){typeof e==`string`&&(e=F(e)),e instanceof ru||(e=new ru(e));let t=e.getAllSubcomponents(),n=0,r=t.length,i;for(;n<r;n++)switch(i=t[n],i.name){case`vtimezone`:if(this.parseTimezone){let e=i.getFirstPropertyValue(`tzid`);e&&this.ontimezone(new I({tzid:e,component:i}))}break;case`vevent`:this.parseEvent&&this.onevent(new au(i));break;default:continue}this.oncomplete()}},Duration:Nc,Event:au,Period:Fc,Property:Zl,Recur:dl,RecurExpansion:iu,RecurIterator:il,Time:P,Timezone:I,TimezoneService:Gc,UtcOffset:nl,VCardTime:rl,parse:F,stringify:U,design:H,helpers:tl},cu=[`mo`,`tu`,`we`,`th`,`fr`,`sa`,`su`],lu=/^(\d{4})-(\d{2})-(\d{2})$/,uu=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;function du(e){let t=uu.exec(e)??lu.exec(e);if(!t)return;let[,n,r,i,a=`0`,o=`0`]=t.map(e=>e??`0`),s=Date.UTC(Number(n),Number(r)-1,Number(i),Number(a),Number(o)),c=new Date(s);if(c.getUTCDate()===Number(i)&&c.getUTCMonth()===Number(r)-1&&!(Number(a)>23||Number(o)>59))return s}function fu(e){return lu.test(e)}function pu(e){return!!e&&typeof e==`object`&&typeof e.start==`string`}function mu(e){if(!pu(e))return`must have a start date`;let{start:t,end:n,repeat:r}=e,i=du(t);if(i===void 0)return`must start on a date written as YYYY-MM-DD, or YYYY-MM-DDTHH:MM with a time`;if(n!==void 0){let e=du(n);if(e===void 0||fu(n)!==fu(t))return`must end on a date, or a date and time, written the same way as its start`;if(e<i)return`must end after it starts`}if(r!==void 0){if(!r||typeof r!=`object`||![`day`,`week`,`month`,`year`].includes(r.every))return`must repeat every day, week, month or year`;if(r.interval!==void 0&&(!Number.isInteger(r.interval)||r.interval<1))return`must repeat every 1 or more days, weeks, months or years`;if(r.days!==void 0&&(!Array.isArray(r.days)||r.days.some(e=>!cu.includes(e))))return`must repeat on days of the week written as mo, tu, we, th, fr, sa or su`;if(r.on!==void 0&&![`date`,`weekday`,`last`].includes(r.on))return`must repeat monthly on its date, its weekday or the last such weekday`;if(r.until!==void 0&&(!lu.test(r.until)||du(r.until)===void 0))return`must stop repeating on a date written as YYYY-MM-DD`;if(r.skip!==void 0&&(!Array.isArray(r.skip)||r.skip.some(e=>!lu.test(e)||du(e)===void 0)))return`must skip dates written as YYYY-MM-DD`}}var hu=[`background`,`foreground`,`primary`,`primaryForeground`,`secondary`,`secondaryForeground`,`muted`,`mutedForeground`,`accent`,`accentForeground`,`border`],gu=A().regex(/^[#a-zA-Z0-9(),.%\s/+-]{1,100}$/,`must be a CSS color, such as #1e3a8a or rgb(30 58 138)`).regex(/^\s*(#[0-9a-fA-F]{3,8}|(rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\([^()]*(\([^()]*\)[^()]*)*\)|[a-zA-Z]+)\s*$/,`must be a CSS color, such as #1e3a8a or rgb(30 58 138)`),_u=A().regex(/^[a-zA-Z0-9 ]{1,60}$/,`must be a font name, such as Inter or Cinzel Decorative`),vu=A().regex(/^[a-z0-9-]{1,60}$/,`must be a code theme's name, such as github-light`),yu=[`sans-serif`,`serif`,`display`,`handwriting`,`monospace`],bu=A().regex(/^\d*\.?\d+(px|rem|em)?$/,`must be a size, such as 0.5rem or 8px`),xu=A().regex(/^gf-[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a part's name, such as gf-card-title`),Su=A().max(1e3).regex(/^[^<>\p{Cc}]*$/u,`must be CSS classes, such as rounded-xl shadow-sm`),Cu=N({colors:nc(ic(hu),gu).default({}),darkMode:Hs().optional(),darkColors:nc(ic(hu),gu).optional(),fonts:N({heading:_u.optional(),body:_u.optional(),headingCategory:ic(yu).optional(),bodyCategory:ic(yu).optional()}).default({}),radius:bu.optional(),code:N({light:vu.optional(),dark:vu.optional(),background:ic([`theme`,`site`]).optional()}).optional(),parts:tc(xu,Su).optional()}),wu=A().regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/,`must be a language's code, such as es or pt-BR`),Tu={message:A(),accept:A(),decline:A(),held:A(),show:A(),policyLabel:A(),choose:A(),save:A(),content:A(),statistics:A(),marketing:A()},Eu={message:`This site shows videos, forms and other content from other sites, which can set cookies and see that you visited. Is that all right with you?`,accept:`Allow`,decline:`No, thanks`,held:`This comes from {site}, which can set cookies.`,show:`Allow and show it`,policyLabel:`Privacy`,choose:`Choose`,save:`Save my choices`,content:`Videos, maps, forms and other content from other sites`,statistics:`Statistics that count visits, to improve the site`,marketing:`Advertising`},Du={es:{message:`Este sitio muestra vídeos, formularios y otros contenidos de otros sitios, que pueden guardar cookies y saber que lo has visitado. ¿Te parece bien?`,accept:`Permitir`,decline:`No, gracias`,held:`Esto viene de {site}, que puede guardar cookies.`,show:`Permitir y mostrarlo`,policyLabel:`Privacidad`,choose:`Elegir`,save:`Guardar mis elecciones`,content:`Vídeos, mapas, formularios y otros contenidos de otros sitios`,statistics:`Estadísticas que cuentan las visitas, para mejorar el sitio`,marketing:`Publicidad`}};function Ou(e){let t=e?.toLowerCase().split(`-`)[0];return t&&Du[t]||Eu}function ku(e,t,n){let r=Ou(t),i=Ou(n);if(r===i)return e;let a=Object.keys(Eu);return{...e,...Object.fromEntries(a.filter(t=>e[t]===i[t]).map(e=>[e,r[e]]))}}var Au=ic([`needed`,`content`,`statistics`,`marketing`]).default(`content`),ju=N({message:Tu.message.default(Eu.message),accept:Tu.accept.default(Eu.accept),decline:Tu.decline.default(Eu.decline),held:Tu.held.default(Eu.held),show:Tu.show.default(Eu.show),policy:A().optional(),policyLabel:Tu.policyLabel.default(Eu.policyLabel),choose:Tu.choose.default(Eu.choose),save:Tu.save.default(Eu.save),content:Tu.content.default(Eu.content),statistics:Tu.statistics.default(Eu.statistics),marketing:Tu.marketing.default(Eu.marketing),days:Rs().int().min(1).max(395).default(180),code:N({head:Au,body:Au}).default({head:`content`,body:`content`})}),Mu=N({title:A().optional(),description:A().optional(),titleTemplate:A().optional(),consent:N(Tu).partial().optional()}),Nu=N({version:oc(1),title:A().default(`My site`),description:A().default(``),url:xs({protocol:/^https?$/}).optional(),noIndex:Hs().optional(),language:A().default(`en`),languageName:A().optional(),languages:M(N({code:wu,name:A().optional()})).optional().superRefine((e,t)=>{let n=new Set;(e??[]).forEach((e,r)=>{let i=e.code.toLowerCase();n.has(i)&&t.addIssue({code:`custom`,path:[r,`code`],message:`is listed twice`}),n.add(i)})}),translations:tc(A(),Mu).optional(),favicon:A().optional(),logo:N({src:A(),alt:A().default(``),darkSrc:A().optional()}).optional(),titleTemplate:A().default(`%s`),socialImage:A().optional(),externalLinksInNewTab:Hs().optional(),timeZone:A().refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},{message:`isn't a time zone: it should be one such as Europe/London or America/New_York`}).optional(),contact:N({address:A().optional(),phone:A().optional(),email:A().optional()}).optional(),forms:N({service:ic([`web3forms`,`formspree`,`other`]).default(`web3forms`),accessKey:A().optional(),address:A().optional(),captcha:Hs().optional()}).optional(),comments:N({repo:A().regex(u),repoId:A().regex(l),category:A(),categoryId:A().regex(l)}).optional(),consent:ju.optional(),theme:Cu.default({colors:{},fonts:{}})}).transform(e=>e.consent?{...e,consent:ku(e.consent,e.language)}:e),Pu=N({label:A(),href:A()}),Fu=Pu.extend({children:M(Pu).optional()}),Iu=N({version:oc(1),menus:tc(A(),M(Fu)).default({}),languages:tc(A(),tc(A(),M(Fu))).optional()});N({version:oc(1),automatic:Hs().default(!0),skip:M(A()).default([])});var Lu=Ys({type:A().min(1),props:Ys({id:A().min(1)})}),Ru=Ys({root:Ys({props:tc(A(),Ws()).optional()}).default({}),content:M(Lu).default([])}),zu=A().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/,`must be a date and time written as YYYY-MM-DDTHH:MM`).refine(e=>du(e)!==void 0,`must be a date and time that exists`),Bu={showFrom:zu.optional(),hideAfter:zu.optional()},Vu={translationOf:A().optional(),translatedFrom:A().optional()};function Hu(e,t){e.showFrom&&e.hideAfter&&e.hideAfter<=e.showFrom&&t.addIssue({code:`custom`,path:[`hideAfter`],message:`must be after showFrom`})}var Uu=N({version:oc(1),...Bu,...Vu,data:Ru}).superRefine(Hu);N({version:oc(1),data:Ru});var Wu=[`text`,`textarea`,`richtext`,`number`,`date`,`event`,`link`,`image`,`select`,`tags`],Gu=A().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,`must use lowercase letters, numbers and hyphens, starting with a letter`),Ku=N({value:A().min(1),label:A()}),qu=N({name:Gu,label:A().min(1),type:ic(Wu),required:Hs().optional(),hint:A().optional(),options:M(Ku).optional()}),Ju=`title`,Yu=N({version:oc(1),name:A().min(1),entryName:A().min(1),path:A().optional(),languagePaths:tc(A(),A()).optional(),fields:M(qu).min(1),sort:N({field:Gu,order:ic([`asc`,`desc`])}).optional(),markdown:N({body:Gu}).optional(),calendar:N({when:Gu,place:Gu.optional(),summary:Gu.optional()}).optional(),template:Ru.default({root:{},content:[]})}).superRefine((e,t)=>{let n=new Set;if(e.fields.forEach((e,r)=>{n.has(e.name)&&t.addIssue({code:`custom`,path:[`fields`,r,`name`],message:`is used by more than one field`}),n.add(e.name),(e.type===`select`||e.type===`tags`)&&!e.options?.length&&t.addIssue({code:`custom`,path:[`fields`,r,`options`],message:`must list at least one choice`})}),e.fields.find(e=>e.name===`title`)?.type!==`text`&&t.addIssue({code:`custom`,path:[`fields`],message:`must include a text field named "${Ju}"`}),e.path!==void 0){let n=o(e.path);n&&t.addIssue({code:`custom`,path:[`path`],message:n})}for(let[n,r]of Object.entries(e.languagePaths??{})){let e=o(r)??(r.startsWith(`/${n}/`)?void 0:`must start with "/${n}/", the language's own address.`);e&&t.addIssue({code:`custom`,path:[`languagePaths`,n],message:e})}if(e.sort&&!n.has(e.sort.field)&&t.addIssue({code:`custom`,path:[`sort`,`field`],message:`must be one of the collection's fields`}),e.calendar){let n=t=>e.fields.find(e=>e.name===t)?.type;n(e.calendar.when)!==`event`&&t.addIssue({code:`custom`,path:[`calendar`,`when`],message:`must be one of the collection's date and time fields`}),e.calendar.place!==void 0&&![`text`,`textarea`].includes(n(e.calendar.place)??``)&&t.addIssue({code:`custom`,path:[`calendar`,`place`],message:`must be one of the collection's text fields`}),e.calendar.summary!==void 0&&![`text`,`textarea`,`richtext`].includes(n(e.calendar.summary)??``)&&t.addIssue({code:`custom`,path:[`calendar`,`summary`],message:`must be one of the collection's text fields`})}e.markdown&&(e.fields.find(t=>t.name===e.markdown?.body)?.type!==`richtext`&&t.addIssue({code:`custom`,path:[`markdown`,`body`],message:`must be one of the collection's formatted-text fields`}),n.has(`version`)&&t.addIssue({code:`custom`,path:[`fields`],message:`can't include a field named "version" when entries are Markdown files`}))}),Xu=N({version:oc(1),...Bu,inLanguage:wu.optional(),...Vu,fields:tc(A(),Ws()).default({})}).superRefine(Hu),Zu=/^\d{4}-\d{2}-\d{2}$/;function Qu(e){return typeof e==`string`&&Zu.test(e)&&!Number.isNaN(Date.parse(`${e}T00:00:00Z`))}function $u(e,t){let n=[];for(let r of e){let e=t[r.name];if(e!=null)switch(r.type){case`number`:(typeof e!=`number`||!Number.isFinite(e))&&n.push(`${r.name} must be a number`);break;case`date`:e!==``&&!Qu(e)&&n.push(`${r.name} must be a date written as YYYY-MM-DD`);break;case`event`:{let t=mu(e);t&&n.push(`${r.name} ${t}`);break}case`select`:e!==``&&!r.options?.some(t=>t.value===e)&&n.push(`${r.name} must be one of: ${r.options?.map(e=>e.value).join(`, `)}`);break;case`tags`:(!Array.isArray(e)||e.some(e=>typeof e!=`string`||!r.options?.some(t=>t.value===e)))&&n.push(`${r.name} must be a list of: ${r.options?.map(e=>e.value).join(`, `)}`);break;default:typeof e!=`string`&&n.push(`${r.name} must be text`)}}return n}var ed=[`version`,`type`,`id`];function td(e,t){let n=ed.indexOf(e),r=ed.indexOf(t);return n!==-1||r!==-1?(n===-1?1/0:n)-(r===-1?1/0:r):e<t?-1:+(e>t)}function nd(e){if(Array.isArray(e))return e.map(nd);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort(td)){let r=e[n];r!==void 0&&(t[n]=nd(r))}return t}return e}function rd(e){return`${JSON.stringify(nd(e),null,2)}\n`}function id(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ad=id();function od(e){ad=e}var sd={exec:()=>null};function cd(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function W(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(G.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ld=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),G={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:cd(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:cd(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:cd(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:cd(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:cd(e=>RegExp(`^ {0,${e}}(?:</?(?:${wd})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:cd(e=>RegExp(`^ {0,${e}}>`))},ud=/^(?:[ \t]*(?:\n|$))+/,dd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fd=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,md=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hd=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,gd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_d=W(gd).replace(/bull/g,hd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),vd=W(gd).replace(/bull/g,hd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),yd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,bd=/^[^\n]+/,xd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Sd=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,xd).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Cd=W(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,hd).getRegex(),wd=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Td=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ed=W(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Td).replace(`tag`,wd).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Dd=e=>W(yd).replace(`hr`,pd).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wd).getRegex(),Od=Dd(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),kd=Dd(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ad={blockquote:W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,kd).getRegex(),code:dd,def:Sd,fences:fd,heading:md,hr:pd,html:Ed,lheading:_d,list:Cd,newline:ud,paragraph:Od,table:sd,text:bd},jd=W(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,pd).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wd).getRegex(),Md={...Ad,lheading:vd,table:jd,paragraph:W(yd).replace(`hr`,pd).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,jd).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,wd).getRegex()},Nd={...Ad,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Td).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:sd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(yd).replace(`hr`,pd).replace(`heading`,` *#{1,6} *[^
64
- ]`).replace(`lheading`,_d).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Pd=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Fd=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Id=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Ld=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Rd=/[\p{P}\p{S}]/u,zd=/[\s\p{P}\p{S}]/u,Bd=/[^\s\p{P}\p{S}]/u,Vd=W(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,zd).getRegex(),Hd=/[\p{Pi}\p{Ps}"']/u,Ud=/(?!~)[\p{P}\p{S}]/u,Wd=/(?!~)[\s\p{P}\p{S}]/u,Gd=/(?:[^\s\p{P}\p{S}]|~)/u,Kd=W(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ld?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),qd=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Jd=W(qd,`u`).replace(/punct/g,Rd).getRegex(),Yd=W(qd,`u`).replace(/punct/g,Ud).getRegex(),Xd=W(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Hd).replace(/punct/g,Rd).getRegex(),Zd=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Qd=W(Zd,`gu`).replace(/notPunctSpace/g,Bd).replace(/punctSpace/g,zd).replace(/punct/g,Rd).getRegex(),$d=W(Zd,`gu`).replace(/notPunctSpace/g,Gd).replace(/punctSpace/g,Wd).replace(/punct/g,Ud).getRegex(),ef=W(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Bd).replace(/punctSpace/g,zd).replace(/punct/g,Rd).getRegex(),tf=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Bd).replace(/punctSpace/g,zd).replace(/punct/g,Rd).getRegex(),nf=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Bd).replace(/punctSpace/g,zd).replace(/punct/g,Rd).getRegex(),rf=W(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Rd).getRegex(),af=W(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Bd).replace(/punctSpace/g,zd).replace(/punct/g,Rd).getRegex(),of=W(/\\(punct)/,`gu`).replace(/punct/g,Rd).getRegex(),sf=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),cf=W(Td).replace(`(?:-->|$)`,`-->`).getRegex(),lf=W(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,cf).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),uf=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,df=W(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,uf).getRegex(),ff=W(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,df).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),pf=W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,df).replace(`ref`,xd).getRegex(),mf=W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,xd).getRegex(),hf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,gf=W(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,uf).getRegex(),_f=W(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,gf).replace(`ref`,hf).getRegex()).replace(`nolink`,W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,hf).getRegex()).getRegex(),vf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,yf=W(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),bf={_backpedal:sd,anyPunctuation:of,autolink:sf,blockSkip:Kd,br:Id,code:Fd,del:sd,delLDelim:sd,delRDelim:sd,emStrongLDelim:Jd,emStrongRDelimAst:Qd,emStrongRDelimUnd:tf,escape:Pd,link:ff,nolink:mf,punctuation:Vd,reflink:pf,reflinkSearch:_f,tag:lf,text:Ld,url:sd},xf={...bf,emStrongLDelim:Xd,emStrongRDelimAst:ef,emStrongRDelimUnd:nf,link:W(/^!?\[(label)\]\((.*?)\)/).replace(`label`,df).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,df).getRegex()},Sf={...bf,emStrongRDelimAst:$d,emStrongLDelim:Yd,delLDelim:rf,delRDelim:af,url:W(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,yf).replace(`protocol`,vf).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,vf).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Cf={...Sf,br:W(Id).replace(`{2,}`,`*`).getRegex(),text:W(Sf.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},wf={normal:Ad,gfm:Md,pedantic:Nd},Tf={normal:bf,gfm:Sf,breaks:Cf,pedantic:xf},Ef={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Df=e=>Ef[e];function Of(e,t){if(t){if(G.escapeTest.test(e))return e.replace(G.escapeReplace,Df)}else if(G.escapeTestNoEncode.test(e))return e.replace(G.escapeReplaceNoEncode,Df);return e}function kf(e){return e.replace(G.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function Af(e){try{e=encodeURI(e).replace(G.percentDecode,`%`)}catch{return null}return e}function jf(e,t){let n=e.replace(G.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(G.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(G.slashPipe,`|`);return n}function Mf(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Nf(e){let t=e.split(`
65
- `),n=t.length-1;for(;n>=0&&G.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
66
- `)}function Pf(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Ff(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function If(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Lf(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function Rf(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
67
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
68
- `)}function zf(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var Bf=class{options;rules;lexer;constructor(e){this.options=e||ad}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Nf(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Rf(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Mf(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Mf(t[0],`
69
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Mf(t[0],`
70
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Mf(t[0],`
71
- `).split(`
72
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
73
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
74
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
75
- ${s}`:s,r=r?`${r}
76
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
77
- `),o=t.raw+`
78
- `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
79
- `).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
80
- ${d.join(`
81
- `)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
82
- `+e.join(`
83
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
84
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
85
- `,1)[0],l=t[1].length,u=this.options.pedantic?If(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>If(e,l)),d=e.split(`
86
- `,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
87
- `,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
88
- `,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
89
- `+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
90
- `+d}f=!d.trim(),r+=l+`
91
- `,e=e.substring(l.length+1),u=m.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Nf(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Ff(t[2],`()`)!==-1)return;let e=Pf(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Mf(t[0],`
92
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=jf(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
93
- `):[],a={type:`table`,raw:Mf(t[0],`
94
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(jf(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Mf(t[0],`
95
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
96
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&zf(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=Mf(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Ff(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),Lf(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&zf(e,n[1],r,this.rules))return;let i=t[Pf((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Lf(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:kf(t[0]),escaped:e}}}},Vf=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ad,this.options.tokenizer=this.options.tokenizer||new Bf,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:G,block:wf.normal,inline:Tf.normal};this.options.pedantic?(t.block=wf.pedantic,t.inline=Tf.pedantic):this.options.gfm&&(t.block=wf.gfm,t.inline=this.options.breaks?Tf.breaks:Tf.gfm),this.tokenizer.rules=t}static get rules(){return{block:wf,inline:Tf}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(G.carriageReturn,`
97
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(G.tabCharGlobal,` `).replace(G.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
98
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
99
- `)?``:`
100
- `)+i.raw,n.text+=`
101
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
102
- `)?``:`
103
- `)+i.raw,n.text+=`
104
- `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
105
- `)?``:`
106
- `)+i.raw,r.text+=`
107
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
108
- `)?``:`
109
- `)+i.raw,n.text+=`
110
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,Pf(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,Pf(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Hf=class{options;parser;constructor(e){this.options=e||ad}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(G.notSpaceStart)?.[0],i=e?e.replace(G.endingNewline,``)+`
111
- `:``;return r?`<pre><code class="language-`+Of(r)+`">`+(n?i:Of(i,!0))+`</code></pre>
112
- `:`<pre><code>`+(n?i:Of(i,!0))+`</code></pre>
113
- `}blockquote({tokens:e}){return`<blockquote>
114
- ${this.parser.parse(e)}</blockquote>
115
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
116
- `}hr(e){return`<hr>
117
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
118
- `+r+`</`+i+`>
119
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
120
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
121
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
122
- <thead>
123
- `+t+`</thead>
124
- `+r+`</table>
125
- `}tablerow({text:e}){return`<tr>
126
- ${e}</tr>
127
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
128
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Of(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?Of(n,!0):this.parser.parseInline(r),o=Af(e);if(o===null)return a;e=Of(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Of(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Af(e);if(i===null)return Of(n);e=i;let a=`<img src="${Of(e)}" alt="${Of(n)}"`;return t&&(a+=` title="${Of(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Of(e.text)}},Uf=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Wf=class e{options;renderer;textRenderer;constructor(e){this.options=e||ad,this.options.renderer=this.options.renderer||new Hf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Uf}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Gf=class{options;block;constructor(e){this.options=e||ad}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Vf.lex:Vf.lexInline}provideParser(e=this.block){return e?Wf.parse:Wf.parseInline}},Kf=new class{defaults=id();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Wf;Renderer=Hf;TextRenderer=Uf;Lexer=Vf;Tokenizer=Bf;Hooks=Gf;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Hf(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Bf(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Gf;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Gf.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Gf.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Vf.lex(e,t??this.defaults)}parser(e,t){return Wf.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Vf.lex:Vf.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Wf.parse:Wf.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Vf.lex:Vf.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Wf.parse:Wf.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
129
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Of(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function K(e,t){return Kf.parse(e,t)}K.options=K.setOptions=function(e){return Kf.setOptions(e),K.defaults=Kf.defaults,od(K.defaults),K},K.getDefaults=id,K.defaults=ad;function qf(...e){return Kf.use(...e),K.defaults=Kf.defaults,od(K.defaults),K}K.use=qf,K.walkTokens=function(e,t){return Kf.walkTokens(e,t)},K.parseInline=Kf.parseInline,K.Parser=Wf,K.parser=Wf.parse,K.Renderer=Hf,K.TextRenderer=Uf,K.Lexer=Vf,K.lexer=Vf.lex,K.Tokenizer=Bf,K.Hooks=Gf,K.parse=K,K.options,K.setOptions,K.walkTokens,K.parseInline,Wf.parse,Vf.lex;var Jf=Symbol.for(`yaml.alias`),Yf=Symbol.for(`yaml.document`),Xf=Symbol.for(`yaml.map`),Zf=Symbol.for(`yaml.pair`),Qf=Symbol.for(`yaml.scalar`),$f=Symbol.for(`yaml.seq`),ep=Symbol.for(`yaml.node.type`),tp=e=>!!e&&typeof e==`object`&&e[ep]===Jf,np=e=>!!e&&typeof e==`object`&&e[ep]===Yf,rp=e=>!!e&&typeof e==`object`&&e[ep]===Xf,q=e=>!!e&&typeof e==`object`&&e[ep]===Zf,J=e=>!!e&&typeof e==`object`&&e[ep]===Qf,ip=e=>!!e&&typeof e==`object`&&e[ep]===$f;function Y(e){if(e&&typeof e==`object`)switch(e[ep]){case Xf:case $f:return!0}return!1}function X(e){if(e&&typeof e==`object`)switch(e[ep]){case Jf:case Xf:case Qf:case $f:return!0}return!1}var ap=e=>(J(e)||Y(e))&&!!e.anchor,op=Symbol(`break visit`),sp=Symbol(`skip children`),cp=Symbol(`remove node`);function lp(e,t){let n=dp(t);np(e)?up(null,e.contents,n,Object.freeze([e]))===cp&&(e.contents=null):up(null,e,n,Object.freeze([]))}lp.BREAK=op,lp.SKIP=sp,lp.REMOVE=cp;function up(e,t,n,r){let i=fp(e,t,n,r);if(X(i)||q(i))return pp(e,r,i),up(e,i,n,r);if(typeof i!=`symbol`){if(Y(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=up(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===op)return op;else i===cp&&(t.items.splice(e,1),--e)}}else if(q(t)){r=Object.freeze(r.concat(t));let e=up(`key`,t.key,n,r);if(e===op)return op;e===cp&&(t.key=null);let i=up(`value`,t.value,n,r);if(i===op)return op;i===cp&&(t.value=null)}}return i}function dp(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function fp(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(rp(t))return n.Map?.(e,t,r);if(ip(t))return n.Seq?.(e,t,r);if(q(t))return n.Pair?.(e,t,r);if(J(t))return n.Scalar?.(e,t,r);if(tp(t))return n.Alias?.(e,t,r)}function pp(e,t,n){let r=t[t.length-1];if(Y(r))r.items[e]=n;else if(q(r))e===`key`?r.key=n:r.value=n;else if(np(r))r.contents=n;else{let e=tp(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var mp={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},hp=e=>e.replace(/[!,[\]{}]/g,e=>mp[e]),gp=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+hp(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&X(e.contents)){let t={};lp(e.contents,(e,n)=>{X(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
130
- `)}};gp.defaultYaml={explicit:!1,version:`1.2`},gp.defaultTags={"!!":`tag:yaml.org,2002:`};function _p(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function vp(e){let t=new Set;return lp(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function yp(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function bp(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=vp(e);let a=yp(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(J(t.node)||Y(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function xp(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=xp(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=xp(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=xp(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=xp(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Sp(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Sp(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ap(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Cp=class{constructor(e){Object.defineProperty(this,ep,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!np(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Sp(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?xp(i,{"":o},``,o):o}},wp=class extends Cp{constructor(e){super(Jf),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],lp(e,{Node:(e,t)=>{(tp(t)||ap(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(Sp(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Tp(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(_p(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Tp(e,t,n){if(tp(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Y(t)){let r=0;for(let i of t.items){let t=Tp(e,i,n);t>r&&(r=t)}return r}if(q(t)){let r=Tp(e,t.key,n),i=Tp(e,t.value,n);return Math.max(r,i)}return 1}var Ep=e=>!e||typeof e!=`function`&&typeof e!=`object`,Z=class extends Cp{constructor(e){super(Qf),this.value=e}toJSON(e,t){return t?.keep?this.value:Sp(this.value,e,t)}toString(){return String(this.value)}};Z.BLOCK_FOLDED=`BLOCK_FOLDED`,Z.BLOCK_LITERAL=`BLOCK_LITERAL`,Z.PLAIN=`PLAIN`,Z.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Z.QUOTE_SINGLE=`QUOTE_SINGLE`;var Dp=`tag:yaml.org,2002:`;function Op(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function kp(e,t,n){if(np(e)&&(e=e.contents),X(e))return e;if(q(e)){let t=n.schema[Xf].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new wp(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Dp+t.slice(2));let l=Op(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Z(e);return c&&(c.node=t),t}l=e instanceof Map?o[Xf]:Symbol.iterator in Object(e)?o[$f]:o[Xf]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new Z(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ap(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return kp(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var jp=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Mp=class extends Cp{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>X(t)||q(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(jp(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Y(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ap(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Y(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&J(i)?i.value:i:Y(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!q(t))return!1;let n=t.value;return n==null||e&&J(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Y(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Y(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ap(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Np=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Pp(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Fp=(e,t,n)=>e.endsWith(`
131
- `)?Pp(n,t):n.includes(`
132
- `)?`
133
- `+Pp(n,t):(e.endsWith(` `)?``:` `)+n,Ip=`flow`,Lp=`block`,Rp=`quoted`;function zp(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Bp(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
134
- `)n===`block`&&(h=Bp(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
135
- `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
136
- `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function Bp(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
137
- `);r=t,i=t+1,a=e[i]}return r}var Vp=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Hp=e=>/^(%|---|\.\.\.)/m.test(e);function Up(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
138
- `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Wp(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Hp(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
139
-
140
- `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
141
- `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:zp(o,a,Rp,Vp(t,!1))}function Gp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
142
- `)||/[ \t]\n|\n[ \t]/.test(e))return Wp(e,t);let n=t.indent||(Hp(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:zp(r,n,Ip,Vp(t,!1))}function Kp(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Wp;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Gp:i&&!t?Wp:n?Gp:Wp}return r(e,t)}var qp;try{qp=RegExp(`(^|(?<!
143
- ))
144
- +(?!
145
- |$)`,`g`)}catch{qp=/\n+(?!\n|$)/g}function Jp({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Kp(n,r);let l=r.indent||(r.forceBlockIndent||Hp(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Z.BLOCK_FOLDED?!1:t===Z.BLOCK_LITERAL||!Up(n,c,l.length);if(!n)return u?`|
146
- `:`>
147
- `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
148
- `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
149
- `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
150
- `&&(p=p.slice(0,-1)),p.replace(qp,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
151
- `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
152
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Vp(r,!0);o!==`folded`&&t!==Z.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=zp(`${v}${e}${p}`,l,Lp,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Yp(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
153
- `)||u&&/[[\]{},]/.test(a))return Kp(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
154
- `)?Kp(a,t):Jp(e,t,n,r);if(!s&&!u&&i!==Z.PLAIN&&a.includes(`
155
- `))return Jp(e,t,n,r);if(Hp(a)){if(c===``)return t.forceBlockIndent=!0,Jp(e,t,n,r);if(s&&c===l)return Kp(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Kp(a,t)}return s?d:zp(d,c,Ip,Vp(t,!1))}function Xp(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==Z.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=Z.QUOTE_DOUBLE);let c=e=>{switch(e){case Z.BLOCK_FOLDED:case Z.BLOCK_LITERAL:return i||a?Kp(o.value,t):Jp(o,t,n,r);case Z.QUOTE_DOUBLE:return Wp(o.value,t);case Z.QUOTE_SINGLE:return Gp(o.value,t);case Z.PLAIN:return Yp(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Zp(e,t){let n=Object.assign({blockQuote:!0,commentString:Np,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Qp(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(J(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function $p(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(J(e)||Y(e))&&e.anchor;a&&_p(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function em(e,t,n,r){if(q(e))return e.toString(t,n,r);if(tp(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=X(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Qp(t.doc.schema.tags,a);let o=$p(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):J(a)?Xp(a,t,n,r):a.toString(t,n,r);return o?J(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function tm({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=X(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Y(e)||!X(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Y(e)||(J(e)?e.type===Z.BLOCK_FOLDED||e.type===Z.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=em(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=Fp(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Fp(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Fp(g,n.indent,l(f))));let _,v,y;X(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&J(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&ip(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ee=!1,b=em(t,n,()=>ee=!0,()=>h=!0),x=` `;if(f||_||v){if(x=_?`
156
- `:``,v){let e=l(v);x+=`\n${Pp(e,n.indent)}`}b===``&&!n.inFlow?x===`
157
- `&&y&&(x=`
158
-
159
- `):x+=`\n${n.indent}`}else if(!p&&Y(t)){let e=b[0],r=b.indexOf(`
160
- `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=b.indexOf(` `);e===`&`&&n!==-1&&n<r&&b[n+1]===`!`&&(n=b.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(x=`\n${n.indent}`)}}else(b===``||b[0]===`
161
- `)&&(x=``);return g+=x+b,n.inFlow?ee&&r&&r():y&&!ee?g+=Fp(g,n.indent,l(y)):h&&i&&i(),g}function nm(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var rm=`<<`,im={identify:e=>e===rm||typeof e==`symbol`&&e.description===rm,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Z(Symbol(rm)),{addToJSMap:om}),stringify:()=>rm},am=(e,t)=>(im.identify(t)||J(t)&&(!t.type||t.type===Z.PLAIN)&&im.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===im.tag&&e.default);function om(e,t,n){let r=cm(e,n);if(ip(r))for(let n of r.items)sm(e,t,n);else if(Array.isArray(r))for(let n of r)sm(e,t,n);else sm(e,t,r)}function sm(e,t,n){let r=cm(e,n);if(!rp(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function cm(e,t){return e&&tp(t)?t.resolve(e.doc,e):t}function lm(e,t,{key:n,value:r}){if(X(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(am(e,n))om(e,t,r);else{let i=Sp(n,``,e);if(t instanceof Map)t.set(i,Sp(r,i,e));else if(t instanceof Set)t.add(i);else{let a=um(n,i,e),o=Sp(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function um(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(X(e)&&n?.doc){let t=Zp(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),nm(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function dm(e,t,n){return new fm(kp(e,void 0,n),kp(t,void 0,n))}var fm=class e{constructor(e,t=null){Object.defineProperty(this,ep,{value:Zf}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return X(n)&&(n=n.clone(t)),X(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return lm(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?tm(this,e,t,n):JSON.stringify(this)}};function pm(e,t,n){return(t.inFlow??e.flow?hm:mm)(e,t,n)}function mm({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(X(i))!d&&i.spaceBefore&&f.push(``),gm(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(q(i)){let e=X(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),gm(n,f,e.commentBefore,d))}d=!1;let s=em(i,u,()=>o=null,()=>d=!0);o&&(s+=Fp(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
162
- `}}return e?(p+=`
163
- `+Pp(l(e),c),s&&s()):d&&o&&o(),p}function hm({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(X(i))i.spaceBefore&&d.push(``),gm(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(q(i)){let e=X(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),gm(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=X(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=em(i,c,()=>a=null);l||=d.length>u||o.includes(`
164
- `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Fp(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
165
- `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function gm({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Pp(t(r),e);n.push(i.trimStart())}}function _m(e,t){let n=J(t)?t.value:t;for(let r of e)if(q(r)&&(r.key===t||r.key===n||J(r.key)&&r.key.value===n))return r}var vm=class extends Mp{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Xf,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(dm(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=q(e)?e:!e||typeof e!=`object`||!(`key`in e)?new fm(e,e?.value):new fm(e.key,e.value);let r=_m(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);J(r.value)&&Ep(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=_m(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=_m(this.items,e)?.value;return(!t&&J(n)?n.value:n)??void 0}has(e){return!!_m(this.items,e)}set(e,t){this.add(new fm(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)lm(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!q(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),pm(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ym={collection:`map`,default:!0,nodeClass:vm,tag:`tag:yaml.org,2002:map`,resolve(e,t){return rp(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>vm.from(e,t,n)},bm=class extends Mp{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super($f,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=xm(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=xm(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&J(r)?r.value:r}has(e){let t=xm(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=xm(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];J(r)&&Ep(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Sp(e,String(r++),t));return n}toString(e,t,n){return e?pm(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(kp(a,void 0,n))}}return i}};function xm(e){let t=J(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Sm={collection:`seq`,default:!0,nodeClass:bm,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return ip(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>bm.from(e,t,n)},Cm={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Xp(e,t,n,r)}},wm={identify:e=>e==null,createNode:()=>new Z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Z(null),stringify:({source:e},t)=>typeof e==`string`&&wm.test.test(e)?e:t.options.nullStr},Tm={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Z(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&Tm.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Em({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var Dm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Em},Om={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Em(e)}},km={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Z(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:Em},Am=e=>typeof e==`bigint`||Number.isInteger(e),jm=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Mm(e,t,n){let{value:r}=e;return Am(r)&&r>=0?n+r.toString(t):Em(e)}var Nm={identify:e=>Am(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>jm(e,2,8,n),stringify:e=>Mm(e,8,`0o`)},Pm={identify:Am,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>jm(e,0,10,n),stringify:Em},Fm={identify:e=>Am(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>jm(e,2,16,n),stringify:e=>Mm(e,16,`0x`)},Im=[ym,Sm,Cm,wm,Tm,Nm,Pm,Fm,Dm,Om,km];function Lm(e){return typeof e==`bigint`||Number.isInteger(e)}var Rm=({value:e})=>JSON.stringify(e),zm=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Rm},{identify:e=>e==null,createNode:()=>new Z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Rm},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Rm},{identify:Lm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Lm(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Rm}],Bm=[ym,Sm].concat(zm,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Vm={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=Z.BLOCK_LITERAL,t!==Z.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===Z.BLOCK_LITERAL?`
166
- `:` `)}return Xp({comment:e,type:t,value:s},r,i,a)}};function Hm(e,t){if(ip(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!q(r)){if(rp(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new fm(new Z(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=q(r)?r:new fm(r)}}else t(`Expected a sequence for this tag`);return e}function Um(e,t,n){let{replacer:r}=n,i=new bm(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(dm(o,s,n))}return i}var Wm={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Hm,createNode:Um},Gm=class e extends bm{constructor(){super(),this.add=vm.prototype.add.bind(this),this.delete=vm.prototype.delete.bind(this),this.get=vm.prototype.get.bind(this),this.has=vm.prototype.has.bind(this),this.set=vm.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(q(e)?(r=Sp(e.key,``,t),i=Sp(e.value,r,t)):r=Sp(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Um(e,t,n),i=new this;return i.items=r.items,i}};Gm.tag=`tag:yaml.org,2002:omap`;var Km={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Gm,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Hm(e,t),r=[];for(let{key:e}of n.items)J(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Gm,n)},createNode:(e,t,n)=>Gm.from(e,t,n)};function qm({value:e,source:t},n){return t&&(e?Jm:Ym).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Jm={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Z(!0),stringify:qm},Ym={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Z(!1),stringify:qm},Xm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Em},Zm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Em(e)}},Qm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Z(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Em},$m=e=>typeof e==`bigint`||Number.isInteger(e);function eh(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function th(e,t,n){let{value:r}=e;if($m(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Em(e)}var nh={identify:$m,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>eh(e,2,2,n),stringify:e=>th(e,2,`0b`)},rh={identify:$m,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>eh(e,1,8,n),stringify:e=>th(e,8,`0`)},ih={identify:$m,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>eh(e,0,10,n),stringify:Em},ah={identify:$m,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>eh(e,2,16,n),stringify:e=>th(e,16,`0x`)},oh=class e extends vm{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=q(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new fm(e.key,null):new fm(e,null),_m(this.items,t.key)||this.items.push(t)}get(e,t){let n=_m(this.items,e);return!t&&q(n)?J(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=_m(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new fm(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(dm(e,null,n));return i}};oh.tag=`tag:yaml.org,2002:set`;var sh={collection:`map`,identify:e=>e instanceof Set,nodeClass:oh,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>oh.from(e,t,n),resolve(e,t){if(rp(e)){if(e.hasAllNullValues(!0))return Object.assign(new oh,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function ch(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function lh(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Em(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var uh={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>ch(e,n),stringify:lh},dh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>ch(e,!1),stringify:lh},fh={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(fh.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=ch(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},ph=[ym,Sm,Cm,wm,Jm,Ym,nh,rh,ih,ah,Xm,Zm,Qm,Vm,im,Km,Wm,sh,uh,dh,fh],mh=new Map([[`core`,Im],[`failsafe`,[ym,Sm,Cm]],[`json`,Bm],[`yaml11`,ph],[`yaml-1.1`,ph]]),hh={binary:Vm,bool:Tm,float:km,floatExp:Om,floatNaN:Dm,floatTime:dh,int:Pm,intHex:Fm,intOct:Nm,intTime:uh,map:ym,merge:im,null:wm,omap:Km,pairs:Wm,seq:Sm,set:sh,timestamp:fh},gh={"tag:yaml.org,2002:binary":Vm,"tag:yaml.org,2002:merge":im,"tag:yaml.org,2002:omap":Km,"tag:yaml.org,2002:pairs":Wm,"tag:yaml.org,2002:set":sh,"tag:yaml.org,2002:timestamp":fh};function _h(e,t,n){let r=mh.get(t);if(r&&!e)return n&&!r.includes(im)?r.concat(im):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(mh.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(im)),i.reduce((e,t)=>{let n=typeof t==`string`?hh[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(hh).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var vh=(e,t)=>e.key<t.key?-1:+(e.key>t.key),yh=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?_h(e,`compat`):e?_h(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?gh:{},this.tags=_h(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Xf,{value:ym}),Object.defineProperty(this,Qf,{value:Cm}),Object.defineProperty(this,$f,{value:Sm}),this.sortMapEntries=typeof a==`function`?a:a===!0?vh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function bh(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Zp(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(Pp(t,``))}let o=!1,s=null;if(e.contents){if(X(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(Pp(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=em(e.contents,i,()=>s=null,t);s&&(c+=Fp(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(em(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
167
- `)?(n.push(`...`),n.push(Pp(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(Pp(a(t),``)))}return n.join(`
168
- `)+`
169
- `}var xh=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ep,{value:Yf});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new gp({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[ep]:{value:Yf}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=X(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){Sh(this.contents)&&this.contents.add(e)}addIn(e,t){Sh(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=vp(this);e.anchor=!t||n.has(t)?yp(t||`a`,n):t}return new wp(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=bp(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=kp(e,l,p);return o&&Y(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new fm(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return Sh(this.contents)?this.contents.delete(e):!1}deleteIn(e){return jp(e)?this.contents!=null&&(this.contents=null,!0):Sh(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Y(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return jp(e)?!t&&J(this.contents)?this.contents.value:this.contents:Y(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Y(this.contents)?this.contents.has(e):!1}hasIn(e){return jp(e)?this.contents!==void 0:Y(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ap(this.schema,[e],t):Sh(this.contents)&&this.contents.set(e,t)}setIn(e,t){jp(e)?this.contents=t:this.contents==null?this.contents=Ap(this.schema,Array.from(e),t):Sh(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new gp({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new gp({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new yh(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=Sp(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?xp(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return bh(this,e)}};function Sh(e){if(Y(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var Ch=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},wh=class extends Ch{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Th=class extends Ch{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},Eh=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
170
- `),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function Dh(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,ee=null,b=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!ee||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,b??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,b??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),ee&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),ee=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let x=e[e.length-1],te=x?x.offset+x.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:ee,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:te,start:b??te}}function Oh(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
171
- `))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(Oh(t.key)||Oh(t.value))return!0}return!1;default:return!0}}function kh(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&Oh(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function Ah(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||J(e)&&J(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var jh=`All mapping items must start at the same column`;function Mh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??vm)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=Dh(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,jh)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
172
- `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||Oh(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,jh);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&kh(r.indent,u,i),n.atKey=!1,Ah(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Dh(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&kh(r.indent,f,i),s=c.range[2];let l=new fm(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
173
- `+_.comment:g.comment=_.comment);let e=new fm(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function Nh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??bm)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=Dh(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&kh(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function Ph(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var Fh=`Block collections are not allowed within flow collections`,Ih=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Lh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?vm:bm))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=Dh(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
174
- `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&Oh(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];q(t)&&(t=t.value??t.key),t.comment?t.comment+=`
175
- `+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],Ih(m)&&i(r.range,`BLOCK_IN_FLOW`,Fh)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);Ih(f)&&i(g.range,`BLOCK_IN_FLOW`,Fh),n.atKey=!1;let _=Dh(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?Ih(m)&&i(v.range,`BLOCK_IN_FLOW`,Fh):_.comment&&(g.comment?g.comment+=`
176
- `+_.comment:g.comment=_.comment);let y=new fm(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;Ah(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new vm(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=Ph(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
177
- `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Rh(e,t,n,r,i,a){let o=n.type===`block-map`?Mh(e,t,n,r,a):n.type===`block-seq`?Nh(e,t,n,r,a):Lh(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function zh(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===vm.tagName&&s===`map`||o===bm.tagName&&s===`seq`)return Rh(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),Rh(e,t,n,i,o)}let l=Rh(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=X(u)?u:new Z(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Bh(e,t,n){let r=t.offset,i=Vh(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?Z.BLOCK_FOLDED:Z.BLOCK_LITERAL,o=t.source?Hh(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
178
- `.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
179
- `;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===Z.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
180
- `):t.length>c||r[0]===` `?(f===` `?f=`
181
- `:!p&&f===`
182
- `&&(f=`
183
-
184
- `),d+=f+t.slice(c)+r,f=`
185
- `,p=!0):r===``?f===`
186
- `?d+=`
187
- `:f=`
188
- `:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
189
- `+o[e][0].slice(c);d[d.length-1]!==`
190
- `&&(d+=`
191
- `);break;default:d+=`
192
- `}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Vh({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Hh(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Uh(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=Z.PLAIN,c=Wh(a,l);break;case`single-quoted-scalar`:s=Z.QUOTE_SINGLE,c=Gh(a,l);break;case`double-quoted-scalar`:s=Z.QUOTE_DOUBLE,c=qh(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=Ph(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Wh(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Kh(e)}function Gh(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Kh(e.slice(1,-1)).replace(/''/g,`'`)}function Kh(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
193
- `?a+=o:o=`
194
- `:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function qh(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
195
- `){if(i===`
196
- `){let{fold:t,offset:i}=Jh(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Yh[i];if(a)n+=a;else if(i===`
197
- `)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
198
- `)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Xh(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
199
- `&&(a!==`\r`||e[r+2]!==`
200
- `)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Jh(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
201
- `||r===`\r`)&&(r!==`\r`||e[t+2]===`
202
- `);)r===`
203
- `&&(n+=`
204
- `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Yh={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
205
- `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Xh(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Zh(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Bh(e,t,r):Uh(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Qf]:c?Qh(e.schema,i,c,n,r):t.type===`scalar`?$h(e,i,t,r):e.schema[Qf];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=J(a)?a:new Z(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new Z(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Qh(e,t,n,r,i){if(n===`!`)return e[Qf];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Qf])}function $h({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Qf];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Qf];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function eg(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var tg={composeNode:ng,composeEmptyNode:rg};function ng(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=ig(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Zh(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=zh(tg,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=rg(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!J(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function rg(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Zh(e,{type:`scalar`,offset:eg(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function ig({options:e},{offset:t,source:n,end:r},i){let a=new wp(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=Ph(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function ag(e,t,{offset:n,start:r,value:i,end:a},o){let s=new xh(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Dh(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?ng(c,i,l,o):rg(c,l.end,r,null,l,o);let u=s.contents.range[2],d=Ph(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function og(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function sg(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
206
-
207
- `:`
208
- `)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var cg=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=og(e);r?this.warnings.push(new Th(i,t,n)):this.errors.push(new wh(i,t,n))},this.directives=new gp({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=sg(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Y(i)&&!i.flow&&i.items.length>0){let e=i.items[0];q(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:sg(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=og(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=ag(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new wh(og(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new wh(og(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=Ph(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new wh(og(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new xh(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},lg=Symbol(`break visit`),ug=Symbol(`skip children`),dg=Symbol(`remove item`);function fg(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),pg(Object.freeze([]),e,t)}fg.BREAK=lg,fg.SKIP=ug,fg.REMOVE=dg,fg.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},fg.parentCollection=(e,t)=>{let n=fg.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function pg(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=pg(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===lg)return lg;else r===dg&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function mg(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
209
- `:case`\r
210
- `:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function hg(e){switch(e){case void 0:case` `:case`
211
- `:case`\r`:case` `:return!0;default:return!1}}var gg=new Set(`0123456789ABCDEFabcdef`),_g=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),vg=new Set(`,[]{}`),yg=new Set(` ,[]{}
212
- \r `),bg=e=>!e||yg.has(e),xg=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
213
- `||t===`\r`&&this.buffer[e+1]===`
214
- `}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
215
- `||!t&&!this.atEnd)return e+n+1}return t===`
216
- `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&hg(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
217
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&hg(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!hg(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&hg(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(bg),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&hg(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(bg),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||hg(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
218
- `,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
219
- `,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>hg(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
220
- `:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
221
- `)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
222
- `,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
223
- `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
224
- `&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(hg(r)||e&&vg.has(r))break;t=n}else if(hg(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
225
- `?(n+=1,r=`
226
- `,i=this.buffer[n+1]):t=n),i===`#`||e&&vg.has(i))break;if(r===`
227
- `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&vg.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(bg),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(hg(n)||t&&vg.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!hg(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(_g.has(t))t=this.buffer[++e];else if(t===`%`&&gg.has(this.buffer[e+1])&&gg.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
228
- `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
229
- `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},Sg=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function Cg(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function wg(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function Tg(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function Eg(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function Dg(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function Og(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function kg(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!Cg(t.start,`explicit-key-ind`)&&!Cg(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,Tg(t.value)?t.value.end?Og(t.value.end,t.sep):t.value.end=t.sep:Og(t.start,t.sep),delete t.sep)}var Ag=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new xg,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=mg(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&kg(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&wg(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:wg(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=Dg(Eg(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
230
- `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
231
- `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Og(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(Cg(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Dg(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Cg(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Tg(t.key)&&!Cg(t.sep,`newline`)){let e=Dg(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Cg(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!Cg(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Og(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||Cg(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=Dg(Eg(t));kg(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
232
- `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
233
- `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=Dg(Eg(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=Dg(Eg(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function jg(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Sg||null,prettyErrors:t}}function Mg(e,t={}){let{lineCounter:n,prettyErrors:r}=jg(t),i=new Ag(n?.addNewLine),a=new cg(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new wh(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Eh(e,n)),o.warnings.forEach(Eh(e,n))),o}function Ng(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Mg(e,n);if(!i)return null;if(i.warnings.forEach(e=>nm(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var Pg=/^---\r?\n([\s\S]*?)\r?\n?---[ \t]*(?:\r?\n|$)/;function Fg(e,t){let n=Pg.exec(e);if(!n)throw Error(`must start with front matter: a line "---", the fields, then another "---".`);let r;try{r=Ng(n[1]??``)??{}}catch(e){throw Error(`has front matter that isn't valid YAML (${e.message.split(`
234
- `)[0]}).`)}if(typeof r!=`object`||!r||Array.isArray(r))throw Error("must have front matter that lists fields, such as `title: My page`.");let{version:i,showFrom:a,hideAfter:o,inLanguage:s,translationOf:c,translatedFrom:l,...u}=r,d=e.slice(n[0].length).replace(/^\r?\n/,``).trimEnd();return{version:i,...a!==void 0&&{showFrom:a},...o!==void 0&&{hideAfter:o},...s!==void 0&&{inLanguage:s},...c!==void 0&&{translationOf:c},...l!==void 0&&{translatedFrom:l},fields:{...u,[t]:d}}}function Ig(e){return e===`/`||/^(\/[a-z0-9]+(?:-[a-z0-9]+)*)+$/.test(e)}var Lg=N({pages:M(A().refine(Ig,`must be a page's address, such as /news`)).optional(),collections:M(A().min(1)).optional(),media:Hs().optional(),layout:Hs().optional(),menus:Hs().optional(),languages:M(A().min(1)).optional()}),Rg=N({version:oc(1),people:tc(A().min(1),Lg).default({}),reviewers:M(A().min(1)).optional()});function zg(e,t){return e.toLowerCase()===t.toLowerCase()}function Bg(e,t){if(e&&t)return Object.entries(e.people).find(([e])=>zg(e,t))?.[1]}function Vg(e,t){return(e??[]).some(e=>e===`/`||t===e||t.startsWith(`${e}/`))}function Hg(e,t){return!e.languages||e.languages.includes(t)}function Ug(e,t,n){if(!t)return!0;if(!Hg(t,m_(e.settings,n.path)))return!1;let r=n.content?.translationOf;return Vg(t.pages,n.path)||r!==void 0&&Vg(t.pages,r)}function Wg(e,t){return!e||(e.collections??[]).includes(t)}function Gg(e,t,n){return!t||Wg(t,n.collection)&&Hg(t,h_(e.settings,n))}function Kg(e){return!e||e.media===!0}function qg(e,t,n){return!t||t.layout===!0&&Hg(t,n??u_(e.settings))}function Jg(e,t,n){return!t||t.menus===!0&&Hg(t,n??u_(e.settings))}function Yg(e){return`content`in e?e.content:void 0}function Xg(e){if(e!==void 0)try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}catch{return}}function Zg(e,t){return t===`content/layout/header.json`||t===`content/layout/footer.json`?u_(e.settings):/^content\/layout\/(?:header|footer)\.([a-z]{2,3}(?:-[A-Za-z0-9]+)*)\.json$/.exec(t)?.[1]}function Qg(e,t){let n=Iu.safeParse(Xg(t));if(!n.success)return;let r=n.data,i=(e,t)=>rd(e??{})===rd(t??{}),a=[];i(r.menus,e.menus)||a.push(u_(e.settings));let o=r.languages??{},s=e.languageMenus??{};for(let e of new Set([...Object.keys(o),...Object.keys(s)]))i(o[e],s[e])||a.push(e);return a}function $g(e){if(!e.startsWith(`content/collections/`))return;let[t,n,...r]=e.slice(a.length+1).split(`/`);if(!t||!n||r.length>0||n===`_collection.json`)return;let i=/^(.+)\.(?:json|md)$/.exec(n)?.[1];return i?{collection:t,slug:i}:void 0}function e_(e,t,n){let r=Yg(n);if(!e||r===void 0)return;let i=l_(e.settings,t,r);return i.ok?{content:i.value}:void 0}function t_(e,t,n){if(!t)return[];let r=[];for(let a of n){let{path:n}=a;if(n.startsWith(`content/pages/`)&&n.endsWith(`.json`)){let o;try{o=i(n)}catch{r.push({path:n,kind:`other`});continue}let s=e.pages.find(e=>e.file===n),c=Xg(Yg(a));(!s||Ug(e,t,s))&&(`delete`in a||Ug(e,t,{path:o,content:{translationOf:typeof c?.translationOf==`string`?c.translationOf:void 0}}))||r.push({path:n,kind:`page`,address:o});continue}let o=$g(n);if(o){let i=e.collections.find(e=>e.id===o.collection),s=i?.entries.find(e=>e.file===n),c=e_(i,n,a);(!Wg(t,o.collection)||s&&!Gg(e,t,s)||c&&!Gg(e,t,{collection:o.collection,content:c.content}))&&r.push({path:n,kind:`entry`,...o});continue}if(n.startsWith(`public/media/`)||n===`content/media.json`||n===`content/media-storage.json`){Kg(t)||r.push({path:n,kind:`media`});continue}let s=Zg(e,n);if(s!==void 0){qg(e,t,s)||r.push({path:n,kind:`layout`});continue}if(n===`content/menus.json`){(`delete`in a?void 0:Qg(e,Yg(a)))?.every(n=>Jg(e,t,n))!==!0&&r.push({path:n,kind:`menus`});continue}r.push({path:n,kind:`other`})}return r}async function n_(t){let n=await t.read(e);if(n===void 0)return;let r=o_(`permissions`,Rg,e,n);if(!r.ok)return;let{people:i,reviewers:a}=r.value;return{people:i,...a&&{reviewers:a}}}async function r_(e,n){let r=new Map;for(let{path:e}of n){let t=$g(e);t&&r.set(t.collection,(r.get(t.collection)??new Set).add(e))}let o=[...r.keys()].map(e=>`${a}/${e}/${s}`),l=n.map(e=>e.path).filter(e=>e.startsWith(`content/pages/`)&&e.endsWith(`.json`)),u=await i_(e,[t,...n.some(e=>e.path===`content/menus.json`)?[c]:[],...l,...o,...[...r.values()].flatMap(e=>[...e])]),d=e=>e.ok?e.value:void 0,f=u.get(t),p=f!==void 0&&d(o_(`site`,Nu,`content/site.json`,f))||Nu.parse({version:1}),m=l.flatMap(e=>{let t=u.get(e),n=t===void 0?void 0:d(o_(`page`,Uu,e,t));return n?[{path:i(e),file:e,content:n}]:[]}),h=[...r].flatMap(([e,t])=>{let n=`${a}/${e}/${s}`,r=u.get(n),i=r===void 0?void 0:d(o_(`collection`,Yu,n,r));return i?[{id:e,file:n,settings:i,entries:[...t].flatMap(t=>{let n=u.get(t),r=n===void 0?void 0:d(l_(i,t,n)),a=$g(t)?.slug;return r&&a?[{collection:e,slug:a,file:t,content:r}]:[]})}]:[]}),g=u.get(c),_=g===void 0?void 0:d(o_(`menus`,Iu,c,g));return{settings:p,pages:m,collections:h,menus:_?.menus??{},..._?.languages&&{languageMenus:_.languages}}}async function i_(e,t){if(e.readFiles)return e.readFiles(t);let n=await Promise.all(t.map(async t=>[t,await e.read(t)]));return new Map(n.filter(e=>e[1]!==void 0))}function a_(e){return e.issues.map(e=>e.path.length?`${e.path.join(`.`)} ${e.message}`:e.message).join(`; `)}function o_(e,t,n,r){let i;try{i=JSON.parse(r)}catch(e){return{ok:!1,problem:{file:n,message:`isn't valid JSON (${e.message}).`}}}return typeof i!=`object`||!i||Array.isArray(i)?{ok:!1,problem:{file:n,message:`must contain a JSON object.`}}:s_(e,t,n,i)}function s_(e,t,n,r){let i;try{i=y(e,r)}catch(e){return{ok:!1,problem:{file:n,message:e.message}}}let a=t.safeParse(i);return a.success?{ok:!0,value:a.data}:{ok:!1,problem:{file:n,message:a_(a.error)}}}function c_(e,t,n){let r;try{r=Fg(t,n)}catch(t){return{ok:!1,problem:{file:e,message:t.message}}}return s_(`entry`,Xu,e,r)}function l_(e,t,n){let r=e.markdown?c_(t,n,e.markdown.body):o_(`entry`,Xu,t,n);if(!r.ok)return r;let i=$u(e.fields,r.value.fields);return i.length>0?{ok:!1,problem:{file:t,message:i.map(e=>`fields.${e}`).join(`; `)}}:r}function u_(e){return e.mainLanguage??e.language}function d_(e){try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e);if(t&&t!==e)return t.charAt(0).toLocaleUpperCase(e)+t.slice(1)}catch{}return e}function f_(e){return`/${e.toLowerCase()}`}function p_(e){let t=u_(e);return[{code:t,name:e.languageName||d_(t),prefix:``,main:!0},...(e.languages??[]).filter(e=>e.code.toLowerCase()!==t.toLowerCase()).map(e=>({code:e.code,name:e.name||d_(e.code),prefix:f_(e.code),main:!1}))]}function m_(e,t){for(let n of p_(e))if(!n.main&&(t===n.prefix||t.startsWith(`${n.prefix}/`)))return n.code;return u_(e)}function h_(e,t){return t.content.inLanguage??u_(e)}var g_=`goodfellow:broker-connect`;function __(e){return e.startsWith(`.github/`)||e===`.gitlab-ci.yml`||e.startsWith(`.gitlab/`)||e===`bitbucket-pipelines.yml`}function v_(e,t){let r={refused:[],confirm:[]};for(let i of e){let{path:e}=i;if(__(e)||e.startsWith(`/`)||e.split(`/`).includes(`..`))r.refused.push(e);else if(e.startsWith(`content/code/`))r.confirm.push({path:e,kind:`custom-code`});else if(!n(e))r.confirm.push({path:e,kind:`code`});else if(e===`content/site.json`){let n=`content`in i?i.content:`bytes`in i?new TextDecoder(`utf-8`,{fatal:!1}).decode(i.bytes):void 0,a;try{a=n===void 0?void 0:JSON.parse(n).url}catch{a=void 0}(a??void 0)!==(t??void 0)&&r.confirm.push({path:e,kind:`site-address`})}}return r}var y_=class extends Error{problem;name=`BrokerRefusedError`;constructor(e,t){super(t),this.problem=e}},b_=[`revision`,`read`,`readBytes`,`list`,`readFiles`,`fileSizes`,`write`,`changedPaths`],x_={methods:[`read`,`readBytes`,`list`]},S_={name:`draft`,data:[`name`],methods:[`changes`,`paths`,`publish`,`submitForReview`,`discard`],objects:{store:{methods:b_}}},C_={data:[`user`,`contentOnly`],methods:[...b_,`deployStatus`,`history`,`readAt`,`repositoryVisibility`,`signOut`],sync:{filesAt:x_},objects:{pages:{data:[`severalDomains`],methods:[`site`,`connect`,`records`,`status`,`secure`,`disconnect`]},editors:{data:[`invitesByEmail`,`membersOnly`],methods:[`list`,`invite`,`setRole`,`remove`,`letEditorsPublish`]},ownerAccess:{data:[`tokenLink`,`active`,`problem`],methods:[`forget`,`startRedirect`,`requestToken`]},updates:{methods:[`setup`,`enable`,`lastRun`,`start`,`rebuild`],objects:{code:{data:[`repo`,`webUrl`],methods:[`read`,`history`,`readAt`]},nightly:{methods:[`supported`,`get`,`set`]}}},drafts:{methods:[`create`,`open`,`list`,`reviews`],returns:{create:S_,open:S_}},scheduledBuilds:{methods:[`timing`,`sync`]},tasks:{methods:[`supported`,`secretsPlace`,`run`]},comments:{methods:[`create`,`find`,`threads`,`hide`,`show`,`remove`,`lock`,`unlock`],objects:{access:{data:[`tokenLink`,`active`],methods:[`forget`,`requestToken`]}}}}};function w_(e){if(!(e instanceof Error))return{name:`Error`,message:String(e),fields:{}};let t={};for(let[n,r]of Object.entries(e))[`string`,`number`,`boolean`].includes(typeof r)&&(t[n]=r);return{name:e.name,message:e.message,fields:t}}function T_(e){return e instanceof Error?{__error:w_(e)}:e}function E_(e,t,n={}){let r=new Map([[0,{target:t,shape:C_,prefix:``}]]),i=1;function a(e,t,r,i){let o=e,s={};for(let e of t.data??[])o[e]!==void 0&&(s[e]=T_(o[e]));let c=(t.methods??[]).filter(e=>typeof o[e]==`function`||n.extra?.[`${r}${e}`]!==void 0);for(let e of Object.keys(t.sync??{}))typeof o[e]==`function`&&c.push(e);let l={};for(let[e,n]of Object.entries(t.objects??{})){let t=o[e];typeof t==`object`&&t&&(l[e]=a(t,n,`${r}${e}.`,i))}return{handle:i,data:s,methods:c,objects:l}}let o=()=>a(t,C_,``,0);function s(e,t){let n=r.get(e);if(!n)return;let i=n.target,a=n.shape,o=n.prefix;for(let e of t.slice(0,-1))if(a=a?.objects?.[e],i=i?.[e],o+=`${e}.`,!a||typeof i!=`object`||!i)return;let s=t.at(-1)??``;if((a?.methods?.includes(s)||Object.hasOwn(a?.sync??{},s))&&a)return{target:i,shape:a,method:s,name:`${o}${s}`}}async function c(e){let t=s(e.handle,e.path);if(!t)throw new y_(`not-here`,`The broker doesn't offer that.`);let{target:o,shape:c,method:l,name:u}=t,d=Array.isArray(e.args)?e.args:[],f=n.extra?.[u];if(c.sync?.[l]){let t=c.sync[l],[r,i]=e.then??[``,[]];if(!t.methods?.includes(r))throw new y_(`not-here`,`The broker doesn't offer that.`);await n.check?.({path:`${u}.${r}`,args:[...d,...i],target:o});let a=o[l].apply(o,d);return a[r].apply(a,i)}await n.check?.({path:u,args:d,target:o});let p=f?await f(...d):await o[l].apply(o,d),m=c.returns?.[l];if(m&&typeof p==`object`&&p){let e=i++,t=`${m.name??u}.`;return r.set(e,{target:p,shape:m,prefix:t}),{__object:a(p,m,t,e)}}return p}return e.onmessage=async t=>{let n=t.data;if(n?.type===`call`&&Array.isArray(n.path))try{let t=await c(n);e.postMessage({type:`answer`,id:n.id,ok:!0,value:t,state:o()})}catch(t){e.postMessage({type:`answer`,id:n.id,ok:!1,error:w_(t),state:o()})}},e.postMessage({type:`state`,state:o()}),()=>{e.onmessage=null,r.clear()}}var D_=N(Object.fromEntries([`connect`,`files`,`secrets`,`read`,`write`].map(e=>[e,M(A()).optional()]))).strict(),O_=N({version:oc(1),title:A().trim().min(1),description:A().optional(),permissions:D_.default({}),blocks:M(A()).optional(),admin:Hs().optional(),screens:M(N({id:A(),title:A()}).strict()).optional(),build:M(N({id:A(),title:A().optional()}).strict()).optional(),tasks:M(N({id:A(),title:A().optional()}).strict()).optional(),server:Hs().optional(),mediaStorage:Hs().optional(),editor:N({title:A().trim().min(1),kinds:M(ic([`page`,`header`,`footer`,`template`])).optional()}).strict().optional()}).strict(),k_=N({release:A(),installed:A(),goodfellow:A().optional(),manifest:O_}),A_=N({version:oc(1),plugins:tc(A(),k_)}),j_={version:1,plugins:{}};function M_(e){return e===void 0?j_:A_.parse(JSON.parse(e))}var N_={anthropic:{name:`Claude`,keyUrl:`https://platform.claude.com/settings/keys`,needsKey:!0,models:[`claude-opus-5-5`,`claude-sonnet-5-5`,`claude-haiku-4-5`]},openai:{name:`OpenAI`,keyUrl:`https://platform.openai.com/api-keys`,needsKey:!0,baseUrl:`https://api.openai.com/v1`,structured:`json_schema`},gemini:{name:`Google Gemini`,keyUrl:`https://aistudio.google.com/apikey`,needsKey:!0,baseUrl:`https://generativelanguage.googleapis.com/v1beta/openai`,structured:`json_schema`},groq:{name:`Groq`,keyUrl:`https://console.groq.com/keys`,needsKey:!0,baseUrl:`https://api.groq.com/openai/v1`,structured:`json_object`},mistral:{name:`Mistral`,keyUrl:`https://console.mistral.ai/api-keys`,needsKey:!0,baseUrl:`https://api.mistral.ai/v1`,structured:`json_schema`},openrouter:{name:`OpenRouter`,keyUrl:`https://openrouter.ai/settings/keys`,needsKey:!0,baseUrl:`https://openrouter.ai/api/v1`,structured:`json_schema`},ovhcloud:{name:`OVHcloud AI Endpoints`,needsKey:!1,baseUrl:`https://oai.endpoints.kepler.ai.cloud.ovh.net/v1`,structured:`json_object`,models:[`gpt-oss-120b`]},custom:{name:`OpenAI-compatible`,needsKey:!1,structured:`json_object`},manual:{name:`Chat app`,needsKey:!1}};function P_(e,t){let n=t?e.split(t).join(`[key]`):e;return n=n.replace(/\b(sk|gsk|AIza)[-_A-Za-z0-9]{12,}/g,`[key]`),n}var F_=`https://api.anthropic.com`,I_=10485760,L_=[`content-type`,`accept`,`anthropic-version`,`anthropic-beta`];function R_(e,t,n){return e===`anthropic`?t===`POST`&&n===`v1/messages`:t===`POST`&&n===`chat/completions`||t===`GET`&&n===`models`}function z_(e,t){return Response.json({error:{message:t}},{status:e,headers:{"cache-control":`no-store`}})}function B_(e,t={}){let n=t.fetch??((e,t)=>fetch(e,t)),r=Object.entries(e).flatMap(([e,t])=>t&&(typeof t==`string`||t.baseUrl)?[[e,t]]:[]),i=new Map(r);async function a(e,t,r){let a=t,o=i.get(a);if(!o)return z_(404,`This site has no key for that service.`);if(!R_(a,e.method,r))return z_(404,`The AI assistant doesn't use that.`);let s=typeof o==`string`?o:o.key,c=a===`anthropic`?F_:typeof o==`object`?o.baseUrl:N_[a].baseUrl??``;if(!c)return z_(404,`This site has no address for that service.`);let l=e.method===`GET`?void 0:await e.arrayBuffer();if(l&&l.byteLength>I_)return z_(413,`That request is too large.`);let u=new Headers;for(let t of L_){let n=e.headers.get(t);n&&u.set(t,n)}s&&(a===`anthropic`?u.set(`x-api-key`,s):u.set(`authorization`,`Bearer ${s}`));let d=`${h(c,`/`,{start:!1})}/${r}${new URL(e.url).search}`,f;try{f=await n(d,{method:e.method,headers:u,body:l,signal:e.signal})}catch(e){if(e.name===`AbortError`)throw e;return z_(502,`The AI service couldn't be reached.`)}if(!f.ok){let e=P_(await f.text().catch(()=>``),s);return new Response(e,{status:f.status,headers:{"content-type":f.headers.get(`content-type`)??`text/plain`,"cache-control":`no-store`}})}return new Response(f.body,{status:f.status,headers:{"content-type":f.headers.get(`content-type`)??`application/json`,"cache-control":`no-store`}})}return{services:[...i.keys()],forward:a}}var V_=new Set([`write`,`draft.store.write`]),H_=[`revision`,`read`,`readBytes`,`list`,`readFiles`,`fileSizes`,`changedPaths`],U_=new Set([...H_,`deployStatus`,`history`,`readAt`,`repositoryVisibility`,`signOut`,`filesAt.read`,`filesAt.readBytes`,`filesAt.list`,`pages.site`,`pages.records`,`pages.status`,`editors.list`,`ownerAccess.forget`,`ownerAccess.startRedirect`,`ownerAccess.requestToken`,`updates.lastRun`,`updates.rebuild`,`updates.code.read`,`updates.code.history`,`updates.code.readAt`,`updates.nightly.supported`,`updates.nightly.get`,`updates.nightly.set`,`drafts.create`,`drafts.open`,`drafts.list`,`drafts.reviews`,`draft.changes`,`draft.paths`,`draft.submitForReview`,...H_.map(e=>`draft.store.${e}`),`scheduledBuilds.timing`,`scheduledBuilds.sync`,`tasks.supported`,`tasks.secretsPlace`,`comments.find`,`comments.threads`,`comments.hide`,`comments.show`,`comments.lock`,`comments.unlock`,`comments.access.forget`,`comments.access.requestToken`]),W_={"pages.connect":`connect`,"pages.secure":`secure`,"pages.disconnect":`disconnect`};async function G_(e,t){let n=e.find(e=>e.path===r);if(n&&`content`in n)try{let e=M_(n.content).plugins,i=M_(await t?.(r)).plugins,a=Object.entries(e).filter(([e,t])=>JSON.stringify(i[e])!==JSON.stringify(t)).map(([e,t])=>({name:e,...t})),o=Object.keys(i).filter(t=>!e[t]);return a.length+o.length>0?{kind:`plugins`,installed:a,removed:o}:void 0}catch{return}}async function K_(e,t,n){let r=v_(e,t);if(r.refused.length>0)return{action:`refuse`,paths:r.refused,reason:`workflow`};let i=new Map;for(let{path:e,kind:t}of r.confirm)i.set(t,[...i.get(t)??[],e]);let a=await G_(e,n),o=[...a?[a]:[],...[...i].map(([e,t])=>({kind:e,paths:t}))];return o.length>0?{action:`ask`,questions:o}:{action:`allow`}}async function q_(e,t){if(!e)return;let n=Bg(await n_(e),e.user.login);if(!n)return;let r=t_(await r_(e,t),n,t);return r.length>0?{action:`refuse`,paths:r.map(e=>e.path),reason:`limits`}:void 0}function J_(e){let t=e?.read;return typeof t==`function`?n=>t.call(e,n):void 0}function Y_(e){if(typeof e==`string`)return e;let{login:t,email:n}=e??{};return typeof t==`string`?t:typeof n==`string`?n:``}function X_(e){return typeof e==`string`?e:``}async function Z_(e,t,n){let{path:r,args:i,target:a}=e;if(V_.has(r)){let e=i[0]??[];if(r===`write`){let t=await q_(n,e);if(t)return t}return K_(e,t,J_(a))}if(r===`draft.publish`){let e=await a.changes();return await q_(n,e)??K_(e,t)}if(r===`updates.start`)return{action:`ask`,questions:[{kind:`update`,release:String(i[0])}]};if(r===`editors.invite`||r===`editors.setRole`)return{action:`ask`,questions:[{kind:`editors`,who:Y_(i[0]),role:String(i[1])}]};if(r===`editors.letEditorsPublish`)return{action:`ask`,questions:[{kind:`editors`,who:``}]};if(r===`editors.remove`)return{action:`ask`,questions:[{kind:`editors-remove`,who:Y_(i[0])}]};let o=W_[r];if(o)return{action:`ask`,questions:[{kind:`domain`,change:o,domain:X_(i[0])}]};if(r===`tasks.run`){let e=i[0]??{};return{action:`ask`,questions:[{kind:`task`,plugin:X_(e.plugin),task:X_(e.task)}]}}if(r===`updates.setup`||r===`updates.enable`)return{action:`ask`,questions:[{kind:`updates-setup`}]};if(r===`draft.discard`){let e=a?.name;return{action:`ask`,questions:[{kind:`discard-draft`,name:X_(e)}]}}return r===`comments.create`?{action:`ask`,questions:[{kind:`comments-create`,name:X_(i[0])}]}:r===`comments.remove`?{action:`ask`,questions:[{kind:`comments-delete`}]}:U_.has(r)?{action:`allow`}:{action:`refuse`,paths:[r],reason:`unknown`}}var Q_={title:`Sign in`,loading:`Loading…`,framed:`This page can't be shown inside another page. Open it on its own.`,noConfig:`This sign-in page isn't set up yet: it needs a broker.json beside it, naming the site it signs in to. See the token broker page in Goodfellow's documentation.`,signInTitle:`Sign in to edit {site}`,signInIntro:`This page keeps your sign-in and AI keys where the site's pages can't reach them, and shows the admin panel from here.`,signInRedirect:`Sign in with {host}`,signInToken:`Or sign in with an access token`,tokenLabel:`Access token`,remember:`Stay signed in on this device`,signInButton:`Sign in`,signingIn:`Signing in…`,signInError:`That didn't work: {message}`,noSiteAddress:`The site has no address yet, so there's no admin panel to show. Set its address in Site Settings first, or ask its owner to.`,badSiteAddress:`The site's address, {address}, isn't one this page can show the admin panel from.`,sameOrigin:`The admin panel is at this page's own address, {address}, where it could read your sign-in. Give the sign-in page an address of its own.`,signedInAs:`Signed in as {name}`,showing:`Showing {address}`,aiKeys:`AI keys`,signOut:`Sign out`,adminFrame:`Admin panel`,confirmTitle:`Publish this?`,confirmIntro:`The admin panel asked to publish changes that need you to say so here, where nothing it runs can say so for you:`,confirmCode:`The site's code, which runs when the site is built:`,confirmCustomCode:`Code that runs on the site's pages:`,confirmSiteAddress:`A new Site address, which is where this page shows the admin panel from. Only publish it if you changed it yourself:`,confirmUpdate:`Installing Goodfellow {release}, which changes the site's packages.`,confirmPlugin:`Installing the plugin {title} ({name} {release}), whose code is included when the site is built and runs on its pages. It asks to:`,confirmPluginRemove:`Removing the plugin {name}.`,pluginConnect:`Reach these addresses from the admin panel: {list}`,pluginFiles:`Read and publish these files: {list}`,pluginSecrets:`Get these secrets when the site is built: {list}`,pluginRead:`Read these parts of the site when it's built: {list}`,pluginWrite:`Write these parts of the built site: {list}`,pluginBlocks:`Add these blocks: {list}`,pluginAdmin:`Run in the admin panel, in a frame of its own`,pluginBuild:`Run steps when the site is built`,pluginServer:`Answer requests on the site's server, with everything the server can do`,pluginEditor:`Offer its own page editor, {title}, which is given what's edited in it`,pluginNothing:`Nothing more`,confirmEditors:`Giving {who} access to edit the site{role}.`,confirmEditorsPublish:`Letting the site's editors publish to it.`,confirmAskTitle:`Allow this?`,confirmAskIntro:`The admin panel asked to do something that needs you to say so here, where nothing it runs can say so for you:`,confirmEditorsRemove:`Taking away {who}'s access to the site.`,confirmDomainConnect:`Connecting the domain {domain} to the site.`,confirmDomainSecure:`Turning on HTTPS for {domain}, and serving the site from it.`,confirmDomainDisconnect:`Removing the domain {domain} from the site.`,confirmTask:`Running the plugin {plugin}'s task {task} with the secrets it was given. Allowing it lets it run again while this page is open.`,confirmUpdatesSetup:`Changing the site's settings on its host so it can install updates by itself.`,confirmDiscardDraft:`Throwing away the draft {name}, which can't be undone.`,confirmCommentsCreate:`Making a public repository, {name}, for visitors' comments, beside the site's.`,confirmCommentsDelete:`Deleting a visitor's comment, which can't be undone.`,confirmPublish:`Publish`,confirmAllow:`Allow`,cancel:`Cancel`,refusedLimits:`An owner has limited what you can change on this site, and this publish changes things outside it: {paths}. Submit it for review instead.`,refusedWorkflow:`The token broker never changes the site's workflows, which run with its secrets: {paths}.`,refusedUnknown:`The token broker doesn't make this call for the admin panel: {paths}.`,declined:`You chose not to do this.`,ownerTitle:`Owner token`,ownerIntro:`Create a token that can manage the site, then paste it here. This page keeps it for as long as it's open, and the admin panel never sees it.`,ownerCreate:`Create a token`,ownerLabel:`Owner token`,ownerUse:`Use this token`,commentsTitle:`GitHub token for comments`,commentsLabel:`GitHub token`,commentsIntro:`Create a GitHub token that can manage the comments' repository, then paste it here. This page keeps it for as long as it's open, and the admin panel never sees it.`,aiTitle:`AI keys`,aiIntro:`The AI assistant asks these services through this page, with your keys, so the admin panel never sees them. Leave a service empty to not use it.`,aiRemember:`Remember these keys on this device`,aiSave:`Save`};function Q(e,t={}){return Q_[e].replace(/\{(\w+)\}/g,(e,n)=>t[n]??e)}var $_=`goodfellow:broker:route`,ev=`goodfellow:broker:ai`,tv=`goodfellow.config.tsx`,nv=Object.keys(N_).filter(e=>e!==`custom`&&e!==`manual`&&(e===`anthropic`||N_[e].baseUrl));function $(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);return r.append(...n),r}function rv(e){return JSON.stringify([e.plugin,e.task])}function iv(e){return e instanceof Error?e.message:String(e)}function av(e){let{repo:t,project:n}=e.options;return typeof t==`string`?t:typeof n==`string`?n:e.package}function ov(){for(let e of[sessionStorage,localStorage])try{let t=e.getItem(ev);if(t)return JSON.parse(t)}catch{}return{}}function sv(e,t){cv(),(t?localStorage:sessionStorage).setItem(ev,JSON.stringify(e))}function cv(){sessionStorage.removeItem(ev),localStorage.removeItem(ev)}async function lv(e){let t=await e.revision(),n=JSON.parse(await e.read(`content/site.json`)??`{}`);if(typeof n.url!=`string`||!n.url)return{problem:`noSiteAddress`};let r;try{r=new URL(n.url.replace(/\/?$/,`/`))}catch{return{problem:`badSiteAddress`}}let i=r.hostname===`localhost`||r.hostname===`127.0.0.1`;if(r.protocol!==`https:`&&!(r.protocol===`http:`&&i))return{problem:`badSiteAddress`};let a=await e.readAt(tv,t).catch(()=>void 0),o=a?m(a):void 0;return{url:`${(o?.checked?f(o):void 0)??r.origin}${r.pathname}admin/`,siteUrl:n.url}}async function uv({root:e,config:t,hosts:n}){document.title=Q(`title`);let r=(...t)=>e.replaceChildren(...t);if(window.top!==window){r($(`p`,{class:`broker-note`},Q(`framed`)));return}let i=new URLSearchParams(location.search).get(`site`),a=t?.sites.find(e=>!i||av(e)===i)??t?.sites[0],o=a&&Object.hasOwn(n,a.package)?n[a.package]:void 0,s=o&&(await o())[a?.export??``];if(!a||typeof s!=`function`){r($(`p`,{class:`broker-note`},Q(`noConfig`)));return}let c=s(a.options),l=()=>{location.hash&&sessionStorage.setItem($_,location.hash)};l(),window.addEventListener(`hashchange`,l),r($(`p`,{class:`broker-note`},Q(`loading`)));let u=null,d;try{u=await c.restore()}catch(e){d=e}u?await p(u):f(d);function f(e){let t=$(`form`,{class:`broker-sign-in`}),n=$(`input`,{type:`checkbox`,id:`broker-remember`}),i=$(`input`,{type:`password`,id:`broker-token`,autocomplete:`off`}),o=$(`p`,{class:`broker-error`,role:`alert`});e!==void 0&&(o.textContent=Q(`signInError`,{message:iv(e)}));let s=$(`button`,{type:`submit`},Q(`signInButton`)),l=async e=>{s.disabled=!0,o.textContent=Q(`signingIn`);try{await p(await e())}catch(e){o.textContent=Q(`signInError`,{message:iv(e)}),s.disabled=!1}};if(t.append($(`h1`,{},Q(`signInTitle`,{site:av(a)})),$(`p`,{},Q(`signInIntro`)),o),c.canRedirect){let e=$(`button`,{type:`button`,class:`broker-primary`},Q(`signInRedirect`,{host:c.name}));e.addEventListener(`click`,()=>void c.startRedirect(n.checked).catch(e=>{o.textContent=Q(`signInError`,{message:iv(e)})})),t.append($(`div`,{},e))}if(c.tokenLinks){let e=$(`ul`,{});for(let t of c.tokenLinks)e.append($(`li`,{},$(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`},t.url)));t.append($(`h2`,{},Q(`signInToken`)),e,$(`label`,{for:`broker-token`},Q(`tokenLabel`)),i,$(`label`,{class:`broker-check`},n,` ${Q(`remember`)}`),$(`div`,{},s))}t.addEventListener(`submit`,e=>{e.preventDefault(),i.value.trim()&&l(()=>c.signInWithToken(i.value.trim(),n.checked))}),r(t)}async function p(e){let t=await lv(e).catch(e=>({problem:`signInError`,error:e}));if(`problem`in t){r($(`p`,{class:`broker-note`,role:`alert`},Q(t.problem,{address:``,message:`error`in t?iv(t.error):``})));return}let n=new URL(t.url).origin;if(n===location.origin){r($(`p`,{class:`broker-note`,role:`alert`},Q(`sameOrigin`,{address:n})));return}let i=sessionStorage.getItem($_)??``,a=$(`iframe`,{class:`broker-frame`,title:Q(`adminFrame`),src:`${t.url}${i.startsWith(`#`)?i:``}`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads allow-modals`,allow:`clipboard-write`}),o=()=>{window.removeEventListener(`message`,p),u?.(),e.signOut(),cv(),sessionStorage.removeItem($_),f()},s=$(`button`,{type:`button`},Q(`aiKeys`));s.addEventListener(`click`,()=>b(()=>a.contentWindow?.location.replace(a.src)));let l=$(`button`,{type:`button`},Q(`signOut`));l.addEventListener(`click`,o),r($(`header`,{class:`broker-bar`},$(`span`,{},Q(`signedInAs`,{name:e.user.name||e.user.login})),$(`span`,{class:`broker-origin`},Q(`showing`,{address:n})),s,l),a);let u,d=new Set,p=r=>{if(r.source!==a.contentWindow||r.origin!==n||r.data?.type!==`goodfellow:broker-ready`)return;u?.();let i=new MessageChannel,s=new MessageChannel;u=E_(i.port1,e,{async check(n){let r=await Z_(n,t.siteUrl,e);if(r.action===`refuse`){let e=r.paths.join(`, `);throw r.reason===`limits`?new y_(`limits`,Q(`refusedLimits`,{paths:e})):r.reason===`unknown`?new y_(`not-here`,Q(`refusedUnknown`,{paths:e})):new y_(`workflow`,Q(`refusedWorkflow`,{paths:e}))}if(r.action!==`ask`)return;let i=r.questions.filter(e=>e.kind!==`task`||!d.has(rv(e)));if(i.length!==0){if(!await _(i))throw new y_(`declined`,Q(`declined`));for(let e of i)e.kind===`task`&&d.add(rv(e))}},extra:{signOut:o,"ownerAccess.requestToken":()=>v(e),"comments.access.requestToken":()=>y(e)}}),s.port1.onmessage=e=>void m(s.port1,e.data);let l={hostName:c.name,redirectAddressesListed:c.canRedirect&&c.redirectAddressesListed===!0,aiServices:Object.keys(ov())};a.contentWindow?.postMessage({type:g_,account:l},n,[i.port2,s.port2])};window.addEventListener(`message`,p)}async function m(e,t){if(t?.type===`route`&&typeof t.hash==`string`){sessionStorage.setItem($_,t.hash);return}if(t?.type!==`ai`)return;let[n=``,...r]=t.path.split(`?`)[0]?.split(`/`)??[],i=t.path.includes(`?`)?t.path.slice(t.path.indexOf(`?`)):``,a=new Request(`https://broker.invalid/${r.join(`/`)}${i}`,{method:t.method,headers:t.headers,...t.body&&t.method!==`GET`&&{body:t.body}}),o=await B_(ov()).forward(a,n,r.join(`/`)),s=await o.arrayBuffer(),c={type:`ai`,id:t.id,status:o.status,headers:[...o.headers.entries()],body:s};e.postMessage(c,[s])}function h(e,t,n){return new Promise(r=>{let i=$(`dialog`,{class:`broker-dialog`},$(`h2`,{},e),...t),a=$(`div`,{class:`broker-actions`});for(let e of n){let t=$(`button`,{type:`button`,...e.primary&&{class:`broker-primary`}},e.label);t.addEventListener(`click`,()=>i.close(e.value?`yes`:`no`)),a.append(t)}i.append(a),i.addEventListener(`close`,()=>{i.remove(),r(i.returnValue===`yes`)}),document.body.append(i),i.showModal()})}function g(e){let{permissions:t}=e,n=(e,t)=>e?.length?[Q(t,{list:e.join(`, `)})]:[],r=[...n(t.connect,`pluginConnect`),...n(t.files,`pluginFiles`),...n(t.secrets,`pluginSecrets`),...n(t.read,`pluginRead`),...n(t.write,`pluginWrite`),...n(e.blocks,`pluginBlocks`),...e.admin?[Q(`pluginAdmin`)]:[],...e.build?.length?[Q(`pluginBuild`)]:[],...e.server?[Q(`pluginServer`)]:[],...e.editor?[Q(`pluginEditor`,{title:e.editor.title})]:[]];return r.length>0?r:[Q(`pluginNothing`)]}function _(e){let t=[$(`p`,{},Q(`confirmIntro`))],n=!1;for(let r of e)if(r.kind===`update`)t.push($(`p`,{},Q(`confirmUpdate`,{release:r.release})));else if(r.kind===`plugins`){n=!0;for(let e of r.installed){let{manifest:n}=e;t.push($(`p`,{},Q(`confirmPlugin`,{title:n.title,name:e.name,release:e.release})),$(`ul`,{},...g(n).map(e=>$(`li`,{},e))))}for(let e of r.removed)t.push($(`p`,{},Q(`confirmPluginRemove`,{name:e})))}else if(r.kind===`editors`)t.push($(`p`,{},r.who?Q(`confirmEditors`,{who:r.who,role:r.role?` (${r.role})`:``}):Q(`confirmEditorsPublish`)));else if(r.kind===`editors-remove`)t.push($(`p`,{},Q(`confirmEditorsRemove`,{who:r.who})));else if(r.kind===`domain`){let e=r.change===`connect`?`confirmDomainConnect`:r.change===`secure`?`confirmDomainSecure`:`confirmDomainDisconnect`;t.push($(`p`,{},Q(e,{domain:r.domain})))}else if(r.kind===`task`)t.push($(`p`,{},Q(`confirmTask`,{plugin:r.plugin,task:r.task})));else if(r.kind===`updates-setup`)t.push($(`p`,{},Q(`confirmUpdatesSetup`)));else if(r.kind===`discard-draft`)t.push($(`p`,{},Q(`confirmDiscardDraft`,{name:r.name})));else if(r.kind===`comments-create`)t.push($(`p`,{},Q(`confirmCommentsCreate`,{name:r.name})));else if(r.kind===`comments-delete`)t.push($(`p`,{},Q(`confirmCommentsDelete`)));else{n=!0;let e=r.kind===`code`?`confirmCode`:r.kind===`custom-code`?`confirmCustomCode`:`confirmSiteAddress`;t.push($(`p`,{},Q(e)),$(`ul`,{},...r.paths.map(e=>$(`li`,{},$(`code`,{},e)))))}return n||(t[0]=$(`p`,{},Q(`confirmAskIntro`))),h(Q(n?`confirmTitle`:`confirmAskTitle`),t,[{label:Q(`cancel`),value:!1},{label:Q(n?`confirmPublish`:`confirmAllow`),value:!0,primary:!0}])}function v(e){let t=e.ownerAccess;if(!t)throw new y_(`not-here`,`This site's host has no owner token.`);return ee(t,Q(`ownerTitle`),Q(`ownerIntro`),Q(`ownerLabel`))}function y(e){let t=e.comments?.access;if(!t)throw new y_(`not-here`,`This site's host has no comments.`);return ee(t,Q(`commentsTitle`),Q(`commentsIntro`),Q(`commentsLabel`))}async function ee(e,t,n,r){let i=$(`input`,{type:`password`,id:`broker-owner-token`,autocomplete:`off`}),a=$(`p`,{class:`broker-error`,role:`alert`});for(;;){if(!await h(t,[$(`p`,{},n),$(`p`,{},$(`a`,{href:e.tokenLink.url,target:`_blank`,rel:`noreferrer`},Q(`ownerCreate`))),$(`label`,{for:`broker-owner-token`},r),i,a],[{label:Q(`cancel`),value:!1},{label:Q(`ownerUse`),value:!0,primary:!0}]))throw new y_(`declined`,Q(`declined`));try{await e.applyToken(i.value.trim());return}catch(e){a.textContent=Q(`signInError`,{message:iv(e)})}}}async function b(e){let t=ov(),n=new Map,r=nv.map(e=>{let r=$(`input`,{type:`password`,id:`broker-ai-${e}`,autocomplete:`off`}),i=t[e];return typeof i==`string`&&(r.value=i),n.set(e,r),$(`div`,{},$(`label`,{for:`broker-ai-${e}`},N_[e].name),r)}),i=$(`input`,{type:`checkbox`,id:`broker-ai-remember`});if(i.checked=localStorage.getItem(ev)!==null,!await h(Q(`aiTitle`),[$(`p`,{},Q(`aiIntro`)),...r,$(`label`,{class:`broker-check`},i,` ${Q(`aiRemember`)}`)],[{label:Q(`cancel`),value:!1},{label:Q(`aiSave`),value:!0,primary:!0}]))return;let a={};for(let[e,t]of n)t.value.trim()&&(a[e]=t.value.trim());sv(a,i.checked),e()}}await uv({root:document.getElementById(`broker`),config:await fetch(`./broker.json`,{cache:`no-store`}).then(e=>e.ok?e.json():void 0).catch(()=>void 0),hosts:{"@goodfellow-cms/bitbucket":()=>d(()=>import(`./dist-C2zb_90U.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"@goodfellow-cms/github":()=>d(()=>import(`./dist-DJGm2ktT.js`),__vite__mapDeps([5,1,6,2,7,3]),import.meta.url),"@goodfellow-cms/gitlab":()=>d(()=>import(`./dist-86wrqcsN.js`),__vite__mapDeps([8,1,2,7,3,4]),import.meta.url)}});