@micacms/editor-ui 0.6.0-rc.2 → 0.7.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.
- package/dist/THIRD_PARTY_NOTICES.txt +39 -39
- package/dist/assets/ChangeComparison.vue_vue_type_script_setup_true_lang-CN7QLLgS.js +2 -0
- package/dist/assets/ChangeComparison.vue_vue_type_script_setup_true_lang-CN7QLLgS.js.map +1 -0
- package/dist/assets/ChangesView-Dp79M2fs.js +7 -0
- package/dist/assets/ChangesView-Dp79M2fs.js.map +1 -0
- package/dist/assets/CollectionView-D9VSxjMl.js +2 -0
- package/dist/assets/CollectionView-D9VSxjMl.js.map +1 -0
- package/dist/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-CWanooQO.js +2 -0
- package/dist/assets/{ConfirmDialog.vue_vue_type_script_setup_true_lang-DaYRluZs.js.map → ConfirmDialog.vue_vue_type_script_setup_true_lang-CWanooQO.js.map} +1 -1
- package/dist/assets/DashboardView-BPyKR5J3.js +2 -0
- package/dist/assets/DashboardView-BPyKR5J3.js.map +1 -0
- package/dist/assets/DeveloperDetails.vue_vue_type_script_setup_true_lang-Bp-D1Kf1.js +2 -0
- package/dist/assets/DeveloperDetails.vue_vue_type_script_setup_true_lang-Bp-D1Kf1.js.map +1 -0
- package/dist/assets/EntryView-qKGxmd49.js +2 -0
- package/dist/assets/EntryView-qKGxmd49.js.map +1 -0
- package/dist/assets/{LoginView-BMcE8J5l.js → LoginView-C4FlLD5n.js} +2 -2
- package/dist/assets/{LoginView-BMcE8J5l.js.map → LoginView-C4FlLD5n.js.map} +1 -1
- package/dist/assets/MediaView-C0FP8j4J.js +2 -0
- package/dist/assets/MediaView-C0FP8j4J.js.map +1 -0
- package/dist/assets/NotFoundView-BXXcZp2U.js +2 -0
- package/dist/assets/{NotFoundView-BT-zH9Ky.js.map → NotFoundView-BXXcZp2U.js.map} +1 -1
- package/dist/assets/ObjectField-BFAmw-Bf.js +2 -0
- package/dist/assets/{ObjectField-BHoHeIbi.js.map → ObjectField-BFAmw-Bf.js.map} +1 -1
- package/dist/assets/PageHeader.vue_vue_type_script_setup_true_lang-YO9Lox87.js +7 -0
- package/dist/assets/PageHeader.vue_vue_type_script_setup_true_lang-YO9Lox87.js.map +1 -0
- package/dist/assets/ReadOnlyNotice.vue_vue_type_script_setup_true_lang-83XB7mFB.js +7 -0
- package/dist/assets/ReadOnlyNotice.vue_vue_type_script_setup_true_lang-83XB7mFB.js.map +1 -0
- package/dist/assets/RepeaterField-BA5zPM54.js +12 -0
- package/dist/assets/RepeaterField-BA5zPM54.js.map +1 -0
- package/dist/assets/SingletonView-rtsXuJ8F.js +2 -0
- package/dist/assets/SingletonView-rtsXuJ8F.js.map +1 -0
- package/dist/assets/{SystemView-AMhNiUgh.css → SystemView-BBJFvsrr.css} +1 -1
- package/dist/assets/SystemView-CBTTQvCI.js +3 -0
- package/dist/assets/SystemView-CBTTQvCI.js.map +1 -0
- package/dist/assets/arrow-right-CVMfMI8t.js +7 -0
- package/dist/assets/arrow-right-CVMfMI8t.js.map +1 -0
- package/dist/assets/arrow-up-D5CzEqmi.js +12 -0
- package/dist/assets/arrow-up-D5CzEqmi.js.map +1 -0
- package/dist/assets/chevron-down-Cn8dXqbz.js +7 -0
- package/dist/assets/chevron-down-Cn8dXqbz.js.map +1 -0
- package/dist/assets/format-CAimH9FV.js +2 -0
- package/dist/assets/format-CAimH9FV.js.map +1 -0
- package/dist/assets/index-C-WfCDd6.js +118 -0
- package/dist/assets/index-C-WfCDd6.js.map +1 -0
- package/dist/assets/index-CBGzi5Bh.css +1 -0
- package/dist/assets/useUnsavedChanges-CErjJu5S.js +201 -0
- package/dist/assets/useUnsavedChanges-CErjJu5S.js.map +1 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/dist/assets/ChangesView-B37VddpZ.js +0 -7
- package/dist/assets/ChangesView-B37VddpZ.js.map +0 -1
- package/dist/assets/CollectionView-DMmV03BG.js +0 -2
- package/dist/assets/CollectionView-DMmV03BG.js.map +0 -1
- package/dist/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-DaYRluZs.js +0 -2
- package/dist/assets/DashboardView-CslqN0A1.js +0 -2
- package/dist/assets/DashboardView-CslqN0A1.js.map +0 -1
- package/dist/assets/EntryView-CpappvZe.js +0 -2
- package/dist/assets/EntryView-CpappvZe.js.map +0 -1
- package/dist/assets/MediaView-CN7asOkJ.js +0 -2
- package/dist/assets/MediaView-CN7asOkJ.js.map +0 -1
- package/dist/assets/NotFoundView-BT-zH9Ky.js +0 -2
- package/dist/assets/ObjectField-BHoHeIbi.js +0 -2
- package/dist/assets/PageHeader.vue_vue_type_script_setup_true_lang-C3ip7WDx.js +0 -7
- package/dist/assets/PageHeader.vue_vue_type_script_setup_true_lang-C3ip7WDx.js.map +0 -1
- package/dist/assets/ReadOnlyNotice.vue_vue_type_script_setup_true_lang-B276O7Z8.js +0 -7
- package/dist/assets/ReadOnlyNotice.vue_vue_type_script_setup_true_lang-B276O7Z8.js.map +0 -1
- package/dist/assets/RepeaterField-CgFHog9l.js +0 -12
- package/dist/assets/RepeaterField-CgFHog9l.js.map +0 -1
- package/dist/assets/SingletonView-BHtlstaz.js +0 -2
- package/dist/assets/SingletonView-BHtlstaz.js.map +0 -1
- package/dist/assets/SystemView-S-i2v0ly.js +0 -3
- package/dist/assets/SystemView-S-i2v0ly.js.map +0 -1
- package/dist/assets/arrow-right-DMhFU3-4.js +0 -7
- package/dist/assets/arrow-right-DMhFU3-4.js.map +0 -1
- package/dist/assets/arrow-up-DeNDcETx.js +0 -12
- package/dist/assets/arrow-up-DeNDcETx.js.map +0 -1
- package/dist/assets/chevron-down-D4nmRhPt.js +0 -7
- package/dist/assets/chevron-down-D4nmRhPt.js.map +0 -1
- package/dist/assets/format-CW--BYT5.js +0 -2
- package/dist/assets/format-CW--BYT5.js.map +0 -1
- package/dist/assets/index-BBFDilFH.js +0 -118
- package/dist/assets/index-BBFDilFH.js.map +0 -1
- package/dist/assets/index-BSYHt4Oa.css +0 -1
- package/dist/assets/useField-DcIPoU4r.js +0 -2
- package/dist/assets/useField-DcIPoU4r.js.map +0 -1
- package/dist/assets/useUnsavedChanges-C4vyxObi.js +0 -145
- package/dist/assets/useUnsavedChanges-C4vyxObi.js.map +0 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ObjectField-BFAmw-Bf.js","assets/index-C-WfCDd6.js","assets/index-CBGzi5Bh.css","assets/ChangeComparison.vue_vue_type_script_setup_true_lang-CN7QLLgS.js","assets/chevron-down-Cn8dXqbz.js","assets/format-CAimH9FV.js","assets/arrow-right-CVMfMI8t.js","assets/ReadOnlyNotice.vue_vue_type_script_setup_true_lang-83XB7mFB.js","assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-CWanooQO.js","assets/RepeaterField-BA5zPM54.js","assets/arrow-up-D5CzEqmi.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{H as Zg,d as De,g as z,c as V,a as q,k as I,t as G,b as pe,f as te,e as Sn,I as Wg,E as Ee,s as kt,w as yt,F as We,j as mt,J as Jg,q as yn,r as Me,D as nd,K as Qs,T as Kg,v as Gg,x as Yg,i as wt,X as rd,B as Si,n as kn,A as al,p as id,L as Xg,o as na,y as Qg,M as e0,N as t0,O as n0,P as r0,Q as i0,R as s0,S as Du,U as Ou,V as o0,W as l0,m as a0,l as u0,Y as c0,Z as sd,$ as f0,u as od,a0 as d0,a1 as h0}from"./index-C-WfCDd6.js";import{u as Dt,w as Tu,h as p0,_ as m0}from"./ChangeComparison.vue_vue_type_script_setup_true_lang-CN7QLLgS.js";import{c as g0,l as b0,r as ld}from"./format-CAimH9FV.js";import{A as y0}from"./arrow-right-CVMfMI8t.js";import{P as k0}from"./ReadOnlyNotice.vue_vue_type_script_setup_true_lang-83XB7mFB.js";import{_ as v0}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CWanooQO.js";/**
|
|
3
|
+
* @license @lucide/vue v1.55.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const x0={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]},A0=Zg(x0);function C0(t){return new RegExp(`^(?:${t})$`,"u")}function ul(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function Mu(t,e="|"){return t.map(n=>hd(n)).join(e)}function cl(t,e){return typeof e=="bigint"?e.toString():e}class _0{constructor(e){this._getter=e,this._value=void 0}get value(){const e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}}function ra(t){return new _0(t)}function w0(t){return t==null}function ia(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function S0(t,e){const n=t/e,r=Math.round(n),i=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function rr(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ad(t){const e=Object.getOwnPropertyDescriptor(t,"shape");return e!=null&&e.get?e.get.raw:e==null?void 0:e.value}function on(t){return ad(t._zod.def)??t._zod.def.shape}function ud(t,e,n){Object.defineProperty(t,e,{get(){const r=n();return rr(this,e,r),r},enumerable:!0,configurable:!0})}function cd(t,e,n){e in t?rr(t,e,n):t[e]=n}function Yn(t,e,n,r){const i=on(e);for(const s of n){const o=Object.getOwnPropertyDescriptor(i,s);o.enumerable&&(o.get?ud(t,s,()=>{const l=e._zod.def.shape[s];return r?r(l,s):l}):cd(t,s,r?r(o.value,s):o.value))}}function E0(t,e){for(const n of Reflect.ownKeys(e)){const r=Object.getOwnPropertyDescriptor(e,n);r.enumerable&&(r.get?ud(t,n,()=>e[n]):cd(t,n,r.value))}}function ht(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function D0(t){return JSON.stringify(t)}function O0(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const fd="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ns(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const T0=ra(()=>{var t;if(Vt.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ti(t){if(ns(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(ns(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function dd(t){return ti(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const M0=new Set(["string","number","symbol"]);function eo(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function On(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function Q(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function hd(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function $0(t){return Object.keys(t).filter(e=>t[e]._zod.optin!==void 0&&t[e]._zod.optout==="optional")}const pd={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},N0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function I0(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s={};return Yn(s,t,to(t,e)),On(t,ht(n,{shape:s,checks:[]}))}function to(t,e){var i;const n=on(t),r=[];for(const s of Reflect.ownKeys(e)){if(!((i=Object.getOwnPropertyDescriptor(n,s))!=null&&i.enumerable))throw new Error(`Unrecognized key: "${String(s)}"`);e[s]&&r.push(s)}return r}function F0(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=new Set(to(t,e)),o={};return Yn(o,t,Reflect.ownKeys(on(t)).filter(l=>!s.has(l))),On(t,ht(n,{shape:o,checks:[]}))}function R0(t,e){if(!ti(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const i=on(t);for(const s of Reflect.ownKeys(e))if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return On(t,ht(t._zod.def,{shape:md(t,e)}))}function md(t,e){const n={};return Yn(n,t,Reflect.ownKeys(on(t))),E0(n,e),n}function P0(t,e){if(!ti(e))throw new Error("Invalid input to safeExtend: expected a plain object");return On(t,ht(t._zod.def,{shape:md(t,e)}))}function B0(t,e){var i,s;if(!((i=e==null?void 0:e._zod)!=null&&i.def))throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if((s=t._zod.def.checks)!=null&&s.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};Yn(n,t,Reflect.ownKeys(on(t))),Yn(n,e,Reflect.ownKeys(on(e)));const r=ht(t._zod.def,{shape:n,get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return On(t,r)}function $u(t,e,n,r="partial"){const s=e._zod.def.checks;if(s&&s.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);const l=n?new Set(to(e,n)):void 0,a={};return Yn(a,e,Reflect.ownKeys(on(e)),t&&((u,c)=>l&&!l.has(c)?u:new t({type:"optional",innerType:u}))),On(e,ht(e._zod.def,{shape:a,checks:[]}))}function z0(t,e,n){const r=n?new Set(to(e,n)):void 0,i={};return Yn(i,e,Reflect.ownKeys(on(e)),(s,o)=>r&&!r.has(o)?s:new t({type:"nonoptional",innerType:s})),On(e,ht(e._zod.def,{shape:i}))}function en(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function L0(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function gd(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Or(t){return typeof t=="string"?t:t==null?void 0:t.message}function Nu(t){const e=[];for(const n of t??[]){const r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;const i=r.maximum??r.length??r.size;i>=0&&e.push([i,n])}return e}function fl(t,e,n){var r;for(let i=e;i<t.length;i++)(r=t[i]).schema??(r.schema=n)}function wr(t,e,n){var a,u,c,f,d,h,p,m,g,b;var r;const i=(u=(a=t.inst)==null?void 0:a._zod)==null?void 0:u.traits;i!=null&&i.has("$ZodType")&&(i.has("$ZodCheck")?(r=t).schema??(r.schema=t.inst):t.schema=t.inst);const s=t.schema!==t.inst?(f=(c=t.schema)==null?void 0:c._zod.def)==null?void 0:f.error:void 0,o=t.message?t.message:Or((p=(h=(d=t.inst)==null?void 0:d._zod.def)==null?void 0:h.error)==null?void 0:p.call(h,t))??Or(s==null?void 0:s(t))??Or((m=e==null?void 0:e.error)==null?void 0:m.call(e,t))??Or((g=n.customError)==null?void 0:g.call(n,t))??Or((b=n.localeError)==null?void 0:b.call(n,t))??"Invalid input",l={};for(const _ of Object.keys(t))_==="inst"||_==="schema"||_==="continue"||_==="input"||_==="__proto__"||(l[_]=t[_]);return l.path??(l.path=[]),l.message=o,e!=null&&e.reportInput&&(l.input=t.input),l}const j0=/[\uD800-\uDBFF]/;function sa(t){const e=t.length;if(!j0.test(t))return e;let n=e;for(let r=0;r<e-1;r++)(t.charCodeAt(r)&64512)===55296&&(t.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function oa(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function q0(t){const e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";const n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function ni(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}function V0(t,e){for(const n in e){const r=Object.getOwnPropertyDescriptor(e,n);r.get?Object.defineProperty(t,n,{...r,enumerable:!1}):U0(t,n,r.value)}}function En(t,e,n,r=!0){return Object.defineProperty(t,e,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function bd(t,e,n){return En(t,e,n,!1)}function yd(t,e){for(const n in t){const r=t[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get(){return En(this,n,r(this))},set(i){En(this,n,i)}})}return e}function U0(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){return this==null?n:En(this,e,n.bind(this))},set(r){En(this,e,r)}})}function H0(t,e){const n=Object.getPrototypeOf(t);return e in n?void 0:n}let _o,cn=!1;const Z0={configurable:!0,get(){cn=!0}};function ge(t,e,n){const r=Object.getPrototypeOf(t._zod);if(e in r&&_o!==t._zod){_o=void 0;return}_o=t._zod,Object.defineProperty(r,e,{configurable:!0,get(){Object.defineProperty(this,e,Z0);const i=cn;cn=!1;try{const s=n(this);return cn?delete this[e]:Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s}),cn=cn||i,s}catch(s){throw delete this[e],cn=cn||i,s}},set(i){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:i})}})}function W0(t,e,n,r){const i=H0(t,e);i&&Object.defineProperty(i,e,{configurable:!0,get(){const s={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,e,s),s.value=n(this),Object.defineProperty(this,e,s),s.value},set(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:r,value:s})}})}const J0="~constantCatch";function K0(t){const e=()=>t;return e[J0]=!0,e}var Iu;const wo={value:void 0,enumerable:!1};let Fu="captureStackTrace"in Error?Error:null;function G0(t){const e=Fu;if(e){const n=e.stackTraceLimit;if(typeof n=="number"){try{e.stackTraceLimit=0}catch{return Fu=null,new t}try{return new t}finally{e.stackTraceLimit=n}}}return new t}function F(t,e,n,r){const i={};function s(d){this.def=d,this.constr=f,this.traits=new Set}s.prototype=i;const o=n,l=o&&new WeakSet;function a(d,h){if(d._zod){if(d._zod.traits.has(t))return}else{wo.value=new s(h);try{Object.defineProperty(d,"_zod",wo)}finally{wo.value=void 0}}if(d._zod.traits.add(t),e(d,h),l){const m=Object.getPrototypeOf(d),g=d._zod.constr.prototype;let b=m;for(;b&&b!==g;)b=Object.getPrototypeOf(b);const _=b??m;l.has(_)||(l.add(_),V0(_,o))}const p=f.prototype;for(const m in p)Object.prototype.hasOwnProperty.call(p,m)&&(m in d||(d[m]=p[m].bind(d)))}const u=(r==null?void 0:r.Parent)??Object;class c extends u{}Object.defineProperty(c,"name",{value:t});function f(d){var g;const h=r!=null&&r.Parent?G0(c):this;a(h,d);const p=h._zod.deferred;if(p){for(const b of p)b();h._zod.deferred=void 0}const m=(g=globalThis.__zod_globalConfig)==null?void 0:g.postProcessor;return m&&m(h),h}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:d=>{var h,p;return r!=null&&r.Parent&&d instanceof r.Parent?!0:(p=(h=d==null?void 0:d._zod)==null?void 0:h.traits)==null?void 0:p.has(t)}}),Object.defineProperty(f,"name",{value:t}),f}class Un extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class kd extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Iu=globalThis).__zod_globalConfig??(Iu.__zod_globalConfig={});const Vt=globalThis.__zod_globalConfig;function Tn(t){return t&&Object.assign(Vt,t),Vt}function Y0(){const t=this._zod;return t.message??(t.message=JSON.stringify(t.def,cl,2)),t.message}function X0(t){this._zod.message=t}const Q0={get:Y0,set:X0,enumerable:!0,configurable:!0},So={value:void 0,enumerable:!1},Ru=new WeakSet([Object.prototype,Error.prototype]),eb=(t,e)=>{t.name="$ZodError",So.value=e,Object.defineProperty(t,"issues",So),So.value=void 0,Object.defineProperty(t,"message",Q0);const n=Object.getPrototypeOf(t);Ru.has(n)||(Ru.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},tb=F("$ZodError",eb);function nb(t,e,n){return Object.prototype.hasOwnProperty.call(t,e)||(e==="__proto__"?Object.defineProperty(t,e,{value:n(),writable:!0,enumerable:!0,configurable:!0}):t[e]=n()),t[e]}function rb(t,e=n=>n.message){const n={},r=[];for(const i of t.issues)i.path.length>0?nb(n,i.path[0],()=>[]).push(e(i)):r.push(e(i));return{formErrors:r,fieldErrors:n}}function ib(t,e=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(l=>r({issues:l},[...s,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...s,...o.path]);else{const l=[...s,...o.path];if(l.length===0)n._errors.push(e(o));else{let a=n,u=0;for(;u<l.length;){const c=l[u],f=u===l.length-1;if(c==="_errors"){f&&a._errors.push(e(o)),u++;continue}Object.prototype.hasOwnProperty.call(a,c)||Object.defineProperty(a,c,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const d=a[c];f&&d._errors.push(e(o)),a=d,u++}}}};return r(t),n}function no(t,e){return{callee:(e==null?void 0:e.callee)??t,Err:e==null?void 0:e.Err}}const la=t=>{const e=(n,r,i,s)=>{const o=i?{...i,async:!1}:{async:!1},l=n._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new Un;if(l.issues.length){const a=new((s==null?void 0:s.Err)??t)(l.issues.map(u=>wr(u,o,Tn())));throw fd(a,(s==null?void 0:s.callee)??e),a}return l.value};return e},aa=t=>{const e=async(n,r,i,s)=>{const o=i?{...i,async:!0}:{async:!0};let l=n._zod.run({value:r,issues:[]},o);if(l instanceof Promise&&(l=await l),l.issues.length){const a=new((s==null?void 0:s.Err)??t)(l.issues.map(u=>wr(u,o,Tn())));throw fd(a,(s==null?void 0:s.callee)??e),a}return l.value};return e},ua=t=>(e,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Un;return s.issues.length?vd(t,s.issues,i):{success:!0,data:s.value}};function vd(t,e,n){let r;return{success:!1,get error(){return r||(r=new t(e.map(i=>wr(i,n,Tn()))),e=void 0,n=void 0),r},set error(i){r=i,e=void 0,n=void 0}}}const ca=t=>async(e,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=e._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?vd(t,s.issues,i):{success:!0,data:s.value}},sb=Symbol.for("zod.compile.invalid"),ob=Symbol.for("zod.compile.fallback"),lb=((t,e,n)=>{const r=t._zod.bag.validator;if(r!==void 0){if(r(e)!==sb)return!0;if(r.definite===!0&&n===void 0)return!1}return ab(t,e,n)});function ab(t,e,n){const r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=t._zod.bag.fallbackRun;let s;if(i?(r[ob]=!0,s=i({value:e,issues:[]},r)):s=t._zod.run({value:e,issues:[]},r),s instanceof Promise)throw new Un;return s.issues.length===0}const ub=async(t,e,n)=>{const r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let i=t._zod.run({value:e,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},cb=t=>{const e=la(t),n=(r,i,s,o)=>{const l=s?{...s,direction:"backward"}:{direction:"backward"};return e(r,i,l,no(n,o))};return n},fb=t=>{const e=la(t),n=(r,i,s,o)=>e(r,i,s,no(n,o));return n},db=t=>{const e=aa(t),n=async(r,i,s,o)=>{const l=s?{...s,direction:"backward"}:{direction:"backward"};return await e(r,i,l,no(n,o))};return n},hb=t=>{const e=aa(t),n=async(r,i,s,o)=>await e(r,i,s,no(n,o));return n},pb=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ua(t)(e,n,i)},mb=t=>(e,n,r)=>ua(t)(e,n,r),gb=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ca(t)(e,n,i)},bb=t=>async(e,n,r)=>ca(t)(e,n,r),yb=/^[cC][0-9a-z]{6,}$/,kb=/^[0-9a-z]+$/,vb=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,xb=/^[0-9a-vA-V]{20}$/,Ab=/^[A-Za-z0-9]{27}$/,Cb=/^[a-zA-Z0-9_-]{21}$/;function _b(t){return new RegExp(`^[a-zA-Z0-9_-]{${t}}$`)}const wb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Sb=/^([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})$/,Pu=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,Eb=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Db="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ob(){return new RegExp(Db,"u")}const Tb=/^(?:(?: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])$/,Mb=/^(([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}|:))$/,$b=/^((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])$/,Nb=/^(([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])$/,Ib=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fb=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Rb=/^https?$/,Pb=/^\+[1-9]\d{6,14}$/,xd="(?:(?:\\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 Bb(t){return new RegExp(`^${t}$`)}const zb=Bb(xd);function dl(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:t.seconds?`${e}:[0-5]\\d(?:\\.\\d+)?`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Lb(t){return new RegExp(`^${dl(t)}$`)}function jb(t){const e=["Z"];t.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${dl({precision:t.precision,seconds:!0})}(?:${e.join("|")})`,r=t.local?`${n}|${dl({precision:t.precision})}`:n;return new RegExp(`^${xd}T(?:${r})$`)}const qb=/^[\s\S]{0,}$/,Vb=/^-?\d+(?:\.\d+)?$/,Ub=/^(?:true|false)$/i,Hb=/^[^A-Z]*$/,Zb=/^[^a-z]*$/,dt=F("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),fa=t=>{const e=t.value;return!w0(e)&&e.length!==void 0},rs={number:"number",bigint:"bigint",object:"date"},Ad=F("$ZodCheckLessThan",(t,e)=>{dt.init(t,e);const n=rs[typeof e.value];t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:rs[typeof r.value]??n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Cd=F("$ZodCheckGreaterThan",(t,e)=>{dt.init(t,e);const n=rs[typeof e.value];t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:rs[typeof r.value]??n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Wb=F("$ZodCheckMultipleOf",(t,e)=>{dt.init(t,e),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?e.value!==BigInt(0)&&n.value%e.value===BigInt(0):S0(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Jb=F("$ZodCheckNumberFormat",(t,e)=>{var o;dt.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[i,s]=pd[e.format];t._zod.check=l=>{const a=l.value;if(n){if(!Number.isInteger(a)){l.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?l.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):l.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}a<i&&l.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>s&&l.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),Kb=F("$ZodCheckMaxLength",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=fa),t._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>e.maximum?sa(i):s)<=e.maximum)return;const l=oa(i);r.issues.push({origin:l,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Gb=F("$ZodCheckMinLength",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=fa),t._zod.check=r=>{const i=r.value,s=i.length;if((typeof i=="string"&&s>=e.minimum&&s<e.minimum*2?sa(i):s)>=e.minimum)return;const l=oa(i);r.issues.push({origin:l,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Yb=F("$ZodCheckLengthEquals",(t,e)=>{var n;dt.init(t,e),(n=t._zod.def).when??(n.when=fa),t._zod.check=r=>{const i=r.value,s=i.length,o=typeof i=="string"&&s>=e.length&&s<=e.length*2?sa(i):s;if(o===e.length)return;const l=oa(i),a=o>e.length;r.issues.push({origin:l,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),ro=F("$ZodCheckStringFormat",(t,e)=>{var n,r;dt.init(t,e),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),Xb=F("$ZodCheckRegex",(t,e)=>{ro.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Qb=F("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Hb),ro.init(t,e)}),ey=F("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Zb),ro.init(t,e)}),ty=F("$ZodCheckIncludes",(t,e)=>{dt.init(t,e);const n=eo(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position},}${n}`:n);e.pattern=r,t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),ny=F("$ZodCheckStartsWith",(t,e)=>{dt.init(t,e);const n=new RegExp(`^${eo(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),ry=F("$ZodCheckEndsWith",(t,e)=>{dt.init(t,e);const n=new RegExp(`.*${eo(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),iy=F("$ZodCheckOverwrite",(t,e)=>{dt.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class sy{constructor(e=[],n={}){this.content=[],this.indent=0,this.args=e,this.closed=n}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
8
|
+
`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,n=(this==null?void 0:this.content)??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
9
|
+
${n.join(`
|
|
10
|
+
`)}
|
|
11
|
+
};`)(...Object.values(this.closed))}}const oy={major:4,minor:6,patch:6},Oe=F("$ZodType",(t,e)=>{var s;var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=oy;const r=t._zod.def.checks,i=t._zod.traits.has("$ZodCheck")?[t,...r??[]]:r!=null&&r.length?[...r]:[];for(const o of i)for(const l of o._zod.onattach)l(t);if(i.length===0)(n=t._zod).deferred??(n.deferred=[]),(s=t._zod.deferred)==null||s.push(()=>{t._zod.run=t._zod.parse});else{const o=(a,u,c)=>{if(a.memo)return a;let f=en(a),d;for(const h of u){if(h._zod.def.when){if(L0(a)||!h._zod.def.when(a))continue}else if(f)continue;const p=a.issues.length,m=h._zod.check(a);if(m instanceof Promise&&(c==null?void 0:c.async)===!1)throw new Un;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(fl(a.issues,p,t),f||(f=en(a,p)))});else{if(a.issues.length===p)continue;fl(a.issues,p,t),f||(f=en(a,p))}}return d?d.then(()=>a):a},l=(a,u,c)=>{if(en(a))return a.aborted=!0,a;const f=o(u,i,c);if(f instanceof Promise){if(c.async===!1)throw new Un;return f.then(d=>t._zod.parse(d,c))}return t._zod.parse(f,c)};t._zod.run=(a,u)=>{if(u.skipChecks)return t._zod.parse(a,u);if(u.direction==="backward"){const f=t._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return f instanceof Promise?f.then(d=>l(d,a,u)):l(f,a,u)}const c=t._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new Un;return c.then(f=>o(f,i,u))}return o(c,i,u)}}},{get"~standard"(){return bd(this,"~standard",wd(this))},set"~standard"(t){En(this,"~standard",t)}}),_d=(t,e)=>t.issues.length?{issues:t.issues.map(n=>wr(n,e,Tn()))}:{value:t.value};async function ly(t,e){const n={async:!0};return _d(await t._zod.run({value:e,issues:[]},n),n)}function wd(t){return{validate:e=>{const n={async:!1};try{const r=t._zod.run({value:e,issues:[]},n);if(!(r instanceof Promise))return _d(r,n)}catch{}return ly(t,e)},vendor:"zod",version:1}}const da=F("$ZodString",(t,e)=>{Oe.init(t,e),t._zod.pattern=e.pattern??qb,t._zod.parse=(n,r)=>{if(e.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:t}),n}}),ke=F("$ZodStringFormat",(t,e)=>{ro.init(t,e),da.init(t,e)}),ay=F("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Sb),ke.init(t,e)}),uy=F("$ZodUUID",(t,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Pu(r))}else e.pattern??(e.pattern=Pu());ke.init(t,e)}),cy=F("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Eb),ke.init(t,e)}),Sd=1,is=2;function Ed(t){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(t):(new URL(t),!0)}catch{return!1}}function fy(t,e){return!("normalize"in e)&&!("hostname"in e)&&!("protocol"in e)?Ed(t)||is:dy(t,e)}function dy(t,e){var n;if(!e.normalize&&((n=e.protocol)==null?void 0:n.source)===Rb.source&&!/^https?:\/\//i.test(t))return Sd;try{if(typeof URL<"u"){const r=URL;if(typeof r.parse=="function")return r.parse(t)??is}return new URL(t)}catch{return is}}const hy=/[\t\n\r]/g;function Bu(t){return t.replace(hy,"")}function py(t,e){return e.lastIndex=0,e.test(t.hostname)}function my(t,e){return e.lastIndex=0,e.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol)}const gy=F("$ZodURL",(t,e)=>{ke.init(t,e),t._zod.check=n=>{try{const r=n.value.trim(),i=fy(r,e);if(i===Sd){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}if(i===is){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort});return}if(i===!0){n.value=Bu(r);return}e.hostname&&!py(i,e.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort}),e.protocol&&!my(i,e.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort}),n.value=e.normalize?i.href:Bu(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),by=F("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Ob()),ke.init(t,e)}),yy=F("$ZodNanoID",(t,e)=>{if(e.length!==void 0&&(!Number.isInteger(e.length)||e.length<1))throw new Error(`Invalid nanoid length: ${e.length}`);e.pattern??(e.pattern=e.length===void 0?Cb:_b(e.length)),ke.init(t,e)}),ky=F("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=yb),ke.init(t,e)}),vy=F("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=kb),ke.init(t,e)}),xy=F("$ZodULID",(t,e)=>{e.pattern??(e.pattern=vb),ke.init(t,e)}),Ay=F("$ZodXID",(t,e)=>{e.pattern??(e.pattern=xb),ke.init(t,e)}),Cy=F("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Ab),ke.init(t,e)}),_y=F("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=jb(e)),ke.init(t,e)}),wy=F("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=zb),ke.init(t,e)}),Sy=F("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Lb(e)),ke.init(t,e)}),Ey=F("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=wb),ke.init(t,e)}),Dy=F("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Tb),ke.init(t,e)}),Oy=/^[0-9a-fA-F:.]+$/;function Dd(t){return Oy.test(t)?Ed(`http://[${t}]`):!1}const Ty=F("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Mb),ke.init(t,e),t._zod.check=n=>{Dd(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}),My=F("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=$b),ke.init(t,e)});function $y(t){const e=t.split("/");if(e.length!==2)return!1;const[n,r]=e;if(!r)return!1;const i=Number(r);return`${i}`!==r||i<0||i>128?!1:Dd(n)}const Ny=F("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Nb),ke.init(t,e),t._zod.check=n=>{$y(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}});function Od(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Td=/^[0-9a-zA-Z+/]*={0,2}$/,Iy=F("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Td),ke.init(t,e),t._zod.check=n=>{Od(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}}),ha=/^[A-Za-z0-9_-]*$/;function Fy(t){if(!ha.test(t))return!1;const e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Od(n)}const Ry=F("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ha),ke.init(t,e),t._zod.check=n=>{Fy(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Py=F("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Pb),ke.init(t,e)});function By(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const zy=F("$ZodJWT",(t,e)=>{ke.init(t,e),t._zod.check=n=>{By(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Md=F("$ZodNumber",(t,e)=>{Oe.init(t,e),t._zod.pattern=Vb,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const s=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:t,...s?{received:s}:{}}),n}}),Ly=F("$ZodNumberFormat",(t,e)=>{Jb.init(t,e),Md.init(t,e)}),jy=F("$ZodBoolean",(t,e)=>{Oe.init(t,e),t._zod.pattern=Ub,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),n}}),qy=F("$ZodUnknown",(t,e)=>{Oe.init(t,e),t._zod.parse=n=>n}),Vy=F("$ZodNever",(t,e)=>{Oe.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function Uy(t,e){const n=Nu(t._zod.def.checks);if(!n.length)return;const r=Math.min(...n.map(s=>s[0])),i=t._zod.parse;t._zod.parse=(s,o)=>{const l=e(s.value);if(l>r&&!(o!=null&&o.skipChecks)&&(o==null?void 0:o.direction)!=="backward"){for(const[a,u]of Nu(t._zod.def.checks))if(l>a&&u._zod.def.when(s)){const c=s.issues.length;return u._zod.check(s),s.issues[c].continue=!1,fl(s.issues,c,t),s}}return i(s,o)}}const Hy=t=>Array.isArray(t)?t.length:-1;function zu(t,e,n){t.issues.length&&e.issues.push(...gd(n,t.issues)),e.value[n]=t.value}const Zy=F("$ZodArray",(t,e)=>{Oe.init(t,e);const n=Vt.memoizer;n==null||n.attach(t),t._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),r;r.value=n?n.alloc(t,r,Array(s.length),i):Array(s.length);const o=[],l=i==null?void 0:i.abortEarly;for(let a=0;a<s.length;a++){const u=s[a],c=e.element._zod.run({value:u,issues:[]},i);if(c instanceof Promise)o.push(c.then(f=>zu(f,r,a)));else if(zu(c,r,a),l&&c.issues.length!==0&&en(c))break}return o.length?Promise.all(o).then(()=>r):r},Uy(t,Hy)});function ss(t,e,n,r,i,s){const o=n in r,l=s==="optional";if(!(!o&&l&&i==="optional")){if(t.issues.length){if(i!==void 0&&l&&!o)return;e.issues.push(...gd(n,t.issues))}if(!o&&i===void 0){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?(o||i==="defaulted"&&!l)&&(e.value[n]=void 0):e.value[n]=t.value}}const Wy=[];function $d(t){var o,l,a,u;const e=Object.keys(t.shape),n=Object.getOwnPropertySymbols(t.shape),r=n.length?n:Wy,i=r.length?[...e,...r]:e;for(const c of i)if(!((u=(a=(l=(o=t.shape)==null?void 0:o[c])==null?void 0:l._zod)==null?void 0:a.traits)!=null&&u.has("$ZodType")))throw new Error(`Invalid element at key "${String(c)}": expected a Zod schema`);const s=$0(t.shape);return{...t,allKeys:i,symbolKeys:r,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(s)}}function Nd(t,e,n,r,i,s,o){const l=[],a=i.keySet,u=i.catchall._zod,c=u.def.type,f=u.optin,d=u.optout;let h=0;for(const p in e){if(o&&n.issues.length!==h){if(en(n,h))break;h=n.issues.length}if(a.has(p))continue;if(p==="__proto__"){c==="never"&&l.push(p);continue}if(c==="never"){l.push(p);continue}const m=u.run({value:e[p],issues:[]},r);m instanceof Promise?t.push(m.then(g=>ss(g,n,p,e,f,d))):ss(m,n,p,e,f,d)}return l.length&&n.issues.push({code:"unrecognized_keys",keys:l,input:e,inst:s,continue:!0}),t.length?Promise.all(t).then(()=>n):n}const Jy=F("$ZodObject",(t,e)=>{Oe.init(t,e);const n=Object.getOwnPropertyDescriptor(e,"shape"),r=n!=null&&n.get?n.get.raw:e.shape??{};if(r){const u=()=>{const c={...r};return Object.defineProperty(e,"shape",{value:c}),u.raw=c,c};u.raw=r,Object.defineProperty(e,"shape",{get:u})}const i=ra(()=>$d(e));ge(t,"propValues",u=>{const c=u.def.shape,f={};for(const d in c){const h=c[d]._zod;if(h.values){Object.prototype.hasOwnProperty.call(f,d)||rr(f,d,new Set);for(const p of h.values)f[d].add(p);h.optin!==void 0&&f[d].add(void 0)}}return f});const s=ns,o=e.catchall;let l;const a=Vt.memoizer;a==null||a.attach(t),t._zod.parse=(u,c)=>{l??(l=i.value);const f=u.value;if(!s(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),u;u.value=a?a.alloc(t,u,{},c):{};const d=[],h=l.shape,p=c==null?void 0:c.abortEarly;let m=u.issues.length;for(const g of l.allKeys){if(p&&u.issues.length!==m){if(en(u,m))break;m=u.issues.length}if(g==="__proto__")continue;const b=h[g],_=b._zod.optin,k=b._zod.optout,C=b._zod.run({value:f[g],issues:[]},c);C instanceof Promise?d.push(C.then(v=>ss(v,u,g,f,_,k))):ss(C,u,g,f,_,k)}return o?Nd(d,f,u,c,i.value,t,p===!0):d.length?Promise.all(d).then(()=>u):u}}),Ky=F("$ZodObjectJIT",(t,e)=>{Jy.init(t,e);const n=t._zod.parse,r=ra(()=>$d(e)),i=Vt.memoizer,s=h=>{var v,x;const p=r.value,m=p.symbolKeys,g=new sy(["payload","ctx"],{shape:h,inst:t,memo:i,syms:m}),b=A=>`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`,_=(A,w)=>`
|
|
12
|
+
let ${A}_ab = false;
|
|
13
|
+
for (let i = 0; i < ${A}.issues.length; i++) {
|
|
14
|
+
const iss = ${A}.issues[i];
|
|
15
|
+
iss.path = iss.path ? [${w}, ...iss.path] : [${w}];
|
|
16
|
+
payload.issues.push(iss);
|
|
17
|
+
if (iss.continue !== true) ${A}_ab = true;
|
|
18
|
+
}
|
|
19
|
+
if (${A}_ab && ctx && ctx.abortEarly) {
|
|
20
|
+
payload.value = newResult;
|
|
21
|
+
return payload;
|
|
22
|
+
}`;g.write("const input = payload.value;");const k=Object.create(null);let C=0;for(const A of p.allKeys)k[A]=`key_${C++}`;g.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const A of p.allKeys){if(A==="__proto__")continue;const w=k[A],T=typeof A=="symbol"?`syms[${m.indexOf(A)}]`:D0(A),O=`${T} in input`,M=h[A],N=(v=M==null?void 0:M._zod)==null?void 0:v.optin,U=N!==void 0,R=((x=M==null?void 0:M._zod)==null?void 0:x.optout)==="optional";if(g.write(`const ${w} = ${b(T)};`),U&&R){const P=N==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;g.write(`
|
|
23
|
+
const ${w}_present = ${O};
|
|
24
|
+
if (!${w}.issues.length || ${w}_present) {
|
|
25
|
+
if (${w}.issues.length) {${_(w,T)}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (${P}) {
|
|
29
|
+
newResult[${T}] = ${w}.value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
`)}else U?(g.write(`
|
|
34
|
+
if (${w}.issues.length) {${_(w,T)}
|
|
35
|
+
}
|
|
36
|
+
`),N==="defaulted"?g.write(`newResult[${T}] = ${w}.value;`):g.write(`
|
|
37
|
+
if (${w}.value !== undefined || ${O}) {
|
|
38
|
+
newResult[${T}] = ${w}.value;
|
|
39
|
+
}
|
|
40
|
+
`)):g.write(`
|
|
41
|
+
const ${w}_present = ${O};
|
|
42
|
+
if (${w}.issues.length) {${_(w,T)}
|
|
43
|
+
}
|
|
44
|
+
if (!${w}_present && !${w}.issues.length) {
|
|
45
|
+
payload.issues.push({
|
|
46
|
+
code: "invalid_type",
|
|
47
|
+
expected: "nonoptional",
|
|
48
|
+
input: undefined,
|
|
49
|
+
path: [${T}]
|
|
50
|
+
});
|
|
51
|
+
if (ctx && ctx.abortEarly) {
|
|
52
|
+
payload.value = newResult;
|
|
53
|
+
return payload;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (${w}_present) {
|
|
58
|
+
newResult[${T}] = ${w}.value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
`)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()};let o;const l=ns,a=!Vt.jitless,c=a&&T0.value,f=e.catchall;let d;t._zod.parse=(h,p)=>{d??(d=r.value);const m=h.value;return l(m)?a&&c&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(o||(o=s(e.shape)),h=o(h,p),f?Nd([],m,h,p,d,t,(p==null?void 0:p.abortEarly)===!0):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),h)}});function Lu(t,e,n,r){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const i=t.filter(s=>!en(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(o=>wr(o,r,Tn())))}),e)}const Gy=F("$ZodUnion",(t,e)=>{Oe.init(t,e),ge(t,"optin",r=>r.def.options.some(i=>i._zod.optin==="defaulted")?"defaulted":r.def.options.some(i=>i._zod.optin!==void 0)?"optional":void 0),ge(t,"optout",r=>r.def.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ge(t,"values",r=>{if(r.def.options.every(i=>i._zod.values))return new Set(r.def.options.flatMap(i=>Array.from(i._zod.values)))}),ge(t,"pattern",r=>{if(r.def.options.every(i=>i._zod.pattern)){const i=r.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>ia(s.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1;const o=[];for(const l of e.options){const a=l._zod.run({value:r.value,issues:[]},i);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(l=>Lu(l,r,t,i)):Lu(o,r,t,i)}}),Yy=F("$ZodIntersection",(t,e)=>{Oe.init(t,e),t._zod.parse=(n,r)=>{const i=n.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([a,u])=>ju(n,a,u)):ju(n,s,o)}});function hl(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(ti(t)&&ti(e)){const n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),i={...t,...e};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(const s of r){if(s==="__proto__")continue;const o=hl(t[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<t.length;r++){const i=t[r],s=e[r],o=hl(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ju(t,e,n){const r=new Map;let i;const s=new Map,o=(u,c)=>{var d,h;let f;if(u.code==="unrecognized_keys"&&!((d=u.path)!=null&&d.length))i??(i=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&((h=u.path)==null?void 0:h.length)===1){const p=String(u.path[0]);s.has(p)||s.set(p,u),f=[p]}else return!1;for(const p of f)r.has(p)||r.set(p,{}),r.get(p)[c]=!0;return!0};for(const u of e.issues)o(u,"l")||t.issues.push(u);for(const u of n.issues)o(u,"r")||t.issues.push(u);const l=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(l.length){const u=i?l.filter(c=>i.keys.includes(c)):[];u.length&&t.issues.push({...i,keys:u});for(const c of l)!u.includes(c)&&s.has(c)&&t.issues.push(s.get(c))}const a=hl(e.value,n.value);if(!a.valid){if(en(t))return t;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return t.value=a.data,t}const Xy=F("$ZodEnum",(t,e)=>{Oe.init(t,e);const n=ul(e.entries),r=new Set(n);t._zod.values=r,ge(t,"pattern",i=>{const s=ul(i.def.entries).filter(o=>M0.has(typeof o));return new RegExp(s.length?`^(${s.map(o=>eo(o.toString())).join("|")})$`:"^[^\\s\\S]$")}),t._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:t}),i}}),Qy=F("$ZodTransform",(t,e)=>{var n;Oe.init(t,e),t._zod.optin="optional",(n=Vt.memoizer)==null||n.guard(t),t._zod.parse=(r,i)=>{if(i.direction==="backward")throw new kd(t.constructor.name);const s=e.transform(r.value,r);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(l=>(r.value=l,r));if(s instanceof Promise)throw new Un;return r.value=s,r}});function qu(t,e){return t.value=e.issues.length?void 0:e.value,t}const Id=F("$ZodOptional",(t,e)=>{Oe.init(t,e),ge(t,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),t._zod.optout="optional",ge(t,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),ge(t,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${ia(r.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(n.value===void 0){if(e.innerType._zod.optin!=="defaulted")return n;const i=e.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>qu(n,s)):qu(n,i)}return e.innerType._zod.run(n,r)}}),e2=F("$ZodExactOptional",(t,e)=>{Id.init(t,e),ge(t,"values",n=>n.def.innerType._zod.values),ge(t,"pattern",n=>n.def.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),t2=F("$ZodNullable",(t,e)=>{Oe.init(t,e),ge(t,"optin",n=>n.def.innerType._zod.optin),ge(t,"optout",n=>n.def.innerType._zod.optout),ge(t,"pattern",n=>{const r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${ia(r.source)}|null)$`):void 0}),ge(t,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),n2=F("$ZodDefault",(t,e)=>{Oe.init(t,e),t._zod.optin="defaulted",ge(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>Vu(s,e)):Vu(i,e)}});function Vu(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const r2=F("$ZodPrefault",(t,e)=>{Oe.init(t,e),t._zod.optin="defaulted",ge(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),i2=F("$ZodNonOptional",(t,e)=>{Oe.init(t,e),ge(t,"values",n=>{const r=n.def.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(n,r)=>{const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>Uu(s,t)):Uu(i,t)}});function Uu(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function Hu(t,e,n,r){return e.issues.length?(t.value=n.catchValue({...e,value:t.value,error:{issues:e.issues.map(i=>wr(i,r,Tn()))},input:t.value}),t):(t.value=e.value,e.memo&&(t.memo=!0),t)}const s2=F("$ZodCatch",(t,e)=>{Oe.init(t,e),ge(t,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ge(t,"optout",n=>n.def.innerType._zod.optout),ge(t,"values",n=>n.def.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run({value:n.value,issues:[]},r);return i instanceof Promise?i.then(s=>Hu(n,s,e,r)):Hu(n,i,e,r)}}),Fd=F("$ZodPipe",(t,e)=>{Oe.init(t,e),ge(t,"values",n=>n.def.in._zod.values),ge(t,"optin",n=>n.def.in._zod.optin),ge(t,"optout",n=>n.def.out._zod.optout),ge(t,"propValues",n=>n.def.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(n,r);return s instanceof Promise?s.then(o=>Ei(o,e.in,r)):Ei(s,e.in,r)}const i=e.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Ei(s,e.out,r)):Ei(i,e.out,r)}});function Ei(t,e,n){return t.issues.some(r=>r.code!=="unrecognized_keys")?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},n)}const o2=F("$ZodPreprocess",(t,e)=>{Fd.init(t,e)}),l2=F("$ZodReadonly",(t,e)=>{Oe.init(t,e),ge(t,"propValues",n=>n.def.innerType._zod.propValues),ge(t,"values",n=>n.def.innerType._zod.values),ge(t,"optin",n=>{var r,i;return(i=(r=n.def.innerType)==null?void 0:r._zod)==null?void 0:i.optin}),ge(t,"optout",n=>{var r,i;return(i=(r=n.def.innerType)==null?void 0:r._zod)==null?void 0:i.optout}),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);const i=e.innerType._zod.run(n,r);return i instanceof Promise?i.then(Zu):Zu(i)}});function Zu(t){return t.memo||(t.value=Object.freeze(t.value)),t}const a2=F("$ZodCustom",(t,e)=>{dt.init(t,e),Oe.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{const r=n.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Wu(s,n,r,t));Wu(i,n,r,t)}});function Wu(t,e,n,r){if(!t){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(ni(i))}}class u2 extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const pl="~memo",Ju=[];function Rd(t){return t!==null&&typeof t=="object"}function Eo(t){return t.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Pd=new WeakMap,Ir=0,Wi=1,Vr=2;function Ji(t,e,n){const r=Pd.get(t);if(r!==void 0)return r?Vr:Ir;if(e.has(t))return Vr;e.add(t);let i=Ir;const s=c=>{if(i!==Vr&&(c!=null&&c._zod)){const f=Ji(c,e);f>i&&(i=f)}},o=(c,f)=>{var h;let d=Ir;for(const p of Reflect.ownKeys(c)){const m=Object.getOwnPropertyDescriptor(c,p);if(!m.enumerable)continue;const g=m.get?Wi:(h=m.value)!=null&&h._zod?Ji(m.value,e):Ir;g>d&&(d=g)}return d},l=c=>{c>i&&(i=c)},a=t._zod.def;switch(a.type){case"object":{const c=ad(a);l(c?o(c):Wi),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(const c of a.items)s(c);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(const c of a.options)s(c);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{const c=a._cachedInner??void 0;l(c?Ji(c,e):Wi);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(const c in a){const f=Object.getOwnPropertyDescriptor(a,c);if(!f||f.get)continue;const d=f.value;if(!(!d||typeof d!="object")){if(d._zod)s(d);else if(Array.isArray(d))for(const h of d)s(h)}}}return e.delete(t),c2(t,i)}function c2(t,e){return e!==Wi&&Pd.set(t,e===Vr),e}function f2(t,e){let n=t.buckets.get(e);return n||(n=new WeakMap,t.buckets.set(e,n)),n}let Di;const Oi=[],d2={alloc(t,e,n){const r=Di;if(!r)return n;Di=void 0;const i={value:n,issues:null};return r.set(e.value,i),Oi.push(i),n},guard(t){var e;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const n=t._zod.parse,r=(i,s)=>{if(s.direction!=="backward"&&p2(s,i.value))throw new u2;return n(i,s)};t._zod.parse=r,t._zod.run===n&&(t._zod.run=r)})},attach(t){var e;let n,r=!1,i,s;(e=t._zod).deferred??(e.deferred=[]),t._zod.deferred.push(()=>{const o=t._zod.parse,l=(a,u)=>{if(n===void 0){const b=Ji(t,new Set);if(b===Ir)return t._zod.parse=o,t._zod.run===l&&(t._zod.run=o),o(a,u);b===Vr||r?n=!0:r=!0}const c=a.value;if(!Rd(c))return o(a,u);let f=u[pl];f||(f={buckets:new WeakMap,backEdges:void 0},u[pl]=f);let d;i===u?d=s:(d=f2(f,t),i=u,s=d);const h=d.get(c);if(h)return a.value=h.value,h.issues?h.issues.length&&a.issues.push(...Eo(h.issues)):(a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(h.value)),a;Di=d;const p=Oi.length,m=o(a,u);Di=void 0;const g=Oi.length>p?Oi.pop():void 0;return m instanceof Promise?m.then(b=>(g&&(g.issues=b.issues.length?Eo(b.issues):Ju),b)):(g&&(g.issues=m.issues.length?Eo(m.issues):Ju),m)};t._zod.parse=l,t._zod.run===o&&(t._zod.run=l)})}};function h2(){return d2}function p2(t,e){var r;const n=(r=t[pl])==null?void 0:r.backEdges;return n!==void 0&&Rd(e)&&n.has(e)}const m2=()=>{const t={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 e(s){return t[s]??null}const 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(s,o){return s==="number"&&typeof o=="number"&&!Number.isFinite(o)?String(o):r[s]??s}return s=>{switch(s.code){case"invalid_type":{const o=i(s.expected),l=q0(s.input),a=i(l,s.input);return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${hd(s.values[0])}`:`Invalid option: expected one of ${Mu(s.values,"|")}`;case"too_big":{const o=s.exact?"exactly ":s.inclusive?"<=":"<",l=e(s.origin);return l?`Too big: expected ${s.origin??"value"} to have ${o}${s.maximum.toString()} ${l.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${o}${s.maximum.toString()}`}case"too_small":{const o=s.exact?"exactly ":s.inclusive?">=":">",l=e(s.origin);return l?`Too small: expected ${s.origin} to have ${o}${s.minimum.toString()} ${l.unit}`:`Too small: expected ${s.origin} to be ${o}${s.minimum.toString()}`}case"invalid_format":{const o=s;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Mu(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(l=>`'${l}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function g2(){return{localeError:m2()}}var Ku;class b2{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function y2(){return new b2}(Ku=globalThis).__zod_globalRegistry??(Ku.__zod_globalRegistry=y2());const Fr=globalThis.__zod_globalRegistry;function Bd(t){return t.checks&&(t.checks=[...t.checks]),t}function k2(t,e){return new t(Bd({type:"string",...Q(e)}))}function v2(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Q(e)})}function x2(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Q(e)})}function A2(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Q(e)})}function C2(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Q(e)})}function _2(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Q(e)})}function w2(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Q(e)})}function S2(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Q(e)})}function E2(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Q(e)})}function D2(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Q(e)})}function O2(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Q(e)})}function T2(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Q(e)})}function M2(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Q(e)})}function $2(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Q(e)})}function N2(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Q(e)})}function I2(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Q(e)})}function F2(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Q(e)})}function R2(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Q(e)})}function P2(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Q(e)})}function B2(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Q(e)})}function z2(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Q(e)})}function L2(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Q(e)})}function j2(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Q(e)})}function zd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Q(e)})}function q2(t,e){return new t({type:"string",format:"date",check:"string_format",...Q(e)})}function V2(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Q(e)})}function U2(t,e){return new t({type:"string",format:"duration",check:"string_format",...Q(e)})}function H2(t,e){return new t(Bd({type:"number",checks:[],...Q(e)}))}function Z2(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Q(e)})}function W2(t,e){return new t({type:"boolean",...Q(e)})}function J2(t){return new t({type:"unknown"})}function K2(t,e){return new t({type:"never",...Q(e)})}function Gu(t,e){return new Ad({check:"less_than",...Q(e),value:t,inclusive:!1})}function Do(t,e){return new Ad({check:"less_than",...Q(e),value:t,inclusive:!0})}function Yu(t,e){return new Cd({check:"greater_than",...Q(e),value:t,inclusive:!1})}function Oo(t,e){return new Cd({check:"greater_than",...Q(e),value:t,inclusive:!0})}function Xu(t,e){return new Wb({check:"multiple_of",...Q(e),value:t})}function Ld(t,e){return new Kb({check:"max_length",...Q(e),maximum:t})}function ls(t,e){return new Gb({check:"min_length",...Q(e),minimum:t})}function jd(t,e){return new Yb({check:"length_equals",...Q(e),length:t})}function G2(t,e){return new Xb({check:"string_format",format:"regex",...Q(e),pattern:t})}function Y2(t){return new Qb({check:"string_format",format:"lowercase",...Q(t)})}function X2(t){return new ey({check:"string_format",format:"uppercase",...Q(t)})}function Q2(t,e){return new ty({check:"string_format",format:"includes",...Q(e),includes:t})}function e1(t,e){return new ny({check:"string_format",format:"starts_with",...Q(e),prefix:t})}function t1(t,e){return new ry({check:"string_format",format:"ends_with",...Q(e),suffix:t})}function Sr(t){return new iy({check:"overwrite",tx:t})}function n1(t){return Sr(e=>e.normalize(t))}function r1(){return Sr(t=>t.trim())}function i1(){return Sr(t=>t.toLowerCase())}function s1(){return Sr(t=>t.toUpperCase())}function o1(){return Sr(t=>O0(t))}function l1(t,e,n){return new t({type:"array",element:e,...Q(n)})}function a1(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Q(n)})}function u1(t,e){const n=c1(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(ni(i,r.value,n._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(ni(s))}},t(r.value,r)),e);return n}function c1(t,e){const n=new dt({check:"custom",...Q(e)});return n._zod.check=t,n}function Ur(t,...e){for(const n of e)for(const r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&rr(t,r,n[r]);return t}function qd(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??Fr,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",intersections:[],deferred:[],external:(t==null?void 0:t.external)??void 0}}function Er(t,e,n,r,i){const s=typeof e.unrepresentable=="function"?e.unrepresentable({zodSchema:t,path:r.path,message:i}):e.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(i);return Object.assign(n,s),!0}function Ke(t,e,n={path:[],schemaPath:[]}){var c,f;var r;const i=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,o),e.sharedDefsExtractedFor=void 0,e.sharedEmitDoneFor=void 0;const l=(f=(c=t._zod).toJSONSchema)==null?void 0:f.call(c);if(l)o.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,d);else{const p=o.schema,m=e.processors[i.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);m(t,e,p,d)}const h=t._zod.parent;h&&(o.ref||(o.ref=h),Ke(h,e,d),e.seen.get(h).isParent=!0)}const a=e.metadataRegistry.get(t);return a&&Ur(o.schema,a),e.io==="input"&&nt(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function Qu(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function Vd(t,e){var o,l,a,u;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(t.external&&t.sharedDefsExtractedFor===t.external)return;const r=new Map;for(const c of t.seen.entries()){const f=(o=t.metadataRegistry.get(c[0]))==null?void 0:o.id;if(f){const d=r.get(f);if(d&&d!==c[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(f,c[0])}}const i=c=>{var m;const f=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const g=(m=t.external.registry.get(c[0]))==null?void 0:m.id,b=t.external.uri??(k=>k);if(g)return{ref:b(g)};const _=c[1].defId??c[1].schema.id??`schema${t.counter++}`;return c[1].defId=_,{defId:_,ref:`${b("__shared")}#/${f}/${Qu(_)}`}}const d="#",h=`${d}/${f}/`;if(c[1]===n&&!c[1].schema.id)return{ref:d};const p=c[1].schema.id??`__schema${t.counter++}`;return{defId:p,ref:h+Qu(p)}},s=c=>{if(c[1].schema.$ref)return;const f=c[1],{ref:d,defId:h}=i(c);f.def={...f.schema},h&&(f.defId=h);const p=f.schema;for(const m in p)delete p[m];p.$ref=d};if(t.cycles==="throw")for(const c of t.seen.entries()){const f=c[1];if(f.cycle)throw new Error(`Cycle detected: #/${(l=f.cycle)==null?void 0:l.join("/")}/<root>
|
|
62
|
+
|
|
63
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of t.seen.entries()){const f=c[1];if(e===c[0]){s(c);continue}if(t.external){const h=(a=t.external.registry.get(c[0]))==null?void 0:a.id;if(e!==c[0]&&h){s(c);continue}}if((u=t.metadataRegistry.get(c[0]))==null?void 0:u.id){s(c);continue}if(f.cycle){s(c);continue}f.count>1&&t.reused==="ref"&&s(c)}t.external&&(t.sharedDefsExtractedFor=t.external)}function Ud(t){const e=t.anyOf;if(!Array.isArray(e)||e.length===0||t.type!==void 0)return;const n=[];for(const r of e){if(!r||typeof r!="object")return;Ud(r);const i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;const s=r.type;for(const o of Array.isArray(s)?s:[s]){if(typeof o!="string")return;n.includes(o)||n.push(o)}}delete t.anyOf,t.type=n.length===1?n[0]:n}const Hd=new Set(["type","properties","required","additionalProperties"]),ec=["oneOf","anyOf"];function tc(t){const e=t.additionalProperties;return e===void 0||e===!1||typeof e!="object"||e===null?null:Object.keys(e).length?e:null}function ml(t){var s;const e=[];for(const o of t){if(typeof o!="object"||o.type!=="object")return null;for(const l in o)if(!Hd.has(l))return null;e.push(o)}const n={},r=new Set;for(const o of e){for(const l in o.properties){if(Object.prototype.hasOwnProperty.call(n,l))continue;const a=[];for(const c of e){const f=((s=c.properties)==null?void 0:s[l])??tc(c);f!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(f))||a.push(f))}const u=a.length===1?a[0]:ml(a)??{allOf:a};rr(n,l,u)}for(const l of o.required??[])r.add(l)}const i={type:"object",properties:n};if(r.size&&(i.required=[...r]),e.every(o=>o.additionalProperties===!1))i.additionalProperties=!1;else{const o=[];for(const l of e){const a=tc(l);a&&!o.some(u=>JSON.stringify(u)===JSON.stringify(a))&&o.push(a)}o.length===1?i.additionalProperties=o[0]:o.length>1&&(i.additionalProperties={allOf:o})}return i}function f1(t){const e=t.allOf;if(!Array.isArray(e)||e.length<2)return;for(const i of Hd)if(i in t)return;const n=e.filter(i=>ec.some(s=>Array.isArray(i[s])));let r=null;if(!n.length)r=ml(e);else{const i=n[0],s=ec.find(a=>Array.isArray(i[a]));if(Object.keys(i).length!==1)return;const o=e.filter(a=>a!==i),l=i[s].map(a=>ml([...o,a]));if(l.some(a=>!a))return;r={[s]:l}}r&&(delete t.allOf,Ur(t,r))}function Zd(t,e){var l,a,u,c;const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=f=>{const d=t.seen.get(f);if(d.ref===null)return;const h=d.def??d.schema,p={...h},m=d.ref;if(d.ref=null,m){r(m);const b=t.seen.get(m),_=b.schema;if(_.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(_)):Ur(h,_),Ur(h,p),f._zod.parent===m)for(const C in h)C==="$ref"||C==="allOf"||C in p||delete h[C];if(_.$ref&&b.def)for(const C in h)C==="$ref"||C==="allOf"||C in b.def&&JSON.stringify(h[C])===JSON.stringify(b.def[C])&&delete h[C]}const g=f._zod.parent;if(g&&g!==m){r(g);const b=t.seen.get(g);if(b!=null&&b.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(const _ in h)_==="$ref"||_==="allOf"||_ in b.def&&JSON.stringify(h[_])===JSON.stringify(b.def[_])&&delete h[_]}t.override({zodSchema:f,jsonSchema:h,path:d.path??[]})};if(!t.external||t.sharedEmitDoneFor!==t.external){for(const f of[...t.seen.entries()].reverse())r(f[0]);if(t.target!=="openapi-3.0")for(const f of t.seen.entries())Ud(f[1].def??f[1].schema);for(const f of t.deferred)f();if(t.intersections.length){const f=new Map;for(const d of t.seen.values())for(const h of[d.schema,d.def]){const p=h==null?void 0:h.allOf;if(!Array.isArray(p))continue;const m=f.get(p);m?m.push(h):f.set(p,[h])}for(const d of t.intersections)for(const h of f.get(d)??[])f1(h)}}const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,(l=t.external)!=null&&l.uri){const f=(a=t.external.registry.get(e))==null?void 0:a.id;if(!f)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(f)}Ur(i,n.defId?n.schema:n.def??n.schema);const s=(u=t.metadataRegistry.get(e))==null?void 0:u.id;s!==void 0&&i.id===s&&delete i.id;const o=((c=t.external)==null?void 0:c.defs)??{};if(!t.external||t.sharedEmitDoneFor!==t.external)for(const f of t.seen.entries()){const d=f[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,rr(o,d.defId,d.def))}t.external&&(t.sharedEmitDoneFor=t.external),t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{const f=JSON.parse(JSON.stringify(i));return Object.defineProperty(f,"~standard",{value:{...e["~standard"],jsonSchema:{input:as(e,"input",t.processors),output:as(e,"output",t.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function nt(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return nt(r.element,n);if(r.type==="set")return nt(r.valueType,n);if(r.type==="lazy")return nt(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 nt(r.innerType,n);if(r.type==="intersection")return nt(r.left,n)||nt(r.right,n);if(r.type==="record"||r.type==="map")return nt(r.keyType,n)||nt(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:nt(r.in,n)||nt(r.out,n);if(r.type==="object"){for(const i in r.shape)if(nt(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(nt(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(nt(i,n))return!0;return!!(r.rest&&nt(r.rest,n))}return!1}const d1=(t,e={})=>n=>{const r=qd({...n,processors:e});return Ke(t,r),Vd(r,t),Zd(r,t)},as=(t,e,n={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=qd({...i??{},target:s,io:e,processors:n});return Ke(t,o),Vd(o,t),Zd(o,t)},br=(t,e,n)=>{(t[e]===void 0||n>t[e])&&(t[e]=n)},yr=(t,e,n)=>{(t[e]===void 0||n<t[e])&&(t[e]=n)},nc=(t,e)=>{br(t,"minimum",e),yr(t,"maximum",e)},Wd=(t,e)=>{t.multipleOf??(t.multipleOf=[]),t.multipleOf.includes(e)||t.multipleOf.push(e)},Jd=(t,e)=>{t.patterns??(t.patterns=new Set),t.patterns.add(e)},Kd=(t,e)=>{t.mime=t.mime?t.mime.filter(n=>e.includes(n)):[...e]},Gd=(t,e)=>{t.format=e,e.includes("int")&&(t.isInt=!0)},rc=(t,e)=>br(t,"minimum",e.minimum),ic=(t,e)=>yr(t,"maximum",e.maximum),sc=t=>(e,n)=>{Gd(e,n.format);const[r,i]=t[n.format];br(e,"minimum",r),yr(e,"maximum",i)},To={greater_than:(t,e)=>br(t,e.inclusive?"minimum":"exclusiveMinimum",e.value),less_than:(t,e)=>yr(t,e.inclusive?"maximum":"exclusiveMaximum",e.value),multiple_of:(t,e)=>Wd(t,e.value),number_format:sc(pd),bigint_format:sc(N0),min_length:rc,max_length:ic,length_equals:(t,e)=>nc(t,e.length),min_size:rc,max_size:ic,size_equals:(t,e)=>nc(t,e.size),string_format:(t,e)=>{Gd(t,e.format),e.pattern&&Jd(t,e.pattern),(e.format==="base64"||e.format==="base64url")&&(t.contentEncoding=e.format),(e.local||e.precision===-1)&&(t.laxFormat=!0)},mime_type:(t,e)=>Kd(t,e.mime)};function Lt(t){var s;const e={},n=t._zod.def,r=t._zod.traits.has("$ZodCheck")?[t,...n.checks??[]]:n.checks??[];for(const o of r)(s=To[o._zod.def.check])==null||s.call(To,e,o._zod.def);const i=t._zod.bag;i.minimum!==void 0&&br(e,"minimum",i.minimum),i.exclusiveMinimum!==void 0&&br(e,"exclusiveMinimum",i.exclusiveMinimum),i.maximum!==void 0&&yr(e,"maximum",i.maximum),i.exclusiveMaximum!==void 0&&yr(e,"exclusiveMaximum",i.exclusiveMaximum),i.multipleOf!==void 0&&Wd(e,i.multipleOf),i.format!==void 0&&(e.format??(e.format=i.format),i.format.includes("int")&&(e.isInt=!0)),i.mime&&Kd(e,i.mime);for(const o of i.patterns??[])Jd(e,o);return e}const h1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},p1=new Map([[Td,Ib],[ha,Fb]]),m1=t=>p1.get(t)??t,g1=(t,e,n,r)=>{const i=n;i.type="string";const{minimum:s,maximum:o,format:l,patterns:a,contentEncoding:u,laxFormat:c}=Lt(t);if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),l&&(i.format=h1[l]??l,i.format===""&&delete i.format,(l==="time"||c)&&delete i.format),u&&(i.contentEncoding=u),a&&a.size>0){const f=[...a].map(m1);f.length===1?i.pattern=f[0].source:f.length>1&&(i.allOf=[...f.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},b1=(t,e,n,r)=>{const i=n,{minimum:s,maximum:o,multipleOf:l,exclusiveMaximum:a,exclusiveMinimum:u,isInt:c}=Lt(t);i.type=c?"integer":"number";const f=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),d=typeof a=="number"&&a<=(o??Number.POSITIVE_INFINITY),h=e.target==="draft-04"||e.target==="openapi-3.0";if(f?h?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),d?h?(i.maximum=a,i.exclusiveMaximum=!0):i.exclusiveMaximum=a:typeof o=="number"&&(i.maximum=o),l){const p=new Set;for(const b of l)Number.isFinite(b)&&b!==0?p.add(Math.abs(b)):Er(t,e,i,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);const[m,...g]=p;m!==void 0&&(i.multipleOf=m),g.length&&(i.allOf=[...i.allOf??[],...g.map(b=>({multipleOf:b}))])}},y1=(t,e,n,r)=>{n.type="boolean"},k1=(t,e,n,r)=>{n.not={}},v1=(t,e,n,r)=>{},x1=(t,e,n,r)=>{const i=t._zod.def,s=ul(i.entries);if(s.length===0){n.not={};return}s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},A1=(t,e,n,r)=>{Er(t,e,n,r,"Custom types cannot be represented in JSON Schema")},C1=(t,e,n,r)=>{Er(t,e,n,r,"Transforms cannot be represented in JSON Schema")},_1=(t,e,n,r)=>{const i=n,s=t._zod.def,{minimum:o,maximum:l}=Lt(t);typeof o=="number"&&(i.minItems=o),typeof l=="number"&&(i.maxItems=l),i.type="array",i.items=Ke(s.element,e,{...r,path:[...r.path,"items"]})};function gl(t){const e=t._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?gl(e.out):e.type==="catch"?gl(e.innerType):t._zod.optin}const w1=(t,e,n,r)=>{var u;const i=n,s=t._zod.def,o=s.shape;if(Object.getOwnPropertySymbols(o).length&&Er(t,e,i,r,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(const c in o)rr(i.properties,c,Ke(o[c],e,{...r,path:[...r.path,"properties",c]}));const a=[];for(const c of Object.keys(o)){const f=s.shape[c];(e.io==="input"?gl(f)===void 0:f._zod.optout===void 0)&&a.push(c)}a.length>0&&(i.required=a),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=Ke(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},S1=(t,e,n,r)=>{const i=t._zod.def,s=i.inclusive===!1,o=i.options.map((l,a)=>Ke(l,e,{...r,path:[...r.path,s?"oneOf":"anyOf",a]}));s?n.oneOf=o:n.anyOf=o},E1=(t,e,n,r)=>{const i=t._zod.def,s=Ke(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ke(i.right,e,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,a=[...l(s)?s.allOf:[s],...l(o)?o.allOf:[o]];n.allOf=a,e.intersections.push(a)},D1=(t,e,n,r)=>{const i=t._zod.def,s=Ke(i.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},O1=(t,e,n,r)=>{const i=t._zod.def;Ke(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},pa=Symbol();function Yd(t,e,n,r,i){let s=!1;const o=JSON.stringify(t,(l,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(Er(e,n,r,i,"BigInt defaults cannot be represented in JSON Schema"),pa):JSON.parse(o)}const T1=(t,e,n,r)=>{const i=t._zod.def;Ke(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;const o=Yd(i.defaultValue,t,e,n,r);o!==pa&&(n.default=o)},M1=(t,e,n,r)=>{const i=t._zod.def;Ke(i.innerType,e,r);const s=e.seen.get(t);if(s.ref=i.innerType,e.io!=="input")return;const o=Yd(i.defaultValue,t,e,n,r);o!==pa&&(n._prefault=o)},$1=(t,e,n,r)=>{const i=t._zod.def;Ke(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Er(t,e,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=o},N1=(t,e,n,r)=>{const i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?i.out:i.in:i.out;Ke(o,e,r);const l=e.seen.get(t);l.ref=o},I1=(t,e,n,r)=>{const i=t._zod.def;Ke(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType,n.readOnly=!0},Xd=(t,e,n,r)=>{const i=t._zod.def;Ke(i.innerType,e,r);const s=e.seen.get(t);s.ref=i.innerType},oc=new WeakSet([Object.prototype,Error.prototype]);function Ti(t,e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get(){const r=n(this);return Object.defineProperty(this,e,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,e,{value:r,configurable:!0,writable:!0})}})}const F1=(t,e)=>{tb.init(t,e),t.name="ZodError";const n=Object.getPrototypeOf(t);oc.has(n)||(oc.add(n),Ti(n,"format",r=>i=>ib(r,i)),Ti(n,"flatten",r=>i=>rb(r,i)),Ti(n,"addIssue",r=>i=>{r.issues.push(i),r.message=JSON.stringify(r.issues,cl,2)}),Ti(n,"addIssues",r=>i=>{r.issues.push(...i),r.message=JSON.stringify(r.issues,cl,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Ot=F("ZodError",F1,void 0,{Parent:Error}),R1=la(Ot),P1=aa(Ot),B1=ua(Ot),z1=ca(Ot),L1=cb(Ot),j1=fb(Ot),q1=db(Ot),V1=hb(Ot),U1=pb(Ot),H1=mb(Ot),Z1=gb(Ot),W1=bb(Ot);function J1(){Vt.localeError||Tn(g2())}function ma(){Vt.memoizer||Tn({memoizer:h2()})}const Te=F("ZodType",(t,e)=>(J1(),Oe.init(t,e),t.def=e,t.type=e.type,t),{check(...t){const e=this.def;return this.clone(ht(e,{checks:[...e.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...t){return this.check(...t)},clone(t,e){return On(this,t,e)},brand(){return this},register(t,e){return t.add(this,e),this},refine(t,e){return this.check(Uk(t,e))},superRefine(t,e){return this.check(Hk(t,e))},overwrite(t){return this.check(Sr(t))},optional(){return uc(this)},exactOptional(){return Mk(this)},nullable(){return cc(this)},nullish(){return uc(cc(this))},nonoptional(t){return Pk(this,t)},array(){return Rr(this)},or(t){return Sk([this,t])},and(t){return Dk(this,t)},transform(t){return fc(this,nh(t))},default(t){return Ik(this,t)},prefault(t){return Rk(this,t)},catch(t){return zk(this,t)},pipe(t){return fc(this,t)},readonly(){return qk(this)},describe(t){const e=this.clone();return Fr.add(e,{description:t}),e},meta(...t){if(t.length===0)return Fr.get(this);const e=this.clone();return Fr.add(e,t[0]),e},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(t,...e){return e.length===0?t(this):t(this,...e)},get"~standard"(){return bd(this,"~standard",{...wd(this),jsonSchema:{input:as(this,"input"),output:as(this,"output")}})},set"~standard"(t){En(this,"~standard",t)},parse:function t(e,n){return R1(this,e,n,{callee:t})},parseAsync:async function t(e,n){return await P1(this,e,n,{callee:t})},safeParse(t,e){return B1(this,t,e)},async safeParseAsync(t,e){return z1(this,t,e)},get spa(){return this==null?void 0:this.safeParseAsync},set spa(t){En(this,"spa",t)},validate(t,e){return lb(this,t,e)},validateAsync(t,e){return ub(this,t,e)},encode:function t(e,n){return L1(this,e,n,{callee:t})},decode:function t(e,n){return j1(this,e,n,{callee:t})},encodeAsync:async function t(e,n){return await q1(this,e,n,{callee:t})},decodeAsync:async function t(e,n){return await V1(this,e,n,{callee:t})},safeEncode(t,e){return U1(this,t,e)},safeDecode(t,e){return H1(this,t,e)},async safeEncodeAsync(t,e){return Z1(this,t,e)},async safeDecodeAsync(t,e){return W1(this,t,e)},toJSONSchema(t){return d1(this,{})(t)},get description(){var t;return(t=Fr.get(this))==null?void 0:t.description},get _def(){return this._zod.def}}),Qd=F("_ZodString",(t,e)=>{da.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>g1(t,n,r)},yd({format:t=>Lt(t).format??null,minLength:t=>Lt(t).minimum??null,maxLength:t=>Lt(t).maximum??null},{regex(...t){return this.check(G2(...t))},includes(...t){return this.check(Q2(...t))},startsWith(...t){return this.check(e1(...t))},endsWith(...t){return this.check(t1(...t))},min(...t){return this.check(ls(...t))},max(...t){return this.check(Ld(...t))},length(...t){return this.check(jd(...t))},nonempty(...t){return this.check(ls(1,...t))},lowercase(t){return this.check(Y2(t))},uppercase(t){return this.check(X2(t))},trim(){return this.check(r1())},normalize(...t){return this.check(n1(...t))},toLowerCase(){return this.check(i1())},toUpperCase(){return this.check(s1())},slugify(){return this.check(o1())}})),K1=F("ZodString",(t,e)=>{da.init(t,e),Qd.init(t,e)},{email(t){return this.check(v2(Q1,t))},url(t){return this.check(S2(tk,t))},jwt(t){return this.check(j2(gk,t))},emoji(t){return this.check(E2(nk,t))},guid(t){return this.check(x2(ek,t))},uuid(t){return this.check(A2(Mi,t))},uuidv4(t){return this.check(C2(Mi,t))},uuidv6(t){return this.check(_2(Mi,t))},uuidv7(t){return this.check(w2(Mi,t))},nanoid(t){return this.check(D2(rk,t))},cuid(t){return this.check(O2(ik,t))},cuid2(t){return this.check(T2(sk,t))},ulid(t){return this.check(M2(ok,t))},base64(t){return this.check(B2(hk,t))},base64url(t){return this.check(z2(pk,t))},xid(t){return this.check($2(lk,t))},ksuid(t){return this.check(N2(ak,t))},ipv4(t){return this.check(I2(uk,t))},ipv6(t){return this.check(F2(ck,t))},cidrv4(t){return this.check(R2(fk,t))},cidrv6(t){return this.check(P2(dk,t))},e164(t){return this.check(L2(mk,t))},datetime(t){return this.check(zd(eh,t))},date(t){return this.check(q2(G1,t))},time(t){return this.check(V2(Y1,t))},duration(t){return this.check(U2(X1,t))}});function At(t){return k2(K1,t)}const Ae=F("ZodStringFormat",(t,e)=>{ke.init(t,e),Qd.init(t,e)}),eh=F("ZodISODateTime",(t,e)=>{_y.init(t,e),Ae.init(t,e)}),G1=F("ZodISODate",(t,e)=>{wy.init(t,e),Ae.init(t,e)}),Y1=F("ZodISOTime",(t,e)=>{Sy.init(t,e),Ae.init(t,e)}),X1=F("ZodISODuration",(t,e)=>{Ey.init(t,e),Ae.init(t,e)}),Q1=F("ZodEmail",(t,e)=>{cy.init(t,e),Ae.init(t,e)}),ek=F("ZodGUID",(t,e)=>{ay.init(t,e),Ae.init(t,e)}),Mi=F("ZodUUID",(t,e)=>{uy.init(t,e),Ae.init(t,e)}),tk=F("ZodURL",(t,e)=>{gy.init(t,e),Ae.init(t,e)}),nk=F("ZodEmoji",(t,e)=>{by.init(t,e),Ae.init(t,e)}),rk=F("ZodNanoID",(t,e)=>{yy.init(t,e),Ae.init(t,e)}),ik=F("ZodCUID",(t,e)=>{ky.init(t,e),Ae.init(t,e)}),sk=F("ZodCUID2",(t,e)=>{vy.init(t,e),Ae.init(t,e)}),ok=F("ZodULID",(t,e)=>{xy.init(t,e),Ae.init(t,e)}),lk=F("ZodXID",(t,e)=>{Ay.init(t,e),Ae.init(t,e)}),ak=F("ZodKSUID",(t,e)=>{Cy.init(t,e),Ae.init(t,e)}),uk=F("ZodIPv4",(t,e)=>{Dy.init(t,e),Ae.init(t,e)}),ck=F("ZodIPv6",(t,e)=>{Ty.init(t,e),Ae.init(t,e)}),fk=F("ZodCIDRv4",(t,e)=>{My.init(t,e),Ae.init(t,e)}),dk=F("ZodCIDRv6",(t,e)=>{Ny.init(t,e),Ae.init(t,e)}),hk=F("ZodBase64",(t,e)=>{Iy.init(t,e),Ae.init(t,e)}),pk=F("ZodBase64URL",(t,e)=>{Ry.init(t,e),Ae.init(t,e)}),mk=F("ZodE164",(t,e)=>{Py.init(t,e),Ae.init(t,e)}),gk=F("ZodJWT",(t,e)=>{zy.init(t,e),Ae.init(t,e)}),th=F("ZodNumber",(t,e)=>{Md.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>b1(t,n,r,i),t.isFinite=!0},yd({minValue:t=>{const{minimum:e,exclusiveMinimum:n}=Lt(t);return Math.max(e??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:t=>{const{maximum:e,exclusiveMaximum:n}=Lt(t);return Math.min(e??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:t=>{const{isInt:e,multipleOf:n}=Lt(t);return!!e||!!(n!=null&&n.some(Number.isSafeInteger))},format:t=>Lt(t).format??null},{gt(t,e){return this.check(Yu(t,e))},gte(t,e){return this.check(Oo(t,e))},min(t,e){return this.check(Oo(t,e))},lt(t,e){return this.check(Gu(t,e))},lte(t,e){return this.check(Do(t,e))},max(t,e){return this.check(Do(t,e))},int(t){return this.check(ac(t))},safe(t){return this.check(ac(t))},positive(t){return this.check(Yu(0,t))},nonnegative(t){return this.check(Oo(0,t))},negative(t){return this.check(Gu(0,t))},nonpositive(t){return this.check(Do(0,t))},multipleOf(t,e){return this.check(Xu(t,e))},step(t,e){return this.check(Xu(t,e))},finite(){return this}}));function lc(t){return H2(th,t)}const bk=F("ZodNumberFormat",(t,e)=>{Ly.init(t,e),th.init(t,e)});function ac(t){return Z2(bk,t)}const yk=F("ZodBoolean",(t,e)=>{jy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>y1(t,n,r)});function kk(t){return W2(yk,t)}const vk=F("ZodUnknown",(t,e)=>{qy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>v1()});function bl(){return J2(vk)}const xk=F("ZodNever",(t,e)=>{Vy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>k1(t,n,r)});function Ak(t){return K2(xk,t)}const Ck=F("ZodArray",(t,e)=>{ma(),Zy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>_1(t,n,r,i),t.element=e.element},{min(t,e){return this.check(ls(t,e))},nonempty(t){return this.check(ls(1,t))},max(t,e){return this.check(Ld(t,e))},length(t,e){return this.check(jd(t,e))},unwrap(){return this.element}});function Rr(t,e){return l1(Ck,t,e)}const _k=F("ZodObject",(t,e)=>{ma(),Ky.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>w1(t,n,r,i),W0(t,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ok(Object.keys(this._zod.def.shape))},catchall(t){return this.clone(ht(this._zod.def,{catchall:t}))},passthrough(){return this.clone(ht(this._zod.def,{catchall:bl()}))},loose(){return this.clone(ht(this._zod.def,{catchall:bl()}))},strict(){return this.clone(ht(this._zod.def,{catchall:Ak()}))},strip(){return this.clone(ht(this._zod.def,{catchall:void 0}))},extend(t){return R0(this,t)},safeExtend(t){return P0(this,t)},merge(t){return B0(this,t)},pick(t){return I0(this,t)},omit(t){return F0(this,t)},partial(...t){return $u(rh,this,t[0])},exactPartial(...t){return $u(ih,this,t[0],"exactPartial")},required(...t){return z0(sh,this,t[0])}});function ga(t,e){const n={type:"object",shape:t??{},...Q(e)};return new _k(n)}const wk=F("ZodUnion",(t,e)=>{Gy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>S1(t,n,r,i),t.options=e.options});function Sk(t,e){return new wk({type:"union",options:t,...Q(e)})}const Ek=F("ZodIntersection",(t,e)=>{Yy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>E1(t,n,r,i)});function Dk(t,e){return new Ek({type:"intersection",left:t,right:e})}const yl=F("ZodEnum",(t,e)=>{Xy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(r,i,s)=>x1(t,r,i),t.enum=e.entries,t.options=[...t._zod.values];const n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{const s={};for(const o of r)if(n.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new yl({...e,checks:[],...Q(i),entries:s})},t.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new yl({...e,checks:[],...Q(i),entries:s})}});function Ok(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new yl({type:"enum",entries:n,...Q(e)})}const Tk=F("ZodTransform",(t,e)=>{ma(),Qy.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>C1(t,n,r,i),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new kd(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(ni(s,n.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=n.value),o.inst??(o.inst=t),n.issues.push(ni(o))}};const i=e.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n)):(n.value=i,n)}});function nh(t){return new Tk({type:"transform",transform:t})}const rh=F("ZodOptional",(t,e)=>{Id.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Xd(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function uc(t){return new rh({type:"optional",innerType:t})}const ih=F("ZodExactOptional",(t,e)=>{e2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Xd(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Mk(t){return new ih({type:"optional",innerType:t})}const $k=F("ZodNullable",(t,e)=>{t2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>D1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function cc(t){return new $k({type:"nullable",innerType:t})}const Nk=F("ZodDefault",(t,e)=>{n2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>T1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Ik(t,e){return new Nk({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():dd(e)}})}const Fk=F("ZodPrefault",(t,e)=>{r2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>M1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Rk(t,e){return new Fk({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():dd(e)}})}const sh=F("ZodNonOptional",(t,e)=>{i2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>O1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Pk(t,e){return new sh({type:"nonoptional",innerType:t,...Q(e)})}const Bk=F("ZodCatch",(t,e)=>{s2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>$1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function zk(t,e){return new Bk({type:"catch",innerType:t,catchValue:typeof e=="function"?e:K0(e)})}const oh=F("ZodPipe",(t,e)=>{Fd.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>N1(t,n,r,i),t.in=e.in,t.out=e.out});function fc(t,e){return new oh({type:"pipe",in:t,out:e})}const Lk=F("ZodPreprocess",(t,e)=>{oh.init(t,e),o2.init(t,e)}),jk=F("ZodReadonly",(t,e)=>{l2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>I1(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function qk(t){return new jk({type:"readonly",innerType:t})}const Vk=F("ZodCustom",(t,e)=>{a2.init(t,e),Te.init(t,e),t._zod.processJSONSchema=(n,r,i)=>A1(t,n,r,i)});function Uk(t,e={}){return a1(Vk,t,e)}function Hk(t,e){return u1(t,e)}function hr(t,e){return new Lk({type:"pipe",in:nh(t),out:e})}function Zk(t){return zd(eh,t)}function Wk(t){return/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(t)}const Jk=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,Kk=/^\d{4}-\d{2}-\d{2}$/;function Gk(t){return t.kind==="boolean"||t.kind==="repeater"?!0:"multiple"in t&&t.multiple===!0}function Yk(t){switch(t.kind){case"text":case"textarea":case"richText":case"email":case"url":case"slug":case"color":case"date":case"select":return!0;default:return!1}}function lh(t,e){return t.label??e}function or(t,e,n){const r=e==="least"?"needs at least":"can have at most";return i=>{const s=typeof i.input=="string"?` (now ${i.input.length})`:"";return`${t} ${r} ${n} character${n===1?"":"s"}${s}.`}}function Mo(t,e,n,r){return`${t} ${e==="least"?"needs at least":"allows at most"} ${n} ${r}${n===1?"":"s"}.`}function Xk(t){return hr(e=>e!==null&&typeof e=="object"&&"path"in e?e.path:e,t)}function Qk(t,e,n,r,i){const s=hr(u=>u===void 0||typeof u=="string"&&u.trim()===""?null:u,At().trim().nullable()),o=ga({path:r,alt:s}).strip(),l=hr(u=>typeof u=="string"?{path:u,alt:null}:u,o),a=t==="optional"||n.enforceRequired===!1?l:l.refine(u=>u.alt!==null,{message:`${e} needs alt text.`,path:["alt"]});return i?a.transform(u=>({src:u.path,alt:u.alt??""})):a}function ev(t,e,n){var i;const r=lh(t,e);switch(t.kind){case"text":{let s=At({error:`${r} must be text.`}).trim();return t.minLength!==void 0&&(s=s.min(t.minLength,{error:or(r,"least",t.minLength)})),t.maxLength!==void 0&&(s=s.max(t.maxLength,{error:or(r,"most",t.maxLength)})),t.pattern&&(s=s.regex(C0(t.pattern),t.patternMessage??`${r} does not have the expected form.`)),s}case"textarea":{let s=At({error:`${r} must be text.`});return t.minLength!==void 0&&(s=s.min(t.minLength,{error:or(r,"least",t.minLength)})),t.maxLength!==void 0&&(s=s.max(t.maxLength,{error:or(r,"most",t.maxLength)})),s}case"richText":{let s=At({error:`${r} must be text.`});return t.maxLength!==void 0&&(s=s.max(t.maxLength,{error:or(r,"most",t.maxLength)})),s}case"number":{let s=lc({error:`${r} must be a number.`}).finite({error:`${r} must be a number.`});return t.integer&&(s=s.int({error:`${r} must be a whole number.`})),t.min!==void 0&&(s=s.min(t.min,{error:`${r} must be at least ${t.min}.`})),t.max!==void 0&&(s=s.max(t.max,{error:`${r} must be at most ${t.max}.`})),s}case"boolean":return kk({error:`${r} must be yes or no.`});case"date":return(t.includeTime?Zk({offset:!0,error:`${r} must be an ISO 8601 timestamp.`}):At().regex(Kk,`${r} must be a date (YYYY-MM-DD).`)).superRefine((o,l)=>{if(Number.isNaN(Date.parse(o))){l.addIssue({code:"custom",message:`${r} is not a valid date.`});return}t.min&&o<t.min&&l.addIssue({code:"custom",message:`${r} must be on or after ${t.min}.`}),t.max&&o>t.max&&l.addIssue({code:"custom",message:`${r} must be on or before ${t.max}.`})});case"email":return At().trim().toLowerCase().email(`${r} must be a valid email address.`);case"url":return At().trim().url(`${r} must be a valid URL.`).refine(s=>/^https?:\/\//i.test(s),`${r} must start with http:// or https://.`);case"slug":return At().trim().toLowerCase().max(t.maxLength??96,{error:or(r,"most",t.maxLength??96)}).refine(Wk,`${r} may only contain lowercase letters, numbers and hyphens.`);case"select":{const s=t.options.map(l=>l.value),o=At().refine(l=>s.includes(l),{message:`${r} must be one of: ${s.join(", ")}.`});return t.multiple?Rr(o,{error:`${r} must be a list.`}):o}case"color":return At().trim().regex(Jk,`${r} must be a hex colour such as #1a2b3c.`);case"coordinates":{const s=(o,l)=>{const a=`${r}: the ${o} must be between -${l} and ${l}.`;return lc({error:`${r}: the ${o} must be a number.`}).min(-l,{error:a}).max(l,{error:a})};return ga({lat:s("latitude",90),lng:s("longitude",180)},{error:`${r} needs a latitude and a longitude.`})}case"media":{const s=t.accept==="image"?(i=n.image)==null?void 0:i.call(n):void 0,o=s??At({error:`${r} must be a file path.`}).min(1,{error:`${r} must be a file path.`}),l=t.alt?Qk(t.alt,r,n,o,s!==void 0):Xk(o);if(!t.multiple)return l;let a=Rr(l,{error:`${r} must be a list of files.`});return t.max!==void 0&&(a=a.max(t.max,{error:Mo(r,"most",t.max,"file")})),a}case"relation":{const s=At({error:`${r} must name an entry.`}).min(1,{error:`${r} must name an entry.`});return t.multiple?Rr(s,{error:`${r} must be a list of entries.`}):s}case"object":return kl(t.fields,n);case"repeater":{let s=Rr(kl(t.fields,n),{error:`${r} must be a list.`});return t.min!==void 0&&(s=s.min(t.min,{error:Mo(r,"least",t.min,"item")})),t.max!==void 0&&(s=s.max(t.max,{error:Mo(r,"most",t.max,"item")})),s}default:return bl()}}function tv(t,e,n){const r=lh(t,e),i=ev(t,e,n),s=o=>o===void 0||o===null||typeof o=="string"&&Yk(t)&&o.trim()===""?null:o;if(Gk(t)){const o=t.kind==="boolean"?t.default??!1:[];return hr(l=>s(l)===null?o:l,i)}return t.required&&n.enforceRequired!==!1?hr(s,i.nullable().refine(o=>o!==null,{message:`${r} is required.`})):hr(s,i.nullable())}function kl(t,e={}){const n={};for(const[r,i]of Object.entries(t))n[r]=tv(i,r,e);return ga(n).strip()}function nv(t){return t.issues.map(e=>({path:e.path.join("."),message:e.message}))}function rv(t,e,n={}){const r=kl(t,n).safeParse(e);return r.success?{ok:!0,data:r.data}:{ok:!1,issues:nv(r.error)}}function ah(t){switch(t.kind){case"boolean":return t.default??!1;case"repeater":return[];case"object":return iv(t.fields);case"select":return t.multiple?Array.isArray(t.default)?t.default:[]:typeof t.default=="string"?t.default:null;case"media":case"relation":return t.multiple?[]:null;case"text":case"textarea":case"richText":case"email":case"url":case"color":case"date":return t.default??null;case"number":return t.default??null;case"slug":case"coordinates":return null}}function iv(t){const e={};for(const[n,r]of Object.entries(t))e[n]=ah(r);return e}function dc(t,e){const n=e??{},r={};for(const[i,s]of Object.entries(t)){const o=n[i];if(o===void 0){r[i]=ah(s);continue}if(s.kind==="object"){r[i]=dc(s.fields,o??{});continue}if(s.kind==="repeater"){const l=Array.isArray(o)?o:[];r[i]=l.map(a=>dc(s.fields,a));continue}r[i]=o}return r}const sv=["for"],ov=["id","checked","disabled","aria-describedby"],lv={class:"min-w-0"},av={class:"block text-sm font-medium"},uv=["id"],cv=["id"],fv=De({__name:"BooleanField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>n.modelValue===!0);return(d,h)=>(z(),V("div",null,[q("label",{for:I(s),class:"flex cursor-pointer items-start gap-3 rounded-sm border border-line bg-raised p-3 transition hover:bg-canvas has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60"},[q("input",{id:I(s),type:"checkbox",checked:f.value,disabled:t.disabled||i.value.readonly,"aria-describedby":I(a),class:"mt-0.5 h-4 w-4 shrink-0 rounded-sm border-line text-accent focus:ring-ink/20",onChange:h[0]||(h[0]=p=>r("update:modelValue",p.target.checked))},null,40,ov),q("span",lv,[q("span",av,G(I(o)),1),i.value.description?(z(),V("span",{key:0,id:I(u),class:"block text-xs text-muted"},G(i.value.description),9,uv)):pe("",!0)])],8,sv),I(l)?(z(),V("p",{key:0,id:I(c),class:"field-error"},G(I(l)),9,cv)):pe("",!0)]))}}),dv=["for"],hv={key:0,class:"text-danger","aria-hidden":"true"},pv={key:1,class:"sr-only"},mv=["id"],gv=["id"],Nt=De({__name:"FieldShell",props:{inputId:{},label:{},description:{},required:{type:Boolean},error:{},hintId:{},errorId:{},bare:{type:Boolean}},setup(t){return(e,n)=>(z(),V("div",null,[t.bare?pe("",!0):(z(),V("label",{key:0,for:t.inputId,class:"field-label"},[Sn(G(t.label)+" ",1),t.required?(z(),V("span",hv,"*")):pe("",!0),t.required?(z(),V("span",pv,"(required)")):pe("",!0)],8,dv)),q("div",{class:Ee(t.bare?"":"mt-1.5")},[Wg(e.$slots,"default")],2),t.description?(z(),V("p",{key:1,id:t.hintId,class:"field-hint"},G(t.description),9,mv)):pe("",!0),t.error?(z(),V("p",{key:2,id:t.errorId,class:"field-error"},G(t.error),9,gv)):pe("",!0)]))}}),bv={class:"flex items-center gap-2"},yv=["value","disabled","aria-label"],kv=["id","value","disabled","aria-invalid","aria-describedby"],vv={key:0,class:"mt-2 flex flex-wrap gap-1.5"},xv=["title","disabled","aria-pressed","onClick"],Av={class:"sr-only"},Cv=De({__name:"ColorField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>typeof n.modelValue=="string"?n.modelValue:""),d=te(()=>/^#[0-9a-f]{6}$/i.test(f.value)?f.value:"#000000");function h(p){r("update:modelValue",p===""?null:p)}return(p,m)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>{var g;return[q("div",bv,[q("input",{type:"color",value:d.value,disabled:t.disabled||i.value.readonly,"aria-label":`${I(o)} colour picker`,class:"h-9.5 w-12 shrink-0 cursor-pointer rounded-sm border border-line bg-raised p-1",onInput:m[0]||(m[0]=b=>h(b.target.value))},null,40,yv),q("input",{id:I(s),type:"text",value:f.value,placeholder:"#1a2b3c",spellcheck:"false",disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input font-mono text-[13px] uppercase",I(l)&&"input-invalid"]),onInput:m[1]||(m[1]=b=>h(b.target.value.trim()))},null,42,kv)]),(g=i.value.presets)!=null&&g.length?(z(),V("div",vv,[(z(!0),V(We,null,mt(i.value.presets,b=>(z(),V("button",{key:b,type:"button",title:b,disabled:t.disabled||i.value.readonly,"aria-pressed":f.value.toLowerCase()===b.toLowerCase(),class:Ee(["h-7 w-7 rounded-full border transition",f.value.toLowerCase()===b.toLowerCase()?"border-ink ring-2 ring-ink/15":"border-line hover:scale-110"]),style:Jg({backgroundColor:b}),onClick:_=>h(b)},[q("span",Av,"Use "+G(b),1)],14,xv))),128))])):pe("",!0)]}),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),_v={class:"grid grid-cols-2 gap-2"},wv=["for"],Sv=["id","value","disabled","aria-describedby"],Ev=["for"],Dv=["id","value","disabled"],Ov={key:0,class:"field-error"},Tv={class:"mt-1.5 flex items-center gap-3 text-xs text-muted"},Mv=["href"],$v=De({__name:"CoordinatesField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>{const k=n.modelValue;if(!k||typeof k!="object")return null;const{lat:C,lng:v}=k;return typeof C=="number"&&typeof v=="number"?{lat:C,lng:v}:null}),d=k=>{var C,v;return((v=(C=n.issues)==null?void 0:C.find(x=>x.path===`${n.path}.${k}`))==null?void 0:v.message)??null},h=Me({lat:"",lng:""}),p=k=>typeof k=="number"?String(k):"",m=(k,C)=>k.trim()===""?typeof C!="number":Number(k)===C;yn(()=>n.modelValue,k=>{const C=k!==null&&typeof k=="object"?k:{};m(h.value.lat,C.lat)&&m(h.value.lng,C.lng)||(h.value={lat:p(C.lat),lng:p(C.lng)})},{immediate:!0,deep:!0});function g(k,C){h.value={...h.value,[k]:C};const v=g0(h.value.lat,h.value.lng);v!==void 0&&r("update:modelValue",v)}function b(k){var x;const C=((x=k.clipboardData)==null?void 0:x.getData("text"))??"",v=/^\s*(-?\d+(?:\.\d+)?)\s*[,;\s]\s*(-?\d+(?:\.\d+)?)\s*$/.exec(C);v&&(k.preventDefault(),r("update:modelValue",{lat:Number(v[1]),lng:Number(v[2])}))}const _=te(()=>f.value?`https://www.openstreetmap.org/?mlat=${f.value.lat}&mlon=${f.value.lng}#map=16/${f.value.lat}/${f.value.lng}`:null);return(k,C)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[q("div",_v,[q("div",null,[q("label",{for:`${I(s)}-lat`,class:"sr-only"},"Latitude",8,wv),q("input",{id:`${I(s)}-lat`,type:"number",step:"any",min:"-90",max:"90",placeholder:"Latitude",value:h.value.lat,disabled:t.disabled||i.value.readonly,"aria-describedby":I(a),class:Ee(["input font-mono text-[13px]",d("lat")&&"input-invalid"]),onInput:C[0]||(C[0]=v=>g("lat",v.target.value)),onPaste:b},null,42,Sv)]),q("div",null,[q("label",{for:`${I(s)}-lng`,class:"sr-only"},"Longitude",8,Ev),q("input",{id:`${I(s)}-lng`,type:"number",step:"any",min:"-180",max:"180",placeholder:"Longitude",value:h.value.lng,disabled:t.disabled||i.value.readonly,class:Ee(["input font-mono text-[13px]",d("lng")&&"input-invalid"]),onInput:C[1]||(C[1]=v=>g("lng",v.target.value)),onPaste:b},null,42,Dv)])]),d("lat")||d("lng")?(z(),V("p",Ov,G(d("lat")??d("lng")),1)):pe("",!0),q("div",Tv,[C[3]||(C[3]=q("span",null,'Paste "47.3769, 8.5417" into either box to fill both.',-1)),_.value?(z(),V("a",{key:0,href:_.value,target:"_blank",rel:"noopener noreferrer",class:"font-medium text-accent underline underline-offset-2"}," Check on the map ",8,Mv)):pe("",!0),f.value?(z(),V("button",{key:1,type:"button",class:"ml-auto font-medium hover:text-ink",onClick:C[2]||(C[2]=v=>r("update:modelValue",null))}," Clear ")):pe("",!0)])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Nv={class:"flex items-center gap-2"},Iv=["id","type","value","min","max","required","disabled","aria-invalid","aria-describedby"],Fv=["disabled"],Rv=De({__name:"DateField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>{const p=n.modelValue;if(typeof p!="string"||p==="")return"";if(!i.value.includeTime)return p.slice(0,10);const m=new Date(p);if(Number.isNaN(m.getTime()))return"";const g=b=>String(b).padStart(2,"0");return`${m.getFullYear()}-${g(m.getMonth()+1)}-${g(m.getDate())}T${g(m.getHours())}:${g(m.getMinutes())}`});function d(p){const m=p.target.value;if(!m){r("update:modelValue",null);return}if(!i.value.includeTime){r("update:modelValue",m);return}const g=new Date(m);r("update:modelValue",Number.isNaN(g.getTime())?null:g.toISOString())}function h(){const p=new Date;r("update:modelValue",i.value.includeTime?p.toISOString():b0(p))}return(p,m)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[q("div",Nv,[q("input",{id:I(s),type:i.value.includeTime?"datetime-local":"date",value:f.value,min:i.value.min,max:i.value.max,required:i.value.required,disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input",I(l)&&"input-invalid"]),onInput:d},null,42,Iv),q("button",{type:"button",class:"btn-secondary shrink-0",disabled:t.disabled||i.value.readonly,onClick:h}," Today ",8,Fv)])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Pv=Symbol("media folder"),Bv="media",zv={class:"flex items-center gap-3 border-b border-line px-5 py-3.5"},Lv={key:0,class:"mb-4 rounded-md border border-line bg-subtle px-4 py-3 text-sm text-muted"},jv={key:1,class:"mb-4 flex cursor-pointer flex-col items-center justify-center gap-1 rounded-md border border-dashed border-line-strong bg-canvas/50 px-4 py-6 text-center transition hover:border-ink/40"},qv=["accept","multiple","disabled"],Vv={class:"text-sm font-medium"},Uv={class:"text-xs text-muted"},Hv={key:2,class:"py-8 text-center text-sm text-muted"},Zv={key:3,class:"py-8 text-center text-sm text-muted"},Wv={key:4,class:"grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-5"},Jv=["aria-pressed","onClick"],Kv={class:"block aspect-4/3 bg-canvas"},Gv=["src"],Yv={key:1,class:"flex h-full w-full items-center justify-center text-xs font-medium uppercase text-muted"},Xv={class:"block px-2 py-1.5"},Qv={class:"block truncate text-xs font-medium"},ex=["title"],tx={class:"block text-[11px] text-muted"},nx={key:0,class:"flex items-center justify-between gap-3 border-t border-line px-5 py-3"},rx={class:"text-sm text-muted"},ix={class:"flex gap-2"},sx=["disabled"],ox=De({__name:"MediaPicker",props:{open:{type:Boolean},accept:{default:"any"},multiple:{type:Boolean,default:!1},selected:{default:()=>[]},folder:{}},emits:["close","choose"],setup(t,{emit:e}){const n=t,r=e,i=id(),s=Me([]),o=Me(!1),l=Me(!1),a=Me(""),u=Me([]),c=Me(null),f=Me(null),d=Me(!1);let h=null;const p=te(()=>n.accept==="image"?"image/*":n.accept==="document"?"application/pdf":void 0),m=te(()=>{const O=a.value.trim().toLowerCase();return s.value.filter(M=>n.folder!==void 0&&!M.path.startsWith(`${Bv}/`)&&!(n.folder&&M.path.startsWith(`${n.folder.path}/`))||n.accept==="image"&&!b(M)||n.accept==="document"&&b(M)?!1:!O||M.path.toLowerCase().includes(O))}),g=te(()=>u.value.length>0),b=O=>O.mimeType.startsWith("image/");async function _(){o.value=!0;try{s.value=(await kn.media.list()).items}catch(O){i.error(O instanceof al?O.message:"Could not load the media library.")}finally{o.value=!1}}yn(()=>n.open,async O=>{var M,N;if(!O){document.body.style.overflow="",h==null||h.focus();return}h=document.activeElement,document.body.style.overflow="hidden",u.value=[],a.value="",await _(),await nd(),(N=(M=c.value)==null?void 0:M.querySelector("input, button"))==null||N.focus()}),Qs(()=>{document.body.style.overflow=""});function k(O){if(!n.multiple){r("choose",[O]),r("close");return}u.value=u.value.includes(O.path)?u.value.filter(M=>M!==O.path):[...u.value,O.path]}function C(){const O=new Map(s.value.map(N=>[N.path,N])),M=u.value.map(N=>O.get(N)).filter(N=>N!==void 0);r("choose",M),r("close")}async function v(O){const M=Array.from(O??[]);if(M.length!==0){l.value=!0;try{const{items:N}=await kn.media.upload(M,{accept:n.accept,...n.folder?{directory:n.folder.path,newEntry:n.folder.isNew}:{}});if(!n.multiple){N[0]&&r("choose",[N[0]]),r("close");return}await _(),u.value=[...u.value,...N.map(U=>U.path)],i.success(`Uploaded ${N.length} file${N.length===1?"":"s"}.`)}catch(N){i.error(N instanceof al?N.message:"The upload failed.")}finally{l.value=!1,f.value&&(f.value.value="")}}}function x(O){var M;d.value=!1,v(((M=O.dataTransfer)==null?void 0:M.files)??null)}function A(O){if(O.key==="Escape"){r("close");return}if(O.key!=="Tab"||!c.value)return;const M=c.value.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'),N=M[0],U=M[M.length-1];!N||!U||(O.shiftKey&&document.activeElement===N?(O.preventDefault(),U.focus()):!O.shiftKey&&document.activeElement===U&&(O.preventDefault(),N.focus()))}const w=O=>O<1024*1024?`${Math.round(O/1024)} KB`:`${(O/1024/1024).toFixed(1)} MB`,T=O=>{const M=O.split("/");return M.pop(),M.join("/")||"/"};return(O,M)=>(z(),kt(Kg,{to:"body"},[t.open?(z(),V("div",{key:0,class:"fixed inset-0 z-50 flex items-end justify-center bg-ink/40 p-0 sm:items-center sm:p-6",onClick:M[6]||(M[6]=Si(N=>r("close"),["self"])),onKeydown:A},[q("div",{ref_key:"dialog",ref:c,role:"dialog","aria-modal":"true","aria-labelledby":"media-picker-title",class:"flex max-h-[90vh] w-full max-w-4xl flex-col rounded-t-xl border border-line bg-raised shadow-2xl sm:rounded-xl"},[q("header",zv,[M[8]||(M[8]=q("h2",{id:"media-picker-title",class:"text-base font-semibold"},"Media",-1)),Gg(q("input",{"onUpdate:modelValue":M[0]||(M[0]=N=>a.value=N),type:"search",placeholder:"Search files…",class:"input ml-auto max-w-56","aria-label":"Search media"},null,512),[[Yg,a.value]]),q("button",{type:"button",class:"btn-ghost -mr-2 px-2",onClick:M[1]||(M[1]=N=>r("close"))},[wt(I(rd),{size:20,"aria-hidden":"true"}),M[7]||(M[7]=q("span",{class:"sr-only"},"Close",-1))])]),q("div",{class:Ee(["min-h-0 flex-1 overflow-y-auto p-5",d.value&&"bg-accent-soft"]),onDragover:M[3]||(M[3]=Si(N=>d.value=!0,["prevent"])),onDragleave:M[4]||(M[4]=Si(N=>d.value=!1,["prevent"])),onDrop:Si(x,["prevent"])},[t.folder===null?(z(),V("p",Lv," Give it a title or a valid URL first. Its files then get their own folder, and you can upload here. ")):(z(),V("label",jv,[q("input",{ref_key:"fileInput",ref:f,type:"file",class:"sr-only",accept:p.value,multiple:t.multiple,disabled:l.value,onChange:M[2]||(M[2]=N=>v(N.target.files))},null,40,qv),q("span",Vv,G(l.value?"Uploading…":"Drop files here, or choose from your device"),1),q("span",Uv,G(t.accept==="image"?"Images":t.accept==="document"?"PDF documents":"Images and documents")+" "+G(t.folder?"· stored with this content":"· shared by all content"),1)])),o.value?(z(),V("p",Hv,"Loading…")):m.value.length===0?(z(),V("p",Zv,G(a.value?`Nothing matches "${a.value}".`:"No files yet."),1)):(z(),V("ul",Wv,[(z(!0),V(We,null,mt(m.value,N=>(z(),V("li",{key:N.path},[q("button",{type:"button","aria-pressed":u.value.includes(N.path)||t.selected.includes(N.path),class:Ee(["group block w-full overflow-hidden rounded-lg border text-left transition",u.value.includes(N.path)?"border-accent ring-2 ring-accent/25":t.selected.includes(N.path)?"border-accent/50":"border-line hover:border-accent/40"]),onClick:U=>k(N)},[q("span",Kv,[b(N)?(z(),V("img",{key:0,src:I(kn).media.url(N.path),alt:"",loading:"lazy",class:"h-full w-full object-cover"},null,8,Gv)):(z(),V("span",Yv,G(N.mimeType.split("/")[1]),1))]),q("span",Xv,[q("span",Qv,G(N.filename),1),q("span",{class:"block truncate text-[11px] text-muted",title:N.path},G(T(N.path)),9,ex),q("span",tx,G(N.width?`${N.width}×${N.height} · `:"")+G(w(N.size)),1)])],10,Jv)]))),128))]))],34),t.multiple?(z(),V("footer",nx,[q("span",rx,G(u.value.length)+" selected ",1),q("div",ix,[q("button",{type:"button",class:"btn-secondary",onClick:M[5]||(M[5]=N=>r("close"))},"Cancel"),q("button",{type:"button",class:"btn-primary",disabled:!g.value,onClick:C}," Add "+G(u.value.length||""),9,sx)])])):pe("",!0)],512)],32)):pe("",!0)]))}}),lx=["aria-describedby"],ax={class:"aspect-4/3"},ux=["src"],cx={key:1,class:"flex h-full w-full flex-col items-center justify-center gap-1 p-2 text-center"},fx={class:"text-[11px] font-semibold uppercase text-muted"},dx=["title"],hx={key:0,class:"px-1.5 pb-1.5"},px=["for"],mx={key:0,class:"text-danger","aria-hidden":"true"},gx={key:1,class:"sr-only"},bx=["id","value","required","disabled","aria-invalid","aria-describedby","onInput"],yx=["id"],kx={class:"absolute inset-x-0 top-0 flex justify-end gap-0.5 bg-gradient-to-b from-ink/50 to-transparent p-1 opacity-0 transition group-hover:opacity-100 group-focus-within:opacity-100"},vx=["disabled","onClick"],xx={class:"sr-only"},Ax=["disabled","onClick"],Cx={class:"sr-only"},_x=["disabled","onClick"],wx={class:"sr-only"},Sx=["id","disabled"],Ex={key:1,class:"ml-2 text-xs text-muted"},Dx=De({__name:"MediaField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=Me(!1),d=Xg(Pv,void 0);function h(A){if(typeof A=="string")return{path:A,alt:null};const w=A??{};return{path:typeof w.path=="string"?w.path:"",alt:typeof w.alt=="string"?w.alt:null}}const p=te(()=>(i.value.multiple?Array.isArray(n.modelValue)?n.modelValue:[]:n.modelValue==null||n.modelValue===""?[]:[n.modelValue]).map(h).filter(w=>w.path!=="")),m=te(()=>p.value.map(A=>A.path)),g=te(()=>p.value.map((A,w)=>{var T,O;return{...A,filename:A.path.split("/").pop()??A.path,url:kn.media.url(A.path),isImage:/\.(jpe?g|png|webp|avif|gif)$/i.test(A.path),altId:`${s}-alt-${w}`,altErrorId:`${s}-alt-${w}-error`,altError:((O=(T=n.issues)==null?void 0:T.find(M=>M.path===(i.value.multiple?`${n.path}.${w}.alt`:`${n.path}.alt`)))==null?void 0:O.message)??null}})),b=te(()=>i.value.multiple&&i.value.max!==void 0&&m.value.length>=i.value.max);function _(A){const w=i.value.alt?A:A.map(T=>T.path);r("update:modelValue",i.value.multiple?w:w[0]??null)}function k(A){if(!i.value.multiple){_(A[0]?[{path:A[0].path,alt:null}]:[]);return}const w=[...p.value];for(const T of A)m.value.includes(T.path)||w.push({path:T.path,alt:null});_(i.value.max?w.slice(0,i.value.max):w)}function C(A){_(p.value.filter((w,T)=>T!==A))}function v(A,w){const T=A+w;if(T<0||T>=p.value.length)return;const O=[...p.value];[O[A],O[T]]=[O[T],O[A]],_(O)}function x(A,w){const T=w.target.value;_(p.value.map((O,M)=>M===A?{...O,alt:T===""?null:T}:O))}return(A,w)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[q("div",{"aria-describedby":I(a)},[g.value.length?(z(),V("ul",{key:0,class:Ee(["mb-2 gap-2",i.value.multiple?i.value.alt?"grid grid-cols-2 sm:grid-cols-3":"grid grid-cols-3 sm:grid-cols-5":"flex"])},[(z(!0),V(We,null,mt(g.value,(T,O)=>(z(),V("li",{key:`${T.path}-${O}`,class:Ee(["group relative overflow-hidden rounded-lg border border-line bg-canvas",i.value.multiple?"":i.value.alt?"w-64":"w-40"])},[q("div",ax,[T.isImage?(z(),V("img",{key:0,src:T.url,alt:"",class:"h-full w-full object-cover"},null,8,ux)):(z(),V("div",cx,[q("span",fx,G(T.filename.split(".").pop()),1)]))]),q("p",{class:"truncate px-1.5 py-1 text-[11px] text-muted",title:T.path},G(T.filename),9,dx),i.value.alt?(z(),V("div",hx,[q("label",{for:T.altId,class:"text-[11px] font-medium"},[w[2]||(w[2]=Sn(" Alt text ",-1)),i.value.alt==="required"?(z(),V("span",mx,"*")):pe("",!0),i.value.alt==="required"?(z(),V("span",gx,"(required)")):pe("",!0)],8,px),q("input",{id:T.altId,type:"text",value:T.alt??"",required:i.value.alt==="required",disabled:t.disabled||i.value.readonly,"aria-invalid":T.altError?"true":void 0,"aria-describedby":T.altError?T.altErrorId:void 0,class:Ee(["input mt-0.5 text-xs",T.altError&&"input-invalid"]),autocomplete:"off",onInput:M=>x(O,M)},null,42,bx),T.altError?(z(),V("p",{key:0,id:T.altErrorId,class:"field-error"},G(T.altError),9,yx)):pe("",!0)])):pe("",!0),q("div",kx,[i.value.multiple&&O>0?(z(),V("button",{key:0,type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold hover:bg-raised",disabled:t.disabled,onClick:M=>v(O,-1)},[wt(I(A0),{size:14,"aria-hidden":"true"}),q("span",xx,"Move "+G(T.filename)+" earlier",1)],8,vx)):pe("",!0),i.value.multiple&&O<g.value.length-1?(z(),V("button",{key:1,type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold hover:bg-raised",disabled:t.disabled,onClick:M=>v(O,1)},[wt(I(y0),{size:14,"aria-hidden":"true"}),q("span",Cx,"Move "+G(T.filename)+" later",1)],8,Ax)):pe("",!0),q("button",{type:"button",class:"rounded-sm bg-raised/90 px-1.5 text-xs font-semibold text-danger hover:bg-raised",disabled:t.disabled,onClick:M=>C(O)},[wt(I(rd),{size:14,"aria-hidden":"true"}),q("span",wx,"Remove "+G(T.filename),1)],8,_x)])],2))),128))],2)):pe("",!0),q("button",{id:I(s),type:"button",class:"btn-secondary",disabled:t.disabled||i.value.readonly||b.value,onClick:w[0]||(w[0]=T=>f.value=!0)},[wt(I(k0),{size:16,"aria-hidden":"true"}),Sn(" "+G(g.value.length&&!i.value.multiple?"Replace":"Add"),1)],8,Sx),b.value?(z(),V("span",Ex," Maximum of "+G(i.value.max)+" reached. ",1)):pe("",!0)],8,lx),wt(ox,{open:f.value,accept:i.value.accept??"any",multiple:i.value.multiple,selected:m.value,folder:I(d),onClose:w[1]||(w[1]=T=>f.value=!1),onChoose:k},null,8,["open","accept","multiple","selected","folder"])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Ox={class:"relative"},Tx=["id","value","min","max","step","required","disabled","aria-invalid","aria-describedby"],Mx={key:0,class:"pointer-events-none absolute inset-y-0 right-3 flex items-center text-sm text-muted"},$x=De({__name:"NumberField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>typeof n.modelValue=="number"?String(n.modelValue):"");function d(h){const p=h.target.value;if(p.trim()===""){r("update:modelValue",null);return}const m=Number(p);r("update:modelValue",Number.isFinite(m)?m:null)}return(h,p)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[q("div",Ox,[q("input",{id:I(s),type:"number",inputmode:"decimal",value:f.value,min:i.value.min,max:i.value.max,step:i.value.step??(i.value.integer?1:"any"),required:i.value.required,disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input",i.value.unit&&"pr-12",I(l)&&"input-invalid"]),onInput:d},null,42,Tx),i.value.unit?(z(),V("span",Mx,G(i.value.unit),1)):pe("",!0)])]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),Nx={key:0,class:"text-sm text-muted"},Ix={key:1,class:"text-sm text-muted"},Fx=["aria-describedby"],Rx={class:"sr-only"},Px=["checked","disabled","onChange"],Bx={class:"min-w-0 flex-1 truncate"},zx={class:"shrink-0 font-mono text-[11px] text-muted"},Lx=["id","value","disabled","aria-invalid","aria-describedby"],jx=["value"],qx=De({__name:"RelationField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=Qg(),d=Me([]),h=Me(!0),p=te(()=>{var k;return((k=f.collection(i.value.collection))==null?void 0:k.label)??i.value.collection});na(async()=>{try{d.value=(await kn.entries.list(i.value.collection)).items}finally{h.value=!1}});const m=te(()=>i.value.multiple?Array.isArray(n.modelValue)?n.modelValue:[]:typeof n.modelValue=="string"?[n.modelValue]:[]),g=k=>{var C;return((C=d.value.find(v=>v.slug===k))==null?void 0:C.title)??k},b=k=>!h.value&&!d.value.some(C=>C.slug===k);function _(k){const C=m.value.includes(k)?m.value.filter(v=>v!==k):[...m.value,k];r("update:modelValue",C)}return(k,C)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[h.value?(z(),V("p",Nx,"Loading "+G(p.value)+"…",1)):d.value.length===0?(z(),V("p",Ix," There are no entries in "+G(p.value)+" yet. ",1)):(z(),V(We,{key:2},[i.value.multiple?(z(),V("fieldset",{key:0,class:"space-y-1.5","aria-describedby":I(a)},[q("legend",Rx,G(I(o)),1),(z(!0),V(We,null,mt(d.value,v=>(z(),V("label",{key:v.slug,class:"flex cursor-pointer items-center gap-2.5 rounded-sm border border-line bg-raised px-3 py-2 text-sm hover:bg-canvas"},[q("input",{type:"checkbox",checked:m.value.includes(v.slug),disabled:t.disabled||i.value.readonly,class:"h-4 w-4 rounded-sm border-line text-accent focus:ring-ink/20",onChange:x=>_(v.slug)},null,40,Px),q("span",Bx,G(v.title),1),q("span",zx,G(v.slug),1)]))),128))],8,Fx)):(z(),V("select",{key:1,id:I(s),value:m.value[0]??"",disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input",I(l)&&"input-invalid"]),onChange:C[0]||(C[0]=v=>r("update:modelValue",v.target.value||null))},[C[1]||(C[1]=q("option",{value:""},"Not set",-1)),(z(!0),V(We,null,mt(d.value,v=>(z(),V("option",{key:v.slug,value:v.slug},G(v.title),9,jx))),128))],42,Lx))],64)),(z(!0),V(We,null,mt(m.value.filter(b),v=>(z(),V("p",{key:v,class:"field-error"},' "'+G(g(v))+'" is no longer in '+G(p.value)+". ",1))),128))]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}});function Ue(t){this.content=t}Ue.prototype={constructor:Ue,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Ue(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ue(n)},addToStart:function(t,e){return new Ue([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ue(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Ue(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ue.from(t),t.size?new Ue(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ue.from(t),t.size?new Ue(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ue.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ue.from=function(t){if(t instanceof Ue)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ue(e)};function uh(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)n++;return a&&a<o.length&&a<l.length&&dh(o.charCodeAt(a-1))&&fh(o.charCodeAt(a))&&n--,n}if(i.content.size||s.content.size){let o=uh(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function ch(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let u=o.text,c=l.text,f=u.length,d=c.length;for(;f>0&&d>0&&u[f-1]==c[d-1];)f--,d--,n--,r--;return f&&d&&f<u.length&&dh(u.charCodeAt(f-1))&&fh(u.charCodeAt(f))&&(n++,r++),{a:n,b:r}}if(o.content.size||l.content.size){let u=ch(o.content,l.content,n-1,r-1);if(u)return u}n-=a,r-=a}}function fh(t){return t>=56320&&t<57344}function dh(t){return t>=55296&&t<56320}class B{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,l=0;l<n;o++){let a=this.content[o],u=l+a.nodeSize;if(u>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,n-c),r,i+c)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new B(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),i+=l.nodeSize),o=a}return new B(r,i)}cutByIndex(e,n){return e==n?B.empty:e==0&&n==this.content.length?this:new B(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new B(i,s)}addToStart(e){return new B([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new B(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return uh(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ch(this,e,n,r)}findIndex(e){if(e==0)return $i(0,e);if(e==this.size)return $i(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?$i(n+1,s):$i(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return B.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return B.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return B.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new B(n||e,r)}static from(e){if(!e)return B.empty;if(e instanceof B)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new B([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}B.empty=new B([],0);const $o={index:0,offset:0};function $i(t,e){return $o.index=t,$o.offset=e,$o}function us(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!us(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!us(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let be=class vl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&us(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return vl.none;if(e instanceof vl)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};be.none=[];class ri extends Error{}class Z{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=ph(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Z(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Z(hh(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Z.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(B.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new Z(e,r,i)}}Z.empty=new Z(B.empty,0,0);function hh(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(i==e||s.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(hh(s.content,e-i-1,n-i-1)))}function ph(t,e,n,r,i,s){let{index:o,offset:l}=t.findIndex(e),a=t.maybeChild(o);if(l==e||a.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=ph(a.content,e-l-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,a);return u&&t.replaceChild(o,a.copy(u))}function Vx(t,e,n){if(n.openStart>t.depth)throw new ri("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ri("Inconsistent open depths");return mh(t,e,n,0)}function mh(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=mh(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Zn(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Ux(n,t);return Zn(s,bh(t,o,l,e,r))}else return Zn(s,cs(t,e,r))}function gh(t,e){if(!e.type.compatibleContent(t.type))throw new ri("Cannot join "+e.type.name+" onto "+t.type.name)}function xl(t,e,n){let r=t.node(n);return gh(r,e.node(n)),r}function Hn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Hr(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Hn(t.nodeAfter,r),s++));for(let l=s;l<o;l++)Hn(i.child(l),r);e&&e.depth==n&&e.textOffset&&Hn(e.nodeBefore,r)}function Zn(t,e){if(!t.type.validContent(e))throw new ri("Invalid content for node "+t.type.name);return t.copy(e)}function bh(t,e,n,r,i){let s=t.depth>i&&xl(t,e,i+1),o=r.depth>i&&xl(n,r,i+1),l=[];return Hr(null,t,i,l),s&&o&&e.index(i)==n.index(i)?(gh(s,o),Hn(Zn(s,bh(t,e,n,r,i+1)),l)):(s&&Hn(Zn(s,cs(t,e,i+1)),l),Hr(e,n,i,l),o&&Hn(Zn(o,cs(n,r,i+1)),l)),Hr(r,null,i,l),new B(l)}function cs(t,e,n){let r=[];if(Hr(null,t,n,r),t.depth>n){let i=xl(t,e,n+1);Hn(Zn(i,cs(t,e,n+1)),r)}return Hr(e,null,n,r),new B(r)}function Ux(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(B.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class ii{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return be.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new fs(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),u=s-a;if(r.push(o,l,i+a),!u||(o=o.child(l),o.isText))break;s=u-1,i+=a+1}return new ii(n,r,s)}static resolveCached(e,n){let r=hc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else hc.set(e,r=new Hx);let i=r.elts[r.i]=ii.resolve(e,n);return r.i=(r.i+1)%Zx,i}}class Hx{constructor(){this.elts=[],this.i=0}}const Zx=12,hc=new WeakMap;class fs{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Wx=Object.create(null);let vn=class Al{constructor(e,n,r,i=be.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||B.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&us(this.attrs,n||e.defaultAttrs||Wx)&&be.sameSet(this.marks,r||be.none)}copy(e=null){return e==this.content?this:new Al(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Al(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return Z.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),l=i.start(o),u=i.node(o).content.cut(i.pos-l,s.pos-l);return new Z(u,i.depth-o,s.depth-o)}replace(e,n,r){return Vx(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ii.resolveCached(this,e)}resolveNoCache(e){return ii.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),yh(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=B.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),pc(this.type.attrs,this.attrs,"node",this.type.name);let e=be.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];pc(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!be.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=B.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,i,r)}};vn.prototype.text=void 0;class ds extends vn{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yh(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ds(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ds(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function yh(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function pc(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}class Xn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Jx(e,n);if(r.next==null)return Xn.empty;let i=kh(r);r.next&&r.err("Unexpected trailing text");let s=tA(eA(i));return nA(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return B.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:f}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let d=s(f,l.concat(c));if(d)return d}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
64
|
+
`)}}Xn.empty=new Xn(!0);class Jx{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function kh(t){let e=[];do e.push(Kx(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Kx(t){let e=[];do e.push(Gx(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Gx(t){let e=Qx(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Yx(t,e);else break;return e}function mc(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Yx(t,e){let n=mc(t),r=n;return t.eat(",")&&(t.next!="}"?r=mc(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Xx(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Qx(t){if(t.eat("(")){let e=kh(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Xx(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function eA(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let u={term:a,to:l};return e[o].push(u),u}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,u)=>a.concat(s(u,l)),[]);if(o.type=="seq")for(let a=0;;a++){let u=s(o.exprs[a],l);if(a==o.exprs.length-1)return u;i(u,l=n())}else if(o.type=="star"){let a=n();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let u=0;u<o.min;u++){let c=n();i(s(o.expr,a),c),a=c}if(o.max==-1)i(s(o.expr,a),a);else for(let u=o.min;u<o.max;u++){let c=n();r(a,c),i(s(o.expr,a),c),a=c}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function vh(t,e){return e-t}function gc(t,e){let n=[];return r(e),n.sort(vh);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&n.indexOf(a)==-1&&r(a)}}}function tA(t){let e=Object.create(null);return n(gc(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c<i.length;c++)i[c][0]==l&&(u=i[c][1]);gc(t,a).forEach(c=>{u||i.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[r.join(",")]=new Xn(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(vh);s.next.push({type:i[o][0],next:e[l.join(",")]||n(l)})}return s}}function nA(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:u}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function xh(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Ah(t,e){let n=Object.create(null);for(let r in t){let i=t[r],s=e&&e[r];if(s===void 0)if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r);else i.validate&&i.validate(s);n[r]=s}return n}function Ch(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new iA(t,r,e[r]);return n}let bc=class _h{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ch(e,r.attrs),this.defaultAttrs=xh(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Xn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ah(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new vn(this,this.computeAttrs(e),B.from(n),be.setFrom(r))}createChecked(e=null,n,r){return n=B.from(n),this.checkContent(n),new vn(this,this.computeAttrs(e),n,be.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=B.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(B.empty,!0);return s?new vn(this,e,n.append(s),be.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:be.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new _h(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function rA(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class iA{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?rA(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class io{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Ch(e,i.attrs),this.excluded=null;let s=xh(this.attrs);this.instance=s?new be(this,s):null}create(e=null){return!e&&this.instance?this.instance:new be(this,Ah(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new io(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class wh{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ue.from(e.nodes),n.marks=Ue.from(e.marks||{}),this.nodes=bc.compile(this.spec.nodes,this),this.marks=io.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Xn.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?yc(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:yc(this,o.split(" "))}this.nodeFromJSON=i=>vn.fromJSON(this,i),this.markFromJSON=i=>be.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof bc){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new ds(r,r.defaultAttrs,e,be.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function yc(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let l in t.marks){let a=t.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function sA(t){return t.tag!=null}function oA(t){return t.style!=null}class xn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(sA(i))this.tags.push(i);else if(oA(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new vc(this,n,!1);return r.addAll(e,be.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new vc(this,n,!0);return r.addAll(e,be.none,n.from,n.to),Z.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(uA(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=xc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=xc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xn(e,xn.schemaRules(e)))}}const Sh={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},lA={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Eh={ol:!0,ul:!0},si=1,Cl=2,Zr=4;function kc(t,e,n){return e!=null?(e?si:0)|(e==="full"?Cl:0):t&&t.whitespace=="pre"?si|Cl:n&~Zr}class Ni{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=be.none,this.match=s||(o&Zr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(B.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&si)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=B.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(B.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Sh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class vc{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=kc(null,n.preserveWhitespace,0)|(r?Zr:0);i?s=new Ni(i.type,i.attrs,be.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Ni(null,null,be.none,!0,null,o):s=new Ni(e.schema.topNodeType,null,be.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Cl?"full":this.localPreserveWS||(i.options&si)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
65
|
+
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Eh.hasOwnProperty(o)&&this.parser.normalizeLists&&aA(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:lA.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,c=this.needsBlock;if(Sh.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=a&&a.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),u&&this.sync(s),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
66
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(u=>!a.clearMark(u)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(e);if(u&&(!i||i.length>u.length+l)&&(i=u,s=a,!u.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=be.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Ac(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=kc(e,s,o.options);o.options&Zr&&o.content.length==0&&(l|=Zr);let a=be.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):Ac(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Ni(e,n,a,i,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=si)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let c=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function aA(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Eh.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function uA(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function xc(t){let e={};for(let n in t)e[n]=t[n];return e}function Ac(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:c}=l.edge(a);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class ir{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Ii(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let u=o.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let u=o.marks[a++],c=this.serializeMark(u,o.isInline,n);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return Ii(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Ki(Ii(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Ki(Ii(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Ki(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ir(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Cc(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Cc(e.marks)}}function Cc(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ii(t){return t.document||window.document}const _c=new WeakMap;function cA(t){let e=_c.get(t);return e===void 0&&_c.set(t,e=fA(t)),e}function fA(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Ki(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=cA(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let l,a=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let f in u)if(u[f]!=null){let d=f.indexOf(" ");d>0?a.setAttributeNS(f.slice(0,d),f.slice(d+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=c;f<e.length;f++){let d=e[f];if(d===0){if(f<e.length-1||f>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof d=="string")a.appendChild(t.createTextNode(d));else{let{dom:h,contentDOM:p}=Ki(t,d,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Dh=65535,Oh=Math.pow(2,16);function dA(t,e){return t+e*Oh}function wc(t){return t&Dh}function hA(t){return(t-(t&Dh))/Oh}const Th=1,Mh=2,Gi=4,$h=8;class _l{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&$h)>0}get deletedBefore(){return(this.delInfo&(Th|Gi))>0}get deletedAfter(){return(this.delInfo&(Mh|Gi))>0}get deletedAcross(){return(this.delInfo&Gi)>0}}class pt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pt.empty)return pt.empty}recover(e){let n=0,r=wc(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+hA(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let u=this.ranges[l+s],c=this.ranges[l+o],f=a+u;if(e<=f){let d=u?e==a?-1:e==f?1:n:n,h=a+i+(d<0?0:c);if(r)return h;let p=e==(n<0?a:f)?null:dA(l/3,e-a),m=0;return u&&(m|=e==a?Mh:e==f?Th:Gi,(n<0?e!=a:e!=f)&&(m|=$h)),new _l(h,m,p)}i+=c-u}return r?e+i:new _l(e+i,0,null)}touches(e,n){let r=0,i=wc(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+s],c=a+u;if(e<=c&&l==i*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),u=this.ranges[i+n],c=this.ranges[i+r];e(l,l+u,a,a+c),s+=c-u}}invert(){return new pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?pt.empty:new pt(e<0?[0,-e,0]:[0,0,e])}}pt.empty=new pt([]);class oi{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new oi(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new oi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new _l(e,i,null)}}const No=Object.create(null);class tt{getMap(){return pt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=No[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in No)throw new RangeError("Duplicate use of step JSON ID "+e);return No[e]=n,n.prototype.jsonID=e,n}}class Ne{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ne(e,null)}static fail(e){return new Ne(null,e)}static fromReplace(e,n,r,i){try{return Ne.ok(e.replace(n,r,i))}catch(s){if(s instanceof ri)return Ne.fail(s.message);throw s}}}function ba(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(ba(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return B.fromArray(r)}class gn extends tt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new Z(ba(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Ne.fromReplace(e,this.from,this.to,s)}invert(){return new jt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new gn(n.pos,r.pos,this.mark)}merge(e){return e instanceof gn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new gn(n.from,n.to,e.markFromJSON(n.mark))}}tt.jsonID("addMark",gn);class jt extends tt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Z(ba(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ne.fromReplace(e,this.from,this.to,r)}invert(){return new gn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new jt(n.pos,r.pos,this.mark)}merge(e){return e instanceof jt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new jt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new jt(n.from,n.to,e.markFromJSON(n.mark))}}tt.jsonID("removeMark",jt);class bn extends tt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ne.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new Z(B.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new bn(this.pos,n.marks[i]);return new bn(this.pos,this.mark)}}return new Qn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new bn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new bn(n.pos,e.markFromJSON(n.mark))}}tt.jsonID("addNodeMark",bn);class Qn extends tt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ne.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ne.fromReplace(e,this.pos,this.pos+1,new Z(B.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new bn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Qn(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Qn(n.pos,e.markFromJSON(n.mark))}}tt.jsonID("removeNodeMark",Qn);class $e extends tt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&wl(e,this.from,this.to)?Ne.fail("Structure replace would overwrite content"):Ne.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pt([this.from,this.to-this.from,this.slice.size])}invert(e){return new $e(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&$e.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new $e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof $e)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new $e(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new $e(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new $e(n.from,n.to,Z.fromJSON(e,n.slice),!!n.structure)}}$e.MAP_BIAS=1;tt.jsonID("replace",$e);class ze extends tt{constructor(e,n,r,i,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(wl(e,this.from,this.gapFrom)||wl(e,this.gapTo,this.to)))return Ne.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ne.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ne.fromReplace(e,this.from,this.to,r):Ne.fail("Content does not fit in gap")}getMap(){return new pt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new ze(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new ze(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ze(n.from,n.to,n.gapFrom,n.gapTo,Z.fromJSON(e,n.slice),n.insert,!!n.structure)}}tt.jsonID("replaceAround",ze);function wl(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function pA(t,e,n,r){let i=[],s=[],o,l;t.doc.nodesBetween(e,n,(a,u,c)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let d=Math.max(u,e),h=Math.min(u+a.nodeSize,n),p=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(p)||(o&&o.to==d&&o.mark.eq(f[m])?o.to=h:i.push(o=new jt(d,h,f[m])));l&&l.to==d?l.to=h:s.push(l=new gn(d,h,r))}}),i.forEach(a=>t.step(a)),s.forEach(a=>t.step(a))}function mA(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof io){let u=o.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let u=Math.min(l+o.nodeSize,n);for(let c=0;c<a.length;c++){let f=a[c],d;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&f.eq(i[h].style)&&(d=p)}d?(d.to=u,d.step=s):i.push({style:f,from:Math.max(l,e),to:u,step:s})}}}),i.forEach(o=>t.step(new jt(o.from,o.to,o.style)))}function ya(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let u=s.child(a),c=l+u.nodeSize,f=r.matchType(u.type);if(!f)o.push(new $e(l,c,Z.empty));else{r=f;for(let d=0;d<u.marks.length;d++)n.allowsMarkType(u.marks[d].type)||t.step(new jt(l,c,u.marks[d]));if(i&&u.isText&&n.whitespace!="pre"){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(u.text);)p||(p=new Z(B.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new $e(l+d.index,l+d.index+d[0].length,p))}}l=c}if(!r.validEnd){let a=r.fillBefore(B.empty,!0);t.replace(l,l,new Z(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function gA(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Dr(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+i,a=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!gA(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function bA(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,u=l,c=B.empty,f=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=B.from(r.node(p).copy(c)),f++):a--;let d=B.empty,h=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,d=B.from(i.node(p).copy(d)),h++):u++;t.step(new ze(a,u,o,l,new Z(c.append(d),f,h),c.size-f,!0))}function ka(t,e,n=null,r=t){let i=yA(t,e),s=i&&kA(r,e);return s?i.map(Sc).concat({type:e,attrs:n}).concat(s.map(Sc)):null}function Sc(t){return{type:t,attrs:null}}function yA(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function kA(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;a&&u<i;u++)a=a.matchType(n.child(u).type);return!a||!a.validEnd?null:o}function vA(t,e,n){let r=B.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=B.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new ze(i,s,i,s,new Z(r,0,0),n.length,!0))}function xA(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&AA(t.doc,t.mapping.slice(s).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?u=!1:!h&&p&&(u=!0)}u===!1&&Ih(t,o,l,s),ya(t,t.mapping.slice(s).map(l,1),r,void 0,u===null);let c=t.mapping.slice(s),f=c.map(l,1),d=c.map(l+o.nodeSize,1);return t.step(new ze(f,d,f+1,d-1,new Z(B.from(r.create(a,null,o.marks)),0,0),1,!0)),u===!0&&Nh(t,o,l,s),!1}})}function Nh(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Ih(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
67
|
+
`))}})}function AA(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function CA(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ze(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Z(B.from(o),0,0),1,!0))}function rn(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>s;u--,c--){let f=i.node(u),d=i.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function _A(t,e,n=1,r){let i=t.doc.resolve(e),s=B.empty,o=B.empty;for(let l=i.depth,a=i.depth-n,u=n-1;l>a;l--,u--){s=B.from(i.node(l).copy(s));let c=r&&r[u];o=B.from(c?c.type.create(c.attrs,o):i.node(l).copy(o))}t.step(new $e(e,e,new Z(s.append(o),n,n),!0))}function Mn(t,e){let n=t.resolve(e),r=n.index();return Fh(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function wA(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Fh(t,e){return!!(t&&e&&!t.isLeaf&&wA(t,e))}function so(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Fh(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function SA(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);c&&!f?r=!1:!c&&f&&(r=!0)}let l=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);Ih(t,c.node(),c.before(),l)}o.inlineContent&&ya(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let a=t.mapping.slice(l),u=a.map(e-n);if(t.step(new $e(u,a.map(e+n,-1),Z.empty,!0)),r===!0){let c=t.doc.resolve(u);Nh(t,c.node(),c.before(),t.steps.length)}return t}function EA(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Rh(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),u=r.node(o),c=!1;if(s==1)c=u.canReplace(a,a,i);else{let f=u.contentMatchAt(a).findWrapping(i.firstChild.type);c=f&&u.canReplaceWith(a,a,f[0])}if(c)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function oo(t,e,n=e,r=Z.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return Ph(i,s,r)?new $e(e,n,r):new DA(i,s,r).fit()}function Ph(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class DA{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=B.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=B.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new Z(s,o,l);return e>-1?new ze(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new $e(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ec(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],c,f=null;if(n==1&&(o?u.matchType(o.type)||(f=u.fillBefore(B.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return Dc(e,-1)<=n?!1:(this.unplaced.size>1&&Dc(e,1)>r&&r++,this.unplaced=new Z(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ec(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new Z(Pr(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Z(Pr(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,u=0,c=[],{match:f,type:d}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));f=f.matchFragment(i)}let h=l.size+e-(o.content.size-o.openEnd);for(;u<l.childCount;){let m=l.child(u),g=f.matchType(m.type);if(!g)break;u++,(u>1||a==0||m.content.size)&&(f=g,c.push(Bh(m.mark(d.allowedMarks(m.marks)),u==1?a:0,u==l.childCount?h:-1)))}let p=u==l.childCount;p||(h=-1),this.placed=Br(this.placed,n,B.from(c)),this.frontier[n].match=f,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<h;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?Z.empty:new Z(Pr(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new Z(Pr(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Io(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Io(e,n,i,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],c=Io(e,l,u,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Br(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Br(this.placed,this.depth,B.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(B.empty,!0);n.childCount&&(this.placed=Br(this.placed,this.frontier.length,n))}}function Pr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Pr(t.firstChild.content,e-1,n)))}function Br(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Br(t.lastChild.content,e-1,n)))}function Ec(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Bh(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Bh(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(B.empty,!0)))),t.copy(r)}function Io(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!OA(n,s.content,o)?l:null}function OA(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function TA(t){return t.spec.defining||t.spec.definingForContent}function Dc(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function MA(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(Ph(i,s,r))return t.step(new $e(e,n,r));let o=Lh(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let d=i.depth,h=i.pos-1;d>0;d--,h--){let p=i.node(d).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(d)>-1?l=d:i.before(d)==h&&o.splice(1,0,-d)}let a=o.indexOf(l),u=[],c=r.openStart;for(let d=r.content,h=0;;h++){let p=d.firstChild;if(u.push(p),h==r.openStart)break;d=p.content}for(let d=c-1;d>=0;d--){let h=u[d],p=TA(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))c=d;else if(p||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+c+1)%(r.openStart+1),p=u[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],b=!0;g<0&&(b=!1,g=-g);let _=i.node(g-1),k=i.index(g-1);if(_.canReplaceWith(k,k,p.type,p.marks))return t.replace(i.before(g),b?s.after(g):n,new Z(zh(r.content,0,r.openStart,h),h,r.openEnd))}}let f=t.steps.length;for(let d=o.length-1;d>=0&&(t.replace(e,n,r),!(t.steps.length>f));d--){let h=o[d];h<0||(e=i.before(h),n=s.after(h))}}function zh(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(zh(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(B.empty,!0))}return t}function $A(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=EA(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new Z(B.from(r),0,0))}function NA(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>o;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=i.depth;a>0&&n==i.start(a);a--)n=i.before(a);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=Lh(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Lh(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class pr extends tt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ne.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Ne.fromReplace(e,this.pos,this.pos+1,new Z(B.from(i),0,n.isLeaf?0:1))}getMap(){return pt.empty}invert(e){return new pr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new pr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new pr(n.pos,n.attr,n.value)}}tt.jsonID("attr",pr);class li extends tt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Ne.ok(r)}getMap(){return pt.empty}invert(e){return new li(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new li(n.attr,n.value)}}tt.jsonID("docAttr",li);let kr=class extends Error{};kr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};kr.prototype=Object.create(Error.prototype);kr.prototype.constructor=kr;kr.prototype.name="TransformError";class jh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new oi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new kr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Z.empty){let i=oo(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new Z(B.from(r),0,0))}delete(e,n){return this.replace(e,n,Z.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return MA(this,e,n,r),this}replaceRangeWith(e,n,r){return $A(this,e,n,r),this}deleteRange(e,n){return NA(this,e,n),this}lift(e,n){return bA(this,e,n),this}join(e,n=1){return SA(this,e,n),this}wrap(e,n){return vA(this,e,n),this}setBlockType(e,n=e,r,i=null){return xA(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return CA(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new pr(e,n,r)),this}setDocAttribute(e,n){return this.step(new li(e,n)),this}addNodeMark(e,n){return this.step(new bn(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof be)n.isInSet(r.marks)&&this.step(new Qn(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Qn(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return _A(this,e,n,r),this}addMark(e,n,r){return pA(this,e,n,r),this}removeMark(e,n,r){return mA(this,e,n,r),this}clearIncompatible(e,n,r){return ya(this,e,n,r),this}}const Fo=Object.create(null);class ie{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new IA(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Z.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:u}=o[l],c=e.mapping.slice(s);e.replaceRange(c.map(a.pos),c.map(u.pos),l?Z.empty:n),l==0&&Mc(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),u=a.map(o.pos),c=a.map(l.pos);s?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),Mc(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ne(e):ur(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?ur(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):ur(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new gt(e.node(0))}static atStart(e){return ur(e,e,0,0,1)||new gt(e)}static atEnd(e){return ur(e,e,e.content.size,e.childCount,-1)||new gt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Fo[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Fo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Fo[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ne.between(this.$anchor,this.$head).getBookmark()}}ie.prototype.visible=!0;class IA{constructor(e,n){this.$from=e,this.$to=n}}let Oc=!1;function Tc(t){!Oc&&!t.parent.inlineContent&&(Oc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ne extends ie{constructor(e,n=e){Tc(e),Tc(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ie.near(r);let i=e.resolve(n.map(this.anchor));return new ne(i.parent.inlineContent?i:r,r)}replace(e,n=Z.empty){if(super.replace(e,n),n==Z.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ne&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new lo(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ne(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=ie.findFrom(n,r,!0)||ie.findFrom(n,-r,!0);if(s)n=s.$head;else return ie.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ie.findFrom(e,-r,!0)||ie.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ne(e,n)}}ie.jsonID("text",ne);class lo{constructor(e,n){this.anchor=e,this.head=n}map(e){return new lo(e.map(this.anchor),e.map(this.head))}resolve(e){return ne.between(e.resolve(this.anchor),e.resolve(this.head))}}class X extends ie{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?ie.near(s):new X(s)}content(){return new Z(B.from(this.node),0,0)}eq(e){return e instanceof X&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new va(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new X(e.resolve(n.anchor))}static create(e,n){return new X(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}X.prototype.visible=!1;ie.jsonID("node",X);class va{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new lo(r,r):new va(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&X.isSelectable(r)?new X(n):ie.near(n)}}class gt extends ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Z.empty){if(n==Z.empty){e.delete(0,e.doc.content.size);let r=ie.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new gt(e)}map(e){return new gt(e)}eq(e){return e instanceof gt}getBookmark(){return FA}}ie.jsonID("all",gt);const FA={map(){return this},resolve(t){return new gt(t)}};function ur(t,e,n,r,i,s=!1){if(e.inlineContent)return ne.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&X.isSelectable(l))return X.create(t,n-(i<0?l.nodeSize:0))}else{let a=ur(t,l,n+i,i<0?l.childCount:0,i,s);if(a)return a}n+=l.nodeSize*i}return null}function Mc(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof $e||i instanceof ze))return;let s=t.mapping.maps[r],o;s.forEach((l,a,u,c)=>{o==null&&(o=c)}),t.setSelection(ie.near(t.doc.resolve(o),n))}const $c=1,Fi=2,Nc=4;class RA extends jh{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|$c)&~Fi,this.storedMarks=null,this}get selectionSet(){return(this.updated&$c)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fi,this}ensureMarks(e){return be.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Fi)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||be.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ie.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Nc,this}get scrolledIntoView(){return(this.updated&Nc)>0}}function Ic(t,e){return!e||!t?t:t.bind(e)}class zr{constructor(e,n,r){this.name=e,this.init=Ic(n.init,r),this.apply=Ic(n.apply,r)}}const PA=[new zr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new zr("selection",{init(t,e){return t.selection||ie.atStart(e.doc)},apply(t){return t.selection}}),new zr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new zr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ro{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=PA.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new zr(r.key,r.spec.state,r))})}}class dr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,u=i?i[o].state:this,c=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,u,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new dr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new RA(this)}static create(e){let n=new Ro(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new dr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Ro(this.schema,e.plugins),r=n.fields,i=new dr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ro(e.schema,e.plugins),s=new dr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=vn.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=ie.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=u.fromJSON.call(a,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function qh(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=qh(i,e,{})),n[r]=i}return n}class Ye{constructor(e){this.spec=e,this.props={},e.props&&qh(e.props,this,this.props),this.key=e.key?e.key.key:Vh("plugin")}getState(e){return e[this.key]}}const Po=Object.create(null);function Vh(t){return t in Po?t+"$"+ ++Po[t]:(Po[t]=0,t+"$")}class vt{constructor(e="key"){this.key=Vh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const He=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},vr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Sl=null;const Xt=function(t,e,n){let r=Sl||(Sl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},BA=function(){Sl=null},er=function(t,e,n,r){return n&&(Fc(t,e,n,r,-1)||Fc(t,e,n,r,1))},zA=/^(img|br|input|textarea|hr)$/i;function Fc(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Qe(t))){let o=t.parentNode;if(!o||!Y(o)||bi(t)||zA.test(t.nodeName)||t.contentEditable=="false")return!1;e=He(t)+(i<0?0:1),t=o}else if(Y(t)){let o=t.childNodes[e+(i<0?-1:0)];if(Y(o)&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Qe(t):0}else return!1}}function Qe(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Y(t){return t.nodeType==1}function Re(t){return t.nodeType==3}function tr(t,e){return e?t.contains(Y(e)?e:e.parentNode):!1}function LA(t,e){for(;;){if(Re(t)&&e)return t;if(Y(t)&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Qe(t)}else if(t.parentNode&&!bi(t))e=He(t),t=t.parentNode;else return null}}function jA(t,e){for(;;){if(Re(t)&&e<t.nodeValue.length)return t;if(Y(t)&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!bi(t))e=He(t)+1,t=t.parentNode;else return null}}function qA(t,e,n){for(let r=e==0,i=e==Qe(t);r||i;){if(t==n)return!0;let s=He(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Qe(t)}}function bi(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ao=function(t){return t.focusNode&&er(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Rn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function VA(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function UA(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Qe(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Qe(r.startContainer),r.startOffset)}}}const Ut=typeof navigator<"u"?navigator:null,Rc=typeof document<"u"?document:null,$n=Ut&&Ut.userAgent||"",El=/Edge\/(\d+)/.exec($n),Uh=/MSIE \d/.exec($n),Dl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($n),ct=!!(Uh||Dl||El),An=Uh?document.documentMode:Dl?+Dl[1]:El?+El[1]:0,bt=!ct&&/gecko\/(\d+)/i.test($n);bt&&+(/Firefox\/(\d+)/.exec($n)||[0,0])[1];const Ol=!ct&&/Chrome\/(\d+)/.exec($n),Je=!!Ol,Hh=Ol?+Ol[1]:0,et=!ct&&!!Ut&&/Apple Computer/.test(Ut.vendor),xr=et&&(/Mobile\/\w+/.test($n)||!!Ut&&Ut.maxTouchPoints>2),_t=xr||(Ut?/Mac/.test(Ut.platform):!1),Zh=Ut?/Win/.test(Ut.platform):!1,tn=/Android \d/.test($n),uo=!!Rc&&"webkitFontSmoothing"in Rc.documentElement.style,HA=uo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ZA(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Jt(t,e){return typeof t=="number"?t:t[e]}function WA(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Pc(t,e,n){if(!Tl(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(!Y(o)){o=vr(o);continue}let l=o==s.body,a=l?ZA(s):WA(o),u=0,c=0;if(e.top<a.top+Jt(r,"top")?c=-(a.top-e.top+Jt(i,"top")):e.bottom>a.bottom-Jt(r,"bottom")&&(c=e.bottom-e.top>a.bottom-a.top?e.top+Jt(i,"top")-a.top:e.bottom-a.bottom+Jt(i,"bottom")),e.left<a.left+Jt(r,"left")?u=-(a.left-e.left+Jt(i,"left")):e.right>a.right-Jt(r,"right")&&(u=e.right-a.right+Jt(i,"right")),u||c)if(l)s.defaultView.scrollBy(u,c);else{let d=o.scrollLeft,h=o.scrollTop;c&&(o.scrollTop+=c),u&&(o.scrollLeft+=u);let p=o.scrollLeft-d,m=o.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:vr(o)}}function JA(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(s,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Wh(t.dom)}}function Wh(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=vr(r));return e}function KA({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Jh(n,r==0?0:r-e)}function Jh(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let lr=null;function GA(t){if(t.setActive)return t.setActive();if(lr)return t.focus(lr);let e=Wh(t);t.focus(lr==null?{get preventScroll(){return lr={preventScroll:!0},!0}}:void 0),lr||(lr=!1,Jh(e,0))}function Kh(t,e){let n,r=2e8,i,s=0,o=e.top,l=e.top,a,u;for(let c=t.firstChild,f=0;c;c=c.nextSibling,f++){let d;if(Y(c))d=c.getClientRects();else if(Re(c))d=Xt(c).getClientRects();else continue;for(let h=0;h<d.length;h++){let p=d[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,i=m&&Re(n)?{left:p.right<e.left?p.right:p.left,top:e.top}:e,Y(c)&&m&&(s=f+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=f+1)}}return!n&&a&&(n=a,i=u,r=0),n&&Re(n)?YA(n,i):!n||r?{node:t,offset:s}:Kh(n,i)}function YA(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=fn(r,1);if(o.top!=o.bottom&&xa(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function xa(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function XA(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function QA(t,e,n){let{node:r,offset:i}=Kh(e,n),s=-1;if(Y(r)&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function eC(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),a;if(!l)return null;if(Y(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function Gh(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(Y(o)){let l=o.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(xa(e,u))return Gh(o,e,u)}}if((s=(s+1)%r)==i)break}return t}function tC(t,e){let n=t.dom.ownerDocument,r,i=0,s=UA(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o)){let u=t.dom.getBoundingClientRect();if(!xa(e,u)||(o=Gh(t.dom,e,u),!o))return null}if(et)for(let u=o;r&&u;u=vr(u))u.draggable&&(r=void 0);if(o=XA(o,e),r){if(bt&&Y(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],f;c.nodeName=="IMG"&&(f=c.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;uo&&i&&Y(r)&&Y(u=r.childNodes[i-1])&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&Y(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||!Y(r)||r.childNodes[i-1].nodeName!="BR")&&(l=eC(t,r,i,e))}l==null&&(l=QA(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Tl(t){return t.top<t.bottom||t.left<t.right}function fn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Tl(r))return r}return Array.prototype.find.call(n,Tl)||t.getBoundingClientRect()}const nC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Yh(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=uo||bt;if(Re(r))if(o&&(nC.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=fn(Xt(r,i,i),n);if(bt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=fn(Xt(r,i-1,i-1),-1);if(u.top==a.top){let c=fn(Xt(r,i,i+1),-1);if(c.top!=a.top)return Tr(c,c.left<u.left)}}return a}else{let a=i,u=i,c=n<0?1:-1;return n<0&&!i?(u++,c=-1):n>=0&&i==r.nodeValue.length?(a--,c=1):n<0?a--:u++,Tr(fn(Xt(r,a,u),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Qe(r))){let a=r.childNodes[i-1];if(Y(a))return Bo(a.getBoundingClientRect(),!1)}if(s==null&&i<Qe(r)){let a=r.childNodes[i];if(Y(a))return Bo(a.getBoundingClientRect(),!0)}return Bo(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Qe(r))){let a=r.childNodes[i-1],u=Re(a)?Xt(a,Qe(a)-(o?0:1)):Y(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Tr(fn(u,1),!1)}if(s==null&&i<Qe(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?Re(a)?Xt(a,0,o?0:1):Y(a)?a:null:null;if(u)return Tr(fn(u,-1),!0)}return Tr(fn(Re(r)?Xt(r):r,-n),n>=0)}function Tr(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Bo(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Xh(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function rC(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Xh(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Yh(t,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(Y(l))a=l.getClientRects();else if(Re(l))a=Xt(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let c=a[u];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const iC=/[\u0590-\u08ac]/;function sC(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=t.domSelection();return l?!iC.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:Xh(t,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),d=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!tr(h,p)||a==p&&u==m;try{l.collapse(c,f),a&&(a!=c||u!=f)&&l.extend&&l.extend(a,u)}catch{}return d!=null&&(l.caretBidiLevel=d),g}):r.pos==r.start()||r.pos==r.end()}let Bc=null,zc=null,Lc=!1;function oC(t,e,n){return Bc==e&&zc==n?Lc:(Bc=e,zc=n,Lc=n=="up"||n=="down"?rC(t,e,n):sC(t,e,n))}const Et=0,jc=1,Bn=2,$t=3;class yi{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Et,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&tr(this.contentDOM,e))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>He(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(Y(o)?tr(o,e):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(;r>0;r--){let s=this.children[r-1];if(s.size||!(s instanceof ep||s instanceof Qh&&s.side>=0))break}if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?He(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?He(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],u=o+a.size;if(i==-1&&e<=u){let c=o+a.border;if(e>=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,c);e=o;for(let f=l;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=He(d.dom)+1;break}e-=d.size}i==-1&&(i=0)}if(i>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;c<this.children.length;c++){let f=this.children[c];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=He(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(!Y(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),f=!1;if((bt||et)&&e==n){let{node:h,offset:p}=l;if(Re(h)){if(f=!!(p&&h.nodeValue[p-1]==`
|
|
68
|
+
`),f&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:He(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(bt&&c.focusNode&&c.focusNode!=a.node&&Y(c.focusNode)){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||f&&et)&&er(l.node,l.offset,c.anchorNode,c.anchorOffset)&&er(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((u.extend||e==n)&&!(f&&bt)){u.collapse(l.node,l.offset);try{e!=n&&u.extend(a.node,a.offset),d=!0}catch{}}if(!d){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+s.border,a=o-s.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?Bn:jc,e==l&&n==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=$t:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Bn:$t}r=o}this.dirty=Bn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Bn:jc;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Qh extends yi{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){let l=Y(o)?o:document.createElement("span");l!=o&&l.appendChild(o),l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Et&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class lC extends yi{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Cn extends yi{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=ir.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Cn(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&$t||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$t&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Et){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Et}}slice(e,n,r){let i=Cn.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=$l(s,n,o,r)),e>0&&(s=$l(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class _n extends yi{constructor(e,n,r,i,s,o,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,s,o){let l=s.nodeViews[n.type.name],a,u=l&&l(n,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),c=u&&u.dom,f=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(!Re(c))throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=ir.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=rp(c,r,n),u?a=new aC(e,n,r,i,c,f||null,d,u):n.isText?new co(e,n,r,i,c,d):new _n(e,n,r,i,c,f||null,d)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>Y(i)&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>B.empty}}return n}matchesNode(e,n,r){return this.dirty==Et&&e.eq(this.node)&&hs(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new cC(this,o&&o.node,e),u=this.node.inlineContent,c=u&&this.node.isBlock;hC(this.node,this.innerDeco,(f,d,h)=>{f.spec.marks?a.syncToMarks(f.spec.marks,r,e,d):f.type.side>=0&&!h&&a.syncToMarks(d==this.node.childCount?be.none:this.node.child(d).marks,r,e,d),a.placeWidget(f,e,i)},(f,d,h,p)=>{a.syncToMarks(f.marks,r,e,p),c&&f.isAtom&&!f.isText&&a.addHackNode("IMG",a.top);let m;a.findNodeMatch(f,d,h,p)||l&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(m=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(f,d,h,m,e)||a.updateNextNode(f,d,h,e,p,i)||a.addNode(f,d,h,e,i),i+=f.nodeSize,u&&(c=f.isAtom&&!f.isText)}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Bn)&&(o&&this.protectLocalComposition(e,o),tp(this.contentDOM,this.children,e),xr&&pC(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ne)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=mC(this.node.content,o,r-n,i-n);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new lC(this,s,n,i);e.input.compositionNodes.push(o),this.children=$l(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==$t||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Et}updateOuterDeco(e){if(hs(e,this.outerDeco))return;let n=!Y(this.nodeDOM),r=this.dom;this.dom=np(this.dom,this.nodeDOM,Ml(this.outerDeco,this.node,n),Ml(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){Y(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){Y(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function qc(t,e,n,r,i){rp(r,e,t);let s=new _n(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class co extends _n{constructor(e,n,r,i,s,o){super(e,n,r,i,s,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==$t||this.dirty!=Et&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Et||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Et,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new co(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=$t)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ep extends yi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Et&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class aC extends _n{constructor(e,n,r,i,s,o,l,a){super(e,n,r,i,s,o,l),this.spec=a}update(e,n,r,i){if(this.dirty==$t)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function tp(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=Vc(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(o instanceof Cn){let a=r?r.previousSibling:t.lastChild;tp(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=Vc(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Wr=function(t){t&&(this.nodeName=t)};Wr.prototype=Object.create(null);const zn=[new Wr];function Ml(t,e,n){if(t.length==0)return zn;let r=n?zn[0]:new Wr,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Wr(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&i.length==1&&i.push(r=new Wr(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function np(t,e,n,r){if(n==zn&&r==zn)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=zn[0]),i=a}uC(i,l||zn[0],o)}return i}function uC(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function rp(t,e,n){return np(t,t,zn,Ml(e,n,!Y(t)))}function hs(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Vc(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class cC{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=fC(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Et,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let c=this.index;c<u;c++){let f=this.top.children[c];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){a=c;break}}if(a<0&&this.index<this.top.children.length){let c=this.top.children[this.index];c instanceof Cn&&c.dirty!=$t&&c.mark.type==e[o].type&&c.spec.update&&!this.isLocked(c.dom)&&c.spec.update(e[o])&&(c.mark=e[o],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=Cn.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let u=this.top.children[l];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==$t&&o.dom==o.contentDOM&&(o.dirty=Bn),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof _n){let u=this.preMatch.matched.get(a);if(u!=null&&u!=s)return!1;let c=a.dom,f,d=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=$t&&hs(n,a.outerDeco));if(!d&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!d&&(f=this.recreateWrapper(a,e,n,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Bn,f.updateChildren(i,o+1),f.dirty=Et),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!hs(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=_n.create(this.top,n,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,i,s){let o=_n.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Qh(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Cn;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof co)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((et||Je)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new ep(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||Y(e)&&e.contains(this.lock.parentNode))}}function fC(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof Cn)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function dC(t,e){return t.type.side-e.type.side}function hC(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,i,e.forChild(s,c),u),s+=c.nodeSize}return}let o=0,l=[],a=null;for(let u=0;;){let c,f;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(c?(f||(f=[c])).push(g):c=g)}if(c)if(f){f.sort(dC);for(let g=0;g<f.length;g++)n(f[g],u,!!a)}else n(c,u,!!a);let d,h;if(a)h=-1,d=a,a=null;else if(u<t.childCount)h=u,d=t.child(u++);else break;for(let g=0;g<l.length;g++)l[g].to<=s&&l.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+d.nodeSize;if(d.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<p&&(a=d.cut(g-s),d=d.cut(0,g-s),p=g,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=d.isInline&&!d.isLeaf?l.filter(g=>!g.inline):l.slice();r(d,m,e.forChild(s,d),h),s=p}}function pC(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function mC(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<t.childCount;){let u=t.child(i++);if(s+=u.nodeSize,!u.isText)break;a+=u.text}if(s>=n){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l<r?a.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=n)return l+u;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function $l(t,e,n,r,i){let s=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],u=l,c=l+=a.size;u>=n||c<=e?s.push(a):(u<e&&s.push(a.slice(0,e-u,r)),i&&(s.push(i),i=void 0),c>n&&s.push(a.slice(n-u,a.size,r)))}return s}function Aa(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,u;if(ao(n)){for(a=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&X.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&qA(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;u=new X(o==f?l:r.resolve(f))}else if(bt&&e=="key"&&o>t.state.selection.to&&Y(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&i&&i.posAtStart>t.state.selection.to)for(let f=n.focusNode;;f=f.parentNode){if(getComputedStyle(f).overflow!="visible"){u=ie.findFrom(r.resolve(i.posAtStart),1);break}if(f==i.dom||f.nextSibling||!f.parentNode||!Y(f.parentNode))break}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=o,d=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),d=Math.max(d,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(f<0)return null;[a,o]=d==t.state.selection.anchor?[d,f]:[f,d],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);if(!u){let f=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;u=Ca(t,c,l,f)}return u}function ip(t){return t.editable?t.hasFocus():op(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function sn(t,e=!1){let n=t.state.selection;if(sp(t,n),!ip(t))return;let r=t.input.mouseDown;if(!e&&Je&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&er(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)bC(t);else{let{anchor:i,head:s}=n,o,l;Uc&&!(n instanceof ne)&&(n.$from.parent.inlineContent||(o=Hc(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=Hc(t,n.to))),t.docView.setSelection(i,s,t,e),Uc&&(o&&Zc(o),l&&Zc(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&gC(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const Uc=et||Je&&Hh<63;function Hc(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(et&&i&&i.contentEditable=="false")return zo(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return zo(i);if(s)return zo(s)}}function zo(t){return t.contentEditable="true",et&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Zc(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function gC(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!ip(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function bC(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,He(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ct&&An<=11&&(n.disabled=!0,n.disabled=!1)}function sp(t,e){if(e instanceof X){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Wc(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Wc(t)}function Wc(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ca(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ne.between(e,n,r)}function Jc(t){return t.editable&&!t.hasFocus()?!1:op(t)}function op(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return tr(t.dom,e.anchorNode)&&(t.editable||tr(t.dom,e.focusNode))}catch{return!1}}function yC(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return er(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Nl(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ie.findFrom(s,e)}function dn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Kc(t,e,n){let r=t.state.selection;if(r instanceof ne)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return dn(t,new ne(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Nl(t.state,e);return i&&i instanceof X?dn(t,i):!1}else if(!(_t&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?X.isSelectable(s)?dn(t,new X(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):dn(t,new ne(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1}}else return!1;else{if(r instanceof X&&r.node.isInline)return dn(t,new ne(e>0?r.$to:r.$from));{let i=Nl(t.state,e);return i?dn(t,i):!1}}}function Jr(t,e){let n=t.pmViewDesc;return n?n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR"):Y(t)&&t.contentEditable=="false"}function ar(t,e){return e<0?kC(t):vC(t)}function kC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(bt&&Y(n)&&r<Qe(n)&&Jr(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!Y(n))break;let l=n.childNodes[r-1];if(Jr(l,-1))i=n,s=--r;else if(Re(l))n=l,r=n.nodeValue.length;else break}else{if(lp(n))break;{let l=n.previousSibling;for(;l&&Jr(l,-1);)i=n.parentNode,s=He(l),l=l.previousSibling;if(l)n=l,r=Qe(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Il(t,n,r):i&&Il(t,i,s)}function vC(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Qe(n),s,o;for(;;)if(r<i){if(!Y(n))break;let l=n.childNodes[r];if(Jr(l,1))s=n,o=++r;else break}else{if(lp(n))break;{let l=n.nextSibling;for(;l&&Jr(l,1);)s=l.parentNode,o=He(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Qe(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Il(t,s,o)}function lp(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function xC(t,e){for(;t&&e==t.childNodes.length&&!bi(t);)e=He(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(Re(n))return n;if(Y(n)&&n.contentEditable=="false")break;t=n,e=0}}function AC(t,e){for(;t&&!e&&!bi(t);)e=He(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(Re(n))return n;if(Y(n)&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Il(t,e,n){if(!Re(e)){let s,o;(o=xC(e,n))?(e=o,n=0):(s=AC(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ao(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&sn(t)},50)}function Gc(t,e){let n=t.state.doc.resolve(e);if(!(Je||Zh)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Yc(t,e,n){let r=t.state.selection;if(r instanceof ne&&!r.empty||n.indexOf("s")>-1||_t&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Nl(t.state,e);if(o&&o instanceof X)return dn(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof gt?ie.near(o,e):ie.findFrom(o,e);return l?dn(t,l):!1}return!1}function Xc(t,e){if(!(t.state.selection instanceof ne))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Qc(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function CC(t){if(!et||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&Y(e)&&n==0&&e.firstChild&&Y(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Qc(t,r,"true"),setTimeout(()=>Qc(t,r,"false"),20)}return!1}function _C(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function wC(t,e){let n=e.keyCode,r=_C(e);if(n==8||_t&&n==72&&r=="c")return Xc(t,-1)||ar(t,-1);if(n==46&&!e.shiftKey||_t&&n==68&&r=="c")return Xc(t,1)||ar(t,1);if(n==13||n==27)return!0;if(n==37||_t&&n==66&&r=="c"){let i=n==37?Gc(t,t.state.selection.from)=="ltr"?-1:1:-1;return Kc(t,i,r)||ar(t,i)}else if(n==39||_t&&n==70&&r=="c"){let i=n==39?Gc(t,t.state.selection.from)=="ltr"?1:-1:1;return Kc(t,i,r)||ar(t,i)}else{if(n==38||_t&&n==80&&r=="c")return Yc(t,-1,r)||ar(t,-1);if(n==40||_t&&n==78&&r=="c")return CC(t)||Yc(t,1,r)||ar(t,1);if(r==(_t?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function _a(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||ir.fromSchema(t.state.schema),l=hp(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,c,f=0;for(;u&&Y(u)&&(c=dp[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=l.createElement(c[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),f++}u=a.firstChild}u&&Y(u)&&u.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
69
|
+
|
|
70
|
+
`);return{dom:a,text:d,slice:e}}function ap(t,e,n,r,i){let s=i.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||s||!n);if(a){if(t.someProp("transformPastedText",d=>{e=d(e,s||r,t)}),s)return l=new Z(B.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
71
|
+
`))),0,0),t.someProp("transformPasted",d=>{l=d(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",d=>d(e,i,r,t));if(f)l=f;else{let d=i.marks(),{schema:h}=t.state,p=ir.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,d)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),o=OC(n),uo&&TC(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let d=o.firstChild;for(;d&&!Y(d);)d=d.nextSibling;if(!d)break;o=d}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||xn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!SC.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)l=MC(ef(l,+c[1],+c[2]),c[4]);else if(l=Z.maxOpen(EC(l.content,i),!0),l.openStart||l.openEnd){let f=0,d=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;d<l.openEnd&&!h.type.spec.isolating;d++,h=h.lastChild);l=ef(l,f,d)}return t.someProp("transformPasted",f=>{l=f(l,t,a)}),l}const SC=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function EC(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&s.length&&cp(a,s,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=fp(o[o.length-1],s.length));let c=up(l,a);o.push(c),i=i.matchType(c.type),s=a}}),o)return B.from(o)}return t}function up(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,B.from(t));return t}function cp(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=cp(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(B.from(up(n,t,i+1))))}}function fp(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,fp(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(B.empty,!0);return t.copy(n.append(r))}function Fl(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),i<r-1&&(l=Fl(l,e,n,r,i+1,s)),i>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(B.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function ef(t,e,n){return e<t.openStart&&(t=new Z(Fl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Z(Fl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const dp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function hp(){return document.implementation.createHTMLDocument("title")}let Mr=null;function DC(t){let e=window.trustedTypes;if(!e)return t;if(!Mr){if(Mr=e.defaultPolicy)try{return Mr.createHTML(t)}catch{}Mr=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Mr.createHTML(t)}function OC(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=hp(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&dp[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=DC(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;for(let o=0;o<n.styleSheets.length;o++){let l=n.styleSheets[o];for(let a=0;a<l.rules.length;a++){let u=l.rules[a];if(u instanceof CSSStyleRule){let c=r.querySelectorAll(u.selectorText);for(let f=0;f<c.length;f++)c[f].style.cssText+=u.style.cssText}}}return r}function TC(t){let e=t.querySelectorAll(Je?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function MC(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{i=B.from(a.create(r[l+1],i))}catch{break}s++,o++}return new Z(i,s,o)}const rt={},it={},$C={touchstart:!0,touchmove:!0};class NC{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function IC(t){for(let e in rt){let n=rt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{RC(t,r)&&!wa(t,r)&&(t.editable||!(r.type in it))&&n(t,r)},$C[e]?{passive:!0}:void 0)}et&&t.dom.addEventListener("input",()=>null),Rl(t)}function nn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function FC(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Rl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>wa(t,r))})}function wa(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function RC(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function PC(t,e){!wa(t,e)&&rt[e.type]&&(t.editable||!(e.type in it))&&rt[e.type](t,e)}it.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!bp(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(tn&&Je&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),xr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Rn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||wC(t,n)?n.preventDefault():nn(t,"key")};it.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};it.keypress=(t,e)=>{let n=e;if(bp(t)||!n.charCode||n.ctrlKey&&!n.altKey||_t&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ne)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function ki(t){return{left:t.clientX,top:t.clientY}}function BC(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Sa(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),i,!0):l(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function vi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function zC(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&X.isSelectable(r)?(vi(t,new X(n)),!0):!1}function LC(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof X&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(X.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(vi(t,X.create(t.state.doc,i)),!0):!1}function jC(t,e,n,r,i){return Sa(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?LC(t,n):zC(t,n))}function qC(t,e,n,r){return Sa(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function VC(t,e,n,r){return Sa(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||UC(t,n,r)}function UC(t,e,n){if(n.button!=0)return!1;let r=pp(t,e,!0),i=t.state.doc;return r?(vi(t,r),r instanceof ne&&i.eq(t.state.doc)&&(t.input.mouseDown=new ZC(t,r)),!0):!1}function pp(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?ne.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)return ne.create(r,l+1,l+1+o.content.size);if(n&&X.isSelectable(o))return X.create(r,l)}return null}function Ea(t){return ps(t)}const mp=_t?"metaKey":"ctrlKey";rt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ea(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&BC(n,t.input.lastClick)&&!n[mp]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(ki(n));o&&(s=="singleClick"?t.input.mouseDown=new HC(t,o,n,!!r):(s=="doubleClick"?qC:VC)(t,o.pos,o.inside,n)?n.preventDefault():nn(t,"pointer"))};class gp{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class HC extends gp{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[mp],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&Y(a.nodeDOM)?a.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof X&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),nn(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||sn(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ki(e))),this.updateAllowDefault(e),this.allowDefault||!n?nn(this.view,"pointer"):jC(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||et&&this.mightDrag&&!this.mightDrag.node.isAtom||Je&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(vi(this.view,ie.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):nn(this.view,"pointer")}move(e){this.updateAllowDefault(e),nn(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class ZC extends gp{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),nn(this.view,"pointer");let n=this.view.posAtCoords(ki(e)),r=n&&pp(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,l]=r.from<s.from?[s.to,r.from]:[s.from,r.to];vi(this.view,ne.create(i,o,l))}}rt.touchstart=t=>{t.input.lastTouch=Date.now(),Ea(t),nn(t,"pointer")};rt.touchmove=t=>{t.input.lastTouch=Date.now(),nn(t,"pointer")};rt.contextmenu=t=>Ea(t);function bp(t,e){return t.composing?!0:et&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const WC=tn?5e3:-1;it.compositionstart=it.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ne&&e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Je&&Zh&&JC(t)))t.markCursor=t.state.storedMarks||n.marks(),ps(t,!0),t.markCursor=null;else if(ps(t,!e.selection.empty),bt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&Y(i)&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(Re(o)){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}yp(t,WC)};function JC(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||!Y(e)||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return Y(r)&&r.contentEditable=="false"}it.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,yp(t,20))};function yp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ps(t),e))}function kp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function KC(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=LA(e.focusNode,e.focusOffset),r=jA(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function ps(t,e=!1){if(!(tn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),kp(t),e||t.docView&&t.docView.dirty){let n=Aa(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function GC(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ai=ct&&An<15||xr&&HA<604;rt.copy=it.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=ai?null:n.clipboardData,o=r.content(),{dom:l,text:a}=_a(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):GC(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function YC(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function XC(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ui(t,r.value,null,i,e):ui(t,r.textContent,r.innerHTML,i,e)},50)}function ui(t,e,n,r,i){let s=ap(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,s||Z.empty)))return!0;if(!s)return!1;let o=YC(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function vp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}it.paste=(t,e)=>{let n=e;if(t.composing&&!tn)return;let r=ai?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ui(t,vp(r),r.getData("text/html"),i,n)?n.preventDefault():XC(t,n)};class xp{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const QC=_t?"altKey":"ctrlKey";function Ap(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[QC]}rt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(ki(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof X?i.to-1:i.to))){if(r&&r.mightDrag)o=X.create(t.state.doc,r.mightDrag.pos);else if(n.target&&Y(n.target)){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(o=X.create(t.state.doc,f.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:u,slice:c}=_a(t,l);(!n.dataTransfer.files.length||!Je||Hh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ai?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",ai||n.dataTransfer.setData("text/plain",u),t.dragging=new xp(c,Ap(t,n),o)};rt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};it.dragover=it.dragenter=(t,e)=>e.preventDefault();it.drop=(t,e)=>{try{e_(t,e,t.dragging)}finally{t.dragging=null}};function e_(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(ki(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=ap(t,vp(e.dataTransfer),ai?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Ap(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||Z.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?Rh(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let u=a.mapping.map(l),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=a.doc;if(c?a.replaceRangeWith(u,u,s.content.firstChild):a.replaceRange(u,u,s),a.doc.eq(f))return;let d=a.doc.resolve(u);if(c&&X.isSelectable(s.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new X(d));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,b)=>h=b),a.setSelection(Ca(t,d,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}rt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&sn(t)},20))};rt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};rt.beforeinput=(t,e)=>{if(tn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Rn(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in it)rt[t]=it[t];function ci(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class ms{constructor(e,n){this.toDOM=e,this.spec=n||Wn,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new St(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ms&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ci(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wn{constructor(e,n){this.attrs=e,this.spec=n||Wn}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new St(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof wn&&ci(this.attrs,e.attrs)&&ci(this.spec,e.spec)}static is(e){return e.type instanceof wn}destroy(){}}class Da{constructor(e,n){this.attrs=e,this.spec=n||Wn}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new St(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Da&&ci(this.attrs,e.attrs)&&ci(this.spec,e.spec)}destroy(){}}class St{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new St(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new St(e,e,new ms(n,r))}static inline(e,n,r,i){return new St(e,n,new wn(r,i))}static node(e,n,r,i){return new St(e,n,new Da(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof wn}get widget(){return this.type instanceof ms}}const cr=[],Wn={};class Fe{constructor(e,n){this.local=e.length?e:cr,this.children=n.length?n:cr}static create(e,n){return n.length?gs(n,e,0,Wn):Xe}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,i+l,s)}}map(e,n,r){return this==Xe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Wn)}mapInner(e,n,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?t_(this.children,o||[],e,n,r,i,s):o?new Fe(o.sort(Jn),cr):Xe}add(e,n){return n.length?this==Xe?Fe.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((l,a)=>{let u=a+r,c;if(c=_p(n,l,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,c,u+1):i.splice(s,0,a,a+l.nodeSize,gs(c,l,u+1,Wn)),s+=3}});let o=Cp(s?wp(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new Fe(o.length?this.local.concat(o).sort(Jn):this.local,i||this.children)}remove(e){return e.length==0||this==Xe?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,a=r[s+1]+n;for(let c=0,f;c<e.length;c++)(f=e[c])&&f.from>l&&f.to<a&&(e[c]=null,(o||(o=[])).push(f));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,l+1);u!=Xe?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Fe(i,r):Xe}forChild(e,n){if(this==Xe)return this;if(n.isLeaf)return Fe.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof wn){let u=Math.max(s,a.from)-s,c=Math.min(o,a.to)-s;u<c&&(i||(i=[])).push(a.copy(u,c))}}if(i){let l=new Fe(i.sort(Jn),cr);return r?new mn([l,r]):l}return r||Xe}eq(e){if(this==e)return!0;if(!(e instanceof Fe)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Oa(this.localsInner(e))}localsInner(e){if(this==Xe)return cr;if(e.inlineContent||!this.local.some(wn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof wn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Fe.empty=new Fe([],[]);Fe.removeOverlap=Oa;const Xe=Fe.empty;class mn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Wn));return mn.from(r)}forChild(e,n){if(n.isLeaf)return Fe.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Xe&&(s instanceof mn?r=r.concat(s.members):r.push(s))}return mn.from(r)}eq(e){if(!(e instanceof mn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?Oa(r?n:n.sort(Jn)):cr}static from(e){switch(e.length){case 0:return Xe;case 1:return e[0];default:return new mn(e.every(n=>n instanceof Fe)?e:e.reduce((n,r)=>n.concat(r instanceof Fe?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function t_(t,e,n,r,i,s,o){let l=t.slice();for(let u=0,c=s;u<n.maps.length;u++){let f=0;n.maps[u].forEach((d,h,p,m)=>{let g=m-p-(h-d);for(let b=0;b<l.length;b+=3){let _=l[b+1];if(_<0||d>_+c-f)continue;let k=l[b]+c-f;h>=k?l[b+1]=d<=k?-2:-1:d>=c&&g&&(l[b]+=g,l[b+1]+=g)}f+=g}),c=n.maps[u].map(c,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let c=n.map(t[u]+s),f=c-i;if(f<0||f>=r.content.size){a=!0;continue}let d=n.map(t[u+1]+s,-1),h=d-i,{index:p,offset:m}=r.content.findIndex(f),g=r.maybeChild(p);if(g&&m==f&&m+g.nodeSize==h){let b=l[u+2].mapInner(n,g,c+1,t[u]+s+1,o);b!=Xe?(l[u]=f,l[u+1]=h,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=n_(l,t,e,n,i,s,o),c=gs(u,r,0,o);e=c.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,d=0;f<c.children.length;f+=3){let h=c.children[f];for(;d<l.length&&l[d]<h;)d+=3;l.splice(d,0,c.children[f],c.children[f+1],c.children[f+2])}}return new Fe(e.sort(Jn),l)}function Cp(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new St(i.from+e,i.to+e,i.type))}return n}function n_(t,e,n,r,i,s,o){function l(a,u){for(let c=0;c<a.local.length;c++){let f=a.local[c].map(r,i,u);f?n.push(f):o.onRemove&&o.onRemove(a.local[c].spec)}for(let c=0;c<a.children.length;c+=3)l(a.children[c+2],a.children[c]+u+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+s+1);return n}function _p(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function wp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function gs(t,e,n,r){let i=[],s=!1;e.forEach((l,a)=>{let u=_p(t,l,a+n);if(u){s=!0;let c=gs(u,l,n+a+1,r);c!=Xe&&i.push(a,a+l.nodeSize,c)}});let o=Cp(s?wp(t):t,-n).sort(Jn);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new Fe(o,i):Xe}function Jn(t,e){return t.from-e.from||t.to-e.to}function Oa(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),tf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),tf(e,i,r.copy(s.from,r.to)));break}}}return e}function tf(t,e,n){for(;e<t.length&&Jn(n,t[e])>0;)e++;t.splice(e,0,n)}function Lo(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Xe&&e.push(r)}),t.cursorWrapper&&e.push(Fe.create(t.state.doc,[t.cursorWrapper.deco])),mn.from(e)}const r_={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},i_=ct&&An<=11;class s_{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class o_{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new s_,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ct&&An<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():et&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),i_&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,r_)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Jc(this.view)){if(this.suppressingSelectionUpdates)return sn(this.view);if(ct&&An<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&er(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=vr(s))n.add(s);for(let s=e.anchorNode;s;s=vr(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:Re(r)?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Jc(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let c=0;c<n.length;c++){let f=this.registerMutation(n[c],a);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(l=!0))}if(a.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Je&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(c=>c.type=="childList"&&c.removedNodes.length))){for(let c of a)if(c.nodeName=="BR"&&c.parentNode){let f=c.nextSibling;for(;f&&Y(f);){if(f.contentEditable=="false"){c.parentNode.removeChild(c);break}f=f.firstChild}}}else if(bt&&a.length){let c=a.filter(f=>f.nodeName=="BR");if(c.length==2){let[f,d]=c;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of c){let h=d.parentNode;h&&h.nodeName=="LI"&&(!f||u_(e,f)!=h)&&d.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ao(r)&&(u=Aa(e))&&u.eq(ie.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,sn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),l_(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,c_(e,a)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||sn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let f=e.addedNodes[c];n.push(f),Re(f)&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ct&&An<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:f,nextSibling:d}=e.addedNodes[c];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d)}let o=i&&i.parentNode==e.target?He(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?He(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,a,1);return{from:l,to:u}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let nf=new WeakMap,rf=!1;function l_(t){if(!nf.has(t)&&(nf.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=bt,rf)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),rf=!0}}function sf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return er(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function a_(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return sf(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?sf(t,n):null}function u_(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function c_(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||!Y(a)||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function f_(t,e,n,r){let{node:i,fromOffset:s,toOffset:o,from:l,to:a}=t.docView.parseRange(e,n),u=t.domSelectionRange(),c,f=u.anchorNode;if(f&&tr(t.dom,f)&&(c=[{node:f,offset:u.anchorOffset}],ao(u)||c.push({node:u.focusNode,offset:u.focusOffset})),Je&&t.input.lastKeyCode===8)for(let b=o;b>s;b--){let _=i.childNodes[b-1],k=_.pmViewDesc;if(_.nodeName=="BR"&&!k){o=b;break}if(!k||k.size)break}let d=t.state.doc,h=t.someProp("domParser")||xn.fromSchema(t.state.schema),p=d.resolve(l),m=null,g=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:d_(r),context:p});if(c&&c[0].pos!=null){let b=c[0].pos,_=c[1]&&c[1].pos;_==null&&(_=b),m={anchor:b+l,head:_+l}}return{doc:g,sel:m,from:l,to:a}}const d_=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(et&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||et&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},h_=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function p_(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let A=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,w=Aa(t,A);if(w&&!t.state.selection.eq(w)){if(Je&&tn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",O=>O(t,Rn(13,"Enter"))))return;let T=t.state.tr.setSelection(w);A=="pointer"?T.setMeta("pointer",!0):A=="key"&&T.scrollIntoView(),s&&T.setMeta("composition",s),t.dispatch(T)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,u=f_(t,e,n,i),c=t.state.doc,f=c.slice(u.from,u.to),d,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(d=t.state.selection.to,h="end"):(d=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=y_(f.content,u.doc.content,u.from,d,h);if(p&&t.input.domChangeCount++,(xr&&t.input.lastIOSEnter>Date.now()-225||tn)&&i.some(A=>Y(A)&&!h_.test(A.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",A=>A(t,Rn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof ne&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let A=of(t,t.state.doc,u.sel);if(A&&!A.eq(t.state.selection)){let w=t.state.tr.setSelection(A);s&&w.setMeta("composition",s),t.dispatch(w)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof ne&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ct&&An<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=u.doc.resolveNoCache(p.start-u.from),g=u.doc.resolveNoCache(p.endB-u.from),b=c.resolve(p.start),_=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((xr&&t.input.lastIOSEnter>Date.now()-225&&(!_||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!_&&b_(u.doc,m.pos,g.pos))&&t.someProp("handleKeyDown",A=>A(t,Rn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&g_(c,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",A=>A(t,Rn(8,"Backspace")))){tn&&Je&&t.domObserver.suppressSelectionUpdates();return}Je&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),tn&&!_&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,g=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,Rn(13,"Enter"))})},20));let k=p.start,C=p.endA,v=A=>{let w=A||t.state.tr.replace(k,C,u.doc.slice(p.start-u.from,p.endB-u.from));if(u.sel){let T=of(t,w.doc,u.sel);T&&!(Je&&t.composing&&T.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(T.head==k||T.head==w.mapping.map(C)-1)||ct&&T.empty&&T.head==k)&&w.setSelection(T)}return s&&w.setMeta("composition",s),w.scrollIntoView()},x;if(_)if(m.pos==g.pos){ct&&An<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>sn(t),20));let A=v(t.state.tr.delete(k,C)),w=c.resolve(p.start).marksAcross(c.resolve(p.endA));w&&A.ensureMarks(w),t.dispatch(A)}else if(p.endA==p.endB&&(x=m_(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let A=v(t.state.tr);x.type=="add"?A.addMark(k,C,x.mark):A.removeMark(k,C,x.mark),t.dispatch(A)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset),w=()=>v(t.state.tr.insertText(A,k,C));t.someProp("handleTextInput",T=>T(t,k,C,A,w))||t.dispatch(w())}else t.dispatch(v());else t.dispatch(v())}function of(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ca(t,e.resolve(n.anchor),e.resolve(n.head))}function m_(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,l,a;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)s=n[c].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=c=>c.mark(l.addToSet(c.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=c=>c.mark(l.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(a(e.child(c)));if(B.from(u).eq(t))return{mark:l,type:o}}function g_(t,e,n,r,i){if(n-e<=i.pos-r.pos||jo(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(jo(s,!0,!0));return!o.parent.isTextblock||o.pos>n||jo(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function b_(t,e,n){let r=0,i=0;return t.nodesBetween(e,n,(s,o)=>{s.isTextblock&&o>=e&&o<n?r++:(s.isText?/\S/.test(s.text.slice(Math.max(0,e-o),Math.min(s.nodeSize,n-o))):s.isLeaf)&&i++}),i==0&&r==1}function jo(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function y_(t,e,n,r,i){let s=t.findDiffStart(e,n),o=n+t.size,l=n+e.size;if(s==null)return null;let{a,b:u}=t.findDiffEnd(e,o,l);if(i=="end"){let c=Math.max(0,s-Math.min(a,u));r-=a+c-s}if(a<s&&o<l){let c=r<=s&&r>=a?s-r:0;s-=c,u=s+(u-a),a=s}else if(u<s){let c=r<=s&&r>=u?s-r:0;s-=c,a=s+(a-u),u=s}return{start:s,endA:a,endB:u}}class Sp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new NC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ff),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=uf(this),af(this),this.nodeViews=cf(this),this.docView=qc(this.state.doc,lf(this),Lo(this),this.dom,this),this.domObserver=new o_(this,(r,i,s,o)=>p_(this,r,i,s,o)),this.domObserver.start(),IC(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Rl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ff),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(kp(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=cf(this);v_(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Rl(this),this.editable=uf(this),af(this);let a=Lo(this),u=lf(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,u,a);(f||!e.selection.eq(i.selection))&&(o=!0);let d=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&JA(this);if(o){this.domObserver.stop();let h=f&&(ct||Je)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&k_(i.selection,e.selection);if(f){let m=Je?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=KC(this)),(s||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=qc(e.doc,u,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&yC(this)&&p.delaySelUpdate())?sn(this,h):(sp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&KA(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!tr(this.dom,e))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof X){let n=this.docView.domAfterPos(this.state.selection.from);Y(n)&&Pc(this,n.getBoundingClientRect(),e)}else Pc(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new xp(e.slice,e.move,i<0?void 0:X.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=n?n(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(ct){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&GA(this.dom),sn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return tC(this,e)}coordsAtPos(e,n=1){return Yh(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return oC(this,n||this.state,e)}pasteHTML(e,n){return ui(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ui(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return _a(this,e)}destroy(){this.docView&&(FC(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Lo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,BA())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return PC(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?et&&this.root.nodeType===11&&VA(this.dom.ownerDocument)==this.dom&&a_(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Sp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function lf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[St.node(0,t.state.doc.content.size,e)]}function af(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:St.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function uf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function k_(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function cf(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function v_(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function ff(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Dn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},bs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},x_=typeof navigator<"u"&&/Mac/.test(navigator.platform),A_=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ze=0;Ze<10;Ze++)Dn[48+Ze]=Dn[96+Ze]=String(Ze);for(var Ze=1;Ze<=24;Ze++)Dn[Ze+111]="F"+Ze;for(var Ze=65;Ze<=90;Ze++)Dn[Ze]=String.fromCharCode(Ze+32),bs[Ze]=String.fromCharCode(Ze);for(var qo in Dn)bs.hasOwnProperty(qo)||(bs[qo]=Dn[qo]);function C_(t){var e=x_&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||A_&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?bs:Dn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const __=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),w_=typeof navigator<"u"&&/Win/.test(navigator.platform);function S_(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))__?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function E_(t){let e=Object.create(null);for(let n in t)e[S_(n)]=t[n];return e}function Vo(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function D_(t){return new Ye({props:{handleKeyDown:Ep(t)}})}function Ep(t){let e=E_(t);return function(n,r){let i=C_(r),s,o=e[Vo(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Vo(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(w_&&r.ctrlKey&&r.altKey)&&(s=Dn[r.keyCode])&&s!=i){let l=e[Vo(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const Ta=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Dp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Op=(t,e,n)=>{let r=Dp(t,n);if(!r)return!1;let i=Ma(r);if(!i){let o=r.blockRange(),l=o&&Dr(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(Bp(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ar(s,"end")||X.isSelectable(s)))for(let o=r.depth;;o--){let l=oo(t.doc,r.before(o),r.after(o),Z.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Ar(s,"end")?ie.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):X.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},O_=(t,e,n)=>{let r=Dp(t,n);if(!r)return!1;let i=Ma(r);return i?Tp(t,i,e):!1},T_=(t,e,n)=>{let r=$p(t,n);if(!r)return!1;let i=$a(r);return i?Tp(t,i,e):!1};function Tp(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let c=l.firstChild;if(!c)return!1;l=c}let u=oo(t.doc,s,a,Z.empty);if(!u||u.from!=s||u instanceof $e&&u.slice.size>=a-s)return!1;if(n){let c=t.tr.step(u);c.setSelection(ne.create(c.doc,s)),n(c.scrollIntoView())}return!0}function Ar(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Mp=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Ma(r)}let o=s&&s.nodeBefore;return!o||!X.isSelectable(o)?!1:(e&&e(t.tr.setSelection(X.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Ma(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function $p(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Np=(t,e,n)=>{let r=$p(t,n);if(!r)return!1;let i=$a(r);if(!i)return!1;let s=i.nodeAfter;if(Bp(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ar(s,"start")||X.isSelectable(s))){let o=oo(t.doc,r.before(),r.after(),Z.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(Ar(s,"start")?ie.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):X.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Ip=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=$a(r)}let o=s&&s.nodeAfter;return!o||!X.isSelectable(o)?!1:(e&&e(t.tr.setSelection(X.create(t.doc,s.pos)).scrollIntoView()),!0)};function $a(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const M_=(t,e)=>{let n=t.selection,r=n instanceof X,i;if(r){if(n.node.isTextblock||!Mn(t.doc,n.from))return!1;i=n.from}else if(i=so(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(X.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},$_=(t,e)=>{let n=t.selection,r;if(n instanceof X){if(n.node.isTextblock||!Mn(t.doc,n.to))return!1;r=n.to}else if(r=so(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},N_=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Dr(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Fp=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
72
|
+
`).scrollIntoView()),!0)};function Na(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const I_=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Na(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(ie.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Rp=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof gt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Na(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(o,s.createAndFill());l.setSelection(ne.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Pp=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(rn(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Dr(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function F_(t){return(e,n)=>{if(e.selection instanceof X&&e.selection.node.isBlock){let{$from:h}=e.selection;return!h.parentOffset||!rn(e.doc,h.pos)?!1:(n&&n(e.tr.split(h.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof ne||e.selection instanceof gt)&&r.deleteSelection();let{$from:i}=r.selection,s=r.steps.length,o=[],l,a,u=!1,c=!1;for(let h=i.depth;;h--)if(i.node(h).isBlock){u=i.end(h)==i.pos+(i.depth-h),c=i.start(h)==i.pos-(i.depth-h),a=Na(i.node(h-1).contentMatchAt(i.indexAfter(h-1))),o.unshift(u&&a?{type:a}:null),l=h;break}else{if(h==1)return!1;o.unshift(null)}let f=i.pos,d=rn(r.doc,f,o.length,o);if(d||(o[0]=a?{type:a}:null,d=rn(r.doc,f,o.length,o)),!d)return!1;if(r.split(f,o.length,o),!u&&c&&i.node(l).type!=a){let h=r.mapping.slice(s),p=h.map(i.before(l)),m=r.doc.resolve(p);a&&i.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&r.setNodeMarkup(h.map(i.before(l)),a)}return n&&n(r.scrollIntoView()),!0}}const R_=F_(),P_=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(X.create(t.doc,i))),!0)};function B_(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Mn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Bp(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&B_(t,e,n))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=B.empty;for(let b=o.length-1;b>=0;b--)p=B.from(o[b].create(null,p));p=B.from(i.copy(p));let m=t.tr.step(new ze(e.pos-1,h,e.pos,h,new Z(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Mn(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&a?null:ie.findFrom(e,1),f=c&&c.$from.blockRange(c.$to),d=f&&Dr(f);if(d!=null&&d>=e.depth)return n&&n(t.tr.lift(f,d).scrollIntoView()),!0;if(u&&Ar(s,"start",!0)&&Ar(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let b=B.empty;for(let k=p.length-1;k>=0;k--)b=B.from(p[k].copy(b));let _=t.tr.step(new ze(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new Z(b,p.length,0),0,!0));n(_.scrollIntoView())}return!0}}return!1}function zp(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(ne.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const z_=zp(-1),L_=zp(1);function j_(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),l=o&&ka(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function df(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,l,(a,u)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let c=n.doc.resolve(u),f=c.index();i=c.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];s.setBlockType(l,a,t,e)}r(s.scrollIntoView())}return!0}}function Ia(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Ia(Ta,Op,Mp);Ia(Ta,Np,Ip);Ia(Fp,Rp,Pp,R_);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function q_(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return V_(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function V_(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new fs(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new fs(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=ka(s,n,r,e);return l?(t&&U_(t,e,l,i,n),!0):!1}function U_(t,e,n,r,i){let s=B.empty;for(let c=n.length-1;c>=0;c--)s=B.from(n[c].type.create(n[c].attrs,s));t.step(new ze(e.start-(r?2:0),e.end,e.start,e.end,new Z(s,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==i&&(o=c+1);let l=n.length-o,a=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,f=e.endIndex,d=!0;c<f;c++,d=!1)!d&&rn(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return t}function H_(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Z_(e,n,t,s):W_(e,n,s):!0:!1}}function Z_(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new ze(s-1,o,s,o,new Z(B.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new fs(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Dr(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return Mn(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function W_(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(l?0:1),c+1,o.content.append(a?B.empty:B.from(i))))return!1;let f=s.pos,d=f+o.nodeSize;return r.step(new ze(f-(l?1:0),d+(a?1:0),f+1,d-1,new Z((l?B.empty:B.from(i.copy(B.empty))).append(a?B.empty:B.from(i.copy(B.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function J_(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let u=a.lastChild&&a.lastChild.type==l.type,c=B.from(u?t.create():null),f=new Z(B.from(t.create(null,B.from(l.type.create(null,c)))),u?3:1,0),d=s.start,h=s.end;n(e.tr.step(new ze(d-(u?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}function fo(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}class ho{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>{const f=a(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,u=e||s.tr,c=()=>(!a&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),l.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(u,n),b=h(...m)(g);return l.push(b),f}])),run:c};return f}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([a,u])=>[a,(...c)=>u(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:fo({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,u])=>[a,(...c)=>u(...c)(l)]))}};return l}}class K_{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function K(t,e,n){return t.config[e]===void 0&&t.parent?K(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?K(t.parent,e,n):null}):t.config[e]}function po(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Lp(t){const e=[],{nodeExtensions:n,markExtensions:r}=po(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=K(o,"addGlobalAttributes",l);if(!a)return;a().forEach(c=>{c.types.forEach(f=>{Object.entries(c.attributes).forEach(([d,h])=>{e.push({type:f,name:d,attribute:{...s,...h}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=K(o,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([c,f])=>{const d={...s,...f};typeof(d==null?void 0:d.default)=="function"&&(d.default=d.default()),d!=null&&d.isRequired&&(d==null?void 0:d.default)===void 0&&delete d.default,e.push({type:o.name,name:c,attribute:d})})}),e}function je(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Ge(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:s,writable:!0});return}if(!r[i]){r[i]=s;return}if(i==="class"){const l=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],u=l.filter(c=>!a.includes(c));r[i]=[...a,...u].join(" ")}else if(i==="style"){const l=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;a.forEach(c=>{const[f,d]=c.split(":").map(h=>h.trim());u.set(f,d)}),l.forEach(c=>{const[f,d]=c.split(":").map(h=>h.trim());u.set(f,d)}),r[i]=Array.from(u.entries()).map(([c,f])=>`${c}: ${f}`).join("; ")}else r[i]=s}),r},{})}function Pl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Ge(n,r),{})}function jp(t){return typeof t=="function"}function le(t,e=void 0,...n){return jp(t)?e?t.bind(e)(...n):t(...n):t}function G_(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Y_(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function hf(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):Y_(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function pf(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&G_(n)?!1:n!=null))}function qp(t,e){var n;const r=Lp(t),{nodeExtensions:i,markExtensions:s}=po(t),o=(n=i.find(u=>K(u,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(i.map(u=>{const c=r.filter(b=>b.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((b,_)=>{const k=K(_,"extendNodeSchema",f);return{...b,...k?k(u):{}}},{}),h=pf({...d,content:le(K(u,"content",f)),marks:le(K(u,"marks",f)),group:le(K(u,"group",f)),inline:le(K(u,"inline",f)),atom:le(K(u,"atom",f)),selectable:le(K(u,"selectable",f)),draggable:le(K(u,"draggable",f)),code:le(K(u,"code",f)),whitespace:le(K(u,"whitespace",f)),linebreakReplacement:le(K(u,"linebreakReplacement",f)),defining:le(K(u,"defining",f)),isolating:le(K(u,"isolating",f)),attrs:Object.fromEntries(c.map(b=>{var _;return[b.name,{default:(_=b==null?void 0:b.attribute)===null||_===void 0?void 0:_.default}]}))}),p=le(K(u,"parseHTML",f));p&&(h.parseDOM=p.map(b=>hf(b,c)));const m=K(u,"renderHTML",f);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Pl(b,c)}));const g=K(u,"renderText",f);return g&&(h.toText=g),[u.name,h]})),a=Object.fromEntries(s.map(u=>{const c=r.filter(g=>g.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((g,b)=>{const _=K(b,"extendMarkSchema",f);return{...g,..._?_(u):{}}},{}),h=pf({...d,inclusive:le(K(u,"inclusive",f)),excludes:le(K(u,"excludes",f)),group:le(K(u,"group",f)),spanning:le(K(u,"spanning",f)),code:le(K(u,"code",f)),attrs:Object.fromEntries(c.map(g=>{var b;return[g.name,{default:(b=g==null?void 0:g.attribute)===null||b===void 0?void 0:b.default}]}))}),p=le(K(u,"parseHTML",f));p&&(h.parseDOM=p.map(g=>hf(g,c)));const m=K(u,"renderHTML",f);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Pl(g,c)})),[u.name,h]}));return new wh({topNode:o,nodes:l,marks:a})}function Uo(t,e){return e.nodes[t]||e.marks[t]||null}function mf(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Fa(t,e){const n=ir.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const X_=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,u;const c=((u=(a=i.type.spec).toText)===null||u===void 0?void 0:u.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function Ra(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class mo{constructor(e){this.find=e.find,this.handler=e.handler}}const Q_=(t,e)=>{if(Ra(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Ri(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const u=a.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let c=!1;const f=X_(u)+s;return o.forEach(d=>{if(c)return;const h=Q_(f,d.find);if(!h)return;const p=a.state.tr,m=fo({state:a.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:b,chain:_,can:k}=new ho({editor:n,state:m});d.handler({state:m,range:g,match:h,commands:b,chain:_,can:k})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),c=!0)}),c}function ew(t){const{editor:e,rules:n}=t,r=new Ye({state:{init(){return null},apply(i,s,o){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=Fa(B.from(c),o.schema);const{from:f}=a,d=f+c.length;Ri({editor:e,from:f,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return Ri({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Ri({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Ri({editor:e,from:o.pos,to:o.pos,text:`
|
|
73
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function tw(t){return Object.prototype.toString.call(t).slice(8,-1)}function Pi(t){return tw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function go(t,e){const n={...t};return Pi(t)&&Pi(e)&&Object.keys(e).forEach(r=>{Pi(e[r])&&Pi(t[r])?n[r]=go(t[r],e[r]):n[r]=e[r]}),n}class ln{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ln(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>go(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new ln(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(K(n,"addOptions",{name:n.name})),n.storage=le(K(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const a=o.find(u=>(u==null?void 0:u.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function nw(t){return typeof t=="number"}class rw{constructor(e){this.find=e.find,this.handler=e.handler}}const iw=(t,e,n)=>{if(Ra(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function sw(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:u,can:c}=new ho({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),b=h.textBetween(m-p,g-p,void 0,"");iw(b,s.find,o).forEach(k=>{if(k.index===void 0)return;const C=m+k.index+1,v=C+k[0].length,x={from:n.tr.mapping.map(C),to:n.tr.mapping.map(v)},A=s.handler({state:n,range:x,match:k,commands:a,chain:u,can:c,pasteEvent:o,dropEvent:l});f.push(A)})}),f.every(h=>h!==null)}let Bi=null;const ow=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function lw(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:f,to:d,rule:h,pasteEvt:p})=>{const m=c.tr,g=fo({state:c,transaction:m});if(!(!sw({editor:e,state:g,from:Math.max(f-1,0),to:d.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new Ye({view(f){const d=p=>{var m;r=!((m=f.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?f.dom.parentElement:null,r&&(Bi=e)},h=()=>{Bi&&(Bi=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,d)=>{if(s=r===f.dom.parentElement,l=d,!s){const h=Bi;h!=null&&h.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(f,d)=>{var h;const p=(h=d.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=d,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(f,d,h)=>{const p=f[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,b=p.getMeta("applyPasteRules"),_=!!b;if(!m&&!g&&!_)return;if(_){let{text:v}=b;typeof v=="string"?v=v:v=Fa(B.from(v),h.schema);const{from:x}=b,A=x+v.length,w=ow(v);return a({rule:c,state:h,from:x,to:{b:A},pasteEvt:w})}const k=d.doc.content.findDiffStart(h.doc.content),C=d.doc.content.findDiffEnd(h.doc.content);if(!(!nw(k)||!C||k===C.b))return a({rule:c,state:h,from:k,to:C,pasteEvt:o})}}))}function aw(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Ln{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Ln.resolve(e),this.schema=qp(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Ln.sort(Ln.flatten(e)),r=aw(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=K(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=K(r,"priority")||100,o=K(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Uo(n.name,this.schema)},i=K(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Ln.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const l={name:o.name,options:o.options,storage:o.storage,editor:e,type:Uo(o.name,this.schema)},a=[],u=K(o,"addKeyboardShortcuts",l);let c={};if(o.type==="mark"&&K(o,"exitable",l)&&(c.ArrowRight=()=>ln.handleExit({editor:e,mark:o})),u){const m=Object.fromEntries(Object.entries(u()).map(([g,b])=>[g,()=>b({editor:e})]));c={...c,...m}}const f=D_(c);a.push(f);const d=K(o,"addInputRules",l);mf(o,e.options.enableInputRules)&&d&&r.push(...d());const h=K(o,"addPasteRules",l);mf(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=K(o,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[ew({editor:e,rules:r}),...lw({editor:e,rules:i}),...s]}get attributes(){return Lp(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=po(this.extensions);return Object.fromEntries(n.filter(r=>!!K(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:je(r.name,this.schema)},o=K(r,"addNodeView",s);if(!o)return[];const l=(a,u,c,f,d)=>{const h=Pl(a,i);return o()({node:a,view:u,getPos:c,decorations:f,innerDecorations:d,editor:e,extension:r,HTMLAttributes:h})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Uo(e.name,this.schema)};e.type==="mark"&&(!((n=le(K(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=K(e,"onBeforeCreate",r),s=K(e,"onCreate",r),o=K(e,"onUpdate",r),l=K(e,"onSelectionUpdate",r),a=K(e,"onTransaction",r),u=K(e,"onFocus",r),c=K(e,"onBlur",r),f=K(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),f&&this.editor.on("destroy",f)})}}class st{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new st(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>go(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new st({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(K(n,"addOptions",{name:n.name})),n.storage=le(K(n,"addStorage",{name:n.name,options:n.options})),n}}function Vp(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
74
|
+
|
|
75
|
+
`,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,i,(a,u,c,f)=>{var d;a.isBlock&&u>r&&(l+=s);const h=o==null?void 0:o[a.type.name];if(h)return c&&(l+=h({node:a,pos:u,parent:c,index:f,range:e})),!1;a.isText&&(l+=(d=a==null?void 0:a.text)===null||d===void 0?void 0:d.slice(Math.max(r,u)-u,i-u))}),l}function Up(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const uw=st.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ye({key:new vt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),l=Math.max(...s.map(c=>c.$to.pos)),a=Up(n);return Vp(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),cw=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),fw=(t=!1)=>({commands:e})=>e.setContent("",t),dw=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:c}=e,f=u.resolve(c.map(a)),d=u.resolve(c.map(a+l.nodeSize)),h=f.blockRange(d);if(!h)return;const p=Dr(h);if(l.type.isTextblock){const{defaultType:m}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},hw=t=>e=>t(e),pw=()=>({state:t,dispatch:e})=>Rp(t,e),mw=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ne(r.doc.resolve(Math.max(o-1,0)))),!0},gw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),a=i.after(s);t.delete(l,a).scrollIntoView()}return!0}return!1},bw=t=>({tr:e,state:n,dispatch:r})=>{const i=je(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),u=s.after(o);e.delete(a,u).scrollIntoView()}return!0}return!1},yw=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},kw=()=>({state:t,dispatch:e})=>Ta(t,e),vw=()=>({commands:t})=>t.keyboardShortcut("Enter"),xw=()=>({state:t,dispatch:e})=>I_(t,e);function ys(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Ra(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Hp(t,e,n={}){return t.find(r=>r.type===e&&ys(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function gf(t,e,n={}){return!!Hp(t,e,n)}function Pa(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!Hp([...i.node.marks],e,n)))return;let o=i.index,l=t.start()+i.offset,a=o+1,u=l+i.node.nodeSize;for(;o>0&&gf([...t.parent.child(o-1).marks],e,n);)o-=1,l-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&gf([...t.parent.child(a).marks],e,n);)u+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function Nn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const Aw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Nn(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:u,to:c}=l;if(i){const f=Pa(a,s,e);if(f&&f.from<=u&&f.to>=c){const d=ne.create(o,f.from,f.to);n.setSelection(d)}}return!0},Cw=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Zp(t){return t instanceof ne}function jn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Wp(t,e=null){if(!e)return null;const n=ie.atStart(t),r=ie.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?ne.create(t,jn(0,i,s),jn(t.content.size,i,s)):ne.create(t,jn(e,i,s),jn(e,i,s))}function bf(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ks(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function _w(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const ww=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(ks()||bf())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),_w()&&!ks()&&!bf()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!Zp(n.state.selection))return o(),!0;const l=Wp(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Sw=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Ew=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Jp=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Jp(r)}return t};function zi(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Jp(n)}function fi(t,e,n){if(t instanceof vn||t instanceof B)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return B.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),fi("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,l="";const a=new wh({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?xn.fromSchema(a).parseSlice(zi(t),n.parseOptions):xn.fromSchema(a).parse(zi(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=xn.fromSchema(e);return n.slice?s.parseSlice(zi(t),n.parseOptions).content:s.parse(zi(t),n.parseOptions)}return fi("",e,n)}function Dw(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof $e||i instanceof ze))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,a,u,c)=>{o===0&&(o=c)}),t.setSelection(ie.near(t.doc.resolve(o),n))}const Ow=t=>!("type"in t),Tw=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{fi(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=fi(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(g){return a(g),!1}let{from:c,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},d=!0,h=!0;if((Ow(l)?l:[l]).forEach(g=>{g.check(),d=d?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),c===f&&h){const{parent:g}=r.doc.resolve(c);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(c-=1,f+=1)}let m;if(d){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof B){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,f)}else m=l,r.replaceWith(c,f,m);n.updateSelection&&Dw(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},Mw=()=>({state:t,dispatch:e})=>M_(t,e),$w=()=>({state:t,dispatch:e})=>$_(t,e),Nw=()=>({state:t,dispatch:e})=>Op(t,e),Iw=()=>({state:t,dispatch:e})=>Np(t,e),Fw=()=>({state:t,dispatch:e,tr:n})=>{try{const r=so(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Rw=()=>({state:t,dispatch:e,tr:n})=>{try{const r=so(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Pw=()=>({state:t,dispatch:e})=>O_(t,e),Bw=()=>({state:t,dispatch:e})=>T_(t,e);function Kp(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function zw(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))ks()||Kp()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const Lw=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=zw(t).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return a==null||a.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function di(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?je(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;const h=Math.max(r,d),p=Math.min(i,d+f.nodeSize);l.push({node:f,from:h,to:p})});const a=i-r,u=l.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>ys(f.node.attrs,n,{strict:!1}));return s?!!u.length:u.reduce((f,d)=>f+d.to-d.from,0)>=a}const jw=(t,e={})=>({state:n,dispatch:r})=>{const i=je(t,n.schema);return di(n,i,e)?N_(n,r):!1},qw=()=>({state:t,dispatch:e})=>Pp(t,e),Vw=t=>({state:e,dispatch:n})=>{const r=je(t,e.schema);return H_(r)(e,n)},Uw=()=>({state:t,dispatch:e})=>Fp(t,e);function bo(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function yf(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const Hw=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=bo(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=je(t,r.schema)),l==="mark"&&(o=Nn(t,r.schema)),i&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(u,c)=>{s&&s===u.type&&n.setNodeMarkup(c,void 0,yf(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&n.addMark(c,c+u.nodeSize,o.create(yf(f.attrs,e)))})})}),!0):!1},Zw=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Ww=()=>({tr:t,dispatch:e})=>{if(e){const n=new gt(t.doc);t.setSelection(n)}return!0},Jw=()=>({state:t,dispatch:e})=>Mp(t,e),Kw=()=>({state:t,dispatch:e})=>Ip(t,e),Gw=()=>({state:t,dispatch:e})=>P_(t,e),Yw=()=>({state:t,dispatch:e})=>L_(t,e),Xw=()=>({state:t,dispatch:e})=>z_(t,e);function Bl(t,e,n={},r={}){return fi(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const Qw=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{var a,u;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const f=Bl(t,i.schema,n,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,f).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function Gp(t,e){const n=Nn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function eS(t,e){const n=new jh(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function tS(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function nS(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function rS(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Ba(t){return e=>rS(e.$from,t)}function iS(t,e){const n=Ln.resolve(t);return qp(n,e)}function sS(t,e){const n={from:0,to:t.content.size};return Vp(t,n,e)}function oS(t,e){const n=je(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function Yp(t,e){const n=bo(typeof e=="string"?e:e.name,t.schema);return n==="node"?oS(t,e):n==="mark"?Gp(t,e):{}}function lS(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function aS(t){const e=lS(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function uS(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const u=e.slice(s).map(l,-1),c=e.slice(s).map(a),f=e.invert().map(u,-1),d=e.invert().map(c);r.push({oldRange:{from:f,to:d},newRange:{from:u,to:c}})})}),aS(r)}function za(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=Pa(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function Yi(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function zl(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Nn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>ys(f.attrs,n,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:f,$to:d})=>{const h=f.pos,p=d.pos;t.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,g),_=Math.min(p,g+m.nodeSize),k=_-b;o+=k,l.push(...m.marks.map(C=>({mark:C,from:b,to:_})))})}),o===0)return!1;const a=l.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>ys(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),u=l.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,d)=>f+d.to-d.from,0);return(a>0?a+u:a)>=o}function cS(t,e,n={}){if(!e)return di(t,null,n)||zl(t,null,n);const r=bo(e,t.schema);return r==="node"?di(t,e,n):r==="mark"?zl(t,e,n):!1}function kf(t,e){const{nodeExtensions:n}=po(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=le(K(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function La(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(La(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function fS(t){return t instanceof X}function dS(t,e,n){var r;const{selection:i}=e;let s=null;if(Zp(i)&&(s=i.$cursor),s){const l=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(l)||!l.some(a=>a.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(c,f,d)=>{if(u)return!1;if(c.isInline){const h=!d||d.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=h&&p}return!u}),u})}const hS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:l}=s,a=Nn(t,r.schema);if(i)if(o){const u=Gp(r,a);n.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const c=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(c,f,(d,h)=>{const p=Math.max(h,c),m=Math.min(h+d.nodeSize,f);d.marks.find(b=>b.type===a)?d.marks.forEach(b=>{a===b.type&&n.addMark(p,m,a.create({...b.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return dS(r,n,a)},pS=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),mS=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=je(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>df(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>df(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},gS=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=jn(t,0,r.content.size),s=X.create(r,i);e.setSelection(s)}return!0},bS=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=ne.atStart(r).from,l=ne.atEnd(r).to,a=jn(i,o,l),u=jn(s,o,l),c=ne.create(r,a,u);e.setSelection(c)}return!0},yS=t=>({state:e,dispatch:n})=>{const r=je(t,e.schema);return J_(r)(e,n)};function vf(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const kS=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,u=i.extensionManager.attributes,c=Yi(u,l.node().type.name,l.node().attrs);if(s instanceof X&&s.node.isBlock)return!l.parentOffset||!rn(o,l.pos)?!1:(r&&(t&&vf(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,d=l.depth===0?void 0:tS(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&d?[{type:d,attrs:c}]:void 0,p=rn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&rn(e.doc,e.mapping.map(l.pos),1,d?[{type:d}]:void 0)&&(p=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(p&&(s instanceof ne&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),d&&!f&&!l.parentOffset&&l.parent.type!==d)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,d)&&e.setNodeMarkup(e.mapping.map(l.before()),d)}t&&vf(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},vS=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const l=je(t,r.schema),{$from:a,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(u))return!1;const f=a.node(-1);if(f.type!==l)return!1;const d=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let b=B.empty;const _=a.index(-1)?1:a.index(-2)?2:3;for(let w=a.depth-_;w>=a.depth-3;w-=1)b=B.from(a.node(w).copy(b));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,C={...Yi(d,a.node().type.name,a.node().attrs),...e},v=((o=l.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(C))||void 0;b=b.append(B.from(l.createAndFill(null,v)||void 0));const x=a.before(a.depth-(_-1));n.replace(x,a.after(-k),new Z(b,4-_,0));let A=-1;n.doc.nodesBetween(x,n.doc.content.size,(w,T)=>{if(A>-1)return!1;w.isTextblock&&w.content.size===0&&(A=T+1)}),A>-1&&n.setSelection(ne.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const h=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,p={...Yi(d,f.type.name,f.attrs),...e},m={...Yi(d,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,u.pos);const g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!rn(n.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:_}=r,{splittableMarks:k}=s.extensionManager,C=_||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!C||!i)return!0;const v=C.filter(x=>k.includes(x.type.name));n.ensureMarks(v)}return!0},Ho=(t,e)=>{const n=Ba(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Mn(t.doc,n.pos)&&t.join(n.pos),!0},Zo=(t,e)=>{const n=Ba(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&Mn(t.doc,r)&&t.join(r),!0},xS=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:u,can:c})=>{const{extensions:f,splittableMarks:d}=i.extensionManager,h=je(t,o.schema),p=je(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:_}=m,k=b.blockRange(_),C=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const v=Ba(x=>kf(x.type.name,f))(m);if(k.depth>=1&&v&&k.depth-v.depth<=1){if(v.node.type===h)return u.liftListItem(p);if(kf(v.node.type.name,f)&&h.validContent(v.node.content)&&l)return a().command(()=>(s.setNodeMarkup(v.pos,h),!0)).command(()=>Ho(s,h)).command(()=>Zo(s,h)).run()}return!n||!C||!l?a().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>Ho(s,h)).command(()=>Zo(s,h)).run():a().command(()=>{const x=c().wrapInList(h,r),A=C.filter(w=>d.includes(w.type.name));return s.ensureMarks(A),x?!0:u.clearNodes()}).wrapInList(h,r).command(()=>Ho(s,h)).command(()=>Zo(s,h)).run()},AS=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Nn(t,r.schema);return zl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},CS=(t,e,n={})=>({state:r,commands:i})=>{const s=je(t,r.schema),o=je(e,r.schema),l=di(r,s,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...n})},_S=(t,e={})=>({state:n,commands:r})=>{const i=je(t,n.schema);return di(n,i,e)?r.lift(i):r.wrapIn(i,e)},wS=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},SS=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},ES=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,a=Nn(t,r.schema),{$from:u,empty:c,ranges:f}=l;if(!i)return!0;if(c&&o){let{from:d,to:h}=l;const p=(s=u.marks().find(g=>g.type===a))===null||s===void 0?void 0:s.attrs,m=Pa(u,a,p);m&&(d=m.from,h=m.to),n.removeMark(d,h,a)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,a)});return n.removeStoredMark(a),!0},DS=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const l=bo(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=je(t,r.schema)),l==="mark"&&(o=Nn(t,r.schema)),i&&n.selection.ranges.forEach(a=>{const u=a.$from.pos,c=a.$to.pos;let f,d,h,p;n.selection.empty?r.doc.nodesBetween(u,c,(m,g)=>{s&&s===m.type&&(h=Math.max(g,u),p=Math.min(g+m.nodeSize,c),f=g,d=m)}):r.doc.nodesBetween(u,c,(m,g)=>{g<u&&s&&s===m.type&&(h=Math.max(g,u),p=Math.min(g+m.nodeSize,c),f=g,d=m),g>=u&&g<=c&&(s&&s===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type){const _=Math.max(g,u),k=Math.min(g+m.nodeSize,c);n.addMark(_,k,o.create({...b.attrs,...e}))}}))}),d&&(f!==void 0&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(m=>{o===m.type&&n.addMark(h,p,o.create({...m.attrs,...e}))}))}),!0):!1},OS=(t,e={})=>({state:n,dispatch:r})=>{const i=je(t,n.schema);return j_(i,e)(n,r)},TS=(t,e={})=>({state:n,dispatch:r})=>{const i=je(t,n.schema);return q_(i,e)(n,r)};var MS=Object.freeze({__proto__:null,blur:cw,clearContent:fw,clearNodes:dw,command:hw,createParagraphNear:pw,cut:mw,deleteCurrentNode:gw,deleteNode:bw,deleteRange:yw,deleteSelection:kw,enter:vw,exitCode:xw,extendMarkRange:Aw,first:Cw,focus:ww,forEach:Sw,insertContent:Ew,insertContentAt:Tw,joinBackward:Nw,joinDown:$w,joinForward:Iw,joinItemBackward:Fw,joinItemForward:Rw,joinTextblockBackward:Pw,joinTextblockForward:Bw,joinUp:Mw,keyboardShortcut:Lw,lift:jw,liftEmptyBlock:qw,liftListItem:Vw,newlineInCode:Uw,resetAttributes:Hw,scrollIntoView:Zw,selectAll:Ww,selectNodeBackward:Jw,selectNodeForward:Kw,selectParentNode:Gw,selectTextblockEnd:Yw,selectTextblockStart:Xw,setContent:Qw,setMark:hS,setMeta:pS,setNode:mS,setNodeSelection:gS,setTextSelection:bS,sinkListItem:yS,splitBlock:kS,splitListItem:vS,toggleList:xS,toggleMark:AS,toggleNode:CS,toggleWrap:_S,undoInputRule:wS,unsetAllMarks:SS,unsetMark:ES,updateAttributes:DS,wrapIn:OS,wrapInList:TS});const $S=st.create({name:"commands",addCommands(){return{...MS}}}),NS=st.create({name:"drop",addProseMirrorPlugins(){return[new Ye({key:new vt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),IS=st.create({name:"editable",addProseMirrorPlugins(){return[new Ye({key:new vt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),FS=new vt("focusEvents"),RS=st.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ye({key:FS,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),PS=st.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:c,$anchor:f}=a,{pos:d,parent:h}=f,p=f.parent.isTextblock&&d>0?l.doc.resolve(d-1):f,m=p.parent.type.spec.isolating,g=f.pos-f.parentOffset,b=m&&p.parent.childCount===1?g===f.pos:ie.atStart(u).from===d;return!c||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ks()||Kp()?s:i},addProseMirrorPlugins(){return[new Ye({key:new vt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:l}=e.selection,a=ie.atStart(e.doc).from,u=ie.atEnd(e.doc).to;if(s||!(o===a&&l===u)||!La(n.doc))return;const d=n.tr,h=fo({state:n,transaction:d}),{commands:p}=new ho({editor:this.editor,state:h});if(p.clearNodes(),!!d.steps.length)return d}})]}}),BS=st.create({name:"paste",addProseMirrorPlugins(){return[new Ye({key:new vt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),zS=st.create({name:"tabindex",addProseMirrorPlugins(){return[new Ye({key:new vt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Pn{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Pn(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Pn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Pn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth)return;const a=new Pn(l,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new Pn(l,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(s[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(a=>n[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const LS=`.ProseMirror {
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ProseMirror {
|
|
80
|
+
word-wrap: break-word;
|
|
81
|
+
white-space: pre-wrap;
|
|
82
|
+
white-space: break-spaces;
|
|
83
|
+
-webkit-font-variant-ligatures: none;
|
|
84
|
+
font-variant-ligatures: none;
|
|
85
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.ProseMirror [contenteditable="false"] {
|
|
89
|
+
white-space: normal;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
93
|
+
white-space: pre-wrap;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ProseMirror pre {
|
|
97
|
+
white-space: pre-wrap;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
img.ProseMirror-separator {
|
|
101
|
+
display: inline !important;
|
|
102
|
+
border: none !important;
|
|
103
|
+
margin: 0 !important;
|
|
104
|
+
width: 0 !important;
|
|
105
|
+
height: 0 !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ProseMirror-gapcursor {
|
|
109
|
+
display: none;
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
position: absolute;
|
|
112
|
+
margin: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ProseMirror-gapcursor:after {
|
|
116
|
+
content: "";
|
|
117
|
+
display: block;
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: -2px;
|
|
120
|
+
width: 20px;
|
|
121
|
+
border-top: 1px solid black;
|
|
122
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@keyframes ProseMirror-cursor-blink {
|
|
126
|
+
to {
|
|
127
|
+
visibility: hidden;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ProseMirror-hideselection *::selection {
|
|
132
|
+
background: transparent;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
136
|
+
background: transparent;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.ProseMirror-hideselection * {
|
|
140
|
+
caret-color: transparent;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
144
|
+
display: block;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
148
|
+
opacity: 0
|
|
149
|
+
}`;function jS(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}let qS=class extends K_{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=jS(LS,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=jp(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(l=>!l.key.startsWith(o))}),n.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[IS,uw.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),$S,RS,PS,zS,NS,BS].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Ln(i,this)}createCommandManager(){this.commandManager=new ho({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Bl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),n=Bl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=Wp(n,this.options.autofocus);this.view=new Sp(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:dr.create({doc:n,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Yp(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return cS(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Fa(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
150
|
+
|
|
151
|
+
`,textSerializers:r={}}=e||{};return sS(this.state.doc,{blockSeparator:n,textSerializers:{...Up(this.schema),...r}})}get isEmpty(){return La(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Pn(n,this)}get $doc(){return this.$pos(0)}};function Cr(t){return new mo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=le(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),u=n.from+l.indexOf(o),c=u+o.length;if(za(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>u).length)return null;c<n.to&&s.delete(c,n.to),u>n.from&&s.delete(n.from+a,u);const d=n.from+a+o.length;s.addMark(n.from+a,d,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function VS(t){return new mo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=le(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const a=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>l?c=l:l=c+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,o+r[0].length-1),s.replaceWith(c,l,a)}else if(r[0]){const u=t.type.isInline?o:o-1;s.insert(u,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()}})}function Ll(t){return new mo({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=le(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function hi(t){return new mo({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=le(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),u=a&&ka(a,t.type,s);if(!u)return null;if(o.wrap(a,u),t.keepMarks&&t.editor){const{selection:f,storedMarks:d}=e,{splittableMarks:h}=t.editor.extensionManager,p=d||f.$to.parentOffset&&f.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Mn(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)}})}let It=class jl{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(K(this,"addOptions",{name:this.name}))),this.storage=le(K(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new jl(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>go(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new jl(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(K(n,"addOptions",{name:n.name})),n.storage=le(K(n,"addStorage",{name:n.name,options:n.options})),n}};function nr(t){return new rw({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=le(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let u=n.to;if(l){const c=a.search(/\S/),f=n.from+a.indexOf(l),d=f+l.length;if(za(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>f).length)return null;d<n.to&&o.delete(d,n.to),f>n.from&&o.delete(n.from+c,f),u=n.from+c+l.length,o.addMark(n.from+c,u,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function US(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof X){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function xf(t){return i0((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class HS extends qS{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=xf(this.view.state),this.reactiveExtensionStorage=xf(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),n0(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const r=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const ZS=De({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=Me(),n=s0();return t0(()=>{const r=t.editor;r&&r.options.element&&e.value&&nd(()=>{if(!e.value||!r.options.element.firstChild)return;const i=I(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:i}),r.createNodeViews()})}),Qs(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return e0("div",{ref:t=>{this.rootEl=t}})}}),WS=(t={})=>{const e=r0();return na(()=>{e.value=new HS(t)}),Qs(()=>{var n,r,i;const s=(n=e.value)===null||n===void 0?void 0:n.options.element,o=s==null?void 0:s.cloneNode(!0);(r=s==null?void 0:s.parentNode)===null||r===void 0||r.replaceChild(o,s),(i=e.value)===null||i===void 0||i.destroy()}),e};var JS=Object.create,ja=Object.defineProperty,KS=Object.getOwnPropertyDescriptor,Xp=Object.getOwnPropertyNames,GS=Object.getPrototypeOf,YS=Object.prototype.hasOwnProperty,W=(t,e)=>function(){return e||(0,t[Xp(t)[0]])((e={exports:{}}).exports,e),e.exports},Qp=(t,e)=>{for(var n in e)ja(t,n,{get:e[n],enumerable:!0})},XS=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Xp(e))!YS.call(t,i)&&i!==n&&ja(t,i,{get:()=>e[i],enumerable:!(r=KS(e,i))||r.enumerable});return t},yo=(t,e,n)=>(n=t!=null?JS(GS(t)):{},XS(!t||!t.__esModule?ja(n,"default",{value:t,enumerable:!0}):n,t)),em=W({"src/grammar/tag.js"(t,e){function n(s,o){function l(){this.constructor=s}l.prototype=o.prototype,s.prototype=new l}function r(s,o,l,a){this.message=s,this.expected=o,this.found=l,this.location=a,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,r)}n(r,Error),r.buildMessage=function(s,o,l){var a={literal:function(m){return'"'+c(m.text)+'"'},class:function(m){var g=m.parts.map(function(b){return Array.isArray(b)?f(b[0])+"-"+f(b[1]):f(b)});return"["+(m.inverted?"^":"")+g+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(m){return m.description},not:function(m){return"not "+d(m.expected)}};function u(m){return m.charCodeAt(0).toString(16).toUpperCase()}function c(m){return m.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(g){return"\\x0"+u(g)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(g){return"\\x"+u(g)})}function f(m){return m.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(g){return"\\x0"+u(g)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(g){return"\\x"+u(g)})}function d(m){return a[m.type](m)}function h(m){var g=m.map(d),b,_;if(g.sort(),g.length>0){for(b=1,_=1;b<g.length;b++)g[b-1]!==g[b]&&(g[_]=g[b],_++);g.length=_}switch(g.length){case 1:return g[0];case 2:return g[0]+" or "+g[1];default:return g.slice(0,-1).join(", ")+", or "+g[g.length-1]}}function p(m){return m?'"'+c(m)+'"':"end of input"}return"Expected "+h(s)+" but "+p(o)+" found."};function i(s,o){o=o!==void 0?o:{};var l={},a={Top:du},u=du,c="/",f=".",d="#",h="=",p="(",m=")",g=",",b="[",_="]",k="null",C="true",v="false",x="{",A="}",w=":",T='"',O="\\",M="n",N="r",U="t",R=/^[$@]/,P=/^[0-9]/,H=/^[^\0-\x1F"\\]/,ee=/^[a-zA-Z0-9_\-]/,se=/^[ \n\t]/,he=Ft("/",!1),Ce=Rt("tag name"),Be=Rt("class"),de=Rt("id"),_e=Ft("=",!1),qe=Ft("(",!1),Ve=Ft(")",!1),ot=Ft(",",!1),Tt=Rt("variable"),Zt=Rt("null"),In=Rt("boolean"),Ai=Ft("[",!1),jm=Ft("]",!1),qm=Ft("{",!1),Vm=Ft("}",!1),Um=Ft(":",!1),Hm=Rt("number"),Zm=Rt("string"),Wm=Rt("identifier"),Jm=Rt("whitespace"),Km=function(y){return{type:"variable",meta:{variable:y}}},Gm=function(y){return{type:"annotation",meta:{attributes:y}}},Ym=function(y,S){return S},Xm=function(y,S,D,$){S&&(D=D||[],D.unshift({type:"attribute",name:"primary",value:S}));const[L,J]=$?["tag",0]:["tag_open",1];return{type:L,nesting:J,meta:{tag:y,attributes:D}}},Qm=function(y){return{type:"tag_close",nesting:-1,meta:{tag:y}}},eg=function(y,S){return y?[y,...S]:[]},au=function(y){return y},tg=function(y){return y},ng=function(y){return y},rg=function(y){return y},ig=function(y){return{type:"class",name:y,value:!0}},sg=function(y){return{type:"attribute",name:"id",value:y}},og=function(y,S){return{type:"attribute",name:y,value:S}},lg=function(y,S,D){return S?[S,...D]:[]},ag=function(y,S){let D={};for(let[$,{name:L,value:J}]of S.entries())D[L||$]=J;return new Ug(y,D)},uu=function(y){return y},ug=function(y,S){return{name:y,value:S}},Ao=function(y){return y},cg=function(y,S,D){return y==="@"?[S,...D]:new Vg([S,...D])},fg=function(){return null},dg=function(){return!0},hg=function(){return!1},pg=function(y,S){return[y,...S]},mg=function(y){return y||[]},gg=function(y,S){return Object.assign(y,...S)},bg=function(y){return y||{}},yg=function(y,S){return y==="$$mdtype"?{}:{[y]:S}},kg=function(){return parseFloat(wg())},vg=function(y){return y.join("")},xg=function(){return`
|
|
152
|
+
`},Ag=function(){return"\r"},Cg=function(){return" "},_g=function(y){return y},E=0,ae=0,Ci=[{line:1,column:1}],_i=[],re=0,wi;if("startRule"in o){if(!(o.startRule in a))throw new Error(`Can't start parsing from rule "`+o.startRule+'".');u=a[o.startRule]}function wg(){return s.substring(ae,E)}function Ft(y,S){return{type:"literal",text:y,ignoreCase:S}}function Sg(){return{type:"end"}}function Rt(y){return{type:"other",description:y}}function cu(y){var S=Ci[y],D;if(S)return S;for(D=y-1;!Ci[D];)D--;for(S=Ci[D],S={line:S.line,column:S.column};D<y;)s.charCodeAt(D)===10?(S.line++,S.column=1):S.column++,D++;return Ci[y]=S,S}var Eg=typeof o.filename=="string"&&o.filename.length>0;function fu(y,S){var D={};Eg&&(D.filename=o.filename);var $=cu(y);D.start={offset:y,line:$.line,column:$.column};var L=cu(S);return D.end={offset:S,line:L.line,column:L.column},D}function Dg(){_i.push({pos:E,variants:[]})}function ve(y){var S=_i[_i.length-1];E<S.pos||(E>S.pos&&(S.pos=E,S.variants=[]),S.variants.push(y))}function Og(y,S,D){return new r(r.buildMessage(y,S,D),y,S,D)}function Tg(){var y=_i[0],S=y.pos;return Og(y.variants,S<s.length?s.charAt(S):null,S<s.length?fu(S,S+1):fu(S,S))}function du(){var y;return y=Mg(),y===l&&(y=$g(),y===l&&(y=Ng(),y===l&&(y=Ig()))),y}function Mg(){var y,S;return y=E,S=xu(),S===l&&(S=bu()),S!==l&&(ae=y,S=Km(S)),y=S,y}function $g(){var y,S,D,$;if(y=E,S=pu(),S!==l){for(D=[],$=fe();$!==l;)D.push($),$=fe();ae=y,y=Gm(S)}else E=y,y=l;return y}function Ng(){var y,S,D,$,L,J,ue,lt=function(an){re===0&&ve(an)};if(y=E,S=hu(),S!==l){for(D=[],$=fe();$!==l;)D.push($),$=fe();for($=E,L=sr(),L!==l?(J=fe(),J===l&&(J=null),ae=$,$=Ym(S,L)):(E=$,$=l),$===l&&($=null),L=pu(),L===l&&(L=null),J=[],ue=fe();ue!==l;)J.push(ue),ue=fe();lt(he),s.charCodeAt(E)===47?(ue=c,E++):ue=l,ue===l&&(ue=null),ae=y,y=Xm(S,$,L,ue)}else E=y,y=l;return y}function Ig(){var y,S,D,$=function(L){re===0&&ve(L)};return y=E,$(he),s.charCodeAt(E)===47?(S=c,E++):S=l,S!==l?(D=hu(),D!==l?(ae=y,y=Qm(D)):(E=y,y=l)):(E=y,y=l),y}function hu(){var y,S=function(D){re===0&&ve(D)};return S(Ce),re++,y=Wt(),re--,y}function pu(){var y,S,D,$;if(y=E,S=gu(),S!==l){for(D=[],$=mu();$!==l;)D.push($),$=mu();ae=y,y=eg(S,D)}else E=y,y=l;return y}function mu(){var y,S,D;if(y=E,S=[],D=fe(),D!==l)for(;D!==l;)S.push(D),D=fe();else S=l;return S!==l?(D=gu(),D!==l?(ae=y,y=au(D)):(E=y,y=l)):(E=y,y=l),y}function gu(){var y,S;return y=E,S=Rg(),S!==l&&(ae=y,S=tg(S)),y=S,y===l&&(y=E,S=Fg(),S!==l&&(ae=y,S=ng(S)),y=S,y===l&&(y=E,S=Pg(),S!==l&&(ae=y,S=rg(S)),y=S)),y}function Fg(){var y,S,D,$=function(L){re===0&&ve(L)};return $(Be),re++,y=E,s.charCodeAt(E)===46?(S=f,E++):S=l,S!==l?(D=Wt(),D!==l?(ae=y,y=ig(D)):(E=y,y=l)):(E=y,y=l),re--,y}function Rg(){var y,S,D,$=function(L){re===0&&ve(L)};return $(de),re++,y=E,s.charCodeAt(E)===35?(S=d,E++):S=l,S!==l?(D=Wt(),D!==l?(ae=y,y=sg(D)):(E=y,y=l)):(E=y,y=l),re--,y}function Pg(){var y,S,D,$,L=function(J){re===0&&ve(J)};return y=E,S=Wt(),S!==l?(L(_e),s.charCodeAt(E)===61?(D=h,E++):D=l,D!==l?($=sr(),$!==l?(ae=y,y=og(S,$)):(E=y,y=l)):(E=y,y=l)):(E=y,y=l),y}function bu(){var y,S,D,$,L,J,ue,lt,an=function(Hg){re===0&&ve(Hg)};if(y=E,S=Wt(),S!==l)if(an(qe),s.charCodeAt(E)===40?(D=p,E++):D=l,D!==l){for($=[],L=fe();L!==l;)$.push(L),L=fe();for(L=E,J=yu(),J===l&&(J=null),ue=[],lt=ku();lt!==l;)ue.push(lt),lt=ku();ae=L,L=lg(S,J,ue),an(Ve),s.charCodeAt(E)===41?(J=m,E++):J=l,J!==l?(ae=y,y=ag(S,L)):(E=y,y=l)}else E=y,y=l;else E=y,y=l;return y}function yu(){var y,S,D,$,L=function(J){re===0&&ve(J)};return y=E,S=E,D=Wt(),D!==l?(L(_e),s.charCodeAt(E)===61?($=h,E++):$=l,$!==l?(ae=S,S=uu(D)):(E=S,S=l)):(E=S,S=l),S===l&&(S=null),D=sr(),D!==l?(ae=y,y=ug(S,D)):(E=y,y=l),y}function ku(){var y,S,D,$,L,J=function(ue){re===0&&ve(ue)};for(y=E,S=[],D=fe();D!==l;)S.push(D),D=fe();if(J(ot),s.charCodeAt(E)===44?(D=g,E++):D=l,D!==l){for($=[],L=fe();L!==l;)$.push(L),L=fe();L=yu(),L!==l?(ae=y,y=Ao(L)):(E=y,y=l)}else E=y,y=l;return y}function vu(){var y,S,D,$=function(L){re===0&&ve(L)};for(y=E,S=[],D=fe();D!==l;)S.push(D),D=fe();return $(ot),s.charCodeAt(E)===44?(D=g,E++):D=l,D!==l?(S=[S,D],y=S):(E=y,y=l),y===l&&(y=null),y}function xu(){var y,S,D,$,L,J=function(ue){re===0&&ve(ue)};if(J(Tt),re++,y=E,R.test(s.charAt(E))?(S=s.charAt(E),E++):S=l,S!==l)if(D=Wt(),D!==l){for($=[],L=Au();L!==l;)$.push(L),L=Au();ae=y,y=cg(S,D,$)}else E=y,y=l;else E=y,y=l;return re--,y}function Au(){var y,S,D,$;return y=E,s.charCodeAt(E)===46?(S=f,E++):S=l,S!==l?(D=Wt(),D!==l?(ae=y,y=uu(D)):(E=y,y=l)):(E=y,y=l),y===l&&(y=E,s.charCodeAt(E)===91?(S=b,E++):S=l,S!==l?(D=Su(),D===l&&(D=Co()),D!==l?(s.charCodeAt(E)===93?($=_,E++):$=l,$!==l?(ae=y,y=Ao(D)):(E=y,y=l)):(E=y,y=l)):(E=y,y=l)),y}function sr(){var y;return y=Bg(),y===l&&(y=zg(),y===l&&(y=Co(),y===l&&(y=Su(),y===l&&(y=Lg(),y===l&&(y=jg(),y===l&&(y=bu(),y===l&&(y=xu()))))))),y}function Bg(){var y,S,D=function($){re===0&&ve($)};return D(Zt),re++,y=E,s.substr(E,4)===k?(S=k,E+=4):S=l,S!==l&&(ae=y,S=fg()),y=S,re--,y}function zg(){var y,S,D=function($){re===0&&ve($)};return D(In),re++,y=E,s.substr(E,4)===C?(S=C,E+=4):S=l,S!==l&&(ae=y,S=dg()),y=S,y===l&&(y=E,s.substr(E,5)===v?(S=v,E+=5):S=l,S!==l&&(ae=y,S=hg()),y=S),re--,y}function Lg(){var y,S,D,$,L,J,ue,lt=function(an){re===0&&ve(an)};if(y=E,lt(Ai),s.charCodeAt(E)===91?(S=b,E++):S=l,S!==l){for(D=[],$=fe();$!==l;)D.push($),$=fe();if($=E,L=sr(),L!==l){for(J=[],ue=Cu();ue!==l;)J.push(ue),ue=Cu();ue=vu(),ae=$,$=pg(L,J)}else E=$,$=l;for($===l&&($=null),L=[],J=fe();J!==l;)L.push(J),J=fe();lt(jm),s.charCodeAt(E)===93?(J=_,E++):J=l,J!==l?(ae=y,y=mg($)):(E=y,y=l)}else E=y,y=l;return y}function Cu(){var y,S,D,$,L,J=function(ue){re===0&&ve(ue)};for(y=E,S=[],D=fe();D!==l;)S.push(D),D=fe();if(J(ot),s.charCodeAt(E)===44?(D=g,E++):D=l,D!==l){for($=[],L=fe();L!==l;)$.push(L),L=fe();L=sr(),L!==l?(ae=y,y=Ao(L)):(E=y,y=l)}else E=y,y=l;return y}function jg(){var y,S,D,$,L,J,ue,lt=function(an){re===0&&ve(an)};if(y=E,lt(qm),s.charCodeAt(E)===123?(S=x,E++):S=l,S!==l){for(D=[],$=fe();$!==l;)D.push($),$=fe();if($=E,L=wu(),L!==l){for(J=[],ue=_u();ue!==l;)J.push(ue),ue=_u();ue=vu(),ae=$,$=gg(L,J)}else E=$,$=l;for($===l&&($=null),L=[],J=fe();J!==l;)L.push(J),J=fe();lt(Vm),s.charCodeAt(E)===125?(J=A,E++):J=l,J!==l?(ae=y,y=bg($)):(E=y,y=l)}else E=y,y=l;return y}function _u(){var y,S,D,$,L,J=function(ue){re===0&&ve(ue)};for(y=E,S=[],D=fe();D!==l;)S.push(D),D=fe();if(J(ot),s.charCodeAt(E)===44?(D=g,E++):D=l,D!==l){for($=[],L=fe();L!==l;)$.push(L),L=fe();L=wu(),L!==l?(ae=y,y=au(L)):(E=y,y=l)}else E=y,y=l;return y}function wu(){var y,S,D,$,L,J=function(ue){re===0&&ve(ue)};if(y=E,S=Wt(),S===l&&(S=Co()),S!==l)if(J(Um),s.charCodeAt(E)===58?(D=w,E++):D=l,D!==l){for($=[],L=fe();L!==l;)$.push(L),L=fe();L=sr(),L!==l?(ae=y,y=yg(S,L)):(E=y,y=l)}else E=y,y=l;else E=y,y=l;return y}function Su(){var y,S,D,$,L,J,ue=function(lt){re===0&&ve(lt)};if(ue(Hm),re++,y=E,s.charCodeAt(E)===45&&E++,S=[],P.test(s.charAt(E))?(D=s.charAt(E),E++):D=l,D!==l)for(;D!==l;)S.push(D),P.test(s.charAt(E))?(D=s.charAt(E),E++):D=l;else S=l;if(S!==l){if(D=E,s.charCodeAt(E)===46?($=f,E++):$=l,$!==l){if(L=[],P.test(s.charAt(E))?(J=s.charAt(E),E++):J=l,J!==l)for(;J!==l;)L.push(J),P.test(s.charAt(E))?(J=s.charAt(E),E++):J=l;else L=l;L!==l?($=[$,L],D=$):(E=D,D=l)}else E=D,D=l;D===l&&(D=null),ae=y,y=kg()}else E=y,y=l;return re--,y}function Co(){var y,S,D,$,L=function(J){re===0&&ve(J)};if(L(Zm),re++,y=E,s.charCodeAt(E)===34?(S=T,E++):S=l,S!==l){for(D=[],$=Eu();$!==l;)D.push($),$=Eu();s.charCodeAt(E)===34?($=T,E++):$=l,$!==l?(ae=y,y=vg(D)):(E=y,y=l)}else E=y,y=l;return re--,y}function Eu(){var y;return H.test(s.charAt(E))?(y=s.charAt(E),E++):y=l,y===l&&(y=qg()),y}function qg(){var y,S,D,$;return y=E,s.charCodeAt(E)===92?(S=O,E++):S=l,S!==l?(s.charCodeAt(E)===34?(D=T,E++):D=l,D===l&&(s.charCodeAt(E)===92?(D=O,E++):D=l,D===l&&(D=E,s.charCodeAt(E)===110?($=M,E++):$=l,$!==l&&(ae=D,$=xg()),D=$,D===l&&(D=E,s.charCodeAt(E)===114?($=N,E++):$=l,$!==l&&(ae=D,$=Ag()),D=$,D===l&&(D=E,s.charCodeAt(E)===116?($=U,E++):$=l,$!==l&&(ae=D,$=Cg()),D=$)))),D!==l?(ae=y,y=_g(D)):(E=y,y=l)):(E=y,y=l),y}function Wt(){var y,S,D,$=function(L){re===0&&ve(L)};if($(Wm),re++,y=E,S=[],ee.test(s.charAt(E))?(D=s.charAt(E),E++):D=l,D!==l)for(;D!==l;)S.push(D),ee.test(s.charAt(E))?(D=s.charAt(E),E++):D=l;else S=l;return S!==l?y=s.substring(y,E):y=S,re--,y}function fe(){var y,S=function(D){re===0&&ve(D)};return S(Jm),re++,se.test(s.charAt(E))?(y=s.charAt(E),E++):y=l,re--,y}const{Variable:Vg,Function:Ug}=o;if(Dg(),wi=u(),wi!==l&&E===s.length)return wi;throw wi!==l&&E<s.length&&ve(Sg()),Tg()}e.exports={SyntaxError:r,parse:i}}}),QS=W({"node_modules/entities/lib/maps/entities.json"(t,e){e.exports={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",amp:"&",AMP:"&",andand:"⩕",And:"⩓",and:"∧",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angmsd:"∡",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",apacir:"⩯",ap:"≈",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxHd:"╤",boxhD:"╥",boxHD:"╦",boxhu:"┴",boxHu:"╧",boxhU:"╨",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsolb:"⧅",bsol:"\\",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",capand:"⩄",capbrcup:"⩉",capcap:"⩋",cap:"∩",Cap:"⋒",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cir:"○",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cup:"∪",Cup:"⋓",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",Darr:"↡",dArr:"⇓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",ddagger:"‡",ddarr:"⇊",DD:"ⅅ",dd:"ⅆ",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrowBar:"⤓",downarrow:"↓",DownArrow:"↓",Downarrow:"⇓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVectorBar:"⥖",DownLeftVector:"↽",DownRightTeeVector:"⥟",DownRightVectorBar:"⥗",DownRightVector:"⇁",DownTeeArrow:"↧",DownTee:"⊤",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",Ecirc:"Ê",ecirc:"ê",ecir:"≖",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",edot:"ė",eDot:"≑",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp13:" ",emsp14:" ",emsp:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",ge:"≥",gE:"≧",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",gescc:"⪩",ges:"⩾",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gla:"⪥",gl:"≷",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gt:">",GT:">",Gt:"≫",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",harrcir:"⥈",harr:"↔",hArr:"⇔",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",Im:"ℑ",imof:"⊷",imped:"Ƶ",Implies:"⇒",incare:"℅",in:"∈",infin:"∞",infintie:"⧝",inodot:"ı",intcal:"⊺",int:"∫",Int:"∬",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larrb:"⇤",larrbfs:"⤟",larr:"←",Larr:"↞",lArr:"⇐",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",latail:"⤙",lAtail:"⤛",lat:"⪫",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",LeftArrowBar:"⇤",leftarrow:"←",LeftArrow:"←",Leftarrow:"⇐",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVectorBar:"⥙",LeftDownVector:"⇃",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTeeArrow:"↤",LeftTee:"⊣",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangleBar:"⧏",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVectorBar:"⥘",LeftUpVector:"↿",LeftVectorBar:"⥒",LeftVector:"↼",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",lescc:"⪨",les:"⩽",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",llarr:"⇇",ll:"≪",Ll:"⋘",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoustache:"⎰",lmoust:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftrightarrow:"⟷",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longmapsto:"⟼",longrightarrow:"⟶",LongRightArrow:"⟶",Longrightarrow:"⟹",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",lt:"<",LT:"<",Lt:"≪",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",midast:"*",midcir:"⫰",mid:"∣",middot:"·",minusb:"⊟",minus:"−",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natural:"♮",naturals:"ℕ",natur:"♮",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",ne:"≠",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
153
|
+
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nlE:"≦̸",nle:"≰",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangleBar:"⧏̸",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangleBar:"⧐̸",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",nparallel:"∦",npar:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",nprec:"⊀",npreceq:"⪯̸",npre:"⪯̸",nrarrc:"⤳̸",nrarr:"↛",nrArr:"⇏",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",Ocirc:"Ô",ocirc:"ô",ocir:"⊚",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",orarr:"↻",Or:"⩔",or:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",otimesas:"⨶",Otimes:"⨷",otimes:"⊗",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",para:"¶",parallel:"∥",par:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plus:"+",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",prap:"⪷",Pr:"⪻",pr:"≺",prcue:"≼",precapprox:"⪷",prec:"≺",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",pre:"⪯",prE:"⪳",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportional:"∝",Proportion:"∷",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarr:"→",Rarr:"↠",rArr:"⇒",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",Re:"ℜ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrowBar:"⇥",rightarrow:"→",RightArrow:"→",Rightarrow:"⇒",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVectorBar:"⥕",RightDownVector:"⇂",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTeeArrow:"↦",RightTee:"⊢",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangleBar:"⧐",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVectorBar:"⥔",RightUpVector:"↾",RightVectorBar:"⥓",RightVector:"⇀",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoustache:"⎱",rmoust:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",scap:"⪸",Scaron:"Š",scaron:"š",Sc:"⪼",sc:"≻",sccue:"≽",sce:"⪰",scE:"⪴",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdotb:"⊡",sdot:"⋅",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",solbar:"⌿",solb:"⧄",sol:"/",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squ:"□",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succapprox:"⪸",succ:"≻",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",Sup:"⋑",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",therefore:"∴",Therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",ThinSpace:" ",thinsp:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",timesbar:"⨱",timesb:"⊠",times:"×",timesd:"⨰",tint:"∭",toea:"⤨",topbot:"⌶",topcir:"⫱",top:"⊤",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",uarr:"↑",Uarr:"↟",uArr:"⇑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrowBar:"⤒",uparrow:"↑",UpArrow:"↑",Uparrow:"⇑",UpArrowDownArrow:"⇅",updownarrow:"↕",UpDownArrow:"↕",Updownarrow:"⇕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTeeArrow:"↥",UpTee:"⊥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",Vcy:"В",vcy:"в",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",veebar:"⊻",vee:"∨",Vee:"⋁",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xharr:"⟷",xhArr:"⟺",Xi:"Ξ",xi:"ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",yuml:"ÿ",Yuml:"Ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",zfr:"𝔷",Zfr:"ℨ",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}}}),tm=W({"node_modules/markdown-it/lib/common/entities.js"(t,e){e.exports=QS()}}),qa=W({"node_modules/uc.micro/categories/P/regex.js"(t,e){e.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/}}),eE=W({"node_modules/mdurl/encode.js"(t,e){var n={};function r(s){var o,l,a=n[s];if(a)return a;for(a=n[s]=[],o=0;o<128;o++)l=String.fromCharCode(o),/^[0-9a-z]$/i.test(l)?a.push(l):a.push("%"+("0"+o.toString(16).toUpperCase()).slice(-2));for(o=0;o<s.length;o++)a[s.charCodeAt(o)]=s[o];return a}function i(s,o,l){var a,u,c,f,d,h="";for(typeof o!="string"&&(l=o,o=i.defaultChars),typeof l>"u"&&(l=!0),d=r(o),a=0,u=s.length;a<u;a++){if(c=s.charCodeAt(a),l&&c===37&&a+2<u&&/^[0-9a-f]{2}$/i.test(s.slice(a+1,a+3))){h+=s.slice(a,a+3),a+=2;continue}if(c<128){h+=d[c];continue}if(c>=55296&&c<=57343){if(c>=55296&&c<=56319&&a+1<u&&(f=s.charCodeAt(a+1),f>=56320&&f<=57343)){h+=encodeURIComponent(s[a]+s[a+1]),a++;continue}h+="%EF%BF%BD";continue}h+=encodeURIComponent(s[a])}return h}i.defaultChars=";/?:@&=+$,-_.!~*'()#",i.componentChars="-_.!~*'()",e.exports=i}}),tE=W({"node_modules/mdurl/decode.js"(t,e){var n={};function r(s){var o,l,a=n[s];if(a)return a;for(a=n[s]=[],o=0;o<128;o++)l=String.fromCharCode(o),a.push(l);for(o=0;o<s.length;o++)l=s.charCodeAt(o),a[l]="%"+("0"+l.toString(16).toUpperCase()).slice(-2);return a}function i(s,o){var l;return typeof o!="string"&&(o=i.defaultChars),l=r(o),s.replace(/(%[a-f0-9]{2})+/gi,function(a){var u,c,f,d,h,p,m,g="";for(u=0,c=a.length;u<c;u+=3){if(f=parseInt(a.slice(u+1,u+3),16),f<128){g+=l[f];continue}if((f&224)===192&&u+3<c&&(d=parseInt(a.slice(u+4,u+6),16),(d&192)===128)){m=f<<6&1984|d&63,m<128?g+="��":g+=String.fromCharCode(m),u+=3;continue}if((f&240)===224&&u+6<c&&(d=parseInt(a.slice(u+4,u+6),16),h=parseInt(a.slice(u+7,u+9),16),(d&192)===128&&(h&192)===128)){m=f<<12&61440|d<<6&4032|h&63,m<2048||m>=55296&&m<=57343?g+="���":g+=String.fromCharCode(m),u+=6;continue}if((f&248)===240&&u+9<c&&(d=parseInt(a.slice(u+4,u+6),16),h=parseInt(a.slice(u+7,u+9),16),p=parseInt(a.slice(u+10,u+12),16),(d&192)===128&&(h&192)===128&&(p&192)===128)){m=f<<18&1835008|d<<12&258048|h<<6&4032|p&63,m<65536||m>1114111?g+="����":(m-=65536,g+=String.fromCharCode(55296+(m>>10),56320+(m&1023))),u+=9;continue}g+="�"}return g})}i.defaultChars=";/?:@&=+$,#",i.componentChars="",e.exports=i}}),nE=W({"node_modules/mdurl/format.js"(t,e){e.exports=function(r){var i="";return i+=r.protocol||"",i+=r.slashes?"//":"",i+=r.auth?r.auth+"@":"",r.hostname&&r.hostname.indexOf(":")!==-1?i+="["+r.hostname+"]":i+=r.hostname||"",i+=r.port?":"+r.port:"",i+=r.pathname||"",i+=r.search||"",i+=r.hash||"",i}}}),rE=W({"node_modules/mdurl/parse.js"(t,e){function n(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var r=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,o=["<",">",'"',"`"," ","\r",`
|
|
154
|
+
`," "],l=["{","}","|","\\","^","`"].concat(o),a=["'"].concat(l),u=["%","/","?",";","#"].concat(a),c=["/","?","#"],f=255,d=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,p={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function g(b,_){if(b&&b instanceof n)return b;var k=new n;return k.parse(b,_),k}n.prototype.parse=function(b,_){var k,C,v,x,A,w=b;if(w=w.trim(),!_&&b.split("#").length===1){var T=s.exec(w);if(T)return this.pathname=T[1],T[2]&&(this.search=T[2]),this}var O=r.exec(w);if(O&&(O=O[0],v=O.toLowerCase(),this.protocol=O,w=w.substr(O.length)),(_||O||w.match(/^\/\/[^@\/]+@[^@\/]+/))&&(A=w.substr(0,2)==="//",A&&!(O&&p[O])&&(w=w.substr(2),this.slashes=!0)),!p[O]&&(A||O&&!m[O])){var M=-1;for(k=0;k<c.length;k++)x=w.indexOf(c[k]),x!==-1&&(M===-1||x<M)&&(M=x);var N,U;for(M===-1?U=w.lastIndexOf("@"):U=w.lastIndexOf("@",M),U!==-1&&(N=w.slice(0,U),w=w.slice(U+1),this.auth=N),M=-1,k=0;k<u.length;k++)x=w.indexOf(u[k]),x!==-1&&(M===-1||x<M)&&(M=x);M===-1&&(M=w.length),w[M-1]===":"&&M--;var R=w.slice(0,M);w=w.slice(M),this.parseHost(R),this.hostname=this.hostname||"";var P=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!P){var H=this.hostname.split(/\./);for(k=0,C=H.length;k<C;k++){var ee=H[k];if(ee&&!ee.match(d)){for(var se="",he=0,Ce=ee.length;he<Ce;he++)ee.charCodeAt(he)>127?se+="x":se+=ee[he];if(!se.match(d)){var Be=H.slice(0,k),de=H.slice(k+1),_e=ee.match(h);_e&&(Be.push(_e[1]),de.unshift(_e[2])),de.length&&(w=de.join(".")+w),this.hostname=Be.join(".");break}}}}this.hostname.length>f&&(this.hostname=""),P&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}var qe=w.indexOf("#");qe!==-1&&(this.hash=w.substr(qe),w=w.slice(0,qe));var Ve=w.indexOf("?");return Ve!==-1&&(this.search=w.substr(Ve),w=w.slice(0,Ve)),w&&(this.pathname=w),m[v]&&this.hostname&&!this.pathname&&(this.pathname=""),this},n.prototype.parseHost=function(b){var _=i.exec(b);_&&(_=_[0],_!==":"&&(this.port=_.substr(1)),b=b.substr(0,b.length-_.length)),b&&(this.hostname=b)},e.exports=g}}),nm=W({"node_modules/mdurl/index.js"(t,e){e.exports.encode=eE(),e.exports.decode=tE(),e.exports.format=nE(),e.exports.parse=rE()}}),rm=W({"node_modules/uc.micro/properties/Any/regex.js"(t,e){e.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/}}),im=W({"node_modules/uc.micro/categories/Cc/regex.js"(t,e){e.exports=/[\0-\x1F\x7F-\x9F]/}}),iE=W({"node_modules/uc.micro/categories/Cf/regex.js"(t,e){e.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/}}),sm=W({"node_modules/uc.micro/categories/Z/regex.js"(t,e){e.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/}}),sE=W({"node_modules/uc.micro/index.js"(t){t.Any=rm(),t.Cc=im(),t.Cf=iE(),t.P=qa(),t.Z=sm()}}),me=W({"node_modules/markdown-it/lib/common/utils.js"(t){function e(R){return Object.prototype.toString.call(R)}function n(R){return e(R)==="[object String]"}var r=Object.prototype.hasOwnProperty;function i(R,P){return r.call(R,P)}function s(R){var P=Array.prototype.slice.call(arguments,1);return P.forEach(function(H){if(H){if(typeof H!="object")throw new TypeError(H+"must be object");Object.keys(H).forEach(function(ee){R[ee]=H[ee]})}}),R}function o(R,P,H){return[].concat(R.slice(0,P),H,R.slice(P+1))}function l(R){return!(R>=55296&&R<=57343||R>=64976&&R<=65007||(R&65535)===65535||(R&65535)===65534||R>=0&&R<=8||R===11||R>=14&&R<=31||R>=127&&R<=159||R>1114111)}function a(R){if(R>65535){R-=65536;var P=55296+(R>>10),H=56320+(R&1023);return String.fromCharCode(P,H)}return String.fromCharCode(R)}var u=/\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,c=/&([a-z#][a-z0-9]{1,31});/gi,f=new RegExp(u.source+"|"+c.source,"gi"),d=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,h=tm();function p(R,P){var H=0;return i(h,P)?h[P]:P.charCodeAt(0)===35&&d.test(P)&&(H=P[1].toLowerCase()==="x"?parseInt(P.slice(2),16):parseInt(P.slice(1),10),l(H))?a(H):R}function m(R){return R.indexOf("\\")<0?R:R.replace(u,"$1")}function g(R){return R.indexOf("\\")<0&&R.indexOf("&")<0?R:R.replace(f,function(P,H,ee){return H||p(P,ee)})}var b=/[&<>"]/,_=/[&<>"]/g,k={"&":"&","<":"<",">":">",'"':"""};function C(R){return k[R]}function v(R){return b.test(R)?R.replace(_,C):R}var x=/[.?*+^$[\]\\(){}|-]/g;function A(R){return R.replace(x,"\\$&")}function w(R){switch(R){case 9:case 32:return!0}return!1}function T(R){if(R>=8192&&R<=8202)return!0;switch(R){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}var O=qa();function M(R){return O.test(R)}function N(R){switch(R){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function U(R){return R=R.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(R=R.replace(/ẞ/g,"ß")),R.toLowerCase().toUpperCase()}t.lib={},t.lib.mdurl=nm(),t.lib.ucmicro=sE(),t.assign=s,t.isString=n,t.has=i,t.unescapeMd=m,t.unescapeAll=g,t.isValidEntityCode=l,t.fromCodePoint=a,t.escapeHtml=v,t.arrayReplaceAt=o,t.isSpace=w,t.isWhiteSpace=T,t.isMdAsciiPunct=N,t.isPunctChar=M,t.escapeRE=A,t.normalizeReference=U}}),oE=W({"node_modules/markdown-it/lib/helpers/parse_link_label.js"(t,e){e.exports=function(r,i,s){var o,l,a,u,c=-1,f=r.posMax,d=r.pos;for(r.pos=i+1,o=1;r.pos<f;){if(a=r.src.charCodeAt(r.pos),a===93&&(o--,o===0)){l=!0;break}if(u=r.pos,r.md.inline.skipToken(r),a===91){if(u===r.pos-1)o++;else if(s)return r.pos=d,-1}}return l&&(c=r.pos),r.pos=d,c}}}),lE=W({"node_modules/markdown-it/lib/helpers/parse_link_destination.js"(t,e){var n=me().unescapeAll;e.exports=function(i,s,o){var l,a,u=0,c=s,f={ok:!1,pos:0,lines:0,str:""};if(i.charCodeAt(s)===60){for(s++;s<o;){if(l=i.charCodeAt(s),l===10||l===60)return f;if(l===62)return f.pos=s+1,f.str=n(i.slice(c+1,s)),f.ok=!0,f;if(l===92&&s+1<o){s+=2;continue}s++}return f}for(a=0;s<o&&(l=i.charCodeAt(s),!(l===32||l<32||l===127));){if(l===92&&s+1<o){if(i.charCodeAt(s+1)===32)break;s+=2;continue}if(l===40&&(a++,a>32))return f;if(l===41){if(a===0)break;a--}s++}return c===s||a!==0||(f.str=n(i.slice(c,s)),f.lines=u,f.pos=s,f.ok=!0),f}}}),aE=W({"node_modules/markdown-it/lib/helpers/parse_link_title.js"(t,e){var n=me().unescapeAll;e.exports=function(i,s,o){var l,a,u=0,c=s,f={ok:!1,pos:0,lines:0,str:""};if(s>=o||(a=i.charCodeAt(s),a!==34&&a!==39&&a!==40))return f;for(s++,a===40&&(a=41);s<o;){if(l=i.charCodeAt(s),l===a)return f.pos=s+1,f.lines=u,f.str=n(i.slice(c+1,s)),f.ok=!0,f;if(l===40&&a===41)return f;l===10?u++:l===92&&s+1<o&&(s++,i.charCodeAt(s)===10&&u++),s++}return f}}}),uE=W({"node_modules/markdown-it/lib/helpers/index.js"(t){t.parseLinkLabel=oE(),t.parseLinkDestination=lE(),t.parseLinkTitle=aE()}}),cE=W({"node_modules/markdown-it/lib/renderer.js"(t,e){var n=me().assign,r=me().unescapeAll,i=me().escapeHtml,s={};s.code_inline=function(l,a,u,c,f){var d=l[a];return"<code"+f.renderAttrs(d)+">"+i(l[a].content)+"</code>"},s.code_block=function(l,a,u,c,f){var d=l[a];return"<pre"+f.renderAttrs(d)+"><code>"+i(l[a].content)+`</code></pre>
|
|
155
|
+
`},s.fence=function(l,a,u,c,f){var d=l[a],h=d.info?r(d.info).trim():"",p="",m="",g,b,_,k,C;return h&&(_=h.split(/(\s+)/g),p=_[0],m=_.slice(2).join("")),u.highlight?g=u.highlight(d.content,p,m)||i(d.content):g=i(d.content),g.indexOf("<pre")===0?g+`
|
|
156
|
+
`:h?(b=d.attrIndex("class"),k=d.attrs?d.attrs.slice():[],b<0?k.push(["class",u.langPrefix+p]):(k[b]=k[b].slice(),k[b][1]+=" "+u.langPrefix+p),C={attrs:k},"<pre><code"+f.renderAttrs(C)+">"+g+`</code></pre>
|
|
157
|
+
`):"<pre><code"+f.renderAttrs(d)+">"+g+`</code></pre>
|
|
158
|
+
`},s.image=function(l,a,u,c,f){var d=l[a];return d.attrs[d.attrIndex("alt")][1]=f.renderInlineAsText(d.children,u,c),f.renderToken(l,a,u)},s.hardbreak=function(l,a,u){return u.xhtmlOut?`<br />
|
|
159
|
+
`:`<br>
|
|
160
|
+
`},s.softbreak=function(l,a,u){return u.breaks?u.xhtmlOut?`<br />
|
|
161
|
+
`:`<br>
|
|
162
|
+
`:`
|
|
163
|
+
`},s.text=function(l,a){return i(l[a].content)},s.html_block=function(l,a){return l[a].content},s.html_inline=function(l,a){return l[a].content};function o(){this.rules=n({},s)}o.prototype.renderAttrs=function(a){var u,c,f;if(!a.attrs)return"";for(f="",u=0,c=a.attrs.length;u<c;u++)f+=" "+i(a.attrs[u][0])+'="'+i(a.attrs[u][1])+'"';return f},o.prototype.renderToken=function(a,u,c){var f,d="",h=!1,p=a[u];return p.hidden?"":(p.block&&p.nesting!==-1&&u&&a[u-1].hidden&&(d+=`
|
|
164
|
+
`),d+=(p.nesting===-1?"</":"<")+p.tag,d+=this.renderAttrs(p),p.nesting===0&&c.xhtmlOut&&(d+=" /"),p.block&&(h=!0,p.nesting===1&&u+1<a.length&&(f=a[u+1],(f.type==="inline"||f.hidden||f.nesting===-1&&f.tag===p.tag)&&(h=!1))),d+=h?`>
|
|
165
|
+
`:">",d)},o.prototype.renderInline=function(l,a,u){for(var c,f="",d=this.rules,h=0,p=l.length;h<p;h++)c=l[h].type,typeof d[c]<"u"?f+=d[c](l,h,a,u,this):f+=this.renderToken(l,h,a);return f},o.prototype.renderInlineAsText=function(l,a,u){for(var c="",f=0,d=l.length;f<d;f++)l[f].type==="text"?c+=l[f].content:l[f].type==="image"?c+=this.renderInlineAsText(l[f].children,a,u):l[f].type==="softbreak"&&(c+=`
|
|
166
|
+
`);return c},o.prototype.render=function(l,a,u){var c,f,d,h="",p=this.rules;for(c=0,f=l.length;c<f;c++)d=l[c].type,d==="inline"?h+=this.renderInline(l[c].children,a,u):typeof p[d]<"u"?h+=p[l[c].type](l,c,a,u,this):h+=this.renderToken(l,c,a,u);return h},e.exports=o}}),Va=W({"node_modules/markdown-it/lib/ruler.js"(t,e){function n(){this.__rules__=[],this.__cache__=null}n.prototype.__find__=function(r){for(var i=0;i<this.__rules__.length;i++)if(this.__rules__[i].name===r)return i;return-1},n.prototype.__compile__=function(){var r=this,i=[""];r.__rules__.forEach(function(s){s.enabled&&s.alt.forEach(function(o){i.indexOf(o)<0&&i.push(o)})}),r.__cache__={},i.forEach(function(s){r.__cache__[s]=[],r.__rules__.forEach(function(o){o.enabled&&(s&&o.alt.indexOf(s)<0||r.__cache__[s].push(o.fn))})})},n.prototype.at=function(r,i,s){var o=this.__find__(r),l=s||{};if(o===-1)throw new Error("Parser rule not found: "+r);this.__rules__[o].fn=i,this.__rules__[o].alt=l.alt||[],this.__cache__=null},n.prototype.before=function(r,i,s,o){var l=this.__find__(r),a=o||{};if(l===-1)throw new Error("Parser rule not found: "+r);this.__rules__.splice(l,0,{name:i,enabled:!0,fn:s,alt:a.alt||[]}),this.__cache__=null},n.prototype.after=function(r,i,s,o){var l=this.__find__(r),a=o||{};if(l===-1)throw new Error("Parser rule not found: "+r);this.__rules__.splice(l+1,0,{name:i,enabled:!0,fn:s,alt:a.alt||[]}),this.__cache__=null},n.prototype.push=function(r,i,s){var o=s||{};this.__rules__.push({name:r,enabled:!0,fn:i,alt:o.alt||[]}),this.__cache__=null},n.prototype.enable=function(r,i){Array.isArray(r)||(r=[r]);var s=[];return r.forEach(function(o){var l=this.__find__(o);if(l<0){if(i)return;throw new Error("Rules manager: invalid rule name "+o)}this.__rules__[l].enabled=!0,s.push(o)},this),this.__cache__=null,s},n.prototype.enableOnly=function(r,i){Array.isArray(r)||(r=[r]),this.__rules__.forEach(function(s){s.enabled=!1}),this.enable(r,i)},n.prototype.disable=function(r,i){Array.isArray(r)||(r=[r]);var s=[];return r.forEach(function(o){var l=this.__find__(o);if(l<0){if(i)return;throw new Error("Rules manager: invalid rule name "+o)}this.__rules__[l].enabled=!1,s.push(o)},this),this.__cache__=null,s},n.prototype.getRules=function(r){return this.__cache__===null&&this.__compile__(),this.__cache__[r]||[]},e.exports=n}}),fE=W({"node_modules/markdown-it/lib/rules_core/normalize.js"(t,e){var n=/\r\n?|\n/g,r=/\0/g;e.exports=function(s){var o;o=s.src.replace(n,`
|
|
167
|
+
`),o=o.replace(r,"�"),s.src=o}}}),dE=W({"node_modules/markdown-it/lib/rules_core/block.js"(t,e){e.exports=function(r){var i;r.inlineMode?(i=new r.Token("inline","",0),i.content=r.src,i.map=[0,1],i.children=[],r.tokens.push(i)):r.md.block.parse(r.src,r.md,r.env,r.tokens)}}}),hE=W({"node_modules/markdown-it/lib/rules_core/inline.js"(t,e){e.exports=function(r){var i=r.tokens,s,o,l;for(o=0,l=i.length;o<l;o++)s=i[o],s.type==="inline"&&r.md.inline.parse(s.content,r.md,r.env,s.children)}}}),pE=W({"node_modules/markdown-it/lib/rules_core/linkify.js"(t,e){var n=me().arrayReplaceAt;function r(s){return/^<a[>\s]/i.test(s)}function i(s){return/^<\/a\s*>/i.test(s)}e.exports=function(o){var l,a,u,c,f,d,h,p,m,g,b,_,k,C,v,x,A=o.tokens,w;if(o.md.options.linkify){for(a=0,u=A.length;a<u;a++)if(!(A[a].type!=="inline"||!o.md.linkify.pretest(A[a].content)))for(c=A[a].children,k=0,l=c.length-1;l>=0;l--){if(d=c[l],d.type==="link_close"){for(l--;c[l].level!==d.level&&c[l].type!=="link_open";)l--;continue}if(d.type==="html_inline"&&(r(d.content)&&k>0&&k--,i(d.content)&&k++),!(k>0)&&d.type==="text"&&o.md.linkify.test(d.content)){for(m=d.content,w=o.md.linkify.match(m),h=[],_=d.level,b=0,p=0;p<w.length;p++)C=w[p].url,v=o.md.normalizeLink(C),o.md.validateLink(v)&&(x=w[p].text,w[p].schema?w[p].schema==="mailto:"&&!/^mailto:/i.test(x)?x=o.md.normalizeLinkText("mailto:"+x).replace(/^mailto:/,""):x=o.md.normalizeLinkText(x):x=o.md.normalizeLinkText("http://"+x).replace(/^http:\/\//,""),g=w[p].index,g>b&&(f=new o.Token("text","",0),f.content=m.slice(b,g),f.level=_,h.push(f)),f=new o.Token("link_open","a",1),f.attrs=[["href",v]],f.level=_++,f.markup="linkify",f.info="auto",h.push(f),f=new o.Token("text","",0),f.content=x,f.level=_,h.push(f),f=new o.Token("link_close","a",-1),f.level=--_,f.markup="linkify",f.info="auto",h.push(f),b=w[p].lastIndex);b<m.length&&(f=new o.Token("text","",0),f.content=m.slice(b),f.level=_,h.push(f)),A[a].children=c=n(c,l,h)}}}}}}),mE=W({"node_modules/markdown-it/lib/rules_core/replacements.js"(t,e){var n=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,r=/\((c|tm|r|p)\)/i,i=/\((c|tm|r|p)\)/ig,s={c:"©",r:"®",p:"§",tm:"™"};function o(u,c){return s[c.toLowerCase()]}function l(u){var c,f,d=0;for(c=u.length-1;c>=0;c--)f=u[c],f.type==="text"&&!d&&(f.content=f.content.replace(i,o)),f.type==="link_open"&&f.info==="auto"&&d--,f.type==="link_close"&&f.info==="auto"&&d++}function a(u){var c,f,d=0;for(c=u.length-1;c>=0;c--)f=u[c],f.type==="text"&&!d&&n.test(f.content)&&(f.content=f.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),f.type==="link_open"&&f.info==="auto"&&d--,f.type==="link_close"&&f.info==="auto"&&d++}e.exports=function(c){var f;if(c.md.options.typographer)for(f=c.tokens.length-1;f>=0;f--)c.tokens[f].type==="inline"&&(r.test(c.tokens[f].content)&&l(c.tokens[f].children),n.test(c.tokens[f].content)&&a(c.tokens[f].children))}}}),gE=W({"node_modules/markdown-it/lib/rules_core/smartquotes.js"(t,e){var n=me().isWhiteSpace,r=me().isPunctChar,i=me().isMdAsciiPunct,s=/['"]/,o=/['"]/g,l="’";function a(c,f,d){return c.substr(0,f)+d+c.substr(f+1)}function u(c,f){var d,h,p,m,g,b,_,k,C,v,x,A,w,T,O,M,N,U,R,P,H;for(R=[],d=0;d<c.length;d++){for(h=c[d],_=c[d].level,N=R.length-1;N>=0&&!(R[N].level<=_);N--);if(R.length=N+1,h.type==="text"){p=h.content,g=0,b=p.length;e:for(;g<b&&(o.lastIndex=g,m=o.exec(p),!!m);){if(O=M=!0,g=m.index+1,U=m[0]==="'",C=32,m.index-1>=0)C=p.charCodeAt(m.index-1);else for(N=d-1;N>=0&&!(c[N].type==="softbreak"||c[N].type==="hardbreak");N--)if(c[N].content){C=c[N].content.charCodeAt(c[N].content.length-1);break}if(v=32,g<b)v=p.charCodeAt(g);else for(N=d+1;N<c.length&&!(c[N].type==="softbreak"||c[N].type==="hardbreak");N++)if(c[N].content){v=c[N].content.charCodeAt(0);break}if(x=i(C)||r(String.fromCharCode(C)),A=i(v)||r(String.fromCharCode(v)),w=n(C),T=n(v),T?O=!1:A&&(w||x||(O=!1)),w?M=!1:x&&(T||A||(M=!1)),v===34&&m[0]==='"'&&C>=48&&C<=57&&(M=O=!1),O&&M&&(O=x,M=A),!O&&!M){U&&(h.content=a(h.content,m.index,l));continue}if(M){for(N=R.length-1;N>=0&&(k=R[N],!(R[N].level<_));N--)if(k.single===U&&R[N].level===_){k=R[N],U?(P=f.md.options.quotes[2],H=f.md.options.quotes[3]):(P=f.md.options.quotes[0],H=f.md.options.quotes[1]),h.content=a(h.content,m.index,H),c[k.token].content=a(c[k.token].content,k.pos,P),g+=H.length-1,k.token===d&&(g+=P.length-1),p=h.content,b=p.length,R.length=N;continue e}}O?R.push({token:d,pos:m.index,single:U,level:_}):M&&U&&(h.content=a(h.content,m.index,l))}}}}e.exports=function(f){var d;if(f.md.options.typographer)for(d=f.tokens.length-1;d>=0;d--)f.tokens[d].type!=="inline"||!s.test(f.tokens[d].content)||u(f.tokens[d].children,f)}}}),Ua=W({"node_modules/markdown-it/lib/token.js"(t,e){function n(r,i,s){this.type=r,this.tag=i,this.attrs=null,this.map=null,this.nesting=s,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}n.prototype.attrIndex=function(i){var s,o,l;if(!this.attrs)return-1;for(s=this.attrs,o=0,l=s.length;o<l;o++)if(s[o][0]===i)return o;return-1},n.prototype.attrPush=function(i){this.attrs?this.attrs.push(i):this.attrs=[i]},n.prototype.attrSet=function(i,s){var o=this.attrIndex(i),l=[i,s];o<0?this.attrPush(l):this.attrs[o]=l},n.prototype.attrGet=function(i){var s=this.attrIndex(i),o=null;return s>=0&&(o=this.attrs[s][1]),o},n.prototype.attrJoin=function(i,s){var o=this.attrIndex(i);o<0?this.attrPush([i,s]):this.attrs[o][1]=this.attrs[o][1]+" "+s},e.exports=n}}),bE=W({"node_modules/markdown-it/lib/rules_core/state_core.js"(t,e){var n=Ua();function r(i,s,o){this.src=i,this.env=o,this.tokens=[],this.inlineMode=!1,this.md=s}r.prototype.Token=n,e.exports=r}}),yE=W({"node_modules/markdown-it/lib/parser_core.js"(t,e){var n=Va(),r=[["normalize",fE()],["block",dE()],["inline",hE()],["linkify",pE()],["replacements",mE()],["smartquotes",gE()]];function i(){this.ruler=new n;for(var s=0;s<r.length;s++)this.ruler.push(r[s][0],r[s][1])}i.prototype.process=function(s){var o,l,a;for(a=this.ruler.getRules(""),o=0,l=a.length;o<l;o++)a[o](s)},i.prototype.State=bE(),e.exports=i}}),kE=W({"node_modules/markdown-it/lib/rules_block/table.js"(t,e){var n=me().isSpace;function r(s,o){var l=s.bMarks[o]+s.tShift[o],a=s.eMarks[o];return s.src.substr(l,a-l)}function i(s){var o=[],l=0,a=s.length,u,c=!1,f=0,d="";for(u=s.charCodeAt(l);l<a;)u===124&&(c?(d+=s.substring(f,l-1),f=l):(o.push(d+s.substring(f,l)),d="",f=l+1)),c=u===92,l++,u=s.charCodeAt(l);return o.push(d+s.substring(f)),o}e.exports=function(o,l,a,u){var c,f,d,h,p,m,g,b,_,k,C,v,x,A,w,T,O,M;if(l+2>a||(m=l+1,o.sCount[m]<o.blkIndent)||!o.md.options.allowIndentation&&o.sCount[m]-o.blkIndent>=4||(d=o.bMarks[m]+o.tShift[m],d>=o.eMarks[m])||(O=o.src.charCodeAt(d++),O!==124&&O!==45&&O!==58)||d>=o.eMarks[m]||(M=o.src.charCodeAt(d++),M!==124&&M!==45&&M!==58&&!n(M))||O===45&&n(M))return!1;for(;d<o.eMarks[m];){if(c=o.src.charCodeAt(d),c!==124&&c!==45&&c!==58&&!n(c))return!1;d++}for(f=r(o,l+1),g=f.split("|"),k=[],h=0;h<g.length;h++){if(C=g[h].trim(),!C){if(h===0||h===g.length-1)continue;return!1}if(!/^:?-+:?$/.test(C))return!1;C.charCodeAt(C.length-1)===58?k.push(C.charCodeAt(0)===58?"center":"right"):C.charCodeAt(0)===58?k.push("left"):k.push("")}if(f=r(o,l).trim(),f.indexOf("|")===-1||!o.md.options.allowIndentation&&o.sCount[l]-o.blkIndent>=4||(g=i(f),g.length&&g[0]===""&&g.shift(),g.length&&g[g.length-1]===""&&g.pop(),b=g.length,b===0||b!==k.length))return!1;if(u)return!0;for(A=o.parentType,o.parentType="table",T=o.md.block.ruler.getRules("blockquote"),_=o.push("table_open","table",1),_.map=v=[l,0],_=o.push("thead_open","thead",1),_.map=[l,l+1],_=o.push("tr_open","tr",1),_.map=[l,l+1],h=0;h<g.length;h++)_=o.push("th_open","th",1),k[h]&&(_.attrs=[["style","text-align:"+k[h]]]),_=o.push("inline","",0),_.content=g[h].trim(),_.children=[],_=o.push("th_close","th",-1);for(_=o.push("tr_close","tr",-1),_=o.push("thead_close","thead",-1),m=l+2;m<a&&!(o.sCount[m]<o.blkIndent);m++){for(w=!1,h=0,p=T.length;h<p;h++)if(T[h](o,m,a,!0)){w=!0;break}if(w||(f=r(o,m).trim(),!f)||!o.md.options.allowIndentation&&o.sCount[m]-o.blkIndent>=4)break;for(g=i(f),g.length&&g[0]===""&&g.shift(),g.length&&g[g.length-1]===""&&g.pop(),m===l+2&&(_=o.push("tbody_open","tbody",1),_.map=x=[l+2,0]),_=o.push("tr_open","tr",1),_.map=[m,m+1],h=0;h<b;h++)_=o.push("td_open","td",1),k[h]&&(_.attrs=[["style","text-align:"+k[h]]]),_=o.push("inline","",0),_.content=g[h]?g[h].trim():"",_.children=[],_=o.push("td_close","td",-1);_=o.push("tr_close","tr",-1)}return x&&(_=o.push("tbody_close","tbody",-1),x[1]=m),_=o.push("table_close","table",-1),v[1]=m,o.parentType=A,o.line=m,!0}}}),vE=W({"node_modules/markdown-it/lib/rules_block/code.js"(t,e){e.exports=function(r,i,s){if(r.md.options.allowIndentation)return!1;var o,l,a;if(r.sCount[i]-r.blkIndent<4)return!1;for(l=o=i+1;o<s;){if(r.isEmpty(o)){o++;continue}if(r.sCount[o]-r.blkIndent>=4){o++,l=o;continue}break}return r.line=l,a=r.push("code_block","code",0),a.content=r.getLines(i,l,4+r.blkIndent,!1)+`
|
|
168
|
+
`,a.map=[i,r.line],!0}}}),xE=W({"node_modules/markdown-it/lib/rules_block/fence.js"(t,e){e.exports=function(r,i,s,o){var l,a,u,c,f,d,h,p=!1,m=r.bMarks[i]+r.tShift[i],g=r.eMarks[i];if(!r.md.options.allowIndentation&&r.sCount[i]-r.blkIndent>=4||m+3>g||(l=r.src.charCodeAt(m),l!==126&&l!==96)||(f=m,m=r.skipChars(m,l),a=m-f,a<3)||(h=r.src.slice(f,m),u=r.src.slice(m,g),l===96&&u.indexOf(String.fromCharCode(l))>=0))return!1;if(o)return!0;for(c=i;c++,!(c>=s||(m=f=r.bMarks[c]+r.tShift[c],g=r.eMarks[c],m<g&&r.sCount[c]<r.blkIndent));)if(r.src.charCodeAt(m)===l&&!(!r.md.options.allowIndentation&&r.sCount[c]-r.blkIndent>=4)&&(m=r.skipChars(m,l),!(m-f<a)&&(m=r.skipSpaces(m),!(m<g)))){p=!0;break}return a=r.sCount[i],r.line=c+(p?1:0),d=r.push("fence","code",0),d.info=u,d.content=r.getLines(i+1,c,a,!0),d.markup=h,d.map=[i,r.line],!0}}}),AE=W({"node_modules/markdown-it/lib/rules_block/blockquote.js"(t,e){var n=me().isSpace;e.exports=function(i,s,o,l){var a,u,c,f,d,h,p,m,g,b,_,k,C,v,x,A,w,T,O,M,N=i.lineMax,U=i.bMarks[s]+i.tShift[s],R=i.eMarks[s];if(!i.md.options.allowIndentation&&i.sCount[s]-i.blkIndent>=4||i.src.charCodeAt(U++)!==62)return!1;if(l)return!0;for(f=g=i.sCount[s]+1,i.src.charCodeAt(U)===32?(U++,f++,g++,a=!1,A=!0):i.src.charCodeAt(U)===9?(A=!0,(i.bsCount[s]+g)%4===3?(U++,f++,g++,a=!1):a=!0):A=!1,b=[i.bMarks[s]],i.bMarks[s]=U;U<R&&(u=i.src.charCodeAt(U),n(u));){u===9?g+=4-(g+i.bsCount[s]+(a?1:0))%4:g++;U++}for(_=[i.bsCount[s]],i.bsCount[s]=i.sCount[s]+1+(A?1:0),h=U>=R,v=[i.sCount[s]],i.sCount[s]=g-f,x=[i.tShift[s]],i.tShift[s]=U-i.bMarks[s],T=i.md.block.ruler.getRules("blockquote"),C=i.parentType,i.parentType="blockquote",m=s+1;m<o&&(M=i.sCount[m]<i.blkIndent,U=i.bMarks[m]+i.tShift[m],R=i.eMarks[m],!(U>=R));m++){if(i.src.charCodeAt(U++)===62&&!M){for(f=g=i.sCount[m]+1,i.src.charCodeAt(U)===32?(U++,f++,g++,a=!1,A=!0):i.src.charCodeAt(U)===9?(A=!0,(i.bsCount[m]+g)%4===3?(U++,f++,g++,a=!1):a=!0):A=!1,b.push(i.bMarks[m]),i.bMarks[m]=U;U<R&&(u=i.src.charCodeAt(U),n(u));){u===9?g+=4-(g+i.bsCount[m]+(a?1:0))%4:g++;U++}h=U>=R,_.push(i.bsCount[m]),i.bsCount[m]=i.sCount[m]+1+(A?1:0),v.push(i.sCount[m]),i.sCount[m]=g-f,x.push(i.tShift[m]),i.tShift[m]=U-i.bMarks[m];continue}if(h)break;for(w=!1,c=0,d=T.length;c<d;c++)if(T[c](i,m,o,!0)){w=!0;break}if(w){i.lineMax=m,i.blkIndent!==0&&(b.push(i.bMarks[m]),_.push(i.bsCount[m]),x.push(i.tShift[m]),v.push(i.sCount[m]),i.sCount[m]-=i.blkIndent);break}b.push(i.bMarks[m]),_.push(i.bsCount[m]),x.push(i.tShift[m]),v.push(i.sCount[m]),i.sCount[m]=-1}for(k=i.blkIndent,i.blkIndent=0,O=i.push("blockquote_open","blockquote",1),O.markup=">",O.map=p=[s,0],i.md.block.tokenize(i,s,m),O=i.push("blockquote_close","blockquote",-1),O.markup=">",i.lineMax=N,i.parentType=C,p[1]=i.line,c=0;c<x.length;c++)i.bMarks[c+s]=b[c],i.tShift[c+s]=x[c],i.sCount[c+s]=v[c],i.bsCount[c+s]=_[c];return i.blkIndent=k,!0}}}),CE=W({"node_modules/markdown-it/lib/rules_block/hr.js"(t,e){var n=me().isSpace;e.exports=function(i,s,o,l){var a,u,c,f,d=i.bMarks[s]+i.tShift[s],h=i.eMarks[s];if(!i.md.options.allowIndentation&&i.sCount[s]-i.blkIndent>=4||(a=i.src.charCodeAt(d++),a!==42&&a!==45&&a!==95))return!1;for(u=1;d<h;){if(c=i.src.charCodeAt(d++),c!==a&&!n(c))return!1;c===a&&u++}return u<3?!1:(l||(i.line=s+1,f=i.push("hr","hr",0),f.map=[s,i.line],f.markup=Array(u+1).join(String.fromCharCode(a))),!0)}}}),_E=W({"node_modules/markdown-it/lib/rules_block/list.js"(t,e){var n=me().isSpace;function r(o,l){var a,u,c,f;return u=o.bMarks[l]+o.tShift[l],c=o.eMarks[l],a=o.src.charCodeAt(u++),a!==42&&a!==45&&a!==43||u<c&&(f=o.src.charCodeAt(u),!n(f))?-1:u}function i(o,l){var a,u=o.bMarks[l]+o.tShift[l],c=u,f=o.eMarks[l];if(c+1>=f||(a=o.src.charCodeAt(c++),a<48||a>57))return-1;for(;;){if(c>=f)return-1;if(a=o.src.charCodeAt(c++),a>=48&&a<=57){if(c-u>=10)return-1;continue}if(a===41||a===46)break;return-1}return c<f&&(a=o.src.charCodeAt(c),!n(a))?-1:c}function s(o,l){var a,u,c=o.level+2;for(a=l+2,u=o.tokens.length-2;a<u;a++)o.tokens[a].level===c&&o.tokens[a].type==="paragraph_open"&&(o.tokens[a+2].hidden=!0,o.tokens[a].hidden=!0,a+=2)}e.exports=function(l,a,u,c){var f,d,h,p,m,g,b,_,k,C,v,x,A,w,T,O,M,N,U,R,P,H,ee,se,he,Ce,Be,de,_e=!1,qe=!0;if(!l.md.options.allowIndentation&&l.sCount[a]-l.blkIndent>=4||!l.md.options.allowIndentation&&l.listIndent>=0&&l.sCount[a]-l.listIndent>=4&&l.sCount[a]<l.blkIndent)return!1;if(c&&l.parentType==="paragraph"&&l.sCount[a]>=l.blkIndent&&(_e=!0),(ee=i(l,a))>=0){if(b=!0,he=l.bMarks[a]+l.tShift[a],A=Number(l.src.slice(he,ee-1)),_e&&A!==1)return!1}else if((ee=r(l,a))>=0)b=!1;else return!1;if(_e&&l.skipSpaces(ee)>=l.eMarks[a])return!1;if(x=l.src.charCodeAt(ee-1),c)return!0;for(v=l.tokens.length,b?(de=l.push("ordered_list_open","ol",1),A!==1&&(de.attrs=[["start",A]])):de=l.push("bullet_list_open","ul",1),de.map=C=[a,0],de.markup=String.fromCharCode(x),T=a,se=!1,Be=l.md.block.ruler.getRules("list"),N=l.parentType,l.parentType="list";T<u;){for(H=ee,w=l.eMarks[T],g=O=l.sCount[T]+ee-(l.bMarks[a]+l.tShift[a]);H<w;){if(f=l.src.charCodeAt(H),f===9)O+=4-(O+l.bsCount[T])%4;else if(f===32)O++;else break;H++}if(d=H,d>=w?m=1:m=O-g,!l.md.options.allowIndentation&&m>4&&(m=1),p=g+m,de=l.push("list_item_open","li",1),de.markup=String.fromCharCode(x),de.map=_=[a,0],b&&(de.info=l.src.slice(he,ee-1)),P=l.tight,R=l.tShift[a],U=l.sCount[a],M=l.listIndent,l.listIndent=l.blkIndent,l.blkIndent=p,l.tight=!0,l.tShift[a]=d-l.bMarks[a],l.sCount[a]=O,d>=w&&l.isEmpty(a+1)?l.line=Math.min(l.line+2,u):l.md.block.tokenize(l,a,u,!0),(!l.tight||se)&&(qe=!1),se=l.line-a>1&&l.isEmpty(l.line-1),l.blkIndent=l.listIndent,l.listIndent=M,l.tShift[a]=R,l.sCount[a]=U,l.tight=P,de=l.push("list_item_close","li",-1),de.markup=String.fromCharCode(x),T=a=l.line,_[1]=T,d=l.bMarks[a],T>=u||l.sCount[T]<l.blkIndent||!l.md.options.allowIndentation&&l.sCount[a]-l.blkIndent>=4)break;for(Ce=!1,h=0,k=Be.length;h<k;h++)if(Be[h](l,T,u,!0)){Ce=!0;break}if(Ce)break;if(b){if(ee=i(l,T),ee<0)break;he=l.bMarks[T]+l.tShift[T]}else if(ee=r(l,T),ee<0)break;if(x!==l.src.charCodeAt(ee-1))break}return b?de=l.push("ordered_list_close","ol",-1):de=l.push("bullet_list_close","ul",-1),de.markup=String.fromCharCode(x),C[1]=T,l.line=T,l.parentType=N,qe&&s(l,v),!0}}}),wE=W({"node_modules/markdown-it/lib/rules_block/reference.js"(t,e){var n=me().normalizeReference,r=me().isSpace;e.exports=function(s,o,l,a){var u,c,f,d,h,p,m,g,b,_,k,C,v,x,A,w,T=0,O=s.bMarks[o]+s.tShift[o],M=s.eMarks[o],N=o+1;if(!s.md.options.allowIndentation&&s.sCount[o]-s.blkIndent>=4||s.src.charCodeAt(O)!==91)return!1;for(;++O<M;)if(s.src.charCodeAt(O)===93&&s.src.charCodeAt(O-1)!==92){if(O+1===M||s.src.charCodeAt(O+1)!==58)return!1;break}for(d=s.lineMax,A=s.md.block.ruler.getRules("reference"),_=s.parentType,s.parentType="reference";N<d&&!s.isEmpty(N);N++)if(!(!s.md.options.allowIndentation&&s.sCount[N]-s.blkIndent>3)&&!(s.sCount[N]<0)){for(x=!1,p=0,m=A.length;p<m;p++)if(A[p](s,N,d,!0)){x=!0;break}if(x)break}for(v=s.getLines(o,N,s.blkIndent,!1).trim(),M=v.length,O=1;O<M;O++){if(u=v.charCodeAt(O),u===91)return!1;if(u===93){b=O;break}else u===10?T++:u===92&&(O++,O<M&&v.charCodeAt(O)===10&&T++)}if(b<0||v.charCodeAt(b+1)!==58)return!1;for(O=b+2;O<M;O++)if(u=v.charCodeAt(O),u===10)T++;else if(!r(u))break;if(k=s.md.helpers.parseLinkDestination(v,O,M),!k.ok||(h=s.md.normalizeLink(k.str),!s.md.validateLink(h)))return!1;for(O=k.pos,T+=k.lines,c=O,f=T,C=O;O<M;O++)if(u=v.charCodeAt(O),u===10)T++;else if(!r(u))break;for(k=s.md.helpers.parseLinkTitle(v,O,M),O<M&&C!==O&&k.ok?(w=k.str,O=k.pos,T+=k.lines):(w="",O=c,T=f);O<M&&(u=v.charCodeAt(O),!!r(u));)O++;if(O<M&&v.charCodeAt(O)!==10&&w)for(w="",O=c,T=f;O<M&&(u=v.charCodeAt(O),!!r(u));)O++;return O<M&&v.charCodeAt(O)!==10||(g=n(v.slice(1,b)),!g)?!1:(a||(typeof s.env.references>"u"&&(s.env.references={}),typeof s.env.references[g]>"u"&&(s.env.references[g]={title:w,href:h}),s.parentType=_,s.line=o+T+1),!0)}}}),SE=W({"node_modules/markdown-it/lib/common/html_blocks.js"(t,e){e.exports=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"]}}),om=W({"node_modules/markdown-it/lib/common/html_re.js"(t,e){var n="[a-zA-Z_:][a-zA-Z0-9:._-]*",r="[^\"'=<>`\\x00-\\x20]+",i="'[^']*'",s='"[^"]*"',o="(?:"+r+"|"+i+"|"+s+")",l="(?:\\s+"+n+"(?:\\s*=\\s*"+o+")?)",a="<[A-Za-z][A-Za-z0-9\\-]*"+l+"*\\s*\\/?>",u="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",c="<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->",f="<[?][\\s\\S]*?[?]>",d="<![A-Z]+\\s+[^>]*>",h="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",p=new RegExp("^(?:"+a+"|"+u+"|"+c+"|"+f+"|"+d+"|"+h+")"),m=new RegExp("^(?:"+a+"|"+u+")");e.exports.HTML_TAG_RE=p,e.exports.HTML_OPEN_CLOSE_TAG_RE=m}}),EE=W({"node_modules/markdown-it/lib/rules_block/html_block.js"(t,e){var n=SE(),r=om().HTML_OPEN_CLOSE_TAG_RE,i=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+n.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(r.source+"\\s*$"),/^$/,!1]];e.exports=function(o,l,a,u){var c,f,d,h,p=o.bMarks[l]+o.tShift[l],m=o.eMarks[l];if(!o.md.options.allowIndentation&&o.sCount[l]-o.blkIndent>=4||!o.md.options.html||o.src.charCodeAt(p)!==60)return!1;for(h=o.src.slice(p,m),c=0;c<i.length&&!i[c][0].test(h);c++);if(c===i.length)return!1;if(u)return i[c][2];if(f=l+1,!i[c][1].test(h)){for(;f<a&&!(o.sCount[f]<o.blkIndent);f++)if(p=o.bMarks[f]+o.tShift[f],m=o.eMarks[f],h=o.src.slice(p,m),i[c][1].test(h)){h.length!==0&&f++;break}}return o.line=f,d=o.push("html_block","",0),d.map=[l,f],d.content=o.getLines(l,f,o.blkIndent,!0),!0}}}),DE=W({"node_modules/markdown-it/lib/rules_block/heading.js"(t,e){var n=me().isSpace;e.exports=function(i,s,o,l){var a,u,c,f,d=i.bMarks[s]+i.tShift[s],h=i.eMarks[s];if(!i.md.options.allowIndentation&&i.sCount[s]-i.blkIndent>=4||(a=i.src.charCodeAt(d),a!==35||d>=h))return!1;for(u=1,a=i.src.charCodeAt(++d);a===35&&d<h&&u<=6;)u++,a=i.src.charCodeAt(++d);return u>6||d<h&&!n(a)?!1:(l||(h=i.skipSpacesBack(h,d),c=i.skipCharsBack(h,35,d),c>d&&n(i.src.charCodeAt(c-1))&&(h=c),i.line=s+1,f=i.push("heading_open","h"+String(u),1),f.markup="########".slice(0,u),f.map=[s,i.line],f=i.push("inline","",0),f.content=i.src.slice(d,h).trim(),f.map=[s,i.line],f.children=[],f=i.push("heading_close","h"+String(u),-1),f.markup="########".slice(0,u)),!0)}}}),OE=W({"node_modules/markdown-it/lib/rules_block/lheading.js"(t,e){e.exports=function(r,i,s){var o,l,a,u,c,f,d,h,p,m=i+1,g,b=r.md.block.ruler.getRules("paragraph");if(!r.md.options.allowIndentation&&r.sCount[i]-r.blkIndent>=4)return!1;for(g=r.parentType,r.parentType="paragraph";m<s&&!r.isEmpty(m);m++)if(!(!r.md.options.allowIndentation&&r.sCount[m]-r.blkIndent>3)){if(r.sCount[m]>=r.blkIndent&&(f=r.bMarks[m]+r.tShift[m],d=r.eMarks[m],f<d&&(p=r.src.charCodeAt(f),(p===45||p===61)&&(f=r.skipChars(f,p),f=r.skipSpaces(f),f>=d)))){h=p===61?1:2;break}if(!(r.sCount[m]<0)){for(l=!1,a=0,u=b.length;a<u;a++)if(b[a](r,m,s,!0)){l=!0;break}if(l)break}}return h?(o=r.getLines(i,m,r.blkIndent,!1).trim(),r.line=m+1,c=r.push("heading_open","h"+String(h),1),c.markup=String.fromCharCode(p),c.map=[i,r.line],c=r.push("inline","",0),c.content=o,c.map=[i,r.line-1],c.children=[],c=r.push("heading_close","h"+String(h),-1),c.markup=String.fromCharCode(p),r.parentType=g,!0):!1}}}),TE=W({"node_modules/markdown-it/lib/rules_block/paragraph.js"(t,e){e.exports=function(r,i){var s,o,l,a,u,c,f=i+1,d=r.md.block.ruler.getRules("paragraph"),h=r.lineMax;for(c=r.parentType,r.parentType="paragraph";f<h&&!r.isEmpty(f);f++)if(!(!r.md.options.allowIndentation&&r.sCount[f]-r.blkIndent>3)&&!(r.sCount[f]<0)){for(o=!1,l=0,a=d.length;l<a;l++)if(d[l](r,f,h,!0)){o=!0;break}if(o)break}return s=r.getLines(i,f,r.blkIndent,!1).trim(),r.line=f,u=r.push("paragraph_open","p",1),u.map=[i,r.line],u=r.push("inline","",0),u.content=s,u.map=[i,r.line],u.children=[],u=r.push("paragraph_close","p",-1),r.parentType=c,!0}}}),ME=W({"node_modules/markdown-it/lib/rules_block/state_block.js"(t,e){var n=Ua(),r=me().isSpace;function i(s,o,l,a){var u,c,f,d,h,p,m,g;for(this.src=s,this.md=o,this.env=l,this.tokens=a,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",c=this.src,g=!1,f=d=p=m=0,h=c.length;d<h;d++){if(u=c.charCodeAt(d),!g)if(r(u)){p++,u===9?m+=4-m%4:m++;continue}else g=!0;(u===10||d===h-1)&&(u!==10&&d++,this.bMarks.push(f),this.eMarks.push(d),this.tShift.push(p),this.sCount.push(m),this.bsCount.push(0),g=!1,p=0,m=0,f=d+1)}this.bMarks.push(c.length),this.eMarks.push(c.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}i.prototype.push=function(s,o,l){var a=new n(s,o,l);return a.block=!0,l<0&&this.level--,a.level=this.level,l>0&&this.level++,this.tokens.push(a),a},i.prototype.isEmpty=function(o){return this.bMarks[o]+this.tShift[o]>=this.eMarks[o]},i.prototype.skipEmptyLines=function(o){for(var l=this.lineMax;o<l&&!(this.bMarks[o]+this.tShift[o]<this.eMarks[o]);o++);return o},i.prototype.skipSpaces=function(o){for(var l,a=this.src.length;o<a&&(l=this.src.charCodeAt(o),!!r(l));o++);return o},i.prototype.skipSpacesBack=function(o,l){if(o<=l)return o;for(;o>l;)if(!r(this.src.charCodeAt(--o)))return o+1;return o},i.prototype.skipChars=function(o,l){for(var a=this.src.length;o<a&&this.src.charCodeAt(o)===l;o++);return o},i.prototype.skipCharsBack=function(o,l,a){if(o<=a)return o;for(;o>a;)if(l!==this.src.charCodeAt(--o))return o+1;return o},i.prototype.getLines=function(o,l,a,u){var c,f,d,h,p,m,g,b=o;if(o>=l)return"";for(m=new Array(l-o),c=0;b<l;b++,c++){for(f=0,g=h=this.bMarks[b],b+1<l||u?p=this.eMarks[b]+1:p=this.eMarks[b];h<p&&f<a;){if(d=this.src.charCodeAt(h),r(d))d===9?f+=4-(f+this.bsCount[b])%4:f++;else if(h-g<this.tShift[b])f++;else break;h++}f>a?m[c]=new Array(f-a+1).join(" ")+this.src.slice(h,p):m[c]=this.src.slice(h,p)}return m.join("")},i.prototype.Token=n,e.exports=i}}),$E=W({"node_modules/markdown-it/lib/parser_block.js"(t,e){var n=Va(),r=[["table",kE(),["paragraph","reference"]],["code",vE()],["fence",xE(),["paragraph","reference","blockquote","list"]],["blockquote",AE(),["paragraph","reference","blockquote","list"]],["hr",CE(),["paragraph","reference","blockquote","list"]],["list",_E(),["paragraph","reference","blockquote"]],["reference",wE()],["html_block",EE(),["paragraph","reference","blockquote"]],["heading",DE(),["paragraph","reference","blockquote"]],["lheading",OE()],["paragraph",TE()]];function i(){this.ruler=new n;for(var s=0;s<r.length;s++)this.ruler.push(r[s][0],r[s][1],{alt:(r[s][2]||[]).slice()})}i.prototype.tokenize=function(s,o,l){for(var a,u,c=this.ruler.getRules(""),f=c.length,d=o,h=!1,p=s.md.options.maxNesting;d<l&&(s.line=d=s.skipEmptyLines(d),!(d>=l||s.sCount[d]<s.blkIndent));){if(s.level>=p){s.line=l;break}for(u=0;u<f&&(a=c[u](s,d,l,!1),!a);u++);s.tight=!h,s.isEmpty(s.line-1)&&(h=!0),d=s.line,d<l&&s.isEmpty(d)&&(h=!0,d++,s.line=d)}},i.prototype.parse=function(s,o,l,a){var u;s&&(u=new this.State(s,o,l,a),this.tokenize(u,u.line,u.lineMax))},i.prototype.State=ME(),e.exports=i}}),NE=W({"node_modules/markdown-it/lib/rules_inline/text.js"(t,e){function n(r){switch(r){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}e.exports=function(i,s){for(var o=i.pos;o<i.posMax&&!n(i.src.charCodeAt(o));)o++;return o===i.pos?!1:(s||(i.pending+=i.src.slice(i.pos,o)),i.pos=o,!0)}}}),IE=W({"node_modules/markdown-it/lib/rules_inline/newline.js"(t,e){var n=me().isSpace;e.exports=function(i,s){var o,l,a,u=i.pos;if(i.src.charCodeAt(u)!==10)return!1;if(o=i.pending.length-1,l=i.posMax,!s)if(o>=0&&i.pending.charCodeAt(o)===32)if(o>=1&&i.pending.charCodeAt(o-1)===32){for(a=o-1;a>=1&&i.pending.charCodeAt(a-1)===32;)a--;i.pending=i.pending.slice(0,a),i.push("hardbreak","br",0)}else i.pending=i.pending.slice(0,-1),i.push("softbreak","br",0);else i.push("softbreak","br",0);for(u++;u<l&&n(i.src.charCodeAt(u));)u++;return i.pos=u,!0}}}),FE=W({"node_modules/markdown-it/lib/rules_inline/escape.js"(t,e){var n=me().isSpace,r=[];for(i=0;i<256;i++)r.push(0);var i;"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(s){r[s.charCodeAt(0)]=1}),e.exports=function(o,l){var a,u=o.pos,c=o.posMax;if(o.src.charCodeAt(u)!==92)return!1;if(u++,u<c){if(a=o.src.charCodeAt(u),a<256&&r[a]!==0)return l||(o.pending+=o.src[u]),o.pos+=2,!0;if(a===10){for(l||o.push("hardbreak","br",0),u++;u<c&&(a=o.src.charCodeAt(u),!!n(a));)u++;return o.pos=u,!0}}return l||(o.pending+="\\"),o.pos++,!0}}}),RE=W({"node_modules/markdown-it/lib/rules_inline/backticks.js"(t,e){e.exports=function(r,i){var s,o,l,a,u,c,f,d,h=r.pos,p=r.src.charCodeAt(h);if(p!==96)return!1;for(s=h,h++,o=r.posMax;h<o&&r.src.charCodeAt(h)===96;)h++;if(l=r.src.slice(s,h),f=l.length,r.backticksScanned&&(r.backticks[f]||0)<=s)return i||(r.pending+=l),r.pos+=f,!0;for(u=c=h;(u=r.src.indexOf("`",c))!==-1;){for(c=u+1;c<o&&r.src.charCodeAt(c)===96;)c++;if(d=c-u,d===f)return i||(a=r.push("code_inline","code",0),a.markup=l,a.content=r.src.slice(h,u).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),r.pos=c,!0;r.backticks[d]=u}return r.backticksScanned=!0,i||(r.pending+=l),r.pos+=f,!0}}}),Af=W({"node_modules/markdown-it/lib/rules_inline/strikethrough.js"(t,e){e.exports.tokenize=function(i,s){var o,l,a,u,c,f=i.pos,d=i.src.charCodeAt(f);if(s||d!==126||(l=i.scanDelims(i.pos,!0),u=l.length,c=String.fromCharCode(d),u<2))return!1;for(u%2&&(a=i.push("text","",0),a.content=c,u--),o=0;o<u;o+=2)a=i.push("text","",0),a.content=c+c,i.delimiters.push({marker:d,length:0,token:i.tokens.length-1,end:-1,open:l.can_open,close:l.can_close});return i.pos+=l.length,!0};function n(r,i){var s,o,l,a,u,c=[],f=i.length;for(s=0;s<f;s++)l=i[s],l.marker===126&&l.end!==-1&&(a=i[l.end],u=r.tokens[l.token],u.type="s_open",u.tag="s",u.nesting=1,u.markup="~~",u.content="",u=r.tokens[a.token],u.type="s_close",u.tag="s",u.nesting=-1,u.markup="~~",u.content="",r.tokens[a.token-1].type==="text"&&r.tokens[a.token-1].content==="~"&&c.push(a.token-1));for(;c.length;){for(s=c.pop(),o=s+1;o<r.tokens.length&&r.tokens[o].type==="s_close";)o++;o--,s!==o&&(u=r.tokens[o],r.tokens[o]=r.tokens[s],r.tokens[s]=u)}}e.exports.postProcess=function(i){var s,o=i.tokens_meta,l=i.tokens_meta.length;for(n(i,i.delimiters),s=0;s<l;s++)o[s]&&o[s].delimiters&&n(i,o[s].delimiters)}}}),Cf=W({"node_modules/markdown-it/lib/rules_inline/emphasis.js"(t,e){e.exports.tokenize=function(i,s){var o,l,a,u=i.pos,c=i.src.charCodeAt(u);if(s||c!==95&&c!==42)return!1;for(l=i.scanDelims(i.pos,c===42),o=0;o<l.length;o++)a=i.push("text","",0),a.content=String.fromCharCode(c),i.delimiters.push({marker:c,length:l.length,token:i.tokens.length-1,end:-1,open:l.can_open,close:l.can_close});return i.pos+=l.length,!0};function n(r,i){var s,o,l,a,u,c,f=i.length;for(s=f-1;s>=0;s--)o=i[s],!(o.marker!==95&&o.marker!==42)&&o.end!==-1&&(l=i[o.end],c=s>0&&i[s-1].end===o.end+1&&i[s-1].marker===o.marker&&i[s-1].token===o.token-1&&i[o.end+1].token===l.token+1,u=String.fromCharCode(o.marker),a=r.tokens[o.token],a.type=c?"strong_open":"em_open",a.tag=c?"strong":"em",a.nesting=1,a.markup=c?u+u:u,a.content="",a=r.tokens[l.token],a.type=c?"strong_close":"em_close",a.tag=c?"strong":"em",a.nesting=-1,a.markup=c?u+u:u,a.content="",c&&(r.tokens[i[s-1].token].content="",r.tokens[i[o.end+1].token].content="",s--))}e.exports.postProcess=function(i){var s,o=i.tokens_meta,l=i.tokens_meta.length;for(n(i,i.delimiters),s=0;s<l;s++)o[s]&&o[s].delimiters&&n(i,o[s].delimiters)}}}),PE=W({"node_modules/markdown-it/lib/rules_inline/link.js"(t,e){var n=me().normalizeReference,r=me().isSpace;e.exports=function(s,o){var l,a,u,c,f,d,h,p,m,g="",b="",_=s.pos,k=s.posMax,C=s.pos,v=!0;if(s.src.charCodeAt(s.pos)!==91||(f=s.pos+1,c=s.md.helpers.parseLinkLabel(s,s.pos,!0),c<0))return!1;if(d=c+1,d<k&&s.src.charCodeAt(d)===40){for(v=!1,d++;d<k&&(a=s.src.charCodeAt(d),!(!r(a)&&a!==10));d++);if(d>=k)return!1;if(C=d,h=s.md.helpers.parseLinkDestination(s.src,d,s.posMax),h.ok){for(g=s.md.normalizeLink(h.str),s.md.validateLink(g)?d=h.pos:g="",C=d;d<k&&(a=s.src.charCodeAt(d),!(!r(a)&&a!==10));d++);if(h=s.md.helpers.parseLinkTitle(s.src,d,s.posMax),d<k&&C!==d&&h.ok)for(b=h.str,d=h.pos;d<k&&(a=s.src.charCodeAt(d),!(!r(a)&&a!==10));d++);}(d>=k||s.src.charCodeAt(d)!==41)&&(v=!0),d++}if(v){if(typeof s.env.references>"u")return!1;if(d<k&&s.src.charCodeAt(d)===91?(C=d+1,d=s.md.helpers.parseLinkLabel(s,d),d>=0?u=s.src.slice(C,d++):d=c+1):d=c+1,u||(u=s.src.slice(f,c)),p=s.env.references[n(u)],!p)return s.pos=_,!1;g=p.href,b=p.title}return o||(s.pos=f,s.posMax=c,m=s.push("link_open","a",1),m.attrs=l=[["href",g]],b&&l.push(["title",b]),s.md.inline.tokenize(s),m=s.push("link_close","a",-1)),s.pos=d,s.posMax=k,!0}}}),BE=W({"node_modules/markdown-it/lib/rules_inline/image.js"(t,e){var n=me().normalizeReference,r=me().isSpace;e.exports=function(s,o){var l,a,u,c,f,d,h,p,m,g,b,_,k,C="",v=s.pos,x=s.posMax;if(s.src.charCodeAt(s.pos)!==33||s.src.charCodeAt(s.pos+1)!==91||(d=s.pos+2,f=s.md.helpers.parseLinkLabel(s,s.pos+1,!1),f<0))return!1;if(h=f+1,h<x&&s.src.charCodeAt(h)===40){for(h++;h<x&&(a=s.src.charCodeAt(h),!(!r(a)&&a!==10));h++);if(h>=x)return!1;for(k=h,m=s.md.helpers.parseLinkDestination(s.src,h,s.posMax),m.ok&&(C=s.md.normalizeLink(m.str),s.md.validateLink(C)?h=m.pos:C=""),k=h;h<x&&(a=s.src.charCodeAt(h),!(!r(a)&&a!==10));h++);if(m=s.md.helpers.parseLinkTitle(s.src,h,s.posMax),h<x&&k!==h&&m.ok)for(g=m.str,h=m.pos;h<x&&(a=s.src.charCodeAt(h),!(!r(a)&&a!==10));h++);else g="";if(h>=x||s.src.charCodeAt(h)!==41)return s.pos=v,!1;h++}else{if(typeof s.env.references>"u")return!1;if(h<x&&s.src.charCodeAt(h)===91?(k=h+1,h=s.md.helpers.parseLinkLabel(s,h),h>=0?c=s.src.slice(k,h++):h=f+1):h=f+1,c||(c=s.src.slice(d,f)),p=s.env.references[n(c)],!p)return s.pos=v,!1;C=p.href,g=p.title}return o||(u=s.src.slice(d,f),s.md.inline.parse(u,s.md,s.env,_=[]),b=s.push("image","img",0),b.attrs=l=[["src",C],["alt",""]],b.children=_,b.content=u,g&&l.push(["title",g])),s.pos=h,s.posMax=x,!0}}}),zE=W({"node_modules/markdown-it/lib/rules_inline/autolink.js"(t,e){var n=/^([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])?)*)$/,r=/^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/;e.exports=function(s,o){var l,a,u,c,f,d,h=s.pos;if(s.src.charCodeAt(h)!==60)return!1;for(f=s.pos,d=s.posMax;;){if(++h>=d||(c=s.src.charCodeAt(h),c===60))return!1;if(c===62)break}return l=s.src.slice(f+1,h),r.test(l)?(a=s.md.normalizeLink(l),s.md.validateLink(a)?(o||(u=s.push("link_open","a",1),u.attrs=[["href",a]],u.markup="autolink",u.info="auto",u=s.push("text","",0),u.content=s.md.normalizeLinkText(l),u=s.push("link_close","a",-1),u.markup="autolink",u.info="auto"),s.pos+=l.length+2,!0):!1):n.test(l)?(a=s.md.normalizeLink("mailto:"+l),s.md.validateLink(a)?(o||(u=s.push("link_open","a",1),u.attrs=[["href",a]],u.markup="autolink",u.info="auto",u=s.push("text","",0),u.content=s.md.normalizeLinkText(l),u=s.push("link_close","a",-1),u.markup="autolink",u.info="auto"),s.pos+=l.length+2,!0):!1):!1}}}),LE=W({"node_modules/markdown-it/lib/rules_inline/html_inline.js"(t,e){var n=om().HTML_TAG_RE;function r(i){var s=i|32;return s>=97&&s<=122}e.exports=function(s,o){var l,a,u,c,f=s.pos;return!s.md.options.html||(u=s.posMax,s.src.charCodeAt(f)!==60||f+2>=u)||(l=s.src.charCodeAt(f+1),l!==33&&l!==63&&l!==47&&!r(l))||(a=s.src.slice(f).match(n),!a)?!1:(o||(c=s.push("html_inline","",0),c.content=s.src.slice(f,f+a[0].length)),s.pos+=a[0].length,!0)}}}),jE=W({"node_modules/markdown-it/lib/rules_inline/entity.js"(t,e){var n=tm(),r=me().has,i=me().isValidEntityCode,s=me().fromCodePoint,o=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,l=/^&([a-z][a-z0-9]{1,31});/i;e.exports=function(u,c){var f,d,h,p=u.pos,m=u.posMax;if(u.src.charCodeAt(p)!==38)return!1;if(p+1<m){if(f=u.src.charCodeAt(p+1),f===35){if(h=u.src.slice(p).match(o),h)return c||(d=h[1][0].toLowerCase()==="x"?parseInt(h[1].slice(1),16):parseInt(h[1],10),u.pending+=i(d)?s(d):s(65533)),u.pos+=h[0].length,!0}else if(h=u.src.slice(p).match(l),h&&r(n,h[1]))return c||(u.pending+=n[h[1]]),u.pos+=h[0].length,!0}return c||(u.pending+="&"),u.pos++,!0}}}),qE=W({"node_modules/markdown-it/lib/rules_inline/balance_pairs.js"(t,e){function n(r,i){var s,o,l,a,u,c,f,d,h={},p=i.length;if(p){var m=0,g=-2,b=[];for(s=0;s<p;s++)if(l=i[s],b.push(0),(i[m].marker!==l.marker||g!==l.token-1)&&(m=s),g=l.token,l.length=l.length||0,!!l.close){for(h.hasOwnProperty(l.marker)||(h[l.marker]=[-1,-1,-1,-1,-1,-1]),u=h[l.marker][(l.open?3:0)+l.length%3],o=m-b[m]-1,c=o;o>u;o-=b[o]+1)if(a=i[o],a.marker===l.marker&&a.open&&a.end<0&&(f=!1,(a.close||l.open)&&(a.length+l.length)%3===0&&(a.length%3!==0||l.length%3!==0)&&(f=!0),!f)){d=o>0&&!i[o-1].open?b[o-1]+1:0,b[s]=s-o+d,b[o]=d,l.open=!1,a.end=s,a.close=!1,c=-1,g=-2;break}c!==-1&&(h[l.marker][(l.open?3:0)+(l.length||0)%3]=c)}}}e.exports=function(i){var s,o=i.tokens_meta,l=i.tokens_meta.length;for(n(i,i.delimiters),s=0;s<l;s++)o[s]&&o[s].delimiters&&n(i,o[s].delimiters)}}}),VE=W({"node_modules/markdown-it/lib/rules_inline/text_collapse.js"(t,e){e.exports=function(r){var i,s,o=0,l=r.tokens,a=r.tokens.length;for(i=s=0;i<a;i++)l[i].nesting<0&&o--,l[i].level=o,l[i].nesting>0&&o++,l[i].type==="text"&&i+1<a&&l[i+1].type==="text"?l[i+1].content=l[i].content+l[i+1].content:(i!==s&&(l[s]=l[i]),s++);i!==s&&(l.length=s)}}}),UE=W({"node_modules/markdown-it/lib/rules_inline/state_inline.js"(t,e){var n=Ua(),r=me().isWhiteSpace,i=me().isPunctChar,s=me().isMdAsciiPunct;function o(l,a,u,c){this.src=l,this.env=u,this.md=a,this.tokens=c,this.tokens_meta=Array(c.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1}o.prototype.pushPending=function(){var l=new n("text","",0);return l.content=this.pending,l.level=this.pendingLevel,this.tokens.push(l),this.pending="",l},o.prototype.push=function(l,a,u){this.pending&&this.pushPending();var c=new n(l,a,u),f=null;return u<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),c.level=this.level,u>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],f={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(c),this.tokens_meta.push(f),c},o.prototype.scanDelims=function(l,a){var u=l,c,f,d,h,p,m,g,b,_,k=!0,C=!0,v=this.posMax,x=this.src.charCodeAt(l);for(c=l>0?this.src.charCodeAt(l-1):32;u<v&&this.src.charCodeAt(u)===x;)u++;return d=u-l,f=u<v?this.src.charCodeAt(u):32,g=s(c)||i(String.fromCharCode(c)),_=s(f)||i(String.fromCharCode(f)),m=r(c),b=r(f),b?k=!1:_&&(m||g||(k=!1)),m?C=!1:g&&(b||_||(C=!1)),a?(h=k,p=C):(h=k&&(!C||g),p=C&&(!k||_)),{can_open:h,can_close:p,length:d}},o.prototype.Token=n,e.exports=o}}),HE=W({"node_modules/markdown-it/lib/parser_inline.js"(t,e){var n=Va(),r=[["text",NE()],["newline",IE()],["escape",FE()],["backticks",RE()],["strikethrough",Af().tokenize],["emphasis",Cf().tokenize],["link",PE()],["image",BE()],["autolink",zE()],["html_inline",LE()],["entity",jE()]],i=[["balance_pairs",qE()],["strikethrough",Af().postProcess],["emphasis",Cf().postProcess],["text_collapse",VE()]];function s(){var o;for(this.ruler=new n,o=0;o<r.length;o++)this.ruler.push(r[o][0],r[o][1]);for(this.ruler2=new n,o=0;o<i.length;o++)this.ruler2.push(i[o][0],i[o][1])}s.prototype.skipToken=function(o){var l,a,u=o.pos,c=this.ruler.getRules(""),f=c.length,d=o.md.options.maxNesting,h=o.cache;if(typeof h[u]<"u"){o.pos=h[u];return}if(o.level<d)for(a=0;a<f&&(o.level++,l=c[a](o,!0),o.level--,!l);a++);else o.pos=o.posMax;l||o.pos++,h[u]=o.pos},s.prototype.tokenize=function(o){for(var l,a,u=this.ruler.getRules(""),c=u.length,f=o.posMax,d=o.md.options.maxNesting;o.pos<f;){if(o.level<d)for(a=0;a<c&&(l=u[a](o,!1),!l);a++);if(l){if(o.pos>=f)break;continue}o.pending+=o.src[o.pos++]}o.pending&&o.pushPending()},s.prototype.parse=function(o,l,a,u){var c,f,d,h=new this.State(o,l,a,u);for(this.tokenize(h),f=this.ruler2.getRules(""),d=f.length,c=0;c<d;c++)f[c](h)},s.prototype.State=UE(),e.exports=s}}),ZE=W({"node_modules/linkify-it/lib/re.js"(t,e){e.exports=function(n){var r={};r.src_Any=rm().source,r.src_Cc=im().source,r.src_Z=sm().source,r.src_P=qa().source,r.src_ZPCc=[r.src_Z,r.src_P,r.src_Cc].join("|"),r.src_ZCc=[r.src_Z,r.src_Cc].join("|");var i="[><|]";return r.src_pseudo_letter="(?:(?!"+i+"|"+r.src_ZPCc+")"+r.src_Any+")",r.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",r.src_auth="(?:(?:(?!"+r.src_ZCc+"|[@/\\[\\]()]).)+@)?",r.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",r.src_host_terminator="(?=$|"+i+"|"+r.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+r.src_ZPCc+"))",r.src_path="(?:[/?#](?:(?!"+r.src_ZCc+"|"+i+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+r.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+r.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+r.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+r.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+r.src_ZCc+"|[']).)+\\'|\\'(?="+r.src_pseudo_letter+"|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+r.src_ZCc+"|[.]).|"+(n&&n["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+r.src_ZCc+").|;(?!"+r.src_ZCc+").|\\!+(?!"+r.src_ZCc+"|[!]).|\\?(?!"+r.src_ZCc+"|[?]).)+|\\/)?",r.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',r.src_xn="xn--[a-z0-9\\-]{1,59}",r.src_domain_root="(?:"+r.src_xn+"|"+r.src_pseudo_letter+"{1,63})",r.src_domain="(?:"+r.src_xn+"|(?:"+r.src_pseudo_letter+")|(?:"+r.src_pseudo_letter+"(?:-|"+r.src_pseudo_letter+"){0,61}"+r.src_pseudo_letter+"))",r.src_host="(?:(?:(?:(?:"+r.src_domain+")\\.)*"+r.src_domain+"))",r.tpl_host_fuzzy="(?:"+r.src_ip4+"|(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%)))",r.tpl_host_no_ip_fuzzy="(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%))",r.src_host_strict=r.src_host+r.src_host_terminator,r.tpl_host_fuzzy_strict=r.tpl_host_fuzzy+r.src_host_terminator,r.src_host_port_strict=r.src_host+r.src_port+r.src_host_terminator,r.tpl_host_port_fuzzy_strict=r.tpl_host_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_port_no_ip_fuzzy_strict=r.tpl_host_no_ip_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+r.src_ZPCc+"|>|$))",r.tpl_email_fuzzy="(^|"+i+'|"|\\(|'+r.src_ZCc+")("+r.src_email_name+"@"+r.tpl_host_fuzzy_strict+")",r.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+r.src_ZPCc+"))((?![$+<=>^`||])"+r.tpl_host_port_fuzzy_strict+r.src_path+")",r.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+r.src_ZPCc+"))((?![$+<=>^`||])"+r.tpl_host_port_no_ip_fuzzy_strict+r.src_path+")",r}}}),WE=W({"node_modules/linkify-it/index.js"(t,e){function n(v){var x=Array.prototype.slice.call(arguments,1);return x.forEach(function(A){A&&Object.keys(A).forEach(function(w){v[w]=A[w]})}),v}function r(v){return Object.prototype.toString.call(v)}function i(v){return r(v)==="[object String]"}function s(v){return r(v)==="[object Object]"}function o(v){return r(v)==="[object RegExp]"}function l(v){return r(v)==="[object Function]"}function a(v){return v.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var u={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function c(v){return Object.keys(v||{}).reduce(function(x,A){return x||u.hasOwnProperty(A)},!1)}var f={"http:":{validate:function(v,x,A){var w=v.slice(x);return A.re.http||(A.re.http=new RegExp("^\\/\\/"+A.re.src_auth+A.re.src_host_port_strict+A.re.src_path,"i")),A.re.http.test(w)?w.match(A.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(v,x,A){var w=v.slice(x);return A.re.no_http||(A.re.no_http=new RegExp("^"+A.re.src_auth+"(?:localhost|(?:(?:"+A.re.src_domain+")\\.)+"+A.re.src_domain_root+")"+A.re.src_port+A.re.src_host_terminator+A.re.src_path,"i")),A.re.no_http.test(w)?x>=3&&v[x-3]===":"||x>=3&&v[x-3]==="/"?0:w.match(A.re.no_http)[0].length:0}},"mailto:":{validate:function(v,x,A){var w=v.slice(x);return A.re.mailto||(A.re.mailto=new RegExp("^"+A.re.src_email_name+"@"+A.re.src_host_strict,"i")),A.re.mailto.test(w)?w.match(A.re.mailto)[0].length:0}}},d="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",h="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function p(v){v.__index__=-1,v.__text_cache__=""}function m(v){return function(x,A){var w=x.slice(A);return v.test(w)?w.match(v)[0].length:0}}function g(){return function(v,x){x.normalize(v)}}function b(v){var x=v.re=ZE()(v.__opts__),A=v.__tlds__.slice();v.onCompile(),v.__tlds_replaced__||A.push(d),A.push(x.src_xn),x.src_tlds=A.join("|");function w(N){return N.replace("%TLDS%",x.src_tlds)}x.email_fuzzy=RegExp(w(x.tpl_email_fuzzy),"i"),x.link_fuzzy=RegExp(w(x.tpl_link_fuzzy),"i"),x.link_no_ip_fuzzy=RegExp(w(x.tpl_link_no_ip_fuzzy),"i"),x.host_fuzzy_test=RegExp(w(x.tpl_host_fuzzy_test),"i");var T=[];v.__compiled__={};function O(N,U){throw new Error('(LinkifyIt) Invalid schema "'+N+'": '+U)}Object.keys(v.__schemas__).forEach(function(N){var U=v.__schemas__[N];if(U!==null){var R={validate:null,link:null};if(v.__compiled__[N]=R,s(U)){o(U.validate)?R.validate=m(U.validate):l(U.validate)?R.validate=U.validate:O(N,U),l(U.normalize)?R.normalize=U.normalize:U.normalize?O(N,U):R.normalize=g();return}if(i(U)){T.push(N);return}O(N,U)}}),T.forEach(function(N){v.__compiled__[v.__schemas__[N]]&&(v.__compiled__[N].validate=v.__compiled__[v.__schemas__[N]].validate,v.__compiled__[N].normalize=v.__compiled__[v.__schemas__[N]].normalize)}),v.__compiled__[""]={validate:null,normalize:g()};var M=Object.keys(v.__compiled__).filter(function(N){return N.length>0&&v.__compiled__[N]}).map(a).join("|");v.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+x.src_ZPCc+"))("+M+")","i"),v.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+x.src_ZPCc+"))("+M+")","ig"),v.re.pretest=RegExp("("+v.re.schema_test.source+")|("+v.re.host_fuzzy_test.source+")|@","i"),p(v)}function _(v,x){var A=v.__index__,w=v.__last_index__,T=v.__text_cache__.slice(A,w);this.schema=v.__schema__.toLowerCase(),this.index=A+x,this.lastIndex=w+x,this.raw=T,this.text=T,this.url=T}function k(v,x){var A=new _(v,x);return v.__compiled__[A.schema].normalize(A,v),A}function C(v,x){if(!(this instanceof C))return new C(v,x);x||c(v)&&(x=v,v={}),this.__opts__=n({},u,x),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=n({},f,v),this.__compiled__={},this.__tlds__=h,this.__tlds_replaced__=!1,this.re={},b(this)}C.prototype.add=function(x,A){return this.__schemas__[x]=A,b(this),this},C.prototype.set=function(x){return this.__opts__=n(this.__opts__,x),this},C.prototype.test=function(x){if(this.__text_cache__=x,this.__index__=-1,!x.length)return!1;var A,w,T,O,M,N,U,R,P;if(this.re.schema_test.test(x)){for(U=this.re.schema_search,U.lastIndex=0;(A=U.exec(x))!==null;)if(O=this.testSchemaAt(x,A[2],U.lastIndex),O){this.__schema__=A[2],this.__index__=A.index+A[1].length,this.__last_index__=A.index+A[0].length+O;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(R=x.search(this.re.host_fuzzy_test),R>=0&&(this.__index__<0||R<this.__index__)&&(w=x.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(M=w.index+w[1].length,(this.__index__<0||M<this.__index__)&&(this.__schema__="",this.__index__=M,this.__last_index__=w.index+w[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(P=x.indexOf("@"),P>=0&&(T=x.match(this.re.email_fuzzy))!==null&&(M=T.index+T[1].length,N=T.index+T[0].length,(this.__index__<0||M<this.__index__||M===this.__index__&&N>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=M,this.__last_index__=N))),this.__index__>=0},C.prototype.pretest=function(x){return this.re.pretest.test(x)},C.prototype.testSchemaAt=function(x,A,w){return this.__compiled__[A.toLowerCase()]?this.__compiled__[A.toLowerCase()].validate(x,w,this):0},C.prototype.match=function(x){var A=0,w=[];this.__index__>=0&&this.__text_cache__===x&&(w.push(k(this,A)),A=this.__last_index__);for(var T=A?x.slice(A):x;this.test(T);)w.push(k(this,A)),T=T.slice(this.__last_index__),A+=this.__last_index__;return w.length?w:null},C.prototype.tlds=function(x,A){return x=Array.isArray(x)?x:[x],A?(this.__tlds__=this.__tlds__.concat(x).sort().filter(function(w,T,O){return w!==O[T-1]}).reverse(),b(this),this):(this.__tlds__=x.slice(),this.__tlds_replaced__=!0,b(this),this)},C.prototype.normalize=function(x){x.schema||(x.url="http://"+x.url),x.schema==="mailto:"&&!/^mailto:/i.test(x.url)&&(x.url="mailto:"+x.url)},C.prototype.onCompile=function(){},e.exports=C}}),JE=W({"node_modules/punycode/punycode.js"(t,e){var n=2147483647,r=36,i=1,s=26,o=38,l=700,a=72,u=128,c="-",f=/^xn--/,d=/[^\0-\x7F]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=r-i,g=Math.floor,b=String.fromCharCode;function _(P){throw new RangeError(p[P])}function k(P,H){const ee=[];let se=P.length;for(;se--;)ee[se]=H(P[se]);return ee}function C(P,H){const ee=P.split("@");let se="";ee.length>1&&(se=ee[0]+"@",P=ee[1]),P=P.replace(h,".");const he=P.split("."),Ce=k(he,H).join(".");return se+Ce}function v(P){const H=[];let ee=0;const se=P.length;for(;ee<se;){const he=P.charCodeAt(ee++);if(he>=55296&&he<=56319&&ee<se){const Ce=P.charCodeAt(ee++);(Ce&64512)==56320?H.push(((he&1023)<<10)+(Ce&1023)+65536):(H.push(he),ee--)}else H.push(he)}return H}var x=P=>String.fromCodePoint(...P),A=function(P){return P>=48&&P<58?26+(P-48):P>=65&&P<91?P-65:P>=97&&P<123?P-97:r},w=function(P,H){return P+22+75*(P<26)-((H!=0)<<5)},T=function(P,H,ee){let se=0;for(P=ee?g(P/l):P>>1,P+=g(P/H);P>m*s>>1;se+=r)P=g(P/m);return g(se+(m+1)*P/(P+o))},O=function(P){const H=[],ee=P.length;let se=0,he=u,Ce=a,Be=P.lastIndexOf(c);Be<0&&(Be=0);for(let de=0;de<Be;++de)P.charCodeAt(de)>=128&&_("not-basic"),H.push(P.charCodeAt(de));for(let de=Be>0?Be+1:0;de<ee;){const _e=se;for(let Ve=1,ot=r;;ot+=r){de>=ee&&_("invalid-input");const Tt=A(P.charCodeAt(de++));Tt>=r&&_("invalid-input"),Tt>g((n-se)/Ve)&&_("overflow"),se+=Tt*Ve;const Zt=ot<=Ce?i:ot>=Ce+s?s:ot-Ce;if(Tt<Zt)break;const In=r-Zt;Ve>g(n/In)&&_("overflow"),Ve*=In}const qe=H.length+1;Ce=T(se-_e,qe,_e==0),g(se/qe)>n-he&&_("overflow"),he+=g(se/qe),se%=qe,H.splice(se++,0,he)}return String.fromCodePoint(...H)},M=function(P){const H=[];P=v(P);const ee=P.length;let se=u,he=0,Ce=a;for(const _e of P)_e<128&&H.push(b(_e));const Be=H.length;let de=Be;for(Be&&H.push(c);de<ee;){let _e=n;for(const Ve of P)Ve>=se&&Ve<_e&&(_e=Ve);const qe=de+1;_e-se>g((n-he)/qe)&&_("overflow"),he+=(_e-se)*qe,se=_e;for(const Ve of P)if(Ve<se&&++he>n&&_("overflow"),Ve===se){let ot=he;for(let Tt=r;;Tt+=r){const Zt=Tt<=Ce?i:Tt>=Ce+s?s:Tt-Ce;if(ot<Zt)break;const In=ot-Zt,Ai=r-Zt;H.push(b(w(Zt+In%Ai,0))),ot=g(In/Ai)}H.push(b(w(ot,0))),Ce=T(he,qe,de===Be),he=0,++de}++he,++se}return H.join("")},N=function(P){return C(P,function(H){return f.test(H)?O(H.slice(4).toLowerCase()):H})},U=function(P){return C(P,function(H){return d.test(H)?"xn--"+M(H):H})},R={version:"2.3.1",ucs2:{decode:v,encode:x},decode:O,encode:M,toASCII:U,toUnicode:N};e.exports=R}}),KE=W({"node_modules/markdown-it/lib/presets/default.js"(t,e){e.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}}}}),GE=W({"node_modules/markdown-it/lib/presets/zero.js"(t,e){e.exports={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","text_collapse"]}}}}}),YE=W({"node_modules/markdown-it/lib/presets/commonmark.js"(t,e){e.exports={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","text_collapse"]}}}}}),lm=W({"node_modules/markdown-it/lib/index.js"(t,e){var n=me(),r=uE(),i=cE(),s=yE(),o=$E(),l=HE(),a=WE(),u=nm(),c=JE(),f={default:KE(),zero:GE(),commonmark:YE()},d=/^(vbscript|javascript|file|data):/,h=/^data:image\/(gif|png|jpeg|webp);/;function p(k){var C=k.trim().toLowerCase();return d.test(C)?!!h.test(C):!0}var m=["http:","https:","mailto:"];function g(k){var C=u.parse(k,!0);if(C.hostname&&(!C.protocol||m.indexOf(C.protocol)>=0))try{C.hostname=c.toASCII(C.hostname)}catch{}return u.encode(u.format(C))}function b(k){var C=u.parse(k,!0);if(C.hostname&&(!C.protocol||m.indexOf(C.protocol)>=0))try{C.hostname=c.toUnicode(C.hostname)}catch{}return u.decode(u.format(C),u.decode.defaultChars+"%")}function _(k,C){if(!(this instanceof _))return new _(k,C);C||n.isString(k)||(C=k||{},k="default"),this.inline=new l,this.block=new o,this.core=new s,this.renderer=new i,this.linkify=new a,this.validateLink=p,this.normalizeLink=g,this.normalizeLinkText=b,this.utils=n,this.helpers=n.assign({},r),this.options={},this.configure(k),C&&this.set(C)}_.prototype.set=function(k){return n.assign(this.options,k),this},_.prototype.configure=function(k){var C=this,v;if(n.isString(k)&&(v=k,k=f[v],!k))throw new Error('Wrong `markdown-it` preset "'+v+'", check name');if(!k)throw new Error("Wrong `markdown-it` preset, can't be empty");return k.options&&C.set(k.options),k.components&&Object.keys(k.components).forEach(function(x){k.components[x].rules&&C[x].ruler.enableOnly(k.components[x].rules),k.components[x].rules2&&C[x].ruler2.enableOnly(k.components[x].rules2)}),this},_.prototype.enable=function(k,C){var v=[];Array.isArray(k)||(k=[k]),["core","block","inline"].forEach(function(A){v=v.concat(this[A].ruler.enable(k,!0))},this),v=v.concat(this.inline.ruler2.enable(k,!0));var x=k.filter(function(A){return v.indexOf(A)<0});if(x.length&&!C)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+x);return this},_.prototype.disable=function(k,C){var v=[];Array.isArray(k)||(k=[k]),["core","block","inline"].forEach(function(A){v=v.concat(this[A].ruler.disable(k,!0))},this),v=v.concat(this.inline.ruler2.disable(k,!0));var x=k.filter(function(A){return v.indexOf(A)<0});if(x.length&&!C)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+x);return this},_.prototype.use=function(k){var C=[this].concat(Array.prototype.slice.call(arguments,1));return k.apply(k,C),this},_.prototype.parse=function(k,C){if(typeof k!="string")throw new Error("Input data should be a String");var v=new this.core.State(k,this,C);return this.core.process(v),v.tokens},_.prototype.render=function(k,C){return C=C||{},this.renderer.render(this.parse(k,C),this.options,C)},_.prototype.parseInline=function(k,C){var v=new this.core.State(k,this,C);return v.inlineMode=!0,this.core.process(v),v.tokens},_.prototype.renderInline=function(k,C){return C=C||{},this.renderer.render(this.parseInline(k,C),this.options,C)},e.exports=_}}),XE=W({"node_modules/markdown-it/index.js"(t,e){e.exports=lm()}}),am={};Qp(am,{getAstValues:()=>ql,isAst:()=>Ha,isFunction:()=>QE,isVariable:()=>eD,resolve:()=>pi});function Ha(t){return!!(t!=null&&t.$$mdtype)}function QE(t){return(t==null?void 0:t.$$mdtype)==="Function"}function eD(t){return(t==null?void 0:t.$$mdtype)==="Variable"}function*ql(t){if(!(t==null||typeof t!="object")){if(Array.isArray(t))for(const e of t)yield*ql(e);if(Ha(t)&&(yield t),Object.getPrototypeOf(t)===Object.prototype)for(const e of Object.values(t))yield*ql(e)}}function pi(t,e={}){if(t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(r=>pi(r,e));if(Ha(t)&&(t==null?void 0:t.resolve)instanceof Function)return t.resolve(e);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const n={};for(const[r,i]of Object.entries(t))n[r]=pi(i,e);return n}var gr,Ht=(gr=class{constructor(e="div",n={},r=[]){this.$$mdtype="Tag",this.name=e,this.attributes=n,this.children=r}},gr.isTag=e=>(e==null?void 0:e.$$mdtype)==="Tag",gr),tD=class{validate(t,e,n){return typeof t=="string"||typeof t=="object"?[]:[{id:"attribute-type-invalid",level:"error",message:`Attribute '${n}' must be type 'string | object'`}]}transform(t){if(!t||typeof t=="string")return t;const e=[];for(const[n,r]of Object.entries(t??{}))r&&e.push(n);return e.join(" ")}},nD=class{validate(t){return typeof t=="string"&&t.match(/^[a-zA-Z]/)?[]:[{id:"attribute-value-invalid",level:"error",message:"The 'id' attribute must start with a letter"}]}},_f=yo(em()),ko=class{constructor(t=[]){this.$$mdtype="Variable",this.path=t}resolve({variables:t}={}){return t instanceof Function?t(this.path):this.path.reduce((e={},n)=>e[n],t)}},vo=class{constructor(t,e){this.$$mdtype="Function",this.name=t,this.parameters=e}resolve(t={}){var r,i;const e=(r=t==null?void 0:t.functions)==null?void 0:r[this.name];if(!e)return null;const n=pi(this.parameters,t);return(i=e.transform)==null?void 0:i.call(e,n,t)}},Pe="{%",qt="%}",rD=/^[a-zA-Z0-9_-]+$/;function vs(t){return typeof t=="string"&&rD.test(t)}function Kn(t){return t&&typeof t=="object"&&typeof t.then=="function"}function _r(t,e=0){let n=0;for(let r=e;r<t.length;r++){const i=t[r];switch(n){case 1:switch(i){case'"':n=0;break;case"\\":n=2;break}break;case 2:n=1;break;case 0:if(i==='"')n=1;else if(t.startsWith(qt,r))return r}}return null}function iD(t,e){for(let n=0;n<t.length;n++){if(!t.startsWith(Pe,n))continue;if(_r(t,n)===null){n+=Pe.length-1;continue}let i=n;for(;i>0&&!/\s/.test(t[i-1]);)i--;for(const s of e)if(t.slice(i,n).includes(`${s}://`))return!0;return!1}return!1}function sD(t,e,n){try{return(0,_f.parse)(t,{Variable:ko,Function:vo})}catch(r){if(!(r instanceof _f.SyntaxError))throw r;const{message:i,location:{start:s,end:o}}=r,l={start:{line:e,character:s.offset+n},end:{line:e+1,character:o.offset+n}};return{type:"error",meta:{error:{message:i,location:l}}}}}function um(t,e=0){let n=e+1;const r=[];let i=0;for(let s=0;s<t.length;s++){if(t[s]===`
|
|
169
|
+
`){n++;continue}if(!t.startsWith(Pe,s))continue;const o=_r(t,s);if(o==null){s=s+Pe.length;continue}const l=t.slice(s,o+qt.length),a=t.slice(s+Pe.length,o),u=t.lastIndexOf(`
|
|
170
|
+
`,s),c=t.indexOf(`
|
|
171
|
+
`,o),f=t.slice(u,c),d=sD(a.trim(),n,s-u),h=f.trim()===l?u:s,p=t.slice(i,h);r.push({type:"text",start:i,end:s-1,content:p}),r.push({map:[n,n+1],position:{start:s-u,end:s-u+l.length},start:s,end:s+l.length-1,info:l,...d}),i=o+qt.length,s=i-1}return r.push({type:"text",start:i,end:t.length-1,content:t.slice(i)}),r}var Za={class:{type:tD,render:!0},id:{type:nD,render:!0}},Lr={findSchema(t,{nodes:e={},tags:n={}}={}){return t.tag?n[t.tag]:e[t.type]},attributes(t,e={}){const n=this.findSchema(t,e)??{},r={},i={...Za,...n.attributes};for(const[s,o]of Object.entries(i)){if(o.render==!1)continue;const l=typeof o.render=="string"?o.render:s;let a=t.attributes[s];if(typeof o.type=="function"){const u=new o.type;u.transform&&(a=u.transform(a,e))}a=a===void 0?o.default:a,a!==void 0&&(r[l]=a)}if(n.slots)for(const[s,o]of Object.entries(n.slots)){if(o.render===!1)continue;const l=typeof o.render=="string"?o.render:s;t.slots[s]&&(r[l]=this.node(t.slots[s],e))}return r},children(t,e={}){const n=t.children.flatMap(r=>this.node(r,e));return n.some(Kn)?Promise.all(n):n},node(t,e={}){const n=this.findSchema(t,e)??{};if(n&&n.transform instanceof Function)return n.transform(t,e);const r=this.children(t,e);if(!n||!n.render)return r;const i=this.attributes(t,e);return Kn(i)||Kn(r)?Promise.all([i,r]).then(s=>new Ht(n.render,...s)):new Ht(n.render,i,r)}},Wa=class cm{constructor(e="node",n={},r=[],i){this.$$mdtype="Node",this.errors=[],this.lines=[],this.inline=!1,this.attributes=n,this.children=r,this.type=e,this.tag=i,this.annotations=[],this.slots={}}*walk(){for(const e of[...Object.values(this.slots),...this.children])yield e,yield*e.walk()}push(e){this.children.push(e)}resolve(e={}){return Object.assign(new cm,this,{children:this.children.map(n=>n.resolve(e)),attributes:pi(this.attributes,e),slots:Object.fromEntries(Object.entries(this.slots).map(([n,r])=>[n,r.resolve(e)]))})}findSchema(e={}){return Lr.findSchema(this,e)}transformAttributes(e={}){return Lr.attributes(this,e)}transformChildren(e){return Lr.children(this,e)}transform(e){return Lr.node(this,e)}},fm={Function:vo,Node:Wa,Variable:ko};function oD(t,e){if(!e)return e;const n=fm[e.$$mdtype];return n?Object.assign(new n,e):e}function lD(t){return JSON.parse(t,oD)}var ft={...fm,...am,fromJSON:lD},Ie=" ",Vl=", ",ce=`
|
|
172
|
+
`,aD=".",wf="-",uD=80,cD=["strong","em","s"],fD=(t,e)=>Math.max(t,e),Wo=(t,e=2)=>({...t,indent:(t.indent||0)+e});function*at(t,e){for(const n of t.children)yield*Qt(n,e)}function*Li(t){yield[...t].join("").trim()}function*Jo(t){yield`| ${t.join(" | ")} |`}function xs(t){if(t!==void 0)return ft.isAst(t)?As(t):t===null?"null":Array.isArray(t)?"["+t.map(xs).join(Vl)+"]":typeof t=="object"?"{"+Object.entries(t).map(([e,n])=>`${vs(e)?e:`"${e}"`}: ${xs(n)}`).join(Vl)+"}":JSON.stringify(t)}function Ul(t){const e=xs(t.value);if(e!==void 0)return t.name==="primary"?e:t.name==="id"&&typeof t.value=="string"&&vs(t.value)?"#"+t.value:t.type==="class"&&vs(t.name)?"."+t.name:`${t.name}=${e}`}function*dD(t){for(const[e,n]of Object.entries(t.attributes))if(e==="class"&&typeof n=="object"&&!ft.isAst(n))for(const r of Object.keys(n))yield Ul({type:"class",name:r,value:n});else yield Ul({type:"attribute",name:e,value:n})}function*$r(t){t.annotations.length&&(yield Pe+Ie,yield t.annotations.map(Ul).join(Ie),yield Ie+qt)}function*hD(t){yield"$",yield t.path.map((e,n)=>n===0?e:vs(e)?"."+e:typeof e=="number"?`[${e}]`:`["${e}"]`).join("")}function*pD(t){yield t.name,yield"(",yield Object.values(t.parameters).map(xs).join(Vl),yield")"}function*Sf(t){let e;do{const{value:n,done:r}=t.next();if(r)return;e=n.trimStart()}while(!e.length);yield e,yield*t}function*ji(t,e){yield t.replace(e,"\\$&").replace(new RegExp(" ","g")," ")}function*mD(t,e={}){const n={...e,parent:t},r=Ie.repeat(n.indent||0);switch(t.type){case"document":{t.attributes.frontmatter&&t.attributes.frontmatter.length&&(yield"---"+ce+t.attributes.frontmatter+ce+"---"+ce+ce),yield*Sf(at(t,n));break}case"heading":{yield ce,yield r,yield"#".repeat(t.attributes.level||1),yield Ie,yield*Sf(at(t,n)),yield*$r(t),yield ce;break}case"paragraph":{yield ce,yield*at(t,n),yield*$r(t),yield ce;break}case"inline":{yield r,yield*at(t,n);break}case"image":{yield"!",yield"[",yield*Qt(t.attributes.alt,n),yield"]",yield"(",yield*typeof t.attributes.src=="string"?ji(t.attributes.src,/[()]/g):Qt(t.attributes.src,n),t.attributes.title&&(yield Ie+`"${t.attributes.title}"`),yield")";break}case"link":{const i=[...at(t,n)].join("");if(i===t.attributes.href&&!t.attributes.title){yield`<${t.attributes.href}>`;break}yield"[",yield i,yield"]",yield"(",yield*typeof t.attributes.href=="string"?ji(t.attributes.href,/[()]/g):Qt(t.attributes.href,n),t.attributes.title&&(yield Ie+`"${t.attributes.title}"`),yield")";break}case"text":{const{content:i}=t.attributes;ft.isAst(i)?(yield Pe+Ie,yield*Qt(i,n),yield Ie+qt):e.parent&&cD.includes(e.parent.type)?yield*ji(i,/[*_~]/g):yield*ji(i,/^\*|#+\s|^>/);break}case"blockquote":{const i=ce+r+">"+Ie,s=t.children.map(o=>As(o,{...n,indent:0}).trim()).join(ce+ce);yield i+s.split(ce).join(i)+ce;break}case"hr":{yield ce,yield r,yield"---",yield ce;break}case"fence":{yield ce,yield r;const s=(t.attributes.content.match(/`{3,}/g)||[]).map(a=>a.length).reduce(fD,0),o="`".repeat(s?s+1:3),l=!t.attributes.content.endsWith(ce);yield o,t.attributes.language&&(yield t.attributes.language),t.annotations.length&&(yield Ie),yield*$r(t),yield ce,yield r,yield t.attributes.content.split(ce).join(ce+r),l&&(yield ce),yield o,yield ce;break}case"tag":{t.inline||(yield ce,yield r);const i=Pe+Ie,s=[...dD(t)].filter(u=>u!==void 0),o=[i+t.tag,...s],l=o.join(Ie),a=l.length+i.length*2>(e.maxTagOpeningWidth||uD);yield(!t.inline&&a?o.join(ce+Ie.repeat(i.length)+r):l)+Ie+(t.children.length?"":"/")+qt,t.children.length&&(yield*at(t,n.allowIndentation?Wo(n):n),t.inline||(yield r),yield Pe+Ie+"/"+t.tag+Ie+qt),t.inline||(yield ce);break}case"list":{const i=t.children.some(s=>s.children.some(o=>o.type==="paragraph"));for(let s=0;s<t.children.length;s++){const o=(()=>{if(!t.attributes.ordered)return t.attributes.marker??wf;let a="1";const u=t.attributes.start??1;return s===0&&(a=u.toString()),e.orderedListMode==="increment"&&(a=(parseInt(u)+s).toString()),`${a}${t.attributes.marker??aD}`})();let l=As(t.children[s],Wo(n,o.length+1));(!i||s===t.children.length-1)&&(l=l.trim()),yield ce+r+o+" "+l}yield ce;break}case"item":{for(let i=0;i<t.children.length;i++)yield*Qt(t.children[i],n),i===0&&(yield*$r(t));break}case"strong":{yield t.attributes.marker??"**",yield*Li(at(t,n)),yield t.attributes.marker??"**";break}case"em":{yield t.attributes.marker??"*",yield*Li(at(t,n)),yield t.attributes.marker??"*";break}case"code":{yield"`",yield*Li(Qt(t.attributes.content,n)),yield"`";break}case"s":{yield"~~",yield*Li(at(t,n)),yield"~~";break}case"hardbreak":{yield"\\"+ce,yield r;break}case"softbreak":{yield ce,yield r;break}case"table":{const i=[...at(t,Wo(n))];if(e.parent&&e.parent.type==="tag"&&e.parent.tag==="table"){for(let s=0;s<i.length;s++){const o=i[s];if(typeof o=="string")o.trim().length&&(yield ce,yield o);else{s!==0&&(yield ce,yield r+"---");for(const l of o)yield ce+r+wf+" "+l}}yield ce}else{const s=[];for(const a of i)for(let u=0;u<a.length;u++)s[u]=s[u]?Math.max(s[u],a[u].length):a[u].length;const[o,...l]=i;yield ce,yield*Jo(o.map((a,u)=>a+Ie.repeat(s[u]-a.length))),yield ce,yield*Jo(o.map((a,u)=>"-".repeat(s[u]))),yield ce;for(const a of l)yield*Jo(a.map((u,c)=>u+Ie.repeat(s[c]-u.length))),yield ce}break}case"thead":{const[i]=[...at(t,n)];yield i||[];break}case"tr":{yield[...at(t,n)];break}case"td":case"th":{yield[...at(t,n),...$r(t)].join("").trim();break}case"tbody":{yield*at(t,n);break}case"comment":{yield"<!-- "+t.attributes.content+` -->
|
|
173
|
+
`;break}}}function*Qt(t,e={}){switch(typeof t){case"undefined":break;case"boolean":case"number":case"string":{yield t.toString();break}case"object":{if(t===null)break;if(Array.isArray(t)){for(const n of t)yield*Qt(n,e);break}switch(t.$$mdtype){case"Function":{yield*pD(t);break}case"Node":yield*mD(t,e);break;case"Variable":{yield*hD(t);break}default:throw new Error(`Unimplemented: "${t.$$mdtype}"`)}break}}}function As(t,e){let n="";for(const r of Qt(t,e))n+=r;return n.trimStart()}var dm=class{validate(t,e,n){return typeof t=="boolean"||t===null||t===void 0||typeof t=="object"?[]:[{id:"attribute-type-invalid",level:"error",message:`Attribute '${n}' must be type 'boolean | object' (null or undefined are also allowed)`}]}};function xi(t){return t!==!1&&t!==void 0&&t!==null}function gD(t){const e=[{condition:t.attributes.primary,children:[]}];for(const n of t.children)n.type==="tag"&&n.tag==="else"?e.push({condition:"primary"in n.attributes?n.attributes.primary:!0,children:[]}):e[e.length-1].children.push(n);return e}var bD={attributes:{primary:{type:dm,render:!1}},transform(t,e){const n=gD(t);for(const{condition:r,children:i}of n)if(xi(r)){const s=i.flatMap(o=>o.transform(e));return s.some(Kn)?Promise.all(s).then(o=>o.flat()):s}return[]}},yD={selfClosing:!0,attributes:{primary:{type:dm,render:!1}}},kD={transform(t){return Object.values(t).every(e=>xi(e))}},vD={transform(t){return Object.values(t).find(e=>xi(e))!==void 0}},xD={parameters:{0:{required:!0}},transform(t){return!xi(t[0])}},AD={transform(t){const e=Object.values(t);return e.every(n=>n===e[0])}},CD={transform(t){return JSON.stringify(t[0],null,2)}},_D={transform(t){return t[0]===void 0?t[1]:t[0]}},hm={and:kD,or:vD,not:xD,equals:AD,default:_D,debug:CD};function Ko(t,e="td"){t.type="tr",t.attributes={};for(const n of t.children)n.type=e;return t}function Ef(t,e){return t.type==="tag"&&!!t.tag&&e.includes(t.tag)}function Df(t){return t.type==="comment"||t.type==="tag"&&t.tag==="comment"}function Of(t){return{id:"table-syntax",level:"critical",message:`Found ${t.type}${t.tag?` ${t.tag}`:""} where a list was expected. Make sure all content inside table cells is indented.`,location:t.location}}function wD(t,e=["if"]){for(const n of t.walk()){if(n.type!=="tag"||n.tag!=="table")continue;const[r,...i]=n.children;if(!r||r.type==="table")continue;const s=new ft.Node("table",n.attributes,[new ft.Node("thead"),new ft.Node("tbody")]),[o,l]=s.children;r.type==="list"&&o.push(Ko(r,"th"));for(const a of i){if(a.type==="list")Ko(a);else if(Ef(a,e)){const u=[];for(const c of a.children)if(c.type!=="hr"){if(c.type==="list")Ko(c);else if(!(Df(c)||c.tag==="else"||Ef(c,e))){a.errors.push(Of(c));continue}u.push(c)}a.children=u}else if(a.type!=="hr"&&!Df(a)){n.errors.push(Of(a));continue}else continue;l.push(a)}n.children=[s]}}var pm=[wD],Tf={ordered_list:"list",bullet_list:"list",code_inline:"code",list_item:"item",variable:"text"};function Mf(t,e){for(const n of e){t.annotations.push(n);const{name:r,value:i,type:s}=n;s==="attribute"?(t.attributes[r]!==void 0&&t.errors.push({id:"duplicate-attribute",level:"warning",message:`Attribute '${r}' already set`}),t.attributes[r]=i):s==="class"&&(t.attributes.class?t.attributes.class[r]=i:t.attributes.class={[r]:i})}}function SD(t,e){switch(e){case"heading":return{level:Number(t.tag.replace("h",""))};case"list":{const n=t.attrs?Object.fromEntries(t.attrs):void 0,r=t.type.startsWith("ordered");return r&&(n!=null&&n.start)?{ordered:!0,start:n.start,marker:t.markup}:{ordered:r,marker:t.markup}}case"link":{const n=Object.fromEntries(t.attrs);return n.title?{href:n.href,title:n.title}:{href:n.href}}case"image":{const n=Object.fromEntries(t.attrs);return n.title?{alt:t.content,src:n.src,title:n.title}:{alt:t.content,src:n.src}}case"em":case"strong":return{marker:t.markup};case"text":case"code":case"comment":return{content:(t.meta||{}).variable||t.content};case"fence":{const[n]=t.info.split(" ",1);return n===""||n===Pe?{content:t.content}:{content:t.content,language:n}}case"td":case"th":{if(t.attrs){const n=Object.fromEntries(t.attrs);let r;if(n.style&&(n.style.includes("left")?r="left":n.style.includes("center")?r="center":n.style.includes("right")&&(r="right")),r)return{align:r}}return{}}default:return{}}}function mm(t,e,n,r,i,s){if(t.type==="frontmatter"){e[0].attributes.frontmatter=t.content;return}if(t.hidden||t.type==="text"&&t.content==="")return;const o=t.errors||[],l=e[e.length-1],{tag:a,attributes:u,error:c}=t.meta||{};if(t.type==="annotation")return s?Mf(s,u):l.errors.push({id:"no-inline-annotations",level:"error",message:`Can't apply inline annotations to '${l.type}'`});let f=t.type.replace(/_(open|close)$/,"");if(Tf[f]&&(f=Tf[f]),f==="error"){const{message:g,location:b}=c;o.push({id:"parse-error",level:"critical",message:g,location:b})}if(t.nesting<0){if(l.type===f&&l.tag===a)return l.lines&&t.map&&l.lines.push(...t.map),e.pop();o.push({id:"missing-opening",level:"critical",message:`Node '${f}' is missing opening`})}const d=SD(t,f),h=new Wa(f,d,void 0,a||void 0),{position:p={}}=t;if(h.errors=o,i!==!1&&(h.lines=t.map||l.lines||[],h.location={file:n,start:{line:h.lines[0],character:p.start},end:{line:h.lines[1],character:p.end}}),s&&(h.inline=!0),u&&["tag","fence","image"].includes(f)&&Mf(h,u),r&&a==="slot"&&typeof h.attributes.primary=="string"?l.slots[h.attributes.primary]=h:l.push(h),t.nesting>0&&e.push(h),!Array.isArray(t.children))return;if(h.type==="inline"&&(s=l),e.push(h),!(f==="image"))for(const g of t.children)mm(g,e,n,r,i,s);e.pop()}function ED(t,e){const n=new Wa("document"),r=[n];typeof e=="string"&&(e={file:e});for(const i of t)mm(i,r,e==null?void 0:e.file,e==null?void 0:e.slots,e==null?void 0:e.location);if(r.length>1)for(const i of r.slice(1))i.errors.push({id:"missing-closing",level:"critical",message:`Node '${i.tag||i.type}' is missing closing`});for(const i of pm)i(n,e==null?void 0:e.conditionalTags);return n}var Ja={};Qp(Ja,{blockquote:()=>ND,code:()=>JD,comment:()=>XD,document:()=>DD,em:()=>UD,error:()=>QD,fence:()=>$D,hardbreak:()=>GD,heading:()=>OD,hr:()=>RD,image:()=>MD,inline:()=>ZD,item:()=>ID,link:()=>WD,list:()=>FD,node:()=>eO,paragraph:()=>TD,s:()=>HD,softbreak:()=>YD,strong:()=>VD,table:()=>PD,tbody:()=>jD,td:()=>BD,text:()=>KD,th:()=>zD,thead:()=>qD,tr:()=>LD});var DD={render:"article",children:["heading","paragraph","image","table","tag","fence","blockquote","comment","list","hr"],attributes:{frontmatter:{render:!1}}},OD={children:["inline"],attributes:{level:{type:Number,render:!1,required:!0}},transform(t,e){return new Ht(`h${t.attributes.level}`,t.transformAttributes(e),t.transformChildren(e))}},TD={render:"p",children:["inline"]},MD={render:"img",attributes:{src:{type:String,required:!0},alt:{type:String},title:{type:String}}},$D={render:"pre",attributes:{content:{type:String,render:!1,required:!0},language:{type:String,render:"data-language"},process:{type:Boolean,render:!1,default:!0}},transform(t,e){const n=t.transformAttributes(e),r=t.children.length?t.transformChildren(e):[t.attributes.content];return new Ht("pre",n,r)}},ND={render:"blockquote",children:["heading","paragraph","image","table","tag","fence","blockquote","list","hr"]},ID={render:"li",children:["inline","heading","paragraph","image","table","tag","fence","blockquote","list","hr"]},FD={children:["item"],attributes:{ordered:{type:Boolean,render:!1,required:!0},start:{type:Number},marker:{type:String,render:!1}},transform(t,e){return new Ht(t.attributes.ordered?"ol":"ul",t.transformAttributes(e),t.transformChildren(e))}},RD={render:"hr"},PD={render:"table"},BD={render:"td",children:["inline","heading","paragraph","image","table","tag","fence","blockquote","list","hr"],attributes:{align:{type:String},colspan:{type:Number,render:"colSpan"},rowspan:{type:Number,render:"rowSpan"}}},zD={render:"th",attributes:{width:{type:String},align:{type:String},colspan:{type:Number,render:"colSpan"},rowspan:{type:Number,render:"rowSpan"}}},LD={render:"tr",children:["th","td"]},jD={render:"tbody",children:["tr","tag"]},qD={render:"thead",children:["tr"]},VD={render:"strong",children:["em","s","link","code","text","tag"],attributes:{marker:{type:String,render:!1}}},UD={render:"em",children:["strong","s","link","code","text","tag"],attributes:{marker:{type:String,render:!1}}},HD={render:"s",children:["strong","em","link","code","text","tag"]},ZD={children:["strong","em","s","code","text","tag","link","image","hardbreak","softbreak","comment"]},WD={render:"a",children:["strong","em","s","code","text","tag"],attributes:{href:{type:String,required:!0},title:{type:String}}},JD={render:"code",attributes:{content:{type:String,render:!1,required:!0}},transform(t,e){const n=t.transformAttributes(e);return new Ht("code",n,[t.attributes.content])}},KD={attributes:{content:{type:String,required:!0}},transform(t){return t.attributes.content}},GD={render:"br"},YD={transform(){return" "}},XD={attributes:{content:{type:String,required:!0}}},QD={},eO={},tO=yo(XE()),{escapeHtml:$f}=(0,tO.default)().utils,nO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Xi(t){if(typeof t=="string"||typeof t=="number")return $f(String(t));if(Array.isArray(t))return t.map(Xi).join("");if(t===null||typeof t!="object"||!Ht.isTag(t))return"";const{name:e,attributes:n,children:r=[]}=t;if(!e)return Xi(r);let i=`<${e}`;for(const[s,o]of Object.entries(n??{}))i+=` ${s.toLowerCase()}="${$f(String(o))}"`;return i+=">",nO.has(e)||(r.length&&(i+=Xi(r)),i+=`</${e}>`),i}function rO(t,e){return typeof t!="string"||t[0]!==t[0].toUpperCase()?t:e instanceof Function?e(t):e[t]}function iO(t,e,{components:n={},resolveTagName:r=rO}={}){function i(o){if(o==null||typeof o!="object")return o;if(Array.isArray(o))return o.map(a=>i(a));if(o.$$mdtype==="Tag")return s(o);if(typeof o!="object")return o;const l={};for(const[a,u]of Object.entries(o))l[a]=i(u);return l}function s(o){if(Array.isArray(o))return e.createElement(e.Fragment,null,...o.map(s));if(o===null||typeof o!="object"||!Ht.isTag(o))return o;const{name:l,attributes:{class:a,...u}={},children:c=[]}=o;return a&&(u.className=a),e.createElement(r(l,n),Object.keys(u).length==0?null:i(u),...c.map(s))}return s(t)}function sO(t,e){return typeof t!="string"?"Fragment":t[0]!==t[0].toUpperCase()?t:e instanceof Function?e(t):e[t]}function Nf(t){return t.map(Ka).join(", ")}function Hl(t){return t==null||typeof t!="object"?JSON.stringify(t):Array.isArray(t)?`[${t.map(n=>Hl(n)).join(", ")}]`:t.$$mdtype==="Tag"?Ka(t):typeof t!="object"?JSON.stringify(t):`{${Object.entries(t).map(([n,r])=>[JSON.stringify(n),Hl(r)].join(": ")).join(", ")}}`}function Ka(t){if(Array.isArray(t))return`React.createElement(React.Fragment, null, ${Nf(t)})`;if(t===null||typeof t!="object"||!Ht.isTag(t))return JSON.stringify(t);const{name:e,attributes:{class:n,...r}={},children:i=[]}=t;return n&&(r.className=n),`React.createElement(
|
|
174
|
+
tagName(${JSON.stringify(e)}, components),
|
|
175
|
+
${Object.keys(r).length==0?"null":Hl(r)},
|
|
176
|
+
${Nf(i)})`}function oO(t,{resolveTagName:e=sO}={}){if(e.name!=="tagName")throw new Error("resolveTagName must be named tagName");return`
|
|
177
|
+
(({components = {}} = {}) => {
|
|
178
|
+
${e}
|
|
179
|
+
return ${Ka(t)};
|
|
180
|
+
})
|
|
181
|
+
`}var lO={html:Xi,react:iO,reactStatic:oO},aO=class{validate(t,e){const{partials:n={}}=e;return n[t]?[]:[{id:"attribute-value-invalid",level:"error",message:`Partial \`${t}\` not found. The 'file' attribute must be set in \`config.partials\``}]}},uO={inline:!1,selfClosing:!0,attributes:{file:{type:aO,render:!1,required:!0},variables:{type:Object,render:!1}},transform(t,e){const{partials:n={}}=e,{file:r,variables:i}=t.attributes,s=n[r];if(!s)return null;const o={...e,variables:{...e.variables,...i,"$$partial:filename":r}},l=a=>a.resolve(o).transformChildren(o);return Array.isArray(s)?s.flatMap(l):l(s)}},cO={children:["table"],inline:!1},fO={attributes:{primary:{type:String,required:!0}}},gm={else:yD,if:bD,partial:uO,slot:fO,table:cO},dO=yo(lm()),Cs=yo(em());function bm(t,e,n){try{const{type:r,meta:i,nesting:s=0}=(0,Cs.parse)(e,{Variable:ko,Function:vo}),o=t.push(r,"",s);return o.info=e,o.meta=i,t.delimiters||(t.delimiters=[]),o}catch(r){if(!(r instanceof Cs.SyntaxError))throw r;const{message:i,location:{start:s,end:o}}=r,l=n?{start:{offset:s.offset+n},end:{offset:o.offset+n}}:null,a=t.push("error","",0);return a.meta={error:{message:i,location:l}},a}}function hO(t,e,n,r){const i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(!t.src.startsWith(Pe,i))return!1;const o=_r(t.src,i),l=t.src.slice(0,s).trim().length;if(!o||o<l-qt.length)return!1;const a=i+Pe.length,u=t.src.slice(i,o+qt.length).split(`
|
|
182
|
+
`).length,c=t.getLines(e,e+u,0,!1),f=c.slice(c.indexOf(Pe)+Pe.length,_r(c)).trim();if(f[0]==="$")return!1;if(r)return!0;const d=bm(t,f,a);return d.map=[e,e+u],t.line+=u,!0}function pO(t,e){if(!t.src.startsWith(Pe,t.pos))return!1;const n=_r(t.src,t.pos);if(!n)return!1;const r=t.src.slice(t.pos+Pe.length,n);return e||bm(t,r.trim()),t.pos=n+qt.length,!0}function mO(t){var n,r;let e;for(e of t.tokens)if(e.type==="fence"){if(e.info.includes(Pe)){const i=e.info.indexOf(Pe),s=_r(e.info,i),o=e.info.slice(i+Pe.length,s);try{const{meta:l}=(0,Cs.parse)(o.trim(),{Variable:ko,Function:vo});e.meta=l}catch(l){if(!(l instanceof Cs.SyntaxError))throw l;e.errors||(e.errors=[]),e.errors.push({id:"fence-tag-error",level:"error",message:`Syntax error in fence tag: ${l.message}`})}}(r=(n=e==null?void 0:e.meta)==null?void 0:n.attributes)!=null&&r.find(i=>i.name==="process"&&!i.value)||(e.children=um(e.content,e.map[0]))}}function gO(t){t.block.ruler.before("paragraph","annotations",hO,{alt:["paragraph","blockquote"]}),t.inline.ruler.push("containers",pO),t.core.ruler.push("annotations",mO)}var ym="---";function km(t,e){return t.src.slice(t.bMarks[e],t.eMarks[e]).trim()}function bO(t,e){for(let n=1;n<e;n++)if(km(t,n)===ym)return n}function yO(t,e,n,r){if(e!=0||km(t,0)!=ym)return!1;const i=bO(t,n);if(!i)return!1;if(r)return!0;const s=t.push("frontmatter","",0);return s.content=t.src.slice(t.eMarks[0],t.bMarks[i]).trim(),s.map=[0,i],s.hidden=!0,t.line=i+1,!0}function kO(t){t.block.ruler.before("hr","frontmatter",yO)}var _s="<!--",Zl="-->";function vO(t,e,n,r){const i=t.bMarks[e]+t.tShift[e];if(!t.src.startsWith(_s,i))return!1;const s=t.src.indexOf(Zl,i);if(s===-1)return!1;if(r)return!0;const o=t.src.slice(i+_s.length,s),l=o.split(`
|
|
183
|
+
`).length,a=t.push("comment","",0);return a.content=o.trim(),a.map=[e,e+l],t.line+=l,!0}function xO(t,e){if(!t.src.startsWith(_s,t.pos))return!1;const n=t.src.indexOf(Zl,t.pos);if(n===-1)return!1;if(e)return!0;const r=t.src.slice(t.pos+_s.length,n),i=t.push("comment","",0);return i.content=r.trim(),t.pos=n+Zl.length,!0}function AO(t){t.block.ruler.before("table","comment",vO,{alt:["paragraph"]}),t.inline.ruler.push("comment",xO)}var CO="The 'href' format cannot contain Markdoc tag or variable. URLs must be static strings.";function _O(t){const e=t;e.errors||(e.errors=[]),e.errors.push({id:"href-format-invalid",level:"error",message:CO})}function wO(t,e){let n;for(n of t.tokens)n.type!=="inline"||typeof n.content!="string"||iD(n.content,e.validatedProtocols)&&_O(n)}function SO(t,e){t.core.ruler.push("link_url_validation",n=>wO(n,e))}var vm=class{constructor(t={}){this.parser=new dO.default(t),this.parser.use(gO,"annotations",{}),this.parser.use(kO,"frontmatter",{}),this.parser.disable(["lheading","code"]),t.allowComments&&this.parser.use(AO,"comments",{}),t.allowLinkValidation&&this.parser.use(SO,t.linkValidationOptions??{validatedProtocols:["http","https"]})}tokenize(t){return this.parser.parse(t.toString(),{})}},EO={String,Number,Array,Object,Boolean};function Ga(t,e,n,r){var i,s;if(!t)return!0;if(ft.isFunction(e)&&((i=n.validation)!=null&&i.validateFunctions)){const o=(s=n.functions)==null?void 0:s[e.name];return o!=null&&o.returns?Array.isArray(o.returns)?o.returns.find(l=>l===t)!==void 0:o.returns===t:!0}if(ft.isAst(e))return!0;if(Array.isArray(t))return t.some(o=>Ga(o,e,n,r));if(typeof t=="string"&&(t=EO[t]),typeof t=="function"){const o=new t;if(o.validate)return o.validate(e,n,r)}return e!=null&&e.constructor===t}function Ya(t){return typeof t=="string"?t:Array.isArray(t)?t.map(Ya).join(" | "):t.name}function DO(t,e){var i,s;const n=(i=e.functions)==null?void 0:i[t.name],r=[];if(!n)return[{id:"function-undefined",level:"critical",message:`Undefined function: '${t.name}'`}];if(n.validate&&r.push(...n.validate(t,e)),n.parameters)for(const[o,l]of Object.entries(t.parameters)){const a=(s=n.parameters)==null?void 0:s[o];if(!a){r.push({id:"parameter-undefined",level:"error",message:`Invalid parameter: '${o}'`});continue}if(!(ft.isAst(l)&&!ft.isFunction(l))&&a.type){const u=Ga(a.type,l,e,o);u===!1?r.push({id:"parameter-type-invalid",level:"error",message:`Parameter '${o}' of '${t.name}' must be type of '${Ya(a.type)}'`}):Array.isArray(u)&&r.push(...u)}}for(const[o,{required:l}]of Object.entries(n.parameters??{}))l&&t.parameters[o]===void 0&&r.push({id:"parameter-missing-required",level:"error",message:`Missing required parameter: '${o}'`});return r}function OO(t,e){return t.length<=e?JSON.stringify(t):`[${t.slice(0,e).map(r=>JSON.stringify(r)).join(",")}, ... ${t.length-e} more]`}function xm(t,e){var s,o;const n=t.findSchema(e),r=[...t.errors||[]];if(!n)return r.push({id:t.tag?"tag-undefined":"node-undefined",level:"critical",message:t.tag?`Undefined tag: '${t.tag}'`:`Undefined node: '${t.type}'`}),r;n.inline!=null&&t.inline!==n.inline&&r.push({id:"tag-placement-invalid",level:"critical",message:`'${t.tag}' tag should be ${n.inline?"inline":"block"}`}),n.selfClosing&&t.children.length>0&&r.push({id:"tag-selfclosing-has-children",level:"critical",message:`'${t.tag}' tag should be self-closing`});const i={...Za,...n.attributes};for(const l of Object.keys(t.slots))((s=n.slots)==null?void 0:s[l])||r.push({id:"slot-undefined",level:"error",message:`Invalid slot: '${l}'`});for(let[l,a]of Object.entries(t.attributes)){const u=i[l];if(!u){r.push({id:"attribute-undefined",level:"error",message:`Invalid attribute: '${l}'`});continue}let{type:c,matches:f,errorLevel:d}=u;if(ft.isAst(a))if(ft.isFunction(a)&&((o=e.validation)!=null&&o.validateFunctions))r.push(...DO(a,e));else if(ft.isVariable(a)&&e.variables){let h=!1,p=e.variables;for(const m of a.path){if(!Object.prototype.hasOwnProperty.call(p,m)){h=!0;break}p=p[m]}h&&r.push({id:"variable-undefined",level:"error",message:`Undefined variable: '${a.path.join(".")}'`})}else continue;if(a=a,c){const h=Ga(c,a,e,l);h===!1&&r.push({id:"attribute-type-invalid",level:d||"error",message:`Attribute '${l}' must be type of '${Ya(c)}'`}),Array.isArray(h)&&r.push(...h)}if(typeof f=="function"&&(f=f(e)),Array.isArray(f)&&!f.includes(a)&&r.push({id:"attribute-value-invalid",level:d||"error",message:`Attribute '${l}' must match one of ${OO(f,8)}. Got '${a}' instead.`}),f instanceof RegExp&&!f.test(a)&&r.push({id:"attribute-value-invalid",level:d||"error",message:`Attribute '${l}' must match ${f}. Got '${a}' instead.`}),typeof u.validate=="function"){const h=u.validate(a,e,l);Array.isArray(h)&&r.push(...h)}}for(const[l,{required:a}]of Object.entries(i))a&&t.attributes[l]===void 0&&r.push({id:"attribute-missing-required",level:"error",message:`Missing required attribute: '${l}'`});if(n.slots)for(const[l,{required:a}]of Object.entries(n.slots))a&&t.slots[l]===void 0&&r.push({id:"slot-missing-required",level:"error",message:`Missing required slot: '${l}'`});for(const{type:l}of t.children)n.children&&l!=="error"&&!n.children.includes(l)&&r.push({id:"child-invalid",level:"warning",message:`Can't nest '${l}' in '${t.tag||t.type}'`});if(n.validate){const l=n.validate(t,e);if(Kn(l))return l.then(a=>r.concat(a));r.push(...l)}return r}function*Am(t,e=[]){yield[t,e];for(const n of[...Object.values(t.slots),...t.children])yield*Am(n,[...e,t])}function TO(t){var n,r;const e=t.location;return e!=null&&typeof((n=e.start)==null?void 0:n.line)=="number"&&typeof((r=e.end)==null?void 0:r.line)=="number"&&(e.file===void 0||typeof e.file=="string")}function If(t,e){var n;return TO(e)?{type:t.type,lines:[e.location.start.line,e.location.end.line],location:{file:(n=t.location)==null?void 0:n.file,...e.location},error:e}:{type:t.type,lines:t.lines,location:t.location,error:e}}function MO(t,e){const n=[...Am(t)].map(([r,i])=>{const s={...e,validation:{...e.validation,parents:i}},o=xm(r,s);return Kn(o)?o.then(l=>l.map(a=>If(r,a))):o.map(l=>If(r,l))});return n.some(Kn)?Promise.all(n).then(r=>r.flat()):n.flat()}var $O=new vm;function Cm(t={}){return{...t,tags:{...gm,...t.tags},nodes:{...Ja,...t.nodes},functions:{...hm,...t.functions}}}function Ff(t,e){return typeof t=="string"&&(t=$O.tokenize(t)),ED(t,e)}function _m(t,e){return Array.isArray(t)?t.flatMap(n=>n.resolve(e)):t.resolve(e)}function Rf(t,e){const n=Cm(e),r=_m(t,n);return Array.isArray(r)?r.flatMap(i=>i.transform(n)):r.transform(n)}function Pf(t,e){const n=Cm(e);return MO(t,n)}function NO(t,e={},...n){return{name:t,attributes:e,children:n}}var xe,wm=(xe=class{constructor(e){this.parse=Ff,this.resolve=n=>_m(n,this.config),this.transform=n=>Rf(n,this.config),this.validate=n=>Pf(n,this.config),this.config=e}},xe.nodes=Ja,xe.tags=gm,xe.functions=hm,xe.globalAttributes=Za,xe.renderers=lO,xe.transforms=pm,xe.Ast=ft,xe.Tag=Ht,xe.Tokenizer=vm,xe.parseTags=um,xe.transformer=Lr,xe.validator=xm,xe.parse=Ff,xe.transform=Rf,xe.validate=Pf,xe.createElement=NO,xe.truthy=xi,xe.format=As,xe);function IO(t){return t.replace(/([\\`*_[\]<])/g,"\\$1").replace(/^(\s*)([#>-])/gm,"$1\\$2").replace(/^(\s*\d+)\./gm,"$1\\.")}function FO(t,e=[]){var i;let n=t;e.some(s=>s.type==="code")&&(n=`\`${n}\``),e.some(s=>s.type==="bold")&&(n=`**${n}**`),e.some(s=>s.type==="italic")&&(n=`_${n}_`),e.some(s=>s.type==="strike")&&(n=`~~${n}~~`);const r=e.find(s=>s.type==="link");if(r){const s=String(((i=r.attrs)==null?void 0:i.href)??"");n=`[${n}](${s})`}return n}function Bf(t=[]){return t.map(e=>{var r;if(e.type==="hardBreak")return`\\
|
|
184
|
+
`;if(e.type!=="text")return"";const n=((r=e.marks)==null?void 0:r.some(i=>i.type==="code"))??!1;return FO(n?e.text??"":IO(e.text??""),e.marks)}).join("")}function zf(t,e,n){return t.split(`
|
|
185
|
+
`).map((r,i)=>(i===0?e:n)+r).join(`
|
|
186
|
+
`).replace(/[ \t]+$/gm,"")}function Qi(t=[]){return t.map(e=>PO(e)).filter(e=>e!=="").join(`
|
|
187
|
+
|
|
188
|
+
`)}function RO(t){const e=Qi(t);return e.startsWith("---")?`***${e.slice(3)}`:e}function PO(t){var e,n,r,i;switch(t.type){case"paragraph":return Bf(t.content);case"heading":{const s=Number(((e=t.attrs)==null?void 0:e.level)??2);return`${"#".repeat(Math.min(Math.max(s,1),6))} ${Bf(t.content)}`}case"blockquote":return zf(Qi(t.content),"> ","> ");case"horizontalRule":return"---";case"codeBlock":{const s=String(((n=t.attrs)==null?void 0:n.language)??""),o=((r=t.content)==null?void 0:r.map(l=>l.text??"").join(""))??"";return`\`\`\`${s}
|
|
189
|
+
${o}
|
|
190
|
+
\`\`\``}case"bulletList":case"orderedList":{const s=t.type==="orderedList",o=Number(((i=t.attrs)==null?void 0:i.start)??1);return(t.content??[]).map((l,a)=>{const u=s?`${o+a}. `:"- ";return zf(Qi(l.content),u," ".repeat(u.length))}).join(`
|
|
191
|
+
`)}default:return t.content?Qi(t.content):""}}function Lf(t){var n;if(!((n=t==null?void 0:t.content)!=null&&n.length))return"";const e=RO(t.content).trim();return e===""?"":`${e}
|
|
192
|
+
`}function jf(t,e){return(t??"").trim()===(e??"").trim()}const BO={strong:"bold",em:"italic",s:"strike"};function mr(t,e){const n=[];for(const r of t){if(r.type==="text"){const s=String(r.attributes.content??"");s!==""&&n.push({type:"text",text:s,...e.length?{marks:e}:{}});continue}if(r.type==="softbreak"){n.push({type:"text",text:" ",...e.length?{marks:e}:{}});continue}if(r.type==="hardbreak"){n.push({type:"hardBreak"});continue}if(r.type==="code"){const s=String(r.attributes.content??"");s!==""&&n.push({type:"text",text:s,marks:[...e,{type:"code"}]});continue}if(r.type==="link"){n.push(...mr(r.children,[...e,{type:"link",attrs:{href:String(r.attributes.href??"")}}]));continue}const i=BO[r.type];if(i){n.push(...mr(r.children,[...e,{type:i}]));continue}n.push(...mr(r.children,e))}return n}function jr(t){const e=[];for(const n of t)switch(n.type){case"inline":e.push({type:"paragraph",content:mr(n.children,[])});break;case"paragraph":{const r=mr(n.children.flatMap(i=>i.type==="inline"?i.children:[i]),[]);e.push({type:"paragraph",...r.length?{content:r}:{}});break}case"heading":{const r=mr(n.children.flatMap(i=>i.type==="inline"?i.children:[i]),[]);e.push({type:"heading",attrs:{level:Number(n.attributes.level??2)},...r.length?{content:r}:{}});break}case"blockquote":e.push({type:"blockquote",content:jr(n.children)});break;case"hr":e.push({type:"horizontalRule"});break;case"fence":e.push({type:"codeBlock",attrs:{language:String(n.attributes.language??"")||null},content:[{type:"text",text:String(n.attributes.content??"").trimEnd()}]});break;case"list":{const r=n.attributes.ordered===!0,i=Number(n.attributes.start??1);e.push({type:r?"orderedList":"bulletList",...r&&i!==1?{attrs:{start:i}}:{},content:n.children.filter(s=>s.type==="item").map(s=>({type:"listItem",content:jr(s.children)}))});break}case"item":e.push({type:"listItem",content:jr(n.children)});break;default:e.push(...jr(n.children))}return e}const zO=new Set(["document","paragraph","inline","text","softbreak","hardbreak","strong","em","s","code","link","heading","blockquote","hr","fence","list","item"]),LO=new Set(["table","thead","tbody","tr","th","td"]),jO={image:"an image",html:"HTML",comment:"a comment"};function qO(t){if(!(t!=null&&t.trim()))return[];const e=new Set,n=r=>{r.type==="document"&&r.attributes.frontmatter&&e.add("front matter"),r.type==="text"&&typeof r.attributes.content!="string"&&e.add("a variable such as {% $name %}"),r.type==="tag"?e.add(`a {% ${r.tag??""} %} tag`):LO.has(r.type)?e.add("a table"):zO.has(r.type)?r.type==="link"&&r.attributes.title&&e.add("a link title"):e.add(jO[r.type]??`a "${r.type}" node`),r.annotations.length>0&&e.add("an attribute such as {% .class %}"),r.errors.length>0&&e.add("Markdoc that does not parse");for(const i of r.children)n(i)};return n(wm.parse(t)),[...e]}function Go(t){if(!(t!=null&&t.trim()))return{type:"doc",content:[{type:"paragraph"}]};const e=jr(wm.parse(t).children);return{type:"doc",content:e.length?e:[{type:"paragraph"}]}}const VO="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",UO="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Wl="numeric",Jl="ascii",Kl="alpha",Kr="asciinumeric",qr="alphanumeric",Gl="domain",Sm="emoji",HO="scheme",ZO="slashscheme",Yo="whitespace";function WO(t,e){return t in e||(e[t]=[]),e[t]}function qn(t,e,n){e[Wl]&&(e[Kr]=!0,e[qr]=!0),e[Jl]&&(e[Kr]=!0,e[Kl]=!0),e[Kr]&&(e[qr]=!0),e[Kl]&&(e[qr]=!0),e[qr]&&(e[Gl]=!0),e[Sm]&&(e[Gl]=!0);for(const r in e){const i=WO(r,n);i.indexOf(t)<0&&i.push(t)}}function JO(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ut(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ut.groups={};ut.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||ut.groups;let i;return e&&e.j?i=e:(i=new ut(e),n&&r&&qn(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||ut.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,l=i.go(t);if(l?(o=new ut,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new ut,s){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(JO(o.t,r),n);qn(s,a,r)}else n&&qn(s,n,r);o.t=s}return i.j[t]=o,o}};const oe=(t,e,n,r,i)=>t.ta(e,n,r,i),we=(t,e,n,r,i)=>t.tr(e,n,r,i),qf=(t,e,n,r,i)=>t.ts(e,n,r,i),j=(t,e,n,r,i)=>t.tt(e,n,r,i),Yt="WORD",Yl="UWORD",Em="ASCIINUMERICAL",Dm="ALPHANUMERICAL",mi="LOCALHOST",Xl="TLD",Ql="UTLD",es="SCHEME",fr="SLASH_SCHEME",Xa="NUM",ea="WS",Qa="NL",Gr="OPENBRACE",Yr="CLOSEBRACE",ws="OPENBRACKET",Ss="CLOSEBRACKET",Es="OPENPAREN",Ds="CLOSEPAREN",Os="OPENANGLEBRACKET",Ts="CLOSEANGLEBRACKET",Ms="FULLWIDTHLEFTPAREN",$s="FULLWIDTHRIGHTPAREN",Ns="LEFTCORNERBRACKET",Is="RIGHTCORNERBRACKET",Fs="LEFTWHITECORNERBRACKET",Rs="RIGHTWHITECORNERBRACKET",Ps="FULLWIDTHLESSTHAN",Bs="FULLWIDTHGREATERTHAN",zs="AMPERSAND",Ls="APOSTROPHE",js="ASTERISK",hn="AT",qs="BACKSLASH",Vs="BACKTICK",Us="CARET",Vn="COLON",eu="COMMA",Hs="DOLLAR",Pt="DOT",Zs="EQUALS",tu="EXCLAMATION",Ct="HYPHEN",Xr="PERCENT",Ws="PIPE",Js="PLUS",Ks="POUND",Qr="QUERY",nu="QUOTE",Om="FULLWIDTHMIDDLEDOT",ru="SEMI",Bt="SLASH",ei="TILDE",Gs="UNDERSCORE",Tm="EMOJI",Ys="SYM";var Mm=Object.freeze({__proto__:null,ALPHANUMERICAL:Dm,AMPERSAND:zs,APOSTROPHE:Ls,ASCIINUMERICAL:Em,ASTERISK:js,AT:hn,BACKSLASH:qs,BACKTICK:Vs,CARET:Us,CLOSEANGLEBRACKET:Ts,CLOSEBRACE:Yr,CLOSEBRACKET:Ss,CLOSEPAREN:Ds,COLON:Vn,COMMA:eu,DOLLAR:Hs,DOT:Pt,EMOJI:Tm,EQUALS:Zs,EXCLAMATION:tu,FULLWIDTHGREATERTHAN:Bs,FULLWIDTHLEFTPAREN:Ms,FULLWIDTHLESSTHAN:Ps,FULLWIDTHMIDDLEDOT:Om,FULLWIDTHRIGHTPAREN:$s,HYPHEN:Ct,LEFTCORNERBRACKET:Ns,LEFTWHITECORNERBRACKET:Fs,LOCALHOST:mi,NL:Qa,NUM:Xa,OPENANGLEBRACKET:Os,OPENBRACE:Gr,OPENBRACKET:ws,OPENPAREN:Es,PERCENT:Xr,PIPE:Ws,PLUS:Js,POUND:Ks,QUERY:Qr,QUOTE:nu,RIGHTCORNERBRACKET:Is,RIGHTWHITECORNERBRACKET:Rs,SCHEME:es,SEMI:ru,SLASH:Bt,SLASH_SCHEME:fr,SYM:Ys,TILDE:ei,TLD:Xl,UNDERSCORE:Gs,UTLD:Ql,UWORD:Yl,WORD:Yt,WS:ea});const Kt=/[a-z]/,Nr=new RegExp("\\p{L}","u"),Xo=new RegExp("\\p{Emoji}","u"),Gt=/\d/,Qo=/\s/,Vf="\r",el=`
|
|
193
|
+
`,KO="️",GO="",tl="";let qi=null,Vi=null;function YO(t=[]){const e={};ut.groups=e;const n=new ut;qi==null&&(qi=Uf(VO)),Vi==null&&(Vi=Uf(UO)),j(n,"'",Ls),j(n,"{",Gr),j(n,"}",Yr),j(n,"[",ws),j(n,"]",Ss),j(n,"(",Es),j(n,")",Ds),j(n,"<",Os),j(n,">",Ts),j(n,"(",Ms),j(n,")",$s),j(n,"「",Ns),j(n,"」",Is),j(n,"『",Fs),j(n,"』",Rs),j(n,"<",Ps),j(n,">",Bs),j(n,"&",zs),j(n,"*",js),j(n,"@",hn),j(n,"`",Vs),j(n,"^",Us),j(n,":",Vn),j(n,",",eu),j(n,"$",Hs),j(n,".",Pt),j(n,"=",Zs),j(n,"!",tu),j(n,"-",Ct),j(n,"%",Xr),j(n,"|",Ws),j(n,"+",Js),j(n,"#",Ks),j(n,"?",Qr),j(n,'"',nu),j(n,"/",Bt),j(n,";",ru),j(n,"~",ei),j(n,"_",Gs),j(n,"\\",qs),j(n,"・",Om);const r=we(n,Gt,Xa,{[Wl]:!0});we(r,Gt,r);const i=we(r,Kt,Em,{[Kr]:!0}),s=we(r,Nr,Dm,{[qr]:!0}),o=we(n,Kt,Yt,{[Jl]:!0});we(o,Gt,i),we(o,Kt,o),we(i,Gt,i),we(i,Kt,i);const l=we(n,Nr,Yl,{[Kl]:!0});we(l,Kt),we(l,Gt,s),we(l,Nr,l),we(s,Gt,s),we(s,Kt),we(s,Nr,s);const a=j(n,el,Qa,{[Yo]:!0}),u=j(n,Vf,ea,{[Yo]:!0}),c=we(n,Qo,ea,{[Yo]:!0});j(n,tl,c),j(u,el,a),j(u,tl,c),we(u,Qo,c),j(c,Vf),j(c,el),we(c,Qo,c),j(c,tl,c);const f=we(n,Xo,Tm,{[Sm]:!0});j(f,"#"),we(f,Xo,f),j(f,KO,f);const d=j(f,GO);j(d,"#"),we(d,Xo,f);const h=[[Kt,o],[Gt,i]],p=[[Kt,null],[Nr,l],[Gt,s]];for(let m=0;m<qi.length;m++)un(n,qi[m],Xl,Yt,h);for(let m=0;m<Vi.length;m++)un(n,Vi[m],Ql,Yl,p);qn(Xl,{tld:!0,ascii:!0},e),qn(Ql,{utld:!0,alpha:!0},e),un(n,"file",es,Yt,h),un(n,"mailto",es,Yt,h),un(n,"http",fr,Yt,h),un(n,"https",fr,Yt,h),un(n,"ftp",fr,Yt,h),un(n,"ftps",fr,Yt,h),qn(es,{scheme:!0,ascii:!0},e),qn(fr,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],_=t[m][1]?{[HO]:!0}:{[ZO]:!0};g.indexOf("-")>=0?_[Gl]=!0:Kt.test(g)?Gt.test(g)?_[Kr]=!0:_[Jl]=!0:_[Wl]=!0,qf(n,g,g,_)}return qf(n,"localhost",mi,{ascii:!0}),n.jd=new ut(Ys),{start:n,tokens:Object.assign({groups:e},Mm)}}function $m(t,e){const n=XO(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let l=t,a=null,u=0,c=null,f=-1,d=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(f=0,d=0,c=l):f>=0&&(f+=n[o].length,d++),u+=n[o].length,s+=n[o].length,o++;s-=f,o-=d,u-=f,i.push({t:c.t,v:e.slice(s-u,s),s:s-u,e:s})}return i}function XO(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function un(t,e,n,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?s=t.j[a]:(s=new ut(r),s.jr=i.slice(),t.j[a]=s),t=s}return s=new ut(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function Uf(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const gi={defaultProtocol:"http",events:null,format:Hf,formatHref:Hf,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function iu(t,e=null){let n=Object.assign({},gi);t&&(n=Object.assign(n,t instanceof iu?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}iu.prototype={o:gi,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:gi[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Hf(t){return t}function Nm(t,e){this.t="token",this.v=t,this.tk=e}Nm.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=gi.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},l=t.get("className",n,e),a=t.get("target",n,e),u=t.get("rel",n,e),c=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),u&&(o.rel=u),c&&Object.assign(o,c),{tagName:i,attributes:o,content:s,eventListeners:f}}};function xo(t,e){class n extends Nm{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const QO=xo("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Zf=xo("text"),eT=xo("nl"),Ui=xo("url",{isLink:!0,toHref(t=gi.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==mi&&t[1].t===Vn}}),xt=t=>new ut(t);function tT({groups:t}){const e=t.domain.concat([zs,js,hn,qs,Vs,Us,Hs,Zs,Ct,Xa,Xr,Ws,Js,Ks,Bt,Ys,ei,Gs]),n=[Ls,Vn,eu,Pt,tu,Xr,Qr,nu,ru,Os,Ts,Gr,Yr,Ss,ws,Es,Ds,Ms,$s,Ns,Is,Fs,Rs,Ps,Bs],r=[zs,Ls,js,qs,Vs,Us,Hs,Zs,Ct,Gr,Yr,Xr,Ws,Js,Ks,Qr,Bt,Ys,ei,Gs],i=xt(),s=j(i,ei);oe(s,r,s),oe(s,t.domain,s);const o=xt(),l=xt(),a=xt();oe(i,t.domain,o),oe(i,t.scheme,l),oe(i,t.slashscheme,a),oe(o,r,s),oe(o,t.domain,o);const u=j(o,hn);j(s,hn,u),j(l,hn,u),j(a,hn,u);const c=j(s,Pt);oe(c,r,s),oe(c,t.domain,s);const f=xt();oe(u,t.domain,f),oe(f,t.domain,f);const d=j(f,Pt);oe(d,t.domain,f);const h=xt(QO);oe(d,t.tld,h),oe(d,t.utld,h),j(u,mi,h);const p=j(f,Ct);j(p,Ct,p),oe(p,t.domain,f),oe(h,t.domain,f),j(h,Pt,d),j(h,Ct,p);const m=j(o,Ct),g=j(o,Pt);j(m,Ct,m),oe(m,t.domain,o),oe(g,r,s),oe(g,t.domain,o);const b=xt(Ui);oe(g,t.tld,b),oe(g,t.utld,b),oe(b,t.domain,o),oe(b,r,s),j(b,Pt,g),j(b,Ct,m),j(b,hn,u);const _=j(b,Vn),k=xt(Ui);oe(_,t.numeric,k);const C=xt(Ui),v=xt();oe(C,e,C),oe(C,n,v),oe(v,e,C),oe(v,n,v),j(b,Bt,C),j(k,Bt,C);const x=j(l,Vn),A=j(a,Vn),w=j(A,Bt),T=j(w,Bt);oe(l,t.domain,o),j(l,Pt,g),j(l,Ct,m),oe(a,t.domain,o),j(a,Pt,g),j(a,Ct,m),oe(x,t.domain,C),j(x,Bt,C),j(x,Qr,C),oe(T,t.domain,C),oe(T,e,C),j(T,Bt,C);const O=[[Gr,Yr],[ws,Ss],[Es,Ds],[Os,Ts],[Ms,$s],[Ns,Is],[Fs,Rs],[Ps,Bs]];for(let M=0;M<O.length;M++){const[N,U]=O[M],R=j(C,N);j(v,N,R);const P=xt(Ui);oe(R,e,P);const H=xt();oe(R,n,H),j(R,U,C),oe(P,e,P),oe(P,n,H),oe(H,e,P),oe(H,n,H),j(P,U,C),j(H,U,C)}return j(i,mi,b),j(i,Qa,eT),{start:i,tokens:Mm}}function nT(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let l=t,a=null,u=null,c=0,f=null,d=-1;for(;i<r&&!(a=l.go(n[i].t));)o.push(n[i++]);for(;i<r&&(u=a||l.go(n[i].t));)a=null,l=u,l.accepts()?(d=0,f=l):d>=0&&d++,i++,c++;if(d<0)i-=c,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(nl(Zf,e,o)),o=[]),i-=d,c-=d;const h=f.t,p=n.slice(i-c,i);s.push(nl(h,e,p))}}return o.length>0&&s.push(nl(Zf,e,o)),s}function nl(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const rT=typeof console<"u"&&console&&console.warn||(()=>{}),iT="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ye={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function sT(){return ut.groups={},ye.scanner=null,ye.parser=null,ye.tokenQueue=[],ye.pluginQueue=[],ye.customSchemes=[],ye.initialized=!1,ye}function Wf(t,e=!1){if(ye.initialized&&rT(`linkifyjs: already initialized - will not register custom scheme "${t}" ${iT}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
194
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
195
|
+
2. Cannot start or end with "-"
|
|
196
|
+
3. "-" cannot repeat`);ye.customSchemes.push([t,e])}function oT(){ye.scanner=YO(ye.customSchemes);for(let t=0;t<ye.tokenQueue.length;t++)ye.tokenQueue[t][1]({scanner:ye.scanner});ye.parser=tT(ye.scanner.tokens);for(let t=0;t<ye.pluginQueue.length;t++)ye.pluginQueue[t][1]({scanner:ye.scanner,parser:ye.parser});return ye.initialized=!0,ye}function su(t){return ye.initialized||oT(),nT(ye.parser.start,t,$m(ye.scanner.start,t))}su.scan=$m;function Im(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new iu(n),i=su(t),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}const ou="[\0- -\u2029 ]",lT=new RegExp(ou),aT=new RegExp(`${ou}$`),uT=new RegExp(ou,"g");function cT(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function fT(t){return new Ye({key:new vt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=eS(n.doc,[...e]);if(uS(l).forEach(({newRange:u})=>{const c=nS(r.doc,u,h=>h.isTextblock);let f,d;if(c.length>1)f=c[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(c.length){const h=r.doc.textBetween(u.from,u.to," "," ");if(!aT.test(h))return;f=c[0],d=r.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&d){const h=d.split(lT).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;const g=su(p).map(b=>b.toObject(t.defaultProtocol));if(!cT(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{za(b.from,b.to,r.doc).some(_=>_.mark.type===t.type)||o.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function dT(t){return new Ye({key:new vt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=r.target;const l=[];for(;o.nodeName!=="DIV";)l.push(o),o=o.parentNode;if(!l.find(d=>d.nodeName==="A"))return!1;const a=Yp(e.state,t.type.name),u=r.target,c=(i=u==null?void 0:u.href)!==null&&i!==void 0?i:a.href,f=(s=u==null?void 0:u.target)!==null&&s!==void 0?s:a.target;return u&&c?(window.open(c,f),!0):!1}}})}function hT(t){return new Ye({key:new vt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const a=Im(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!a?!1:t.editor.commands.setMark(t.type,{href:a.href})}}})}function Fn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(uT,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const pT=ln.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Wf(t);return}Wf(t.scheme,t.optionalSlashes)})},onDestroy(){sT()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Fn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Fn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Fn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ge(this.options.HTMLAttributes,t),0]:["a",Ge(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Fn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Fn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[nr({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=Im(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Fn(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(fT({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Fn(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(dT({type:this.type})),this.options.linkOnPaste&&t.push(hT({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),mT=/^\s*>\s$/,gT=It.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[hi({find:mT,type:this.type})]}}),bT=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,yT=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,kT=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,vT=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,xT=ln.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Cr({find:bT,type:this.type}),Cr({find:kT,type:this.type})]},addPasteRules(){return[nr({find:yT,type:this.type}),nr({find:vT,type:this.type})]}}),AT="listItem",Jf="textStyle",Kf=/^\s*([-+*])\s$/,CT=It.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AT,this.editor.getAttributes(Jf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=hi({find:Kf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=hi({find:Kf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jf),editor:this.editor})),[t]}}),_T=/(^|[^`])`([^`]+)`(?!`)/,wT=/(^|[^`])`([^`]+)`(?!`)/g,ST=ln.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Cr({find:_T,type:this.type})]},addPasteRules(){return[nr({find:wT,type:this.type})]}}),ET=/^```([a-z]+)?[\s\n]$/,DT=/^~~~([a-z]+)?[\s\n]$/,OT=It.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ge(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
197
|
+
|
|
198
|
+
`);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:u})=>(u.setSelection(ie.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ll({find:ET,type:this.type,getAttributes:t=>({language:t[1]})}),Ll({find:DT,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ye({key:new vt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
|
|
199
|
+
`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(ne.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),TT=It.create({name:"doc",topNode:!0,content:"block+"});function MT(t={}){return new Ye({view(e){return new $T(e,t)}})}class $T{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(n){let f=e.nodeBefore,d=e.nodeAfter;if(f||d){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=f?p.bottom:p.top;f&&d&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),d=this.width/2*o;r={left:f.left-d,right:f.left+d,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,c=-pageYOffset;else{let f=a.getBoundingClientRect(),d=f.width/a.offsetWidth,h=f.height/a.offsetHeight;u=f.left-a.scrollLeft*d,c=f.top-a.scrollTop*h}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-c)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(!n||s)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Rh(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const NT=st.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[MT(this.options)]}});class Se extends ie{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Se.valid(r)?new Se(r):ie.near(r)}content(){return Z.empty}eq(e){return e instanceof Se&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Se(e.resolve(n.pos))}getBookmark(){return new lu(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!IT(e)||!FT(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Se.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let a=e.doc.resolve(i);if(Se.valid(a))return a}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!X.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let l=e.doc.resolve(i);if(Se.valid(l))return l}return null}}}Se.prototype.visible=!1;Se.findFrom=Se.findGapCursorFrom;ie.jsonID("gapcursor",Se);class lu{constructor(e){this.pos=e}map(e){return new lu(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Se.valid(n)?new Se(n):ie.near(n)}}function Fm(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function IT(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Fm(i.type))return!0;if(i.inlineContent)return!1}}return!0}function FT(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Fm(i.type))return!0;if(i.inlineContent)return!1}}return!0}function RT(){return new Ye({props:{decorations:LT,createSelectionBetween(t,e,n){return e.pos==n.pos&&Se.valid(n)?new Se(n):null},handleClick:BT,handleKeyDown:PT,handleDOMEvents:{beforeinput:zT}}})}const PT=Ep({ArrowLeft:Hi("horiz",-1),ArrowRight:Hi("horiz",1),ArrowUp:Hi("vert",-1),ArrowDown:Hi("vert",1)});function Hi(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof ne){if(!s.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=Se.findGapCursorFrom(l,e,a);return u?(i&&i(r.tr.setSelection(new Se(u))),!0):!1}}function BT(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Se.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&X.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Se(r))),!0)}function zT(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Se))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=B.empty;for(let o=r.length-1;o>=0;o--)i=B.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new Z(i,0,0));return s.setSelection(ne.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function LT(t){if(!(t.selection instanceof Se))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Fe.create(t.doc,[St.widget(t.selection.head,e,{key:"gapcursor"})])}const jT=st.create({name:"gapCursor",addProseMirrorPlugins(){return[RT()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=le(K(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),qT=It.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ge(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
200
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&a&&o){const f=a.filter(d=>l.includes(d.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),VT=It.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ge(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ll({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Xs=200,Le=function(){};Le.prototype.append=function(e){return e.length?(e=Le.from(e),!this.length&&e||e.length<Xs&&this.leafAppend(e)||this.length<Xs&&e.leafPrepend(this)||this.appendInner(e)):this};Le.prototype.prepend=function(e){return e.length?Le.from(e).append(this):this};Le.prototype.appendInner=function(e){return new UT(this,e)};Le.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Le.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Le.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Le.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Le.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Le.from=function(e){return e instanceof Le?e:e&&e.length?new Rm(e):Le.empty};var Rm=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Xs)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Xs)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Le);Le.empty=new Rm([]);var UT=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Le);const HT=500;class Mt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,u=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),s=i.maps.length),s--,c.push(f);return}if(i){c.push(new zt(f.map));let h=f.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],u.push(new zt(p,void 0,void 0,u.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(s)):f.selection,a=new Mt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let c=0;c<e.steps.length;c++){let f=e.steps[c].invert(e.docs[c]),d=new zt(e.mapping.maps[c],f,n),h;(h=a&&a.merge(d))&&(d=h,c?s.pop():l=l.slice(0,l.length-1)),s.push(d),n&&(o++,n=void 0),i||(a=d)}let u=o-r.depth;return u>WT&&(l=ZT(l,u),o-=u),new Mt(l.append(s),o)}remapping(e,n){let r=new oi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Mt(this.items.append(e.map(n=>new zt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],i=this.items.length-n,s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(d=>{d.selection&&l--},i);let a=n;this.items.forEach(d=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(d.step){let m=e.steps[h].invert(e.docs[h]),g=d.selection&&d.selection.map(s.slice(a+1,h));g&&l++,r.push(new zt(p,m,g))}else r.push(new zt(p))},i);let u=[];for(let d=n;d<o;d++)u.push(new zt(s.maps[d]));let c=this.items.slice(0,i).append(u).append(r),f=new Mt(c,l);return f.emptyItemCount()>HT&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let f=new zt(u.invert(),a,c),d,h=i.length-1;(d=i.length&&i[h].merge(f))?i[h]=d:i.push(f)}}else o.map&&r--},this.items.length,0),new Mt(Le.from(i.reverse()),s)}}Mt.empty=new Mt(Le.empty,0);function ZT(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class zt{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new zt(n.getMap().invert(),n,this.selection)}}}class pn{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const WT=20;function JT(t,e,n,r){let i=n.getMeta(Gn),s;if(i)return i.historyState;n.getMeta(YT)&&(t=new pn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Gn))return o.getMeta(Gn).redo?new pn(t.done.addTransform(n,void 0,r,ts(e)),t.undone,Gf(n.mapping.maps),t.prevTime,t.prevComposition):new pn(t.done,t.undone.addTransform(n,void 0,r,ts(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!KT(n,t.prevRanges)),u=o?rl(t.prevRanges,n.mapping):Gf(n.mapping.maps);return new pn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,ts(e)),Mt.empty,u,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new pn(t.done.rebased(n,s),t.undone.rebased(n,s),rl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new pn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),rl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function KT(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Gf(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function rl(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function GT(t,e,n){let r=ts(e),i=Gn.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new pn(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Gn,{redo:n,historyState:a})}let il=!1,Yf=null;function ts(t){let e=t.plugins;if(Yf!=e){il=!1,Yf=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){il=!0;break}}return il}const Gn=new vt("history"),YT=new vt("closeHistory");function XT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ye({key:Gn,state:{init(){return new pn(Mt.empty,Mt.empty,null,0,-1)},apply(e,n,r){return JT(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Bm:r=="historyRedo"?zm:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Pm(t,e){return(n,r)=>{let i=Gn.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=GT(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Bm=Pm(!1,!0),zm=Pm(!0,!0),QT=st.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Bm(t,e),redo:()=>({state:t,dispatch:e})=>zm(t,e)}},addProseMirrorPlugins(){return[XT(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),eM=It.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ge(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!US(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):fS(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:u}=o.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(ne.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(X.create(o.doc,u.pos)):o.setSelection(ne.create(o.doc,u.pos));else{const f=(a=u.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();f&&(o.insert(c,f),o.setSelection(ne.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[VS({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),tM=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,nM=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,rM=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,iM=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sM=ln.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Cr({find:tM,type:this.type}),Cr({find:rM,type:this.type})]},addPasteRules(){return[nr({find:nM,type:this.type}),nr({find:iM,type:this.type})]}}),oM=It.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ge(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),lM="listItem",Xf="textStyle",Qf=/^(\d+)\.\s$/,aM=It.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ge(this.options.HTMLAttributes,n),0]:["ol",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(lM,this.editor.getAttributes(Xf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=hi({find:Qf,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=hi({find:Qf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Xf)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),uM=It.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,dM=ln.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Cr({find:cM,type:this.type})]},addPasteRules(){return[nr({find:fM,type:this.type})]}}),hM=It.create({name:"text",group:"inline"}),pM=st.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(xT.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(gT.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(CT.configure(this.options.bulletList)),this.options.code!==!1&&t.push(ST.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(OT.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(TT.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(NT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(jT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(qT.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(VT.configure(this.options.heading)),this.options.history!==!1&&t.push(QT.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(eM.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(sM.configure(this.options.italic)),this.options.listItem!==!1&&t.push(oM.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(aM.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(uM.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(dM.configure(this.options.strike)),this.options.text!==!1&&t.push(hM.configure(this.options.text)),t}});function Lm(t=[]){return[pM.configure({heading:{levels:[1,2,3,4,5,6]}}),pT.configure({openOnClick:!1,autolink:t.includes("link"),protocols:["http","https","mailto","tel"],HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}})]}function ed(t){return["code","codeBlock",...t]}const mM=iS(Lm()),gM={key:0,class:"rounded-sm border border-line bg-canvas/60"},bM={class:"border-b border-line px-3 py-2 text-sm",role:"status"},yM=["id","aria-label","aria-describedby"],kM=["aria-label"],vM=["title","aria-label","aria-pressed","disabled","onClick"],xM=De({__name:"RichTextField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=["bold","italic","heading","bulletList","orderedList","link"],d=te(()=>i.value.toolbar??f),h=x=>d.value.includes(x),p=te(()=>typeof n.modelValue=="string"?n.modelValue:""),m=te(()=>qO(p.value)),g=te(()=>{if(m.value.length>0)return null;try{return mM.nodeFromJSON(Go(p.value)),null}catch(x){return`The editor could not load this text (${x.message}).`}}),b=te(()=>m.value.length>0?`This text contains ${_(m.value)}, which the editor cannot show.`:g.value);function _(x){return x.length<2?x[0]??"":`${x.slice(0,-1).join(", ")} and ${x.at(-1)}`}const k=WS({content:b.value?"":Go(p.value),editable:!(n.disabled||i.value.readonly||b.value),injectCSS:!1,extensions:Lm(d.value),enableInputRules:ed(d.value),enablePasteRules:ed(d.value),editorProps:{attributes:{id:s,role:"textbox","aria-multiline":"true","aria-label":o.value}},onUpdate({editor:x}){if(b.value)return;const A=x.isEmpty?null:Lf(x.getJSON()),w=typeof n.modelValue=="string"?n.modelValue:null;jf(A,w)||r("update:modelValue",A)}});yn(()=>n.modelValue,x=>{const A=k.value;if(!A||A.isFocused||b.value)return;const w=typeof x=="string"?x:"",T=A.isEmpty?"":Lf(A.getJSON());jf(w,T)||A.commands.setContent(Go(w),!1)}),yn(()=>n.disabled,x=>{var A;return(A=k.value)==null?void 0:A.setEditable(!(x||i.value.readonly||b.value))}),yn(b,x=>{var A;return(A=k.value)==null?void 0:A.setEditable(!(n.disabled||i.value.readonly||x))}),Qs(()=>{var x;return(x=k.value)==null?void 0:x.destroy()});function C(){const x=k.value;if(!x)return;const A=x.getAttributes("link").href,w=window.prompt("Link address",A??"https://");if(w!==null){if(w===""){x.chain().focus().extendMarkRange("link").unsetLink().run();return}if(!/^(https?:|mailto:|tel:|\/)/i.test(w)){window.alert("Links must start with http://, https://, mailto:, tel: or /");return}x.chain().focus().extendMarkRange("link").setLink({href:w}).run()}}const v=te(()=>{const x=k.value;return x?[{feature:"bold",label:"Bold",glyph:"B",isActive:()=>x.isActive("bold"),run:()=>x.chain().focus().toggleBold().run()},{feature:"italic",label:"Italic",glyph:"I",isActive:()=>x.isActive("italic"),run:()=>x.chain().focus().toggleItalic().run()},{feature:"strike",label:"Strikethrough",glyph:"S",isActive:()=>x.isActive("strike"),run:()=>x.chain().focus().toggleStrike().run()},{feature:"heading",label:"Heading",glyph:"H2",isActive:()=>x.isActive("heading",{level:2}),run:()=>x.chain().focus().toggleHeading({level:2}).run()},{feature:"heading",label:"Subheading",glyph:"H3",isActive:()=>x.isActive("heading",{level:3}),run:()=>x.chain().focus().toggleHeading({level:3}).run()},{feature:"bulletList",label:"Bulleted list",glyph:"•",isActive:()=>x.isActive("bulletList"),run:()=>x.chain().focus().toggleBulletList().run()},{feature:"orderedList",label:"Numbered list",glyph:"1.",isActive:()=>x.isActive("orderedList"),run:()=>x.chain().focus().toggleOrderedList().run()},{feature:"blockquote",label:"Quote",glyph:"❝",isActive:()=>x.isActive("blockquote"),run:()=>x.chain().focus().toggleBlockquote().run()},{feature:"link",label:"Link",glyph:"🔗",isActive:()=>x.isActive("link"),run:C},{feature:"horizontalRule",label:"Divider",glyph:"—",isActive:()=>!1,run:()=>x.chain().focus().setHorizontalRule().run()}].filter(w=>h(w.feature)):[]});return(x,A)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[b.value?(z(),V("div",gM,[q("p",bM,[Sn(G(b.value)+" To keep it, it is read-only here. A developer can change it in the ",1),A[0]||(A[0]=q("code",null,".mdoc",-1)),A[1]||(A[1]=Sn(" file. ",-1))]),q("pre",{id:I(s),class:"max-h-96 overflow-auto px-3 py-2 text-xs whitespace-pre-wrap","aria-label":I(o),"aria-describedby":I(a)},G(p.value),9,yM)])):(z(),V("div",{key:1,class:Ee(["rich-text overflow-hidden rounded-sm border bg-surface focus-within:ring-2 focus-within:ring-ink/10",I(l)?"border-danger":"border-line focus-within:border-ink"])},[q("div",{class:"flex flex-wrap items-center gap-0.5 border-b border-line bg-canvas/60 px-1.5 py-1",role:"toolbar","aria-label":`${I(o)} formatting`},[(z(!0),V(We,null,mt(v.value,w=>(z(),V("button",{key:w.label,type:"button",title:w.label,"aria-label":w.label,"aria-pressed":w.isActive(),disabled:t.disabled||i.value.readonly,class:Ee(["h-7 min-w-7 rounded px-1.5 text-xs font-semibold transition",w.isActive()?"bg-ink text-surface":"text-muted hover:bg-raised hover:text-ink"]),onClick:T=>w.run()},G(w.glyph),11,vM))),128))],8,kM),wt(I(ZS),{editor:I(k),"aria-describedby":I(a)},null,8,["editor","aria-describedby"])],2))]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),AM=["aria-describedby"],CM={class:"sr-only"},_M=["checked","disabled","onChange"],wM=["id","value","required","disabled","aria-invalid","aria-describedby"],SM={value:""},EM=["value"],DM=De({__name:"SelectField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>Array.isArray(n.modelValue)?n.modelValue:typeof n.modelValue=="string"?[n.modelValue]:[]);function d(h){const p=f.value.includes(h)?f.value.filter(m=>m!==h):[...f.value,h];r("update:modelValue",p)}return(h,p)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[i.value.multiple?(z(),V("fieldset",{key:0,class:"space-y-1.5","aria-describedby":I(a)},[q("legend",CM,G(I(o)),1),(z(!0),V(We,null,mt(i.value.options,m=>(z(),V("label",{key:m.value,class:"flex cursor-pointer items-center gap-2.5 rounded-sm border border-line bg-raised px-3 py-2 text-sm hover:bg-canvas"},[q("input",{type:"checkbox",checked:f.value.includes(m.value),disabled:t.disabled||i.value.readonly,class:"h-4 w-4 rounded-sm border-line text-accent focus:ring-ink/20",onChange:g=>d(m.value)},null,40,_M),Sn(" "+G(m.label),1)]))),128))],8,AM)):(z(),V("select",{key:1,id:I(s),value:f.value[0]??"",required:i.value.required,disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input",I(l)&&"input-invalid"]),onChange:p[0]||(p[0]=m=>r("update:modelValue",m.target.value||null))},[q("option",SM,G(i.value.required?"Choose…":"Not set"),1),(z(!0),V(We,null,mt(i.value.options,m=>(z(),V("option",{key:m.value,value:m.value},G(m.label),9,EM))),128))],42,wM))]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),OM={class:"flex items-stretch"},TM=["id","value","maxlength","disabled","aria-invalid","aria-describedby"],MM=["disabled"],$M={key:0,class:"field-hint"},NM=De({__name:"SlugField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{},source:{},sourceLabel:{},collection:{},exceptSlug:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>typeof n.modelValue=="string"?n.modelValue:""),d=Me(f.value!=="");let h;yn(()=>n.source,g=>{if(!(d.value||!i.value.from||!n.collection)){if(!(g!=null&&g.trim())){r("update:modelValue",null);return}clearTimeout(h),h=setTimeout(async()=>{try{const{slug:b}=await kn.entries.suggestSlug(n.collection,g,n.exceptSlug);d.value||r("update:modelValue",b||null)}catch{}},300)}});function p(g){d.value=!0;const b=g.target.value;r("update:modelValue",b===""?null:b)}function m(){var g;d.value=!1,r("update:modelValue",null),(g=n.source)!=null&&g.trim()&&n.collection&&kn.entries.suggestSlug(n.collection,n.source,n.exceptSlug).then(({slug:b})=>r("update:modelValue",b||null))}return(g,b)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[q("div",OM,[b[0]||(b[0]=q("span",{class:"inline-flex select-none items-center rounded-l-sm border border-r-0 border-line bg-canvas px-3 font-mono text-sm text-muted","aria-hidden":"true"}," / ",-1)),q("input",{id:I(s),type:"text",value:f.value,maxlength:i.value.maxLength??96,disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input rounded-l-none font-mono text-[13px]",I(l)&&"input-invalid"]),spellcheck:"false",autocomplete:"off",onInput:p},null,42,TM),d.value&&i.value.from?(z(),V("button",{key:0,type:"button",class:"btn-ghost ml-2 shrink-0 whitespace-nowrap",disabled:t.disabled,onClick:m}," Reset ",8,MM)):pe("",!0)]),!d.value&&i.value.from?(z(),V("p",$M," Made from the "+G((t.sourceLabel??i.value.from).toLowerCase())+". Change it to set your own. ",1)):pe("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),IM=["id","type","value","placeholder","maxlength","required","disabled","aria-invalid","aria-describedby"],FM={key:0,class:"mt-1 text-right text-xs text-muted"},sl=De({__name:"TextField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>i.value.kind==="email"?"email":i.value.kind==="url"?"url":"text"),d=te(()=>typeof n.modelValue=="string"?n.modelValue:""),h=te(()=>"maxLength"in i.value?i.value.maxLength??null:null),p=te(()=>h.value!==null&&d.value.length>h.value*.7);function m(g){const b=g.target.value;r("update:modelValue",b===""?null:b)}return(g,b)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[q("input",{id:I(s),type:f.value,value:d.value,placeholder:"placeholder"in i.value?i.value.placeholder:void 0,maxlength:h.value??void 0,required:i.value.required,disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input",I(l)&&"input-invalid"]),autocomplete:"off",onInput:m},null,42,IM),p.value?(z(),V("p",FM,G(d.value.length)+" / "+G(h.value),1)):pe("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),RM=["id","value","rows","placeholder","maxlength","required","disabled","aria-invalid","aria-describedby"],PM={key:0,class:"mt-1 text-right text-xs text-muted"},BM=De({__name:"TextareaField",props:{field:{},path:{},issues:{},disabled:{type:Boolean},modelValue:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>n.field),{inputId:s,label:o,error:l,describedBy:a,hintId:u,errorId:c}=Dt(n),f=te(()=>typeof n.modelValue=="string"?n.modelValue:""),d=te(()=>i.value.maxLength!==void 0&&f.value.length>i.value.maxLength*.7);function h(p){const m=p.target.value;r("update:modelValue",m===""?null:m)}return(p,m)=>(z(),kt(Nt,{"input-id":I(s),label:I(o),description:i.value.description,required:i.value.required,error:I(l),"hint-id":I(u),"error-id":I(c)},{default:yt(()=>[q("textarea",{id:I(s),value:f.value,rows:i.value.rows??4,placeholder:i.value.placeholder,maxlength:i.value.maxLength,required:i.value.required,disabled:t.disabled||i.value.readonly,"aria-invalid":I(l)?"true":void 0,"aria-describedby":I(a),class:Ee(["input resize-y",I(l)&&"input-invalid"]),onInput:h},null,42,RM),d.value?(z(),V("p",PM,G(f.value.length)+" / "+G(i.value.maxLength),1)):pe("",!0)]),_:1},8,["input-id","label","description","required","error","hint-id","error-id"]))}}),zM={text:sl,textarea:BM,richText:xM,number:$x,boolean:fv,date:Rv,email:sl,url:sl,slug:NM,select:DM,object:Du(()=>Ou(()=>import("./ObjectField-BFAmw-Bf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),repeater:Du(()=>Ou(()=>import("./RepeaterField-BA5zPM54.js"),__vite__mapDeps([9,1,2,3,4,10,7,5,6,8]))),relation:qx,media:Dx,color:Cv,coordinates:$v},LM={key:0,class:"rounded-md border border-line bg-subtle px-3 py-2 text-xs text-muted"},td=De({__name:"FieldRenderer",props:{field:{},path:{},modelValue:{},issues:{},disabled:{type:Boolean},collection:{},entrySlug:{},source:{},sourceLabel:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>zM[n.field.kind]),s=te(()=>n.field.kind==="slug"?{source:n.source,sourceLabel:n.sourceLabel,collection:n.collection,exceptSlug:n.entrySlug}:{});return(o,l)=>!i.value&&!t.field.hidden?(z(),V("p",LM,G(t.field.label??t.path)+': the field type "'+G(t.field.kind)+'" needs a newer version of Mica. ',1)):t.field.hidden?pe("",!0):(z(),kt(l0(i.value),o0({key:1,field:t.field,path:t.path,issues:t.issues,disabled:t.disabled,"model-value":t.modelValue},s.value,{"onUpdate:modelValue":l[0]||(l[0]=a=>r("update:modelValue",a))}),null,16,["field","path","issues","disabled","model-value"]))}}),jM={class:"space-y-6"},qM={key:0,class:"card p-4 sm:p-5"},VM={class:"px-1 font-mono text-[11px] font-medium uppercase tracking-[.08em] text-muted"},UM={class:"mt-3 grid grid-cols-12 gap-x-4 gap-y-5"},HM=["data-field-path"],ZM={key:1,class:"grid grid-cols-12 gap-x-4 gap-y-5"},WM=["data-field-path"],C$=De({__name:"FieldList",props:{fields:{},modelValue:{},path:{},issues:{},disabled:{type:Boolean},collection:{},entrySlug:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=te(()=>{const u=[];for(const[c,f]of Object.entries(n.fields)){if(f.hidden)continue;const d=f.group??null,h=u.at(-1);h&&h.name===d?h.entries.push({key:c,field:f}):u.push({name:d,entries:[{key:c,field:f}]})}return u}),s=u=>n.path?`${n.path}.${u}`:u;function o(u,c){r("update:modelValue",{...n.modelValue,[u]:c})}function l(u){var c;if(!(u.kind!=="slug"||!u.from))return((c=n.fields[u.from])==null?void 0:c.label)??p0(u.from)}function a(u){if(u.kind!=="slug"||!u.from)return null;const c=n.modelValue[u.from];return typeof c=="string"?c:null}return(u,c)=>(z(),V("div",jM,[(z(!0),V(We,null,mt(i.value,(f,d)=>(z(),V(We,{key:`${f.name??"ungrouped"}-${d}`},[f.name?(z(),V("fieldset",qM,[q("legend",VM,G(f.name),1),q("div",UM,[(z(!0),V(We,null,mt(f.entries,h=>(z(),V("div",{key:h.key,class:Ee(I(Tu)(h.field)),"data-field-path":s(h.key)},[wt(td,{field:h.field,path:s(h.key),"model-value":t.modelValue[h.key],issues:t.issues,disabled:t.disabled,collection:t.collection,"entry-slug":t.entrySlug,source:a(h.field),"source-label":l(h.field),"onUpdate:modelValue":p=>o(h.key,p)},null,8,["field","path","model-value","issues","disabled","collection","entry-slug","source","source-label","onUpdate:modelValue"])],10,HM))),128))])])):(z(),V("div",ZM,[(z(!0),V(We,null,mt(f.entries,h=>(z(),V("div",{key:h.key,class:Ee(I(Tu)(h.field)),"data-field-path":s(h.key)},[wt(td,{field:h.field,path:s(h.key),"model-value":t.modelValue[h.key],issues:t.issues,disabled:t.disabled,collection:t.collection,"entry-slug":t.entrySlug,source:a(h.field),"source-label":l(h.field),"onUpdate:modelValue":p=>o(h.key,p)},null,8,["field","path","model-value","issues","disabled","collection","entry-slug","source","source-label","onUpdate:modelValue"])],10,WM))),128))]))],64))),128))]))}});function JM(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function KM(t){for(let e=t;e!=="";e=e.includes(".")?e.slice(0,e.lastIndexOf(".")):""){const n=document.querySelector(`[data-field-path="${CSS.escape(e)}"]`);if(!n)continue;const r=n.querySelector('input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [contenteditable="true"], button:not([disabled])')??n;return n.scrollIntoView({behavior:JM(),block:"center"}),r.focus({preventScroll:!0}),!0}return!1}const GM={key:0,role:"alert",class:"mb-5 rounded-md border border-danger/15 bg-danger-soft p-4"},YM={class:"text-sm font-medium text-danger"},XM={class:"mt-1.5 space-y-0.5 text-xs text-danger"},QM=["onClick"],_$=De({__name:"IssueSummary",props:{issues:{}},setup(t){return(e,n)=>t.issues.length?(z(),V("div",GM,[q("p",YM,G(t.issues.length)+" field"+G(t.issues.length===1?"":"s")+" need"+G(t.issues.length===1?"s":"")+" attention ",1),q("ul",XM,[(z(!0),V(We,null,mt(t.issues,r=>(z(),V("li",{key:r.path},[q("button",{type:"button",class:"text-left underline underline-offset-2 hover:no-underline",onClick:i=>I(KM)(r.path)},G(r.message),9,QM)]))),128))])])):pe("",!0)}}),e$={role:"status",class:"mb-5 flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border border-accent/20 bg-accent-soft px-4 py-3"},t$={class:"min-w-0 flex-1 text-sm"},w$=De({__name:"KeptChangesNotice",props:{at:{}},emits:["restore","forget"],setup(t,{emit:e}){const n=e;return(r,i)=>(z(),V("div",e$,[q("p",t$," You have changes from "+G(I(ld)(t.at))+" that were not saved. ",1),q("button",{type:"button",class:"btn-secondary",onClick:i[0]||(i[0]=s=>n("restore"))},"Restore them"),q("button",{type:"button",class:"btn-ghost",onClick:i[1]||(i[1]=s=>n("forget"))},"Let them go")]))}}),n$={role:"status",class:"mb-5 flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md border border-line bg-subtle px-4 py-3"},r$={class:"min-w-0 flex-1 text-sm"},i$={key:0,class:"text-xs text-muted"},s$={key:1,class:"block text-xs text-warning"},o$={key:0},l$={key:1},S$=De({__name:"PendingNotice",props:{edit:{}},emits:["discarded"],setup(t,{emit:e}){const n=t,r=e,i=u0(),s=id(),o=Me(!1),l=te(()=>{var f;return(c0([n.edit],((f=i.status.value)==null?void 0:f.validation.problems)??[]).get(n.edit.key)??[]).flatMap(d=>d.issues.map(h=>h.message))}),a=Me(!1),u={new:"New, and not on the website yet.",changed:"Saved, and not on the website yet.",removed:"Removed, and still on the website until you publish."};async function c(){a.value=!0;try{await kn.staging.discard(n.edit.fileChanges.map(f=>f.path)),s.success("Discarded the changes."),o.value=!1,r("discarded",n.edit),await i.refresh()}catch(f){s.error(f instanceof al?f.message:"Could not discard.")}finally{a.value=!1}}return(f,d)=>{const h=a0("RouterLink");return z(),V(We,null,[q("div",n$,[q("p",r$,[Sn(G(u[t.edit.state])+" ",1),t.edit.savedAt?(z(),V("span",i$,"Saved "+G(I(ld)(t.edit.savedAt))+".",1)):pe("",!0),l.value.length>0?(z(),V("span",s$," Not ready to publish: "+G(l.value.join(" ")),1)):pe("",!0)]),wt(h,{to:{name:"changes"},class:"btn-secondary"},{default:yt(()=>[...d[2]||(d[2]=[Sn("Publish…",-1)])]),_:1}),q("button",{type:"button",class:"btn-ghost",onClick:d[0]||(d[0]=p=>o.value=!0)},"Discard changes")]),wt(v0,{open:o.value,title:"Discard the changes?","confirm-label":"Discard",destructive:"",busy:a.value,onCancel:d[1]||(d[1]=p=>o.value=!1),onConfirm:c},{default:yt(()=>[t.edit.state==="new"?(z(),V("p",o$,"This deletes it. It was never published. It cannot be undone.")):(z(),V("p",l$,"This puts it back as it was at the last publication. It cannot be undone."))]),_:1},8,["open","busy"])],64)}}}),a$={role:"alert",class:"mb-5 rounded-md border border-warning/15 bg-warning-soft p-4"},u$={key:0,class:"mt-1 text-xs text-muted"},c$={class:"mt-2.5 flex flex-wrap gap-2"},f$=["disabled"],d$=["disabled"],h$={key:2,class:"mt-1 text-xs text-muted"},E$=De({__name:"SaveConflict",props:{state:{},theirs:{},mine:{},fields:{},busy:{type:Boolean}},emits:["keep","take"],setup(t,{emit:e}){const n=e;return(r,i)=>(z(),V("div",a$,[i[4]||(i[4]=q("p",{class:"text-sm font-medium text-warning"},"Somebody else saved this while you were editing",-1)),t.state==="loading"?(z(),V("p",u$,"Loading their version…")):t.state==="loaded"&&t.theirs?(z(),V(We,{key:1},[i[2]||(i[2]=q("p",{class:"mt-1 text-xs text-muted"},"Your changes are not saved yet. Their saved version, then yours:",-1)),wt(m0,{comparison:{before:t.theirs,after:t.mine},fields:t.fields},null,8,["comparison","fields"]),q("div",c$,[q("button",{type:"button",class:"btn-secondary",disabled:t.busy,onClick:i[0]||(i[0]=s=>n("keep"))},"Keep mine",8,f$),q("button",{type:"button",class:"btn-ghost",disabled:t.busy,onClick:i[1]||(i[1]=s=>n("take"))},"Use theirs",8,d$)]),i[3]||(i[3]=q("p",{class:"mt-2 text-xs text-muted"},'"Keep mine" saves your version over theirs. Mica notes who chose it.',-1))],64)):(z(),V("p",h$," It was deleted or moved to another URL. Your changes are still in the form and not saved. Copy what you need. "))]))}}),ol=(t,e)=>t===e||t.startsWith(`${e}.`);function D$(t,e){const n=Me([]),r=new Set;let i=[];const s=()=>{const u=t();if(!u)return[];const c=rv(u,e.value,{enforceRequired:!1});return c.ok?[]:c.issues},o=u=>[...u,...i.filter(c=>!u.some(f=>f.path===c.path))],l=()=>{const u=s(),c=new Set(n.value.map(f=>f.path));n.value=o(u.filter(f=>c.has(f.path)||[...r].some(d=>ol(f.path,d))))};let a=JSON.stringify(e.value);return yn(e,u=>{const c=JSON.parse(a);if(a=JSON.stringify(u),n.value.length===0)return;const f=Object.keys({...c,...u}).filter(h=>JSON.stringify(c[h])!==JSON.stringify(u[h])),d=s();i=i.filter(h=>!f.some(p=>ol(h.path,p))),n.value=n.value.flatMap(h=>{if(!f.some(m=>ol(h.path,m)))return[h];const p=d.find(m=>m.path===h.path);return p?[p]:[]})},{deep:!0}),{issues:n,leave(u){r.add(u),l()},checkAll(){const u=s();return n.value=o(u),u.length===0},set(u){i=u,n.value=u},reset(){n.value=[],i=[],r.clear(),a=JSON.stringify(e.value)}}}function O$(t){var e;return t instanceof Element?((e=t.closest("[data-field-path]"))==null?void 0:e.getAttribute("data-field-path"))??null:null}const ta="mica:kept:";function p$(t){try{const e=window.sessionStorage.getItem(ta+t);return e?JSON.parse(e):null}catch{return null}}function Zi(t,e){try{e?window.sessionStorage.setItem(ta+t,JSON.stringify(e)):window.sessionStorage.removeItem(ta+t)}catch{}}function T$(t,e,n,r){const i=Me(null),s=od();return yn([e,r],()=>{r.value&&(i.value=null,Zi(t(),{values:e.value,revision:n.value,at:new Date().toISOString()}))},{deep:!0}),sd(()=>{s.leaving.value||Zi(t(),null)}),{offered:i,check(){const o=p$(t());i.value=o&&JSON.stringify(o.values)!==JSON.stringify(e.value)?o:null,i.value||Zi(t(),null)},restore(){if(!i.value)return;const o=f0(i.value);e.value=structuredClone(o.values),n.value=o.revision,i.value=null},forget(){i.value=null,Zi(t(),null)}}}const m$="You have unsaved changes. Leave without saving?";function M$(t){const e=Me(ll(t.value)),n=Me(!0),r=te(()=>n.value&&ll(t.value)!==e.value);function i(){e.value=ll(t.value)}function s(){n.value=!1}const o=od();function l(u){r.value&&!o.leaving.value&&u.preventDefault()}na(()=>window.addEventListener("beforeunload",l)),sd(()=>window.removeEventListener("beforeunload",l));const a=()=>!r.value||window.confirm(m$);return d0(a),h0(a),{dirty:r,markClean:i,release:s}}function ll(t){return JSON.stringify(t,(e,n)=>{if(n===null||typeof n!="object"||Array.isArray(n))return n;const r=n,i={};for(const s of Object.keys(r).sort())i[s]=r[s];return i})}export{Pv as M,S$ as _,M$ as a,T$ as b,E$ as c,w$ as d,_$ as e,C$ as f,O$ as g,KM as h,iv as i,Wk as j,D$ as u,dc as w};
|
|
201
|
+
//# sourceMappingURL=useUnsavedChanges-CErjJu5S.js.map
|