import{r as _,j as x,a as Jt,g as Kh}from"./query-Bw69rE6b.js";import{d as xe,C as Jh,c as we,k as Fo,W as Gh,D as Zh,g as Xh,a6 as tc,M as Yh,a4 as Qh,R as ep,H as nc,X as tp,j as np,N as rp,B as Fu,U as ip,Y as sp,p as op}from"./index-CoUu6FiM.js";import{B as up,L as rc,s as ic,w as lp}from"./with-selector-DmmuW8RZ.js";import{C as sc}from"./code-zqIp-0hD.js";import{T as oc}from"./table-BgcaxH7z.js";import{E as ap}from"./eye-DjFgzw_3.js";import{C as cp}from"./code-xml-CnSqwYLd.js";import{f as dp,a as fp,u as hp}from"./react-CQKYBN-P.js";import{D as pp}from"./download-C1IJ2Fiw.js";import{S as mp}from"./SourceAttacher-D2Hyd3T_.js";import{R as gp}from"./rotate-ccw-CDH4c_fo.js";import{B as bp}from"./Badge-DwoQNRW3.js";import{e as xp,f as yp,d as kp,a as wp}from"./usePages-D5h-FCve.js";import"./upload-DvIhupK8.js";/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cp=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Ep=xe("clock",Cp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sp=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],vp=xe("copy",Sp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ap=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Mp=xe("cpu",Ap);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tp=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],_p=xe("ellipsis",Tp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dp=[["path",{d:"M12 22h6a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"15usau"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M3 16v-1.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5V16",key:"s1gz5"}],["path",{d:"M6 22h2",key:"194x9m"}],["path",{d:"M7 14v8",key:"11ixej"}]],Np=xe("file-type-corner",Dp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Op=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],uc=xe("heading-1",Op);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rp=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],lc=xe("heading-2",Rp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ip=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],ac=xe("heading-3",Ip);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lp=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Fp=xe("italic",Lp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pp=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],zp=xe("link",Pp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bp=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],cc=xe("list-ordered",Bp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $p=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],jp=xe("maximize-2",$p);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hp=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],qp=xe("minimize-2",Hp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vp=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Wp=xe("pen-line",Vp);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Up=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],Kp=xe("quote",Up);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jp=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Pu=xe("wand-sparkles",Jp);function Gp(t){return t==="doc_profile"?Fo:t==="lineage_artifact"?Gh:Zh}function Zp(t){return t==="doc_profile"?"docs":t==="lineage_artifact"?"lineage":t==="db_column"?"column":t==="db_table"?"table":t==="db_schema"?"schema":t==="db_database"?"database":t==="db_profile"?"db profile":t}function Xp({asset:t}){const[e,n]=_.useState(!1),r=Gp(t.kind);async function i(){try{await navigator.clipboard.writeText(t.ref),n(!0),window.setTimeout(()=>n(!1),1200)}catch{}}const s=t.ref||"(no reference)",o=s.replace(/\//g,"/​");return x.jsxs("div",{className:"group flex items-start gap-2 rounded px-1 py-1 transition-colors hover:bg-surface-subtle",children:[x.jsx("span",{className:"mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded bg-accent-soft/50 text-accent-ink",children:x.jsx(r,{size:12})}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("div",{className:"break-words font-mono text-[12px] leading-snug text-ink",title:s,children:o}),x.jsx("div",{className:"mt-0.5 text-[10px] uppercase tracking-wide text-ink-dim",children:Zp(t.kind)})]}),x.jsx("button",{type:"button",onClick:i,"aria-label":"Copy ref",title:e?"Copied":"Copy ref",className:we("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-ink-muted transition hover:bg-surface hover:text-ink","opacity-0 group-hover:opacity-100",e&&"!opacity-100 text-accent-ink"),children:e?x.jsx(Jh,{size:12}):x.jsx(vp,{size:12})})]})}function Yp(t){if(!t.trim())return 0;const n=t.replace(/```[\s\S]*?```/g," ").replace(/`[^`]*`/g," ").replace(/[#>*_~`|\-]/g," ").match(/\b[\w'-]+\b/g);return n?n.length:0}function Qp(t){return t===0?"0 min":`${Math.max(1,Math.round(t/220))} min`}function e0({markdown:t,assetCount:e,modelUsed:n}){const r=_.useMemo(()=>Yp(t),[t]);return x.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-border px-1 pt-2 text-[11px] text-ink-dim",children:[x.jsxs("span",{className:"inline-flex items-center gap-1",children:[x.jsx(Fo,{size:11}),r.toLocaleString()," words"]}),x.jsxs("span",{className:"inline-flex items-center gap-1",children:[x.jsx(Ep,{size:11}),Qp(r)]}),x.jsxs("span",{className:"inline-flex items-center gap-1",children:[x.jsx(Xh,{size:11}),e," ",e===1?"asset":"assets"]}),n&&x.jsxs("span",{className:"inline-flex items-center gap-1",children:[x.jsx(Mp,{size:11}),n]})]})}function t0({editor:t,disabled:e=!1}){const[n,r]=_.useState(!1),i=e||!t;function s(a,c,d,f=!1){return x.jsx("button",{type:"button",onClick:a,"aria-label":d,title:d,"aria-pressed":f,disabled:i,className:we("inline-flex h-7 w-7 items-center justify-center rounded text-ink-muted transition-colors",f&&"bg-accent-soft text-accent-ink",!f&&!i&&"hover:bg-surface-subtle hover:text-ink",i&&"cursor-not-allowed opacity-40"),children:c})}function o(){if(!t)return;const a=t.getAttributes("link").href,c=window.prompt("Link URL",a??"https://");if(c!==null){if(c===""){t.chain().focus().extendMarkRange("link").unsetLink().run();return}t.chain().focus().extendMarkRange("link").setLink({href:c}).run()}}const u=x.jsxs(x.Fragment,{children:[s(()=>t?.chain().focus().toggleHeading({level:1}).run(),x.jsx(uc,{size:14}),"Heading 1",!!t?.isActive("heading",{level:1})),s(()=>t?.chain().focus().toggleHeading({level:2}).run(),x.jsx(lc,{size:14}),"Heading 2",!!t?.isActive("heading",{level:2})),s(()=>t?.chain().focus().toggleHeading({level:3}).run(),x.jsx(ac,{size:14}),"Heading 3",!!t?.isActive("heading",{level:3})),s(()=>t?.chain().focus().toggleBold().run(),x.jsx(up,{size:14}),"Bold",!!t?.isActive("bold")),s(()=>t?.chain().focus().toggleItalic().run(),x.jsx(Fp,{size:14}),"Italic",!!t?.isActive("italic"))]}),l=x.jsxs(x.Fragment,{children:[s(()=>t?.chain().focus().toggleBulletList().run(),x.jsx(rc,{size:14}),"Bullet list",!!t?.isActive("bulletList")),s(()=>t?.chain().focus().toggleOrderedList().run(),x.jsx(cc,{size:14}),"Ordered list",!!t?.isActive("orderedList")),s(()=>t?.chain().focus().toggleCode().run(),x.jsx(sc,{size:14}),"Inline code",!!t?.isActive("code")),s(o,x.jsx(zp,{size:14}),"Insert link",!!t?.isActive("link")),s(()=>t?.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),x.jsx(oc,{size:14}),"Insert table"),s(()=>t?.chain().focus().setHorizontalRule().run(),x.jsx(tc,{size:14}),"Horizontal rule")]});return x.jsxs("div",{className:"flex flex-wrap items-center gap-0.5",children:[u,x.jsx("div",{className:"hidden sm:flex items-center gap-0.5",children:l}),x.jsxs("div",{className:"sm:hidden relative",children:[x.jsx("button",{type:"button",onClick:()=>r(a=>!a),"aria-label":"More formatting","aria-expanded":n,disabled:i,className:"inline-flex h-7 w-7 items-center justify-center rounded text-ink-muted hover:bg-surface-subtle hover:text-ink disabled:cursor-not-allowed disabled:opacity-40",children:x.jsx(_p,{size:14})}),n&&!i&&x.jsx("div",{className:"absolute left-0 top-8 z-10 flex gap-0.5 rounded-md border border-border bg-surface-raised p-1 shadow-md",children:l})]}),x.jsxs("span",{className:"ml-auto text-[10px] text-ink-dim",children:["Tip: type ",x.jsx("kbd",{className:"rounded border border-border bg-surface px-1",children:"/"})," for blocks"]})]})}const dc="amx-pages-editor-view",n0=[{id:"edit",label:"Edit",icon:Wp},{id:"preview",label:"Preview",icon:ap},{id:"source",label:"Source",icon:cp}];function r0(t="edit"){if(typeof window>"u")return t;try{const e=window.localStorage.getItem(dc);if(e==="edit"||e==="preview"||e==="source")return e}catch{}return t}function i0({value:t,onChange:e}){return _.useEffect(()=>{try{window.localStorage.setItem(dc,t)}catch{}},[t]),x.jsx("div",{role:"tablist","aria-label":"Editor view",className:"inline-flex items-center gap-0.5 rounded-md border border-border bg-surface p-0.5",children:n0.map(n=>{const r=n.icon,i=n.id===t;return x.jsxs("button",{type:"button",role:"tab","aria-selected":i,onClick:()=>e(n.id),className:we("inline-flex items-center gap-1.5 rounded px-2.5 py-1 text-xs font-medium transition-colors",i?"bg-accent-soft text-accent-ink":"text-ink-muted hover:bg-surface-subtle hover:text-ink"),children:[x.jsx(r,{size:12}),n.label]},n.id)})})}function ce(t){this.content=t}ce.prototype={constructor:ce,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 ce(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 ce(n)},addToStart:function(t,e){return new ce([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ce(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 ce(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=ce.from(t),t.size?new ce(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ce.from(t),t.size?new ce(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ce.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}};ce.from=function(t){if(t instanceof ce)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ce(e)};function fc(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){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=fc(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function hc(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),u=e.child(--s),l=o.nodeSize;if(o==u){n-=l,r-=l;continue}if(!o.sameMarkup(u))return{a:n,b:r};if(o.isText&&o.text!=u.text){let a=0,c=Math.min(o.text.length,u.text.length);for(;a<c&&o.text[o.text.length-a-1]==u.text[u.text.length-a-1];)a++,n--,r--;return{a:n,b:r}}if(o.content.size||u.content.size){let a=hc(o.content,u.content,n-1,r-1);if(a)return a}n-=l,r-=l}}class E{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,u=0;u<n;o++){let l=this.content[o],a=u+l.nodeSize;if(a>e&&r(l,i+u,s||null,o)!==!1&&l.content.size){let c=u+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}u=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(u,l)=>{let a=u.isText?u.text.slice(Math.max(e,l)-l,n-l):u.isLeaf?i?typeof i=="function"?i(u):i:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&a||u.isTextblock)&&r&&(o?o=!1:s+=r),s+=a},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 E(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 u=this.content[s],l=o+u.nodeSize;l>e&&((o<e||l>n)&&(u.isText?u=u.cut(Math.max(0,e-o),Math.min(u.text.length,n-o)):u=u.cut(Math.max(0,e-o-1),Math.min(u.content.size,n-o-1))),r.push(u),i+=u.nodeSize),o=l}return new E(r,i)}cutByIndex(e,n){return e==n?E.empty:e==0&&n==this.content.length?this:new E(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 E(i,s)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(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 fc(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return hc(this,e,n,r)}findIndex(e){if(e==0)return br(0,e);if(e==this.size)return br(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?br(n+1,s):br(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 E.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return E.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.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 E(n||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const ls={index:0,offset:0};function br(t,e){return ls.index=t,ls.offset=e,ls}function Wr(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(!Wr(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Wr(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let B=class Gs{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&&Wr(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`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}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 Gs.none;if(e instanceof Gs)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};B.none=[];class Ur extends Error{}class M{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=mc(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new M(r,this.openStart,this.openEnd)}removeBetween(e,n){return new M(pc(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 M.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 M(E.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 M(e,r,i)}}M.empty=new M(E.empty,0,0);function pc(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:u}=t.findIndex(n);if(i==e||s.isText){if(u!=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(pc(s.content,e-i-1,n-i-1)))}function mc(t,e,n,r,i,s){let{index:o,offset:u}=t.findIndex(e),l=t.maybeChild(o);if(u==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=mc(l.content,e-u-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,l);return a&&t.replaceChild(o,l.copy(a))}function s0(t,e,n){if(n.openStart>t.depth)throw new Ur("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ur("Inconsistent open depths");return gc(t,e,n,0)}function gc(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=gc(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,u=o.content;return Vt(o,u.cut(0,t.parentOffset).append(n.content).append(u.cut(e.parentOffset)))}else{let{start:o,end:u}=o0(n,t);return Vt(s,xc(t,o,u,e,r))}else return Vt(s,Kr(t,e,r))}function bc(t,e){if(!e.type.compatibleContent(t.type))throw new Ur("Cannot join "+e.type.name+" onto "+t.type.name)}function Zs(t,e,n){let r=t.node(n);return bc(r,e.node(n)),r}function qt(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 Fn(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&&(qt(t.nodeAfter,r),s++));for(let u=s;u<o;u++)qt(i.child(u),r);e&&e.depth==n&&e.textOffset&&qt(e.nodeBefore,r)}function Vt(t,e){return t.type.checkContent(e),t.copy(e)}function xc(t,e,n,r,i){let s=t.depth>i&&Zs(t,e,i+1),o=r.depth>i&&Zs(n,r,i+1),u=[];return Fn(null,t,i,u),s&&o&&e.index(i)==n.index(i)?(bc(s,o),qt(Vt(s,xc(t,e,n,r,i+1)),u)):(s&&qt(Vt(s,Kr(t,e,i+1)),u),Fn(e,n,i,u),o&&qt(Vt(o,Kr(n,r,i+1)),u)),Fn(r,null,i,u),new E(u)}function Kr(t,e,n){let r=[];if(Fn(null,t,n,r),t.depth>n){let i=Zs(t,e,n+1);qt(Vt(i,Kr(t,e,n+1)),r)}return Fn(e,null,n,r),new E(r)}function o0(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(E.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Kn{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 B.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let u=r;r=i,i=u}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 Jr(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:u,offset:l}=o.content.findIndex(s),a=s-l;if(r.push(o,u,i+l),!a||(o=o.child(u),o.isText))break;s=a-1,i+=l+1}return new Kn(n,r,s)}static resolveCached(e,n){let r=zu.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 zu.set(e,r=new u0);let i=r.elts[r.i]=Kn.resolve(e,n);return r.i=(r.i+1)%l0,i}}class u0{constructor(){this.elts=[],this.i=0}}const l0=12,zu=new WeakMap;class Jr{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 a0=Object.create(null);let At=class Xs{constructor(e,n,r,i=B.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||E.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&&Wr(this.attrs,n||e.defaultAttrs||a0)&&B.sameSet(this.marks,r||B.none)}copy(e=null){return e==this.content?this:new Xs(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Xs(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 M.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),u=i.start(o),a=i.node(o).content.cut(i.pos-u,s.pos-u);return new M(a,i.depth-o,s.depth-o)}replace(e,n,r){return s0(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 Kn.resolveCached(this,e)}resolveNoCache(e){return Kn.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()+")"),yc(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=E.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),u=o&&o.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).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),this.type.checkAttrs(this.attrs);let e=B.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!B.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=E.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};At.prototype.text=void 0;class Gr extends At{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):yc(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 Gr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Gr(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 yc(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Gt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new c0(e,n);if(r.next==null)return Gt.empty;let i=kc(r);r.next&&r.err("Unexpected trailing text");let s=b0(g0(i));return x0(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,u){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return E.from(u.map(a=>a.createAndFill()));for(let a=0;a<o.next.length;a++){let{type:c,next:d}=o.next[a];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,u.concat(c));if(f)return f}}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 u=i;u.type;u=u.via)o.push(u.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:u,next:l}=s.next[o];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in n)&&(!i.type||l.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),n[u.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(`
`)}}Gt.empty=new Gt(!0);class c0{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 kc(t){let e=[];do e.push(d0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function d0(t){let e=[];do e.push(f0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function f0(t){let e=m0(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=h0(t,e);else break;return e}function Bu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function h0(t,e){let n=Bu(t),r=n;return t.eat(",")&&(t.next!="}"?r=Bu(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function p0(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 m0(t){if(t.eat("(")){let e=kc(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=p0(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 g0(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,u,l){let a={term:l,to:u};return e[o].push(a),a}function i(o,u){o.forEach(l=>l.to=u)}function s(o,u){if(o.type=="choice")return o.exprs.reduce((l,a)=>l.concat(s(a,u)),[]);if(o.type=="seq")for(let l=0;;l++){let a=s(o.exprs[l],u);if(l==o.exprs.length-1)return a;i(a,u=n())}else if(o.type=="star"){let l=n();return r(u,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,u),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(u)].concat(s(o.expr,u));if(o.type=="range"){let l=u;for(let a=0;a<o.min;a++){let c=n();i(s(o.expr,l),c),l=c}if(o.max==-1)i(s(o.expr,l),l);else for(let a=o.min;a<o.max;a++){let c=n();r(l,c),i(s(o.expr,l),c),l=c}return[r(l)]}else{if(o.type=="name")return[r(u,void 0,o.value)];throw new Error("Unknown expr type")}}}}function wc(t,e){return e-t}function $u(t,e){let n=[];return r(e),n.sort(wc);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:u,to:l}=s[o];!u&&n.indexOf(l)==-1&&r(l)}}}function b0(t){let e=Object.create(null);return n($u(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:u,to:l})=>{if(!u)return;let a;for(let c=0;c<i.length;c++)i[c][0]==u&&(a=i[c][1]);$u(t,l).forEach(c=>{a||i.push([u,a=[]]),a.indexOf(c)==-1&&a.push(c)})})});let s=e[r.join(",")]=new Gt(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let u=i[o][1].sort(wc);s.next.push({type:i[o][0],next:e[u.join(",")]||n(u)})}return s}}function x0(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let u=0;u<i.next.length;u++){let{type:l,next:a}=i.next[u];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(a)==-1&&r.push(a)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Cc(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 Ec(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Sc(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function vc(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new k0(t,r,e[r]);return n}let ju=class Ac{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=vc(e,r.attrs),this.defaultAttrs=Cc(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==Gt.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:Ec(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new At(this,this.computeAttrs(e),E.from(n),B.setFrom(r))}createChecked(e=null,n,r){return n=E.from(n),this.checkContent(n),new At(this,this.computeAttrs(e),n,B.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=E.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(E.empty,!0);return s?new At(this,e,n.append(s),B.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){Sc(this.attrs,e,"node",this.name)}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:B.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Ac(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 y0(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 k0{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?y0(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class $i{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=vc(e,i.attrs),this.excluded=null;let s=Cc(this.attrs);this.instance=s?new B(this,s):null}create(e=null){return!e&&this.instance?this.instance:new B(this,Ec(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new $i(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]}checkAttrs(e){Sc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Po{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=ce.from(e.nodes),n.marks=ce.from(e.marks||{}),this.nodes=ju.compile(this.spec.nodes,this),this.marks=$i.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||"",u=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Gt.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=u=="_"?null:u?Hu(this,u.split(" ")):u==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Hu(this,o.split(" "))}this.nodeFromJSON=i=>At.fromJSON(this,i),this.markFromJSON=i=>B.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 ju){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 Gr(r,r.defaultAttrs,e,B.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 Hu(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 u in t.marks){let l=t.marks[u];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function w0(t){return t.tag!=null}function C0(t){return t.style!=null}class at{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(w0(i))this.tags.push(i);else if(C0(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 Vu(this,n,!1);return r.addAll(e,B.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Vu(this,n,!0);return r.addAll(e,B.none,n.from,n.to),M.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(v0(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],u=o.style;if(!(u.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||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 u=n[o];if((u.priority==null?50:u.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=Wu(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=Wu(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new at(e,at.schemaRules(e)))}}const Mc={address:!0,article:!0,aside:!0,blockquote:!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},E0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Tc={ol:!0,ul:!0},Jn=1,Ys=2,Pn=4;function qu(t,e,n){return e!=null?(e?Jn:0)|(e==="full"?Ys:0):t&&t.whitespace=="pre"?Jn|Ys:n&~Pn}class xr{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=B.none,this.match=s||(o&Pn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(E.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&Jn)){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=E.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(E.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&&!Mc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Vu{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=qu(null,n.preserveWhitespace,0)|(r?Pn:0);i?s=new xr(i.type,i.attrs,B.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new xr(null,null,B.none,!0,null,o):s=new xr(e.schema.topNodeType,null,B.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&Ys?"full":this.localPreserveWS||(i.options&Jn)>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,`
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let u=r.split(/\r?\n|\r/);for(let l=0;l<u.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),u[l]&&this.insertNode(o.text(u[l]),n,!/\S/.test(u[l]));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 u=i.content[i.content.length-1],l=e.previousSibling;(!u||l&&l.nodeName=="BR"||u.isText&&/[ \t\r\n\u000c]$/.test(u.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(),u;Tc.hasOwnProperty(o)&&this.parser.normalizeLists&&S0(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(l?l.ignore:E0.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let a,c=this.needsBlock;if(Mc.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),a=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),a&&this.sync(s),this.needsBlock=c}else{let a=this.readStyles(e,n);a&&this.addElementByRule(e,l,a,l.consuming===!1?u:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),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 u=void 0;;){let l=this.parser.matchStyle(s,o,this,u);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(a=>!l.clearMark(a)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)u=l;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 l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let u=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(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(u)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];o!=u;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,u=0;o>=0;o--){let l=this.nodes[o],a=l.findWrapping(e);if(a&&(!i||i.length>a.length+u)&&(i=a,s=l,!a.length))break;if(l.solid){if(r)break;u+=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=B.none;for(let u of i.concat(e.marks))(s.type?s.type.allowsMarkType(u.type):Uu(u.type,e.type))&&(o=u.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 u=qu(e,s,o.options);o.options&Pn&&o.content.length==0&&(u|=Pn);let l=B.none;return r=r.filter(a=>(o.type?o.type.allowsMarkType(a.type):Uu(a.type,e))?(l=a.addToSet(l),!1):!0),this.nodes.push(new xr(e,n,l,i,null,u)),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|=Jn)}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=(u,l)=>{for(;u>=0;u--){let a=n[u];if(a==""){if(u==n.length-1||u==0)continue;for(;l>=s;l--)if(o(u-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!c||c.name!=a&&!c.isInGroup(a))return!1;l--}}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 S0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Tc.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function v0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Wu(t){let e={};for(let n in t)e[n]=t[n];return e}function Uu(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=u=>{s.push(u);for(let l=0;l<u.edgeCount;l++){let{type:a,next:c}=u.edge(l);if(a==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class nn{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=yr(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let u=0,l=0;for(;u<s.length&&l<o.marks.length;){let a=o.marks[l];if(!this.marks[a.type.name]){l++;continue}if(!a.eq(s[u][0])||a.type.spec.spanning===!1)break;u++,l++}for(;u<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let a=o.marks[l++],c=this.serializeMark(a,o.isInline,n);c&&(s.push([a,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return yr(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Pr(yr(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&&Pr(yr(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Pr(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new nn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Ku(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Ku(e.marks)}}function Ku(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function yr(t){return t.document||window.document}const Ju=new WeakMap;function A0(t){let e=Ju.get(t);return e===void 0&&Ju.set(t,e=M0(t)),e}function M0(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 Pr(t,e,n,r){if(e.nodeType==3)return{dom:e};if(e.dom&&e.dom.nodeType==3)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=A0(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 u,l=n?t.createElementNS(n,i):t.createElement(i),a=e[1],c=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){c=2;for(let d in a)if(a[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),a[d]):d=="style"&&l.style?l.style.cssText=a[d]:l.setAttribute(d,a[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=Pr(t,f,n,r);if(l.appendChild(h),p){if(u)throw new RangeError("Multiple content holes");u=p}}}return{dom:l,contentDOM:u}}const _c=65535,Dc=Math.pow(2,16);function T0(t,e){return t+e*Dc}function Gu(t){return t&_c}function _0(t){return(t-(t&_c))/Dc}const Nc=1,Oc=2,zr=4,Rc=8;class Qs{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Rc)>0}get deletedBefore(){return(this.delInfo&(Nc|zr))>0}get deletedAfter(){return(this.delInfo&(Oc|zr))>0}get deletedAcross(){return(this.delInfo&zr)>0}}class Te{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Te.empty)return Te.empty}recover(e){let n=0,r=Gu(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+_0(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 u=0;u<this.ranges.length;u+=3){let l=this.ranges[u]-(this.inverted?i:0);if(l>e)break;let a=this.ranges[u+s],c=this.ranges[u+o],d=l+a;if(e<=d){let f=a?e==l?-1:e==d?1:n:n,h=l+i+(f<0?0:c);if(r)return h;let p=e==(n<0?l:d)?null:T0(u/3,e-l),m=e==l?Oc:e==d?Nc:zr;return(n<0?e!=l:e!=d)&&(m|=Rc),new Qs(h,m,p)}i+=c-a}return r?e+i:new Qs(e+i,0,null)}touches(e,n){let r=0,i=Gu(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let l=this.ranges[u]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[u+s],c=l+a;if(e<=c&&u==i*3)return!0;r+=this.ranges[u+o]-a}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],u=o-(this.inverted?s:0),l=o+(this.inverted?0:s),a=this.ranges[i+n],c=this.ranges[i+r];e(u,u+a,l,l+c),s+=c-a}}invert(){return new Te(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Te.empty:new Te(e<0?[0,-e,0]:[0,0,e])}}Te.empty=new Te([]);class Gn{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 Gn(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 Gn;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],u=o.mapResult(e,n);if(u.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new Qs(e,i,null)}}const as=Object.create(null);class ye{getMap(){return Te.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=as[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 as)throw new RangeError("Duplicate use of step JSON ID "+e);return as[e]=n,n.prototype.jsonID=e,n}}class te{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new te(e,null)}static fail(e){return new te(null,e)}static fromReplace(e,n,r,i){try{return te.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ur)return te.fail(s.message);throw s}}}function zo(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(zo(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return E.fromArray(r)}class Ct extends ye{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 M(zo(n.content,(o,u)=>!o.isAtom||!u.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return te.fromReplace(e,this.from,this.to,s)}invert(){return new je(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 Ct(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ct(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 Ct(n.from,n.to,e.markFromJSON(n.mark))}}ye.jsonID("addMark",Ct);class je extends ye{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 M(zo(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return te.fromReplace(e,this.from,this.to,r)}invert(){return new Ct(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 je(n.pos,r.pos,this.mark)}merge(e){return e instanceof je&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new je(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 je(n.from,n.to,e.markFromJSON(n.mark))}}ye.jsonID("removeMark",je);class Et extends ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return te.fromReplace(e,this.pos,this.pos+1,new M(E.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 Et(this.pos,n.marks[i]);return new Et(this.pos,this.mark)}}return new Zt(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Et(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 Et(n.pos,e.markFromJSON(n.mark))}}ye.jsonID("addNodeMark",Et);class Zt extends ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return te.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return te.fromReplace(e,this.pos,this.pos+1,new M(E.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Et(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zt(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 Zt(n.pos,e.markFromJSON(n.mark))}}ye.jsonID("removeNodeMark",Zt);class ee extends ye{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&eo(e,this.from,this.to)?te.fail("Structure replace would overwrite content"):te.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Te([this.from,this.to-this.from,this.slice.size])}invert(e){return new ee(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&&ee.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new ee(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ee)||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?M.empty:new M(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ee(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?M.empty:new M(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ee(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 ee(n.from,n.to,M.fromJSON(e,n.slice),!!n.structure)}}ee.MAP_BIAS=1;ye.jsonID("replace",ee);class le extends ye{constructor(e,n,r,i,s,o,u=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=u}apply(e){if(this.structure&&(eo(e,this.from,this.gapFrom)||eo(e,this.gapTo,this.to)))return te.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return te.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?te.fromReplace(e,this.from,this.to,r):te.fail("Content does not fit in gap")}getMap(){return new Te([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 le(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 le(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 le(n.from,n.to,n.gapFrom,n.gapTo,M.fromJSON(e,n.slice),n.insert,!!n.structure)}}ye.jsonID("replaceAround",le);function eo(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 D0(t,e,n,r){let i=[],s=[],o,u;t.doc.nodesBetween(e,n,(l,a,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(a,e),h=Math.min(a+l.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:i.push(o=new je(f,h,d[m])));u&&u.to==f?u.to=h:s.push(u=new Ct(f,h,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function N0(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,u)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof $i){let a=o.marks,c;for(;c=r.isInSet(a);)(l||(l=[])).push(c),a=c.removeFromSet(a)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let a=Math.min(u+o.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=a,f.step=s):i.push({style:d,from:Math.max(u,e),to:a,step:s})}}}),i.forEach(o=>t.step(new je(o.from,o.to,o.style)))}function Bo(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],u=e+1;for(let l=0;l<s.childCount;l++){let a=s.child(l),c=u+a.nodeSize,d=r.matchType(a.type);if(!d)o.push(new ee(u,c,M.empty));else{r=d;for(let f=0;f<a.marks.length;f++)n.allowsMarkType(a.marks[f].type)||t.step(new je(u,c,a.marks[f]));if(i&&a.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(a.text);)p||(p=new M(E.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),o.push(new ee(u+f.index,u+f.index+f[0].length,p))}}u=c}if(!r.validEnd){let l=r.fillBefore(E.empty,!0);t.replace(u,u,new M(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function O0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Sn(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),u=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(u,l,n))return r;if(r==0||o.type.spec.isolating||!O0(o,u,l))break;u&&(i=1),l<o.childCount&&(s=1)}return null}function R0(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),u=i.after(s+1),l=o,a=u,c=E.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=E.from(r.node(p).copy(c)),d++):l--;let f=E.empty,h=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=E.from(i.node(p).copy(f)),h++):a++;t.step(new le(l,a,o,u,new M(c.append(f),d,h),c.size-d,!0))}function $o(t,e,n=null,r=t){let i=I0(t,e),s=i&&L0(r,e);return s?i.map(Zu).concat({type:e,attrs:n}).concat(s.map(Zu)):null}function Zu(t){return{type:t,attrs:null}}function I0(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 L0(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 l=(o.length?o[o.length-1]:e).contentMatch;for(let a=r;l&&a<i;a++)l=l.matchType(n.child(a).type);return!l||!l.validEnd?null:o}function F0(t,e,n){let r=E.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let u=n[o].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=E.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new le(i,s,i,s,new M(r,0,0),n.length,!0))}function P0(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,u)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&z0(t.doc,t.mapping.slice(s).map(u),r)){let a=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?a=!1:!h&&p&&(a=!0)}a===!1&&Lc(t,o,u,s),Bo(t,t.mapping.slice(s).map(u,1),r,void 0,a===null);let c=t.mapping.slice(s),d=c.map(u,1),f=c.map(u+o.nodeSize,1);return t.step(new le(d,f,d+1,f-1,new M(E.from(r.create(l,null,o.marks)),0,0),1,!0)),a===!0&&Ic(t,o,u,s),!1}})}function Ic(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,u=/\r?\n|\r/g;for(;o=u.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Lc(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(`
`))}})}function z0(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function B0(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 le(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new M(E.from(o),0,0),1,!0))}function ct(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 a=i.depth-1,c=n-2;a>s;a--,c--){let d=i.node(a),f=i.index(a);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let u=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(u,u,l?l.type:i.node(s+1).type)}function $0(t,e,n=1,r){let i=t.doc.resolve(e),s=E.empty,o=E.empty;for(let u=i.depth,l=i.depth-n,a=n-1;u>l;u--,a--){s=E.from(i.node(u).copy(s));let c=r&&r[a];o=E.from(c?c.type.create(c.attrs,o):i.node(u).copy(o))}t.step(new ee(e,e,new M(s.append(o),n,n),!0))}function Rt(t,e){let n=t.resolve(e),r=n.index();return Fc(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function j0(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 Fc(t,e){return!!(t&&e&&!t.isLeaf&&j0(t,e))}function ji(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,u=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),u++,o=r.node(i).maybeChild(u)):(s=r.node(i).maybeChild(u-1),o=r.node(i+1)),s&&!s.isTextblock&&Fc(s,o)&&r.node(i).canReplace(u,u+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function H0(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",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let u=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);Lc(t,c.node(),c.before(),u)}o.inlineContent&&Bo(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(u),a=l.map(e-n);if(t.step(new ee(a,l.map(e+n,-1),M.empty,!0)),r===!0){let c=t.doc.resolve(a);Ic(t,c.node(),c.before(),t.steps.length)}return t}function q0(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 Pc(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 u=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(u>0?1:0),a=r.node(o),c=!1;if(s==1)c=a.canReplace(l,l,i);else{let d=a.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&a.canReplaceWith(l,l,d[0])}if(c)return u==0?r.pos:u<0?r.before(o+1):r.after(o+1)}return null}function Hi(t,e,n=e,r=M.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return zc(i,s,r)?new ee(e,n,r):new V0(i,s,r).fit()}function zc(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class V0{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=E.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=E.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let a=this.findFittable();a?this.placeNodes(a):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,u=i.depth;for(;o&&u&&s.childCount==1;)s=s.firstChild.content,o--,u--;let l=new M(s,o,u);return e>-1?new le(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new ee(r.pos,i.pos,l):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=cs(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:l,match:a}=this.frontier[u],c,d=null;if(n==1&&(o?a.matchType(o.type)||(d=a.fillBefore(E.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:d};if(n==2&&o&&(c=a.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:c};if(s&&a.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=cs(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=cs(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new M(Nn(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new M(Nn(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,u=r?r.content:o.content,l=o.openStart-e,a=0,c=[],{match:d,type:f}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let h=u.size+e-(o.content.size-o.openEnd);for(;a<u.childCount;){let m=u.child(a),g=d.matchType(m.type);if(!g)break;a++,(a>1||l==0||m.content.size)&&(d=g,c.push(Bc(m.mark(f.allowedMarks(m.marks)),a==1?l:0,a==u.childCount?h:-1)))}let p=a==u.childCount;p||(h=-1),this.placed=On(this.placed,n,E.from(c)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=u;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?M.empty:new M(Nn(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new M(Nn(o.content,e,a),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!ds(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=ds(e,n,i,r,s);if(o){for(let u=n-1;u>=0;u--){let{match:l,type:a}=this.frontier[u],c=ds(e,u,a,l,!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=On(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=On(this.placed,this.depth,E.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(E.empty,!0);n.childCount&&(this.placed=On(this.placed,this.frontier.length,n))}}function Nn(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Nn(t.firstChild.content,e-1,n)))}function On(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(On(t.lastChild.content,e-1,n)))}function cs(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Bc(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Bc(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(E.empty,!0)))),t.copy(r)}function ds(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 u=r.fillBefore(s.content,!0,o);return u&&!W0(n,s.content,o)?u:null}function W0(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function U0(t){return t.spec.defining||t.spec.definingForContent}function K0(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(zc(i,s,r))return t.step(new ee(e,n,r));let o=jc(i,s);o[o.length-1]==0&&o.pop();let u=-(i.depth+1);o.unshift(u);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?u=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(u),a=[],c=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(a.push(p),h==r.openStart)break;f=p.content}for(let f=c-1;f>=0;f--){let h=a[f],p=U0(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(u)-1)))c=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+c+1)%(r.openStart+1),p=a[h];if(p)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],b=!0;g<0&&(b=!1,g=-g);let y=i.node(g-1),k=i.index(g-1);if(y.canReplaceWith(k,k,p.type,p.marks))return t.replace(i.before(g),b?s.after(g):n,new M($c(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function $c(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy($c(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(E.empty,!0))}return t}function J0(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=q0(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new M(E.from(r),0,0))}function G0(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),u=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(u=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(u=!0);if(!u){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=jc(r,i);for(let o=0;o<s.length;o++){let u=s[o],l=o==s.length-1;if(l&&u==0||r.node(u).type.contentMatch.validEnd)return t.delete(r.start(u),i.end(u));if(u>0&&(l||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return t.delete(r.before(u),i.after(u))}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 jc(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 fn extends ye{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 te.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 te.fromReplace(e,this.pos,this.pos+1,new M(E.from(i),0,n.isLeaf?0:1))}getMap(){return Te.empty}invert(e){return new fn(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 fn(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 fn(n.pos,n.attr,n.value)}}ye.jsonID("attr",fn);class Zn extends ye{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 te.ok(r)}getMap(){return Te.empty}invert(e){return new Zn(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 Zn(n.attr,n.value)}}ye.jsonID("docAttr",Zn);let mn=class extends Error{};mn=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};mn.prototype=Object.create(Error.prototype);mn.prototype.constructor=mn;mn.prototype.name="TransformError";class jo{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Gn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new mn(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,u,l)=>{e=Math.min(e,u),n=Math.max(n,l)})}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=M.empty){let i=Hi(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new M(E.from(r),0,0))}delete(e,n){return this.replace(e,n,M.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return K0(this,e,n,r),this}replaceRangeWith(e,n,r){return J0(this,e,n,r),this}deleteRange(e,n){return G0(this,e,n),this}lift(e,n){return R0(this,e,n),this}join(e,n=1){return H0(this,e,n),this}wrap(e,n){return F0(this,e,n),this}setBlockType(e,n=e,r,i=null){return P0(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return B0(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new fn(e,n,r)),this}setDocAttribute(e,n){return this.step(new Zn(e,n)),this}addNodeMark(e,n){return this.step(new Et(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 B)n.isInSet(r.marks)&&this.step(new Zt(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Zt(e,s)),i=s.removeFromSet(i);for(let u=o.length-1;u>=0;u--)this.step(o[u])}return this}split(e,n=1,r){return $0(this,e,n,r),this}addMark(e,n,r){return D0(this,e,n,r),this}removeMark(e,n,r){return N0(this,e,n,r),this}clearIncompatible(e,n,r){return Bo(this,e,n,r),this}}const fs=Object.create(null);class R{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Hc(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=M.empty){let r=n.content.lastChild,i=null;for(let u=0;u<n.openEnd;u++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let u=0;u<o.length;u++){let{$from:l,$to:a}=o[u],c=e.mapping.slice(s);e.replaceRange(c.map(l.pos),c.map(a.pos),u?M.empty:n),u==0&&Qu(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:u}=i[s],l=e.mapping.slice(r),a=l.map(o.pos),c=l.map(u.pos);s?e.deleteRange(a,c):(e.replaceRangeWith(a,c,n),Qu(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new N(e):ln(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?ln(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):ln(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 De(e.node(0))}static atStart(e){return ln(e,e,0,0,1)||new De(e)}static atEnd(e){return ln(e,e,e.content.size,e.childCount,-1)||new De(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=fs[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 fs)throw new RangeError("Duplicate use of selection JSON ID "+e);return fs[e]=n,n.prototype.jsonID=e,n}getBookmark(){return N.between(this.$anchor,this.$head).getBookmark()}}R.prototype.visible=!0;class Hc{constructor(e,n){this.$from=e,this.$to=n}}let Xu=!1;function Yu(t){!Xu&&!t.parent.inlineContent&&(Xu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class N extends R{constructor(e,n=e){Yu(e),Yu(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 R.near(r);let i=e.resolve(n.map(this.anchor));return new N(i.parent.inlineContent?i:r,r)}replace(e,n=M.empty){if(super.replace(e,n),n==M.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof N&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new qi(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 N(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=R.findFrom(n,r,!0)||R.findFrom(n,-r,!0);if(s)n=s.$head;else return R.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(R.findFrom(e,-r,!0)||R.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new N(e,n)}}R.jsonID("text",N);class qi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new qi(e.map(this.anchor),e.map(this.head))}resolve(e){return N.between(e.resolve(this.anchor),e.resolve(this.head))}}class O extends R{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?R.near(s):new O(s)}content(){return new M(E.from(this.node),0,0)}eq(e){return e instanceof O&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ho(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new O(e.resolve(n.anchor))}static create(e,n){return new O(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}O.prototype.visible=!1;R.jsonID("node",O);class Ho{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new qi(r,r):new Ho(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&O.isSelectable(r)?new O(n):R.near(n)}}class De extends R{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=M.empty){if(n==M.empty){e.delete(0,e.doc.content.size);let r=R.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new De(e)}map(e){return new De(e)}eq(e){return e instanceof De}getBookmark(){return Z0}}R.jsonID("all",De);const Z0={map(){return this},resolve(t){return new De(t)}};function ln(t,e,n,r,i,s=!1){if(e.inlineContent)return N.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let u=e.child(o);if(u.isAtom){if(!s&&O.isSelectable(u))return O.create(t,n-(i<0?u.nodeSize:0))}else{let l=ln(t,u,n+i,i<0?u.childCount:0,i,s);if(l)return l}n+=u.nodeSize*i}return null}function Qu(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof ee||i instanceof le))return;let s=t.mapping.maps[r],o;s.forEach((u,l,a,c)=>{o==null&&(o=c)}),t.setSelection(R.near(t.doc.resolve(o),n))}const el=1,kr=2,tl=4;class X0 extends jo{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|el)&~kr,this.storedMarks=null,this}get selectionSet(){return(this.updated&el)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=kr,this}ensureMarks(e){return B.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&kr)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~kr,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)||B.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(R.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|=tl,this}get scrolledIntoView(){return(this.updated&tl)>0}}function nl(t,e){return!e||!t?t:t.bind(e)}class Rn{constructor(e,n,r){this.name=e,this.init=nl(n.init,r),this.apply=nl(n.apply,r)}}const Y0=[new Rn("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Rn("selection",{init(t,e){return t.selection||R.atStart(e.doc)},apply(t){return t.selection}}),new Rn("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Rn("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class hs{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Y0.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 Rn(r.key,r.spec.state,r))})}}class dn{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 u=this.config.plugins[o];if(u.spec.appendTransaction){let l=i?i[o].n:0,a=i?i[o].state:this,c=l<n.length&&u.spec.appendTransaction.call(u,l?n.slice(l):n,a,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<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 dn(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 X0(this)}static create(e){let n=new hs(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new dn(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 hs(this.schema,e.plugins),r=n.fields,i=new dn(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 hs(e.schema,e.plugins),s=new dn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=At.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=R.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 u in r){let l=r[u],a=l.spec.state;if(l.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(n,u)){s[o.name]=a.fromJSON.call(l,e,n[u],s);return}}s[o.name]=o.init(e,s)}}),s}}function qc(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=qc(i,e,{})),n[r]=i}return n}class V{constructor(e){this.spec=e,this.props={},e.props&&qc(e.props,this,this.props),this.key=e.key?e.key.key:Vc("plugin")}getState(e){return e[this.key]}}const ps=Object.create(null);function Vc(t){return t in ps?t+"$"+ ++ps[t]:(ps[t]=0,t+"$")}class G{constructor(e="key"){this.key=Vc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qo=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Wc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Uc=(t,e,n)=>{let r=Wc(t,n);if(!r)return!1;let i=Vo(r);if(!i){let o=r.blockRange(),u=o&&Sn(o);return u==null?!1:(e&&e(t.tr.lift(o,u).scrollIntoView()),!0)}let s=i.nodeBefore;if(td(t,i,e,-1))return!0;if(r.parent.content.size==0&&(gn(s,"end")||O.isSelectable(s)))for(let o=r.depth;;o--){let u=Hi(t.doc,r.before(o),r.after(o),M.empty);if(u&&u.slice.size<u.to-u.from){if(e){let l=t.tr.step(u);l.setSelection(gn(s,"end")?R.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):O.create(l.doc,i.pos-s.nodeSize)),e(l.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},Q0=(t,e,n)=>{let r=Wc(t,n);if(!r)return!1;let i=Vo(r);return i?Kc(t,i,e):!1},em=(t,e,n)=>{let r=Gc(t,n);if(!r)return!1;let i=Wo(r);return i?Kc(t,i,e):!1};function Kc(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,u=o,l=e.pos+1;for(;!u.isTextblock;l++){if(u.type.spec.isolating)return!1;let c=u.firstChild;if(!c)return!1;u=c}let a=Hi(t.doc,s,l,M.empty);if(!a||a.from!=s||a instanceof ee&&a.slice.size>=l-s)return!1;if(n){let c=t.tr.step(a);c.setSelection(N.create(c.doc,s)),n(c.scrollIntoView())}return!0}function gn(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 Jc=(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=Vo(r)}let o=s&&s.nodeBefore;return!o||!O.isSelectable(o)?!1:(e&&e(t.tr.setSelection(O.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Vo(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 Gc(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Zc=(t,e,n)=>{let r=Gc(t,n);if(!r)return!1;let i=Wo(r);if(!i)return!1;let s=i.nodeAfter;if(td(t,i,e,1))return!0;if(r.parent.content.size==0&&(gn(s,"start")||O.isSelectable(s))){let o=Hi(t.doc,r.before(),r.after(),M.empty);if(o&&o.slice.size<o.to-o.from){if(e){let u=t.tr.step(o);u.setSelection(gn(s,"start")?R.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):O.create(u.doc,u.mapping.map(i.pos))),e(u.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},Xc=(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=Wo(r)}let o=s&&s.nodeAfter;return!o||!O.isSelectable(o)?!1:(e&&e(t.tr.setSelection(O.create(t.doc,s.pos)).scrollIntoView()),!0)};function Wo(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 tm=(t,e)=>{let n=t.selection,r=n instanceof O,i;if(r){if(n.node.isTextblock||!Rt(t.doc,n.from))return!1;i=n.from}else if(i=ji(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(O.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},nm=(t,e)=>{let n=t.selection,r;if(n instanceof O){if(n.node.isTextblock||!Rt(t.doc,n.to))return!1;r=n.to}else if(r=ji(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},rm=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Sn(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Yc=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
`).scrollIntoView()),!0)};function Uo(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 im=(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=Uo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let u=n.after(),l=t.tr.replaceWith(u,u,o.createAndFill());l.setSelection(R.near(l.doc.resolve(u),1)),e(l.scrollIntoView())}return!0},Qc=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof De||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Uo(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,u=t.tr.insert(o,s.createAndFill());u.setSelection(N.create(u.doc,o+1)),e(u.scrollIntoView())}return!0},ed=(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(ct(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Sn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function sm(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof O&&e.selection.node.isBlock)return!r.parentOffset||!ct(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,u,l=!1,a=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),a=r.start(h)==r.pos-(r.depth-h),u=Uo(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(l&&u?{type:u}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof N||e.selection instanceof De)&&c.deleteSelection();let d=c.mapping.map(r.pos),f=ct(c.doc,d,s.length,s);if(f||(s[0]=u?{type:u}:null,f=ct(c.doc,d,s.length,s)),!f)return!1;if(c.split(d,s.length,s),!l&&a&&r.node(o).type!=u){let h=c.mapping.map(r.before(o)),p=c.doc.resolve(h);u&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,u)&&c.setNodeMarkup(c.mapping.map(r.before(o)),u)}return n&&n(c.scrollIntoView()),!0}}const om=sm(),um=(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(O.create(t.doc,i))),!0)};function lm(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||Rt(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function td(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,u,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&lm(t,e,n))return!0;let a=!l&&e.parent.canReplace(e.index(),e.index()+1);if(a&&(o=(u=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&u.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=E.empty;for(let b=o.length-1;b>=0;b--)p=E.from(o[b].create(null,p));p=E.from(i.copy(p));let m=t.tr.step(new le(e.pos-1,h,e.pos,h,new M(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Rt(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&l?null:R.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&Sn(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(a&&gn(s,"start",!0)&&gn(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=E.empty;for(let k=p.length-1;k>=0;k--)b=E.from(p[k].copy(b));let y=t.tr.step(new le(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new M(b,p.length,0),0,!0));n(y.scrollIntoView())}return!0}}return!1}function nd(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(N.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const am=nd(-1),cm=nd(1);function dm(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),u=o&&$o(o,t,e);return u?(r&&r(n.tr.wrap(o,u).scrollIntoView()),!0):!1}}function rl(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:u}}=n.selection.ranges[s];n.doc.nodesBetween(o,u,(l,a)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(a),d=c.index();i=c.parent.canReplaceWith(d,d+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:u},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(u,l,t,e)}r(s.scrollIntoView())}return!0}}function Ko(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Ko(qo,Uc,Jc);Ko(qo,Zc,Xc);Ko(Yc,Qc,ed,om);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function fm(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let u=r?n.tr:null;return hm(u,o,t,e)?(r&&r(u.scrollIntoView()),!0):!1}}function hm(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 l=o.resolve(e.start-2);s=new Jr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Jr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let u=$o(s,n,r,e);return u?(t&&pm(t,e,u,i,n),!0):!1}function pm(t,e,n,r,i){let s=E.empty;for(let c=n.length-1;c>=0;c--)s=E.from(n[c].type.create(n[c].attrs,s));t.step(new le(e.start-(r?2:0),e.end,e.start,e.end,new M(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 u=n.length-o,l=e.start+n.length-(r?2:0),a=e.parent;for(let c=e.startIndex,d=e.endIndex,f=!0;c<d;c++,f=!1)!f&&ct(t.doc,l,u)&&(t.split(l,u),l+=2*u),l+=a.child(c).nodeSize;return t}function mm(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?gm(e,n,t,s):bm(e,n,s):!0:!1}}function gm(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new le(s-1,o,s,o,new M(E.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Jr(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const u=Sn(r);if(u==null)return!1;i.lift(r,u);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Rt(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function bm(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 u=n.startIndex==0,l=n.endIndex==i.childCount,a=s.node(-1),c=s.index(-1);if(!a.canReplace(c+(u?0:1),c+1,o.content.append(l?E.empty:E.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new le(d-(u?1:0),f+(l?1:0),d+1,f-1,new M((u?E.empty:E.from(i.copy(E.empty))).append(l?E.empty:E.from(i.copy(E.empty))),u?0:1,l?0:1),u?0:1)),e(r.scrollIntoView()),!0}function xm(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let u=s.parent,l=u.child(o-1);if(l.type!=t)return!1;if(n){let a=l.lastChild&&l.lastChild.type==u.type,c=E.from(a?t.create():null),d=new M(E.from(t.create(null,E.from(u.type.create(null,c)))),a?3:1,0),f=s.start,h=s.end;n(e.tr.step(new le(f-(a?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const de=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},bn=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let to=null;const ut=function(t,e,n){let r=to||(to=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},ym=function(){to=null},Xt=function(t,e,n,r){return n&&(il(t,e,n,r,-1)||il(t,e,n,r,1))},km=/^(img|br|input|textarea|hr)$/i;function il(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Pe(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ar(t)||km.test(t.nodeName)||t.contentEditable=="false")return!1;e=de(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Pe(t):0}else return!1}}function Pe(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wm(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Pe(t)}else if(t.parentNode&&!ar(t))e=de(t),t=t.parentNode;else return null}}function Cm(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ar(t))e=de(t)+1,t=t.parentNode;else return null}}function Em(t,e,n){for(let r=e==0,i=e==Pe(t);r||i;){if(t==n)return!0;let s=de(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Pe(t)}}function ar(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 Vi=function(t){return t.focusNode&&Xt(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Pt(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Sm(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function vm(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Pe(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Pe(r.startContainer),r.startOffset)}}}const Ze=typeof navigator<"u"?navigator:null,sl=typeof document<"u"?document:null,It=Ze&&Ze.userAgent||"",no=/Edge\/(\d+)/.exec(It),rd=/MSIE \d/.exec(It),ro=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(It),ve=!!(rd||ro||no),Mt=rd?document.documentMode:ro?+ro[1]:no?+no[1]:0,ze=!ve&&/gecko\/(\d+)/i.test(It);ze&&+(/Firefox\/(\d+)/.exec(It)||[0,0])[1];const io=!ve&&/Chrome\/(\d+)/.exec(It),he=!!io,id=io?+io[1]:0,me=!ve&&!!Ze&&/Apple Computer/.test(Ze.vendor),xn=me&&(/Mobile\/\w+/.test(It)||!!Ze&&Ze.maxTouchPoints>2),Fe=xn||(Ze?/Mac/.test(Ze.platform):!1),sd=Ze?/Win/.test(Ze.platform):!1,lt=/Android \d/.test(It),cr=!!sl&&"webkitFontSmoothing"in sl.documentElement.style,Am=cr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Mm(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 nt(t,e){return typeof t=="number"?t:t[e]}function Tm(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 ol(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=bn(o);continue}let u=o,l=u==s.body,a=l?Mm(s):Tm(u),c=0,d=0;if(e.top<a.top+nt(r,"top")?d=-(a.top-e.top+nt(i,"top")):e.bottom>a.bottom-nt(r,"bottom")&&(d=e.bottom-e.top>a.bottom-a.top?e.top+nt(i,"top")-a.top:e.bottom-a.bottom+nt(i,"bottom")),e.left<a.left+nt(r,"left")?c=-(a.left-e.left+nt(i,"left")):e.right>a.right-nt(r,"right")&&(c=e.right-a.right+nt(i,"right")),c||d)if(l)s.defaultView.scrollBy(c,d);else{let h=u.scrollLeft,p=u.scrollTop;d&&(u.scrollTop+=d),c&&(u.scrollLeft+=c);let m=u.scrollLeft-h,g=u.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:bn(o)}}function _m(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 u=t.root.elementFromPoint(s,o);if(!u||u==t.dom||!t.dom.contains(u))continue;let l=u.getBoundingClientRect();if(l.top>=n-20){r=u,i=l.top;break}}return{refDOM:r,refTop:i,stack:od(t.dom)}}function od(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=bn(r));return e}function Dm({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;ud(n,r==0?0:r-e)}function ud(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 sn=null;function Nm(t){if(t.setActive)return t.setActive();if(sn)return t.focus(sn);let e=od(t);t.focus(sn==null?{get preventScroll(){return sn={preventScroll:!0},!0}}:void 0),sn||(sn=!1,ud(e,0))}function ld(t,e){let n,r=2e8,i,s=0,o=e.top,u=e.top,l,a;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=ut(c).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=u){o=Math.max(p.bottom,o),u=Math.min(p.top,u);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&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=c,a={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=d+1)}}return!n&&l&&(n=l,i=a,r=0),n&&n.nodeType==3?Om(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:ld(n,i)}function Om(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=pt(r,1);if(o.top!=o.bottom&&Jo(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 Jo(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Rm(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Im(t,e,n){let{node:r,offset:i}=ld(e,n),s=-1;if(r.nodeType==1&&!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 Lm(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let u=t.docView.nearestDesc(s,!0),l;if(!u)return null;if(u.dom.nodeType==1&&(u.node.isBlock&&u.parent||!u.contentDOM)&&((l=u.dom.getBoundingClientRect()).width||l.height)&&(u.node.isBlock&&u.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(u.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=u.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=u.posAfter),o=!0),!u.contentDOM&&i<0&&!u.node.isText))return(u.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?u.posBefore:u.posAfter;s=u.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function ad(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(o.nodeType==1){let u=o.getClientRects();for(let l=0;l<u.length;l++){let a=u[l];if(Jo(e,a))return ad(o,e,a)}}if((s=(s+1)%r)==i)break}return t}function Fm(t,e){let n=t.dom.ownerDocument,r,i=0,s=vm(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),u;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let a=t.dom.getBoundingClientRect();if(!Jo(e,a)||(o=ad(t.dom,e,a),!o))return null}if(me)for(let a=o;r&&a;a=bn(a))a.draggable&&(r=void 0);if(o=Rm(o,e),r){if(ze&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let a;cr&&i&&r.nodeType==1&&(a=r.childNodes[i-1]).nodeType==1&&a.contentEditable=="false"&&a.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?u=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(u=Lm(t,r,i,e))}u==null&&(u=Im(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:u,inside:l?l.posAtStart-l.border:-1}}function ul(t){return t.top<t.bottom||t.left<t.right}function pt(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(ul(r))return r}return Array.prototype.find.call(n,ul)||t.getBoundingClientRect()}const Pm=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function cd(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=cr||ze;if(r.nodeType==3)if(o&&(Pm.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=pt(ut(r,i,i),n);if(ze&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let a=pt(ut(r,i-1,i-1),-1);if(a.top==l.top){let c=pt(ut(r,i,i+1),-1);if(c.top!=l.top)return An(c,c.left<a.left)}}return l}else{let l=i,a=i,c=n<0?1:-1;return n<0&&!i?(a++,c=-1):n>=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:a++,An(pt(ut(r,l,a),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Pe(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return ms(l.getBoundingClientRect(),!1)}if(s==null&&i<Pe(r)){let l=r.childNodes[i];if(l.nodeType==1)return ms(l.getBoundingClientRect(),!0)}return ms(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Pe(r))){let l=r.childNodes[i-1],a=l.nodeType==3?ut(l,Pe(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(a)return An(pt(a,1),!1)}if(s==null&&i<Pe(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let a=l?l.nodeType==3?ut(l,0,o?0:1):l.nodeType==1?l:null:null;if(a)return An(pt(a,-1),!0)}return An(pt(r.nodeType==3?ut(r):r,-n),n>=0)}function An(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 ms(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 dd(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 zm(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return dd(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let u=t.docView.nearestDesc(s,!0);if(!u)break;if(u.node.isBlock){s=u.contentDOM||u.dom;break}s=u.dom.parentNode}let o=cd(t,i.pos,1);for(let u=s.firstChild;u;u=u.nextSibling){let l;if(u.nodeType==1)l=u.getClientRects();else if(u.nodeType==3)l=ut(u,0,u.nodeValue.length).getClientRects();else continue;for(let a=0;a<l.length;a++){let c=l[a];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 Bm=/[\u0590-\u08ac]/;function $m(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,u=t.domSelection();return u?!Bm.test(r.parent.textContent)||!u.modify?n=="left"||n=="backward"?s:o:dd(t,e,()=>{let{focusNode:l,focusOffset:a,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=u.caretBidiLevel;u.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&a==m;try{u.collapse(c,d),l&&(l!=c||a!=d)&&u.extend&&u.extend(l,a)}catch{}return f!=null&&(u.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let ll=null,al=null,cl=!1;function jm(t,e,n){return ll==e&&al==n?cl:(ll=e,al=n,cl=n=="up"||n=="down"?zm(t,e,n):$m(t,e,n))}const Be=0,dl=1,zt=2,Xe=3;class dr{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Be,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){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&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))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>de(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;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)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):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 u=i.children[o];if(u.size){i=u;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],u=s+o.size;if(u>e||o instanceof hd){i=e-s;break}s=u}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof fd&&s.side>=0;r--);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?de(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?de(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,u=0;;u++){let l=this.children[u],a=o+l.size;if(i==-1&&e<=a){let c=o+l.border;if(e>=c&&n<=a-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=o;for(let d=u;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=de(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(a>n||u==this.children.length-1)){n=a;for(let c=u+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=de(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=a}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(n.nodeType!=1||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 u=this.domFromPos(e,e?-1:1),l=n==e?u:this.domFromPos(n,n?-1:1),a=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((ze||me)&&e==n){let{node:h,offset:p}=u;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
`),d&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(u=l={node:g.parentNode,offset:de(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(ze&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&me)&&Xt(u.node,u.offset,c.anchorNode,c.anchorOffset)&&Xt(l.node,l.offset,c.focusNode,c.focusOffset))return;let f=!1;if((a.extend||e==n)&&!(d&&ze)){a.collapse(u.node,u.offset);try{e!=n&&a.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=u;u=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(u.node,u.offset),a.removeAllRanges(),a.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 u=r+s.border,l=o-s.border;if(e>=u&&n<=l){this.dirty=e==r||n==o?zt:dl,e==u&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Xe:s.markDirty(e-u,n-u);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?zt:Xe}r=o}this.dirty=zt}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?zt:dl;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class fd extends dr{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){if(o.nodeType!=1){let u=document.createElement("span");u.appendChild(o),o=u}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Be&&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 Hm extends dr{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 Yt extends dr{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=nn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Yt(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Xe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Xe&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Be){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Be}}slice(e,n,r){let i=Yt.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=oo(s,n,o,r)),e>0&&(s=oo(s,0,e,r));for(let u=0;u<s.length;u++)s[u].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 Tt extends dr{constructor(e,n,r,i,s,o,u,l,a){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=u}static create(e,n,r,i,s,o){let u=s.nodeViews[n.type.name],l,a=u&&u(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=a&&a.dom,d=a&&a.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=nn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=gd(c,r,n),a?l=new qm(e,n,r,i,c,d||null,f,a,s,o+1):n.isText?new Wi(e,n,r,i,c,f,s):new Tt(e,n,r,i,c,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>E.empty)}return e}matchesNode(e,n,r){return this.dirty==Be&&e.eq(this.node)&&Zr(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,u=s&&s.pos<0,l=new Wm(this,o&&o.node,e);Jm(this.node,this.innerDeco,(a,c,d)=>{a.spec.marks?l.syncToMarks(a.spec.marks,r,e,c):a.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?B.none:this.node.child(c).marks,r,e,c),l.placeWidget(a,e,i)},(a,c,d,f)=>{l.syncToMarks(a.marks,r,e,f);let h;l.findNodeMatch(a,c,d,f)||u&&e.state.selection.from>i&&e.state.selection.to<i+a.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(a,c,d,h,e)||l.updateNextNode(a,c,d,e,f,i)||l.addNode(a,c,d,e,i),i+=a.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==zt)&&(o&&this.protectLocalComposition(e,o),pd(this.contentDOM,this.children,e),xn&&Gm(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof N)||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,u=Zm(this.node.content,o,r-n,i-n);return u<0?null:{node:s,pos:u,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 Hm(this,s,n,i);e.input.compositionNodes.push(o),this.children=oo(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Xe||!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=Be}updateOuterDeco(e){if(Zr(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=md(this.dom,this.nodeDOM,so(this.outerDeco,this.node,n),so(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function fl(t,e,n,r,i){gd(r,e,t);let s=new Tt(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Wi extends Tt{constructor(e,n,r,i,s,o,u){super(e,n,r,i,s,null,o,u,0)}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==Xe||this.dirty!=Be&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Be||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=Be,!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 Wi(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Xe)}get domAtom(){return!1}isText(e){return this.node.text==e}}class hd extends dr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Be&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class qm extends Tt{constructor(e,n,r,i,s,o,u,l,a,c){super(e,n,r,i,s,o,u,a,c),this.spec=l}update(e,n,r,i){if(this.dirty==Xe)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 pd(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],u=o.dom;if(u.parentNode==t){for(;u!=r;)r=hl(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(u,r);if(o instanceof Yt){let l=r?r.previousSibling:t.lastChild;pd(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=hl(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const zn=function(t){t&&(this.nodeName=t)};zn.prototype=Object.create(null);const Bt=[new zn];function so(t,e,n){if(t.length==0)return Bt;let r=n?Bt[0]:new zn,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new zn(o.nodeName));for(let u in o){let l=o[u];l!=null&&(n&&i.length==1&&i.push(r=new zn(e.isInline?"span":"div")),u=="class"?r.class=(r.class?r.class+" ":"")+l:u=="style"?r.style=(r.style?r.style+";":"")+l:u!="nodeName"&&(r[u]=l))}}}return i}function md(t,e,n,r){if(n==Bt&&r==Bt)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],u=n[s];if(s){let l;u&&u.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),u=Bt[0]),i=l}Vm(i,u||Bt[0],o)}return i}function Vm(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 gd(t,e,n){return md(t,t,Bt,so(e,n,t.nodeType!=1))}function Zr(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 hl(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Wm{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Um(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,u=Math.min(o,e.length);for(;s<u&&(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=Be,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,a=this.top.children.length;i<this.preMatch.index&&(a=Math.min(this.index+3,a));for(let c=this.index;c<a;c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=Yt.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 u=this.index,l=Math.min(this.top.children.length,u+5);u<l;u++){let a=this.top.children[u];if(a.matchesNode(e,n,r)&&!this.preMatch.matched.has(a)){s=u;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==Xe&&o.dom==o.contentDOM&&(o.dirty=zt),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 u=this.index;u<this.top.children.length;u++){let l=this.top.children[u];if(l instanceof Tt){let a=this.preMatch.matched.get(l);if(a!=null&&a!=s)return!1;let c=l.dom,d,f=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Xe&&Zr(n,l.outerDeco));if(!f&&l.update(e,n,r,i))return this.destroyBetween(this.index,u),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,u),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=zt,d.updateChildren(i,o+1),d.dirty=Be),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)||!Zr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let u=Tt.create(this.top,n,r,i,s,o);if(u.contentDOM){u.children=e.children,e.children=[];for(let l of u.children)l.parent=u}return e.destroy(),u}addNode(e,n,r,i,s){let o=Tt.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 fd(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 Yt;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Wi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((me||he)&&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 hd(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||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Um(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let u;for(;;)if(r){let a=n.children[r-1];if(a instanceof Yt)n=a,r=a.children.length;else{u=a,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=u.node;if(l){if(l!=t.child(i-1))break;--i,s.set(u,i),o.push(u)}}return{index:i,matched:s,matches:o.reverse()}}function Km(t,e){return t.type.side-e.type.side}function Jm(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let a=0;a<t.childCount;a++){let c=t.child(a);r(c,i,e.forChild(s,c),a),s+=c.nodeSize}return}let o=0,u=[],l=null;for(let a=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(c?(d||(d=[c])).push(g):c=g)}if(c)if(d){d.sort(Km);for(let g=0;g<d.length;g++)n(d[g],a,!!l)}else n(c,a,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(a<t.childCount)h=a,f=t.child(a++);else break;for(let g=0;g<u.length;g++)u[g].to<=s&&u.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)u.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<u.length;b++)u[b].to<g&&(g=u[b].to);g<p&&(l=f.cut(g-s),f=f.cut(0,g-s),p=g,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?u.filter(g=>!g.inline):u.slice();r(f,m,e.forChild(s,f),h),s=p}}function Gm(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 Zm(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),u=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let a=t.child(i++);if(s+=a.nodeSize,!a.isText)break;l+=a.text}if(s>=n){if(s>=r&&l.slice(r-e.length-u,r-u)==e)return r-e.length;let a=u<r?l.lastIndexOf(e,r-u-1):-1;if(a>=0&&a+e.length+u>=n)return u+a;if(n==r&&l.length>=r+e.length-u&&l.slice(r-u,r-u+e.length)==e)return r}}return-1}function oo(t,e,n,r,i){let s=[];for(let o=0,u=0;o<t.length;o++){let l=t[o],a=u,c=u+=l.size;a>=n||c<=e?s.push(l):(a<e&&s.push(l.slice(0,e-a,r)),i&&(s.push(i),i=void 0),c>n&&s.push(l.slice(n-a,l.size,r)))}return s}function Go(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 u=r.resolve(o),l,a;if(Vi(n)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&O.isSelectable(d)&&i.parent&&!(d.isInline&&Em(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;a=new O(o==f?u:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=f==t.state.selection.anchor?[f,d]:[d,f],u=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!a){let d=e=="pointer"||t.state.selection.head<u.pos&&!s?1:-1;a=Zo(t,c,u,d)}return a}function bd(t){return t.editable?t.hasFocus():yd(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function dt(t,e=!1){let n=t.state.selection;if(xd(t,n),!!bd(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&he){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Xt(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ym(t);else{let{anchor:r,head:i}=n,s,o;pl&&!(n instanceof N)&&(n.$from.parent.inlineContent||(s=ml(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=ml(t,n.to))),t.docView.setSelection(r,i,t,e),pl&&(s&&gl(s),o&&gl(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Xm(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const pl=me||he&&id<63;function ml(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(me&&i&&i.contentEditable=="false")return gs(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return gs(i);if(s)return gs(s)}}function gs(t){return t.contentEditable="true",me&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function gl(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Xm(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(()=>{(!bd(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ym(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,de(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ve&&Mt<=11&&(n.disabled=!0,n.disabled=!1)}function xd(t,e){if(e instanceof O){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(bl(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else bl(t)}function bl(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Zo(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||N.between(e,n,r)}function xl(t){return t.editable&&!t.hasFocus()?!1:yd(t)}function yd(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Qm(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Xt(e.node,e.offset,n.anchorNode,n.anchorOffset)}function uo(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&&R.findFrom(s,e)}function mt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function yl(t,e,n){let r=t.state.selection;if(r instanceof N)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 mt(t,new N(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=uo(t.state,e);return i&&i instanceof O?mt(t,i):!1}else if(!(Fe&&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 u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(u))&&!o.contentDOM?O.isSelectable(s)?mt(t,new O(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):cr?mt(t,new N(t.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof O&&r.node.isInline)return mt(t,new N(e>0?r.$to:r.$from));{let i=uo(t.state,e);return i?mt(t,i):!1}}}function Xr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Bn(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function on(t,e){return e<0?e1(t):t1(t)}function e1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(ze&&n.nodeType==1&&r<Xr(n)&&Bn(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let u=n.childNodes[r-1];if(Bn(u,-1))i=n,s=--r;else if(u.nodeType==3)n=u,r=n.nodeValue.length;else break}}else{if(kd(n))break;{let u=n.previousSibling;for(;u&&Bn(u,-1);)i=n.parentNode,s=de(u),u=u.previousSibling;if(u)n=u,r=Xr(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?lo(t,n,r):i&&lo(t,i,s)}function t1(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Xr(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let u=n.childNodes[r];if(Bn(u,1))s=n,o=++r;else break}else{if(kd(n))break;{let u=n.nextSibling;for(;u&&Bn(u,1);)s=u.parentNode,o=de(u)+1,u=u.nextSibling;if(u)n=u,r=0,i=Xr(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&lo(t,s,o)}function kd(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function n1(t,e){for(;t&&e==t.childNodes.length&&!ar(t);)e=de(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function r1(t,e){for(;t&&!e&&!ar(t);)e=de(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function lo(t,e,n){if(e.nodeType!=3){let s,o;(o=n1(e,n))?(e=o,n=0):(s=r1(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Vi(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&&dt(t)},50)}function kl(t,e){let n=t.state.doc.resolve(e);if(!(he||sd)&&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 wl(t,e,n){let r=t.state.selection;if(r instanceof N&&!r.empty||n.indexOf("s")>-1||Fe&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=uo(t.state,e);if(o&&o instanceof O)return mt(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,u=r instanceof De?R.near(o,e):R.findFrom(o,e);return u?mt(t,u):!1}return!1}function Cl(t,e){if(!(t.state.selection instanceof N))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 El(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function i1(t){if(!me||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;El(t,r,"true"),setTimeout(()=>El(t,r,"false"),20)}return!1}function s1(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function o1(t,e){let n=e.keyCode,r=s1(e);if(n==8||Fe&&n==72&&r=="c")return Cl(t,-1)||on(t,-1);if(n==46&&!e.shiftKey||Fe&&n==68&&r=="c")return Cl(t,1)||on(t,1);if(n==13||n==27)return!0;if(n==37||Fe&&n==66&&r=="c"){let i=n==37?kl(t,t.state.selection.from)=="ltr"?-1:1:-1;return yl(t,i,r)||on(t,i)}else if(n==39||Fe&&n==70&&r=="c"){let i=n==39?kl(t,t.state.selection.from)=="ltr"?1:-1:1;return yl(t,i,r)||on(t,i)}else{if(n==38||Fe&&n==80&&r=="c")return wl(t,-1,r)||on(t,-1);if(n==40||Fe&&n==78&&r=="c")return i1(t)||wl(t,1,r)||on(t,1);if(r==(Fe?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Xo(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")||nn.fromSchema(t.state.schema),u=Ad(),l=u.createElement("div");l.appendChild(o.serializeFragment(r,{document:u}));let a=l.firstChild,c,d=0;for(;a&&a.nodeType==1&&(c=vd[a.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=u.createElement(c[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}a=l.firstChild}a&&a.nodeType==1&&a.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`

`);return{dom:l,text:f,slice:e}}function wd(t,e,n,r,i){let s=i.parent.type.spec.code,o,u;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return u=new M(E.from(t.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0),t.someProp("transformPasted",f=>{u=f(u,t,!0)}),u;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)u=d;else{let f=i.marks(),{schema:h}=t.state,p=nn.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,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=c1(n),cr&&d1(o);let a=o&&o.querySelector("[data-pm-slice]"),c=a&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(a.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(u||(u=(t.someProp("clipboardParser")||t.someProp("domParser")||at.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!u1.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)u=f1(Sl(u,+c[1],+c[2]),c[4]);else if(u=M.maxOpen(l1(u.content,i),!0),u.openStart||u.openEnd){let d=0,f=0;for(let h=u.content.firstChild;d<u.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=u.content.lastChild;f<u.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);u=Sl(u,d,f)}return t.someProp("transformPasted",d=>{u=d(u,t,l)}),u}const u1=/^(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 l1(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(u=>{if(!o)return;let l=i.findWrapping(u.type),a;if(!l)return o=null;if(a=o.length&&s.length&&Ed(l,s,u,o[o.length-1],0))o[o.length-1]=a;else{o.length&&(o[o.length-1]=Sd(o[o.length-1],s.length));let c=Cd(u,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return E.from(o)}return t}function Cd(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,E.from(t));return t}function Ed(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Ed(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(E.from(Cd(n,t,i+1))))}}function Sd(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Sd(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(E.empty,!0);return t.copy(n.append(r))}function ao(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,u=o.content;return t.childCount>1&&(s=0),i<r-1&&(u=ao(u,e,n,r,i+1,s)),i>=n&&(u=e<0?o.contentMatchAt(0).fillBefore(u,s<=i).append(u):u.append(o.contentMatchAt(o.childCount).fillBefore(E.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(u))}function Sl(t,e,n){return e<t.openStart&&(t=new M(ao(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new M(ao(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const vd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let vl=null;function Ad(){return vl||(vl=document.implementation.createHTMLDocument("title"))}let bs=null;function a1(t){let e=window.trustedTypes;return e?(bs||(bs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),bs.createHTML(t)):t}function c1(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Ad().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&vd[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=a1(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function d1(t){let e=t.querySelectorAll(he?"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 f1(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 u=r.length-2;u>=0;u-=2){let l=n.nodes[r[u]];if(!l||l.hasRequiredAttrs())break;i=E.from(l.create(r[u+1],i)),s++,o++}return new M(i,s,o)}const Ce={},Ee={},h1={touchstart:!0,touchmove:!0};class p1{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 m1(t){for(let e in Ce){let n=Ce[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{b1(t,r)&&!Yo(t,r)&&(t.editable||!(r.type in Ee))&&n(t,r)},h1[e]?{passive:!0}:void 0)}me&&t.dom.addEventListener("input",()=>null),co(t)}function St(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function g1(t){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 co(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Yo(t,r))})}function Yo(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function b1(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 x1(t,e){!Yo(t,e)&&Ce[e.type]&&(t.editable||!(e.type in Ee))&&Ce[e.type](t,e)}Ee.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Td(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(lt&&he&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),xn&&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,Pt(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||o1(t,n)?n.preventDefault():St(t,"key")};Ee.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ee.keypress=(t,e)=>{let n=e;if(Td(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Fe&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof N)||!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 Ui(t){return{left:t.clientX,top:t.clientY}}function y1(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Qo(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,u=>o>s.depth?u(t,n,s.nodeAfter,s.before(o),i,!0):u(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function hn(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 k1(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&O.isSelectable(r)?(hn(t,new O(n)),!0):!1}function w1(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof O&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let u=o>s.depth?s.nodeAfter:s.node(o);if(O.isSelectable(u)){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?(hn(t,O.create(t.state.doc,i)),!0):!1}function C1(t,e,n,r,i){return Qo(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?w1(t,n):k1(t,n))}function E1(t,e,n,r){return Qo(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function S1(t,e,n,r){return Qo(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||v1(t,n,r)}function v1(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(hn(t,N.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(o.inlineContent)hn(t,N.create(r,u+1,u+1+o.content.size));else if(O.isSelectable(o))hn(t,O.create(r,u));else continue;return!0}}function eu(t){return Yr(t)}const Md=Fe?"metaKey":"ctrlKey";Ce.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=eu(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&y1(n,t.input.lastClick)&&!n[Md]&&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};let o=t.posAtCoords(Ui(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new A1(t,o,n,!!r)):(s=="doubleClick"?E1:S1)(t,o.pos,o.inside,n)?n.preventDefault():St(t,"pointer"))};class A1{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Md],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 u=i?null:r.target,l=u?e.docView.nearestDesc(u,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:a}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||a instanceof O&&a.from<=o&&a.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ze&&!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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),St(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),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(()=>dt(this.view)),this.view.input.mouseDown=null}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(Ui(e))),this.updateAllowDefault(e),this.allowDefault||!n?St(this.view,"pointer"):C1(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||me&&this.mightDrag&&!this.mightDrag.node.isAtom||he&&!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)?(hn(this.view,R.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):St(this.view,"pointer")}move(e){this.updateAllowDefault(e),St(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ce.touchstart=t=>{t.input.lastTouch=Date.now(),eu(t),St(t,"pointer")};Ce.touchmove=t=>{t.input.lastTouch=Date.now(),St(t,"pointer")};Ce.contextmenu=t=>eu(t);function Td(t,e){return t.composing?!0:me&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const M1=lt?5e3:-1;Ee.compositionstart=Ee.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof N&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||he&&sd&&T1(t)))t.markCursor=t.state.storedMarks||n.marks(),Yr(t,!0),t.markCursor=null;else if(Yr(t,!e.selection.empty),ze&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let u=t.domSelection();u&&u.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}_d(t,M1)};function T1(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ee.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,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++,_d(t,20))};function _d(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Yr(t),e))}function Dd(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=D1());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function _1(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=wm(e.focusNode,e.focusOffset),r=Cm(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 D1(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Yr(t,e=!1){if(!(lt&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Dd(t),e||t.docView&&t.docView.dirty){let n=Go(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 N1(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 Xn=ve&&Mt<15||xn&&Am<604;Ce.copy=Ee.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Xn?null:n.clipboardData,o=r.content(),{dom:u,text:l}=Xo(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",l)):N1(t,u),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function O1(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function R1(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?Yn(t,r.value,null,i,e):Yn(t,r.textContent,r.innerHTML,i,e)},50)}function Yn(t,e,n,r,i){let s=wd(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||M.empty)))return!0;if(!s)return!1;let o=O1(s),u=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Nd(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," "):""}Ee.paste=(t,e)=>{let n=e;if(t.composing&&!lt)return;let r=Xn?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Yn(t,Nd(r),r.getData("text/html"),i,n)?n.preventDefault():R1(t,n)};class Od{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const I1=Fe?"altKey":"ctrlKey";function Rd(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[I1]}Ce.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(Ui(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof O?i.to-1:i.to))){if(r&&r.mightDrag)o=O.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=O.create(t.state.doc,d.posBefore))}}let u=(o||t.state.selection).content(),{dom:l,text:a,slice:c}=Xo(t,u);(!n.dataTransfer.files.length||!he||id>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Xn?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Xn||n.dataTransfer.setData("text/plain",a),t.dragging=new Od(c,Rd(t,n),o)};Ce.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ee.dragover=Ee.dragenter=(t,e)=>e.preventDefault();Ee.drop=(t,e)=>{try{L1(t,e,t.dragging)}finally{t.dragging=null}};function L1(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ui(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=wd(t,Nd(e.dataTransfer),Xn?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Rd(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||M.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let u=s?Pc(t.state.doc,i.pos,s):i.pos;u==null&&(u=i.pos);let l=t.state.tr;if(o){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let a=l.mapping.map(u),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(a,a,s.content.firstChild):l.replaceRange(a,a,s),l.doc.eq(d))return;let f=l.doc.resolve(a);if(c&&O.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new O(f));else{let h=l.mapping.map(u);l.mapping.maps[l.mapping.maps.length-1].forEach((p,m,g,b)=>h=b),l.setSelection(Zo(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}Ce.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())&&dt(t)},20))};Ce.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)};Ce.beforeinput=(t,e)=>{if(he&&lt&&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,Pt(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 Ee)Ce[t]=Ee[t];function Qn(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 Qr{constructor(e,n){this.toDOM=e,this.spec=n||Wt,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 ue(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Qr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Qn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class _t{constructor(e,n){this.attrs=e,this.spec=n||Wt}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 ue(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof _t&&Qn(this.attrs,e.attrs)&&Qn(this.spec,e.spec)}static is(e){return e.type instanceof _t}destroy(){}}class tu{constructor(e,n){this.attrs=e,this.spec=n||Wt}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 ue(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 tu&&Qn(this.attrs,e.attrs)&&Qn(this.spec,e.spec)}destroy(){}}class ue{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ue(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 ue(e,e,new Qr(n,r))}static inline(e,n,r,i){return new ue(e,n,new _t(r,i))}static node(e,n,r,i){return new ue(e,n,new tu(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof _t}get widget(){return this.type instanceof Qr}}const an=[],Wt={};class j{constructor(e,n){this.local=e.length?e:an,this.children=n.length?n:an}static create(e,n){return n.length?ei(n,e,0,Wt):pe}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 u=this.local[o];u.from<=n&&u.to>=e&&(!s||s(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let u=this.children[o]+1;this.children[o+2].findInner(e-u,n-u,r,i+u,s)}}map(e,n,r){return this==pe||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Wt)}mapInner(e,n,r,i,s){let o;for(let u=0;u<this.local.length;u++){let l=this.local[u].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?F1(this.children,o||[],e,n,r,i,s):o?new j(o.sort(Ut),an):pe}add(e,n){return n.length?this==pe?j.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((u,l)=>{let a=l+r,c;if(c=Ld(n,u,a)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(u,c,a+1):i.splice(s,0,l,l+u.nodeSize,ei(c,u,a+1,Wt)),s+=3}});let o=Id(s?Fd(n):n,-r);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||o.splice(u--,1);return new j(o.length?this.local.concat(o).sort(Ut):this.local,i||this.children)}remove(e){return e.length==0||this==pe?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,u=r[s]+n,l=r[s+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>u&&d.to<l&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let a=r[s+2].removeInner(o,u+1);a!=pe?r[s+2]=a:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let u=0;u<i.length;u++)i[u].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new j(i,r):pe}forChild(e,n){if(this==pe)return this;if(n.isLeaf)return j.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let s=e+1,o=s+n.content.size;for(let u=0;u<this.local.length;u++){let l=this.local[u];if(l.from<o&&l.to>s&&l.type instanceof _t){let a=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;a<c&&(i||(i=[])).push(l.copy(a,c))}}if(i){let u=new j(i.sort(Ut),an);return r?new yt([u,r]):u}return r||pe}eq(e){if(this==e)return!0;if(!(e instanceof j)||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 nu(this.localsInner(e))}localsInner(e){if(this==pe)return an;if(e.inlineContent||!this.local.some(_t.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof _t||n.push(this.local[r]);return n}forEachSet(e){e(this)}}j.empty=new j([],[]);j.removeOverlap=nu;const pe=j.empty;class yt{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Wt));return yt.from(r)}forChild(e,n){if(n.isLeaf)return j.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=pe&&(s instanceof yt?r=r.concat(s.members):r.push(s))}return yt.from(r)}eq(e){if(!(e instanceof yt)||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?nu(r?n:n.sort(Ut)):an}static from(e){switch(e.length){case 0:return pe;case 1:return e[0];default:return new yt(e.every(n=>n instanceof j)?e:e.reduce((n,r)=>n.concat(r instanceof j?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function F1(t,e,n,r,i,s,o){let u=t.slice();for(let a=0,c=s;a<n.maps.length;a++){let d=0;n.maps[a].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let b=0;b<u.length;b+=3){let y=u[b+1];if(y<0||f>y+c-d)continue;let k=u[b]+c-d;h>=k?u[b+1]=f<=k?-2:-1:f>=c&&g&&(u[b]+=g,u[b+1]+=g)}d+=g}),c=n.maps[a].map(c,-1)}let l=!1;for(let a=0;a<u.length;a+=3)if(u[a+1]<0){if(u[a+1]==-2){l=!0,u[a+1]=-1;continue}let c=n.map(t[a]+s),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[a+1]+s,-1),h=f-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let b=u[a+2].mapInner(n,g,c+1,t[a]+s+1,o);b!=pe?(u[a]=d,u[a+1]=h,u[a+2]=b):(u[a+1]=-2,l=!0)}else l=!0}if(l){let a=P1(u,t,e,n,i,s,o),c=ei(a,r,0,o);e=c.local;for(let d=0;d<u.length;d+=3)u[d+1]<0&&(u.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let h=c.children[d];for(;f<u.length&&u[f]<h;)f+=3;u.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new j(e.sort(Ut),u)}function Id(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 ue(i.from+e,i.to+e,i.type))}return n}function P1(t,e,n,r,i,s,o){function u(l,a){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,a);d?n.push(d):o.onRemove&&o.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)u(l.children[c+2],l.children[c]+a+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&u(t[l+2],e[l]+s+1);return n}function Ld(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 Fd(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ei(t,e,n,r){let i=[],s=!1;e.forEach((u,l)=>{let a=Ld(t,u,l+n);if(a){s=!0;let c=ei(a,u,n+l+1,r);c!=pe&&i.push(l,l+u.nodeSize,c)}});let o=Id(s?Fd(t):t,-n).sort(Ut);for(let u=0;u<o.length;u++)o[u].type.valid(e,o[u])||(r.onRemove&&r.onRemove(o[u].spec),o.splice(u--,1));return o.length||i.length?new j(o,i):pe}function Ut(t,e){return t.from-e.from||t.to-e.to}function nu(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),Al(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),Al(e,i,r.copy(s.from,r.to)));break}}}return e}function Al(t,e,n){for(;e<t.length&&Ut(n,t[e])>0;)e++;t.splice(e,0,n)}function xs(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=pe&&e.push(r)}),t.cursorWrapper&&e.push(j.create(t.state.doc,[t.cursorWrapper.deco])),yt.from(e)}const z1={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},B1=ve&&Mt<=11;class $1{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 j1{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new $1,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]);ve&&Mt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():me&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),B1&&(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,z1)),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(xl(this.view)){if(this.suppressingSelectionUpdates)return dt(this.view);if(ve&&Mt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xt(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=bn(s))n.add(s);for(let s=e.anchorNode;s;s=bn(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?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)&&xl(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,u=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(u=!0))}if(l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){c.parentNode.removeChild(c);break}d=d.firstChild}}}else if(ze&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||V1(e,d)!=h)&&f.remove()}}}let a=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vi(r)&&(a=Go(e))&&a.eq(R.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,dt(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),H1(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,W1(e,l)),this.handleDOMChange(s,o,u,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||dt(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 d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}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(ve&&Mt<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?de(i)+1:0,u=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?de(s):e.target.childNodes.length,a=r.localPosFromDOM(e.target,l,1);return{from:u,to:a}}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 Ml=new WeakMap,Tl=!1;function H1(t){if(!Ml.has(t)&&(Ml.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ze,Tl)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."),Tl=!0}}function _l(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return Xt(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function q1(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return _l(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?_l(t,n):null}function V1(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 W1(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 u=o;for(;;){let l=u.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;u=l}u.insertBefore(s,u.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function U1(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:u}=t.docView.parseRange(e,n),l=t.domSelectionRange(),a,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(a=[{node:c,offset:l.anchorOffset}],Vi(l)||a.push({node:l.focusNode,offset:l.focusOffset})),he&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=r.childNodes[g-1],y=b.pmViewDesc;if(b.nodeName=="BR"&&!y){s=g;break}if(!y||y.size)break}let d=t.state.doc,f=t.someProp("domParser")||at.fromSchema(t.state.schema),h=d.resolve(o),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:a,ruleFromNode:K1,context:h});if(a&&a[0].pos!=null){let g=a[0].pos,b=a[1]&&a[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:u}}function K1(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(me&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||me&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const J1=/^(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 G1(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,T=Go(t,A);if(T&&!t.state.selection.eq(T)){if(he&&lt&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",$=>$(t,Pt(13,"Enter"))))return;let I=t.state.tr.setSelection(T);A=="pointer"?I.setMeta("pointer",!0):A=="key"&&I.scrollIntoView(),s&&I.setMeta("composition",s),t.dispatch(I)}return}let o=t.state.doc.resolve(e),u=o.sharedDepth(n);e=o.before(u+1),n=t.state.doc.resolve(n).after(u+1);let l=t.state.selection,a=U1(t,e,n),c=t.state.doc,d=c.slice(a.from,a.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=Y1(d.content,a.doc.content,a.from,f,h);if(p&&t.input.domChangeCount++,(xn&&t.input.lastIOSEnter>Date.now()-225||lt)&&i.some(A=>A.nodeType==1&&!J1.test(A.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",A=>A(t,Pt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof N&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(a.sel&&a.sel.anchor!=a.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(a.sel){let A=Dl(t,t.state.doc,a.sel);if(A&&!A.eq(t.state.selection)){let T=t.state.tr.setSelection(A);s&&T.setMeta("composition",s),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof N&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=a.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=a.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ve&&Mt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>a.from&&a.doc.textBetween(p.start-a.from-1,p.start-a.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=a.doc.resolveNoCache(p.start-a.from),g=a.doc.resolveNoCache(p.endB-a.from),b=c.resolve(p.start),y=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((xn&&t.input.lastIOSEnter>Date.now()-225&&(!y||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!y&&m.pos<a.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(a.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",A=>A(t,Pt(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&X1(c,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",A=>A(t,Pt(8,"Backspace")))){lt&&he&&t.domObserver.suppressSelectionUpdates();return}he&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),lt&&!y&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&a.sel&&a.sel.anchor==a.sel.head&&a.sel.head==p.endA&&(p.endB-=2,g=a.doc.resolveNoCache(p.endB-a.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,Pt(13,"Enter"))})},20));let k=p.start,w=p.endA,C=A=>{let T=A||t.state.tr.replace(k,w,a.doc.slice(p.start-a.from,p.endB-a.from));if(a.sel){let I=Dl(t,T.doc,a.sel);I&&!(he&&t.composing&&I.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==k||I.head==T.mapping.map(w)-1)||ve&&I.empty&&I.head==k)&&T.setSelection(I)}return s&&T.setMeta("composition",s),T.scrollIntoView()},v;if(y)if(m.pos==g.pos){ve&&Mt<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>dt(t),20));let A=C(t.state.tr.delete(k,w)),T=c.resolve(p.start).marksAcross(c.resolve(p.endA));T&&A.ensureMarks(T),t.dispatch(A)}else if(p.endA==p.endB&&(v=Z1(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let A=C(t.state.tr);v.type=="add"?A.addMark(k,w,v.mark):A.removeMark(k,w,v.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),T=()=>C(t.state.tr.insertText(A,k,w));t.someProp("handleTextInput",I=>I(t,k,w,A,T))||t.dispatch(T())}else t.dispatch(C());else t.dispatch(C())}function Dl(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Zo(t,e.resolve(n.anchor),e.resolve(n.head))}function Z1(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,u,l;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)u=i[0],o="add",l=c=>c.mark(u.addToSet(c.marks));else if(i.length==0&&s.length==1)u=s[0],o="remove",l=c=>c.mark(u.removeFromSet(c.marks));else return null;let a=[];for(let c=0;c<e.childCount;c++)a.push(l(e.child(c)));if(E.from(a).eq(t))return{mark:u,type:o}}function X1(t,e,n,r,i){if(n-e<=i.pos-r.pos||ys(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let u=s.nodeAfter;return u!=null&&n==e+u.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(ys(s,!0,!0));return!o.parent.isTextblock||o.pos>n||ys(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function ys(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 Y1(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:u}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,u));r-=o+l-s}if(o<s&&t.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&Nl(e.textBetween(s-1,s+1))&&(s+=l?1:-1),u=s+(u-o),o=s}else if(u<s){let l=r<=s&&r>=u?s-r:0;s-=l,s&&s<t.size&&Nl(t.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-u),u=s}return{start:s,endA:o,endB:u}}function Nl(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Pd{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 p1,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Fl),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=Il(this),Rl(this),this.nodeViews=Ll(this),this.docView=fl(this.state.doc,Ol(this),xs(this),this.dom,this),this.domObserver=new j1(this,(r,i,s,o)=>G1(this,r,i,s,o)),this.domObserver.start(),m1(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&&co(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Fl),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&&(Dd(this),o=!0),this.state=e;let u=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(u||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Ll(this);eg(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(u||n.handleDOMEvents!=this._props.handleDOMEvents)&&co(this),this.editable=Il(this),Rl(this);let l=xs(this),a=Ol(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,a,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&_m(this);if(o){this.domObserver.stop();let h=d&&(ve||he)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Q1(i.selection,e.selection);if(d){let p=he?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_1(this)),(s||!this.docView.update(e.doc,a,l,this))&&(this.docView.updateOuterDeco(a),this.docView.destroy(),this.docView=fl(e.doc,a,l,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Qm(this))?dt(this,h):(xd(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():f&&Dm(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof O){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ol(this,n.getBoundingClientRect(),e)}else ol(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 Od(e.slice,e.move,i<0?void 0:O.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 u=this.directPlugins[o].props[e];if(u!=null&&(i=n?n(u):u))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let u=s[o].props[e];if(u!=null&&(i=n?n(u):u))return i}}hasFocus(){if(ve){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&&Nm(this.dom),dt(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 Fm(this,e)}coordsAtPos(e,n=1){return cd(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 jm(this,n||this.state,e)}pasteHTML(e,n){return Yn(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Yn(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Xo(this,e)}destroy(){this.docView&&(g1(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],xs(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ym())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return x1(this,e)}domSelectionRange(){let e=this.domSelection();return e?me&&this.root.nodeType===11&&Sm(this.dom.ownerDocument)==this.dom&&q1(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Pd.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Ol(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"),[ue.node(0,t.state.doc.content.size,e)]}function Rl(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:ue.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Il(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Q1(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 Ll(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 eg(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 Fl(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 Dt={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:"'"},ti={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tg=typeof navigator<"u"&&/Mac/.test(navigator.platform),ng=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var fe=0;fe<10;fe++)Dt[48+fe]=Dt[96+fe]=String(fe);for(var fe=1;fe<=24;fe++)Dt[fe+111]="F"+fe;for(var fe=65;fe<=90;fe++)Dt[fe]=String.fromCharCode(fe+32),ti[fe]=String.fromCharCode(fe);for(var ks in Dt)ti.hasOwnProperty(ks)||(ti[ks]=Dt[ks]);function rg(t){var e=tg&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ng&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ti:Dt)[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 ig=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),sg=typeof navigator<"u"&&/Win/.test(navigator.platform);function og(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let u=0;u<e.length-1;u++){let l=e[u];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))ig?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function ug(t){let e=Object.create(null);for(let n in t)e[og(n)]=t[n];return e}function ws(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 lg(t){return new V({props:{handleKeyDown:ru(t)}})}function ru(t){let e=ug(t);return function(n,r){let i=rg(r),s,o=e[ws(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[ws(i,r,!1)];if(u&&u(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(sg&&r.ctrlKey&&r.altKey)&&(s=Dt[r.keyCode])&&s!=i){let u=e[ws(s,r)];if(u&&u(n.state,n.dispatch,n))return!0}}return!1}}var ag=Object.defineProperty,iu=(t,e)=>{for(var n in e)ag(t,n,{get:e[n],enumerable:!0})};function Ki(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}}}var Ji=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([o,u])=>[o,(...a)=>{const c=u(...a)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o=[],u=!!t,l=t||i.tr,a=()=>(!u&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(l,e),g=f(...p)(m);return o.push(g),c}])),run:a};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([u,l])=>[u,(...a)=>l(...a)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:Ki({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([u,l])=>[u,(...a)=>l(...a)(o)]))}};return o}},zd={};iu(zd,{blur:()=>cg,clearContent:()=>dg,clearNodes:()=>fg,command:()=>hg,createParagraphNear:()=>pg,cut:()=>mg,deleteCurrentNode:()=>gg,deleteNode:()=>bg,deleteRange:()=>xg,deleteSelection:()=>yg,enter:()=>kg,exitCode:()=>wg,extendMarkRange:()=>Cg,first:()=>Eg,focus:()=>vg,forEach:()=>Ag,insertContent:()=>Mg,insertContentAt:()=>Dg,joinBackward:()=>Rg,joinDown:()=>Og,joinForward:()=>Ig,joinItemBackward:()=>Lg,joinItemForward:()=>Fg,joinTextblockBackward:()=>Pg,joinTextblockForward:()=>zg,joinUp:()=>Ng,keyboardShortcut:()=>$g,lift:()=>jg,liftEmptyBlock:()=>Hg,liftListItem:()=>qg,newlineInCode:()=>Vg,resetAttributes:()=>Wg,scrollIntoView:()=>Ug,selectAll:()=>Kg,selectNodeBackward:()=>Jg,selectNodeForward:()=>Gg,selectParentNode:()=>Zg,selectTextblockEnd:()=>Xg,selectTextblockStart:()=>Yg,setContent:()=>Qg,setMark:()=>yb,setMeta:()=>kb,setNode:()=>wb,setNodeSelection:()=>Cb,setTextDirection:()=>Eb,setTextSelection:()=>Sb,sinkListItem:()=>vb,splitBlock:()=>Ab,splitListItem:()=>Mb,toggleList:()=>_b,toggleMark:()=>Db,toggleNode:()=>Nb,toggleWrap:()=>Ob,undoInputRule:()=>Rb,unsetAllMarks:()=>Ib,unsetMark:()=>Lb,unsetTextDirection:()=>Fb,updateAttributes:()=>Pb,wrapIn:()=>zb,wrapInList:()=>Bb});var cg=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),dg=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),fg=()=>({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,(u,l)=>{if(u.type.isText)return;const{doc:a,mapping:c}=e,d=a.resolve(c.map(l)),f=a.resolve(c.map(l+u.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Sn(h);if(u.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},hg=t=>e=>t(e),pg=()=>({state:t,dispatch:e})=>Qc(t,e),mg=(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 N(r.doc.resolve(Math.max(o-1,0)))),!0},gg=()=>({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 u=i.before(s),l=i.after(s);t.delete(u,l).scrollIntoView()}return!0}return!1};function ne(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}var bg=t=>({tr:e,state:n,dispatch:r})=>{const i=ne(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 l=s.before(o),a=s.after(o);e.delete(l,a).scrollIntoView()}return!0}return!1},xg=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},yg=()=>({state:t,dispatch:e})=>qo(t,e),kg=()=>({commands:t})=>t.keyboardShortcut("Enter"),wg=()=>({state:t,dispatch:e})=>im(t,e);function su(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function ni(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:su(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Bd(t,e,n={}){return t.find(r=>r.type===e&&ni(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Pl(t,e,n={}){return!!Bd(t,e,n)}function ou(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!n){const a=r.node.marks.find(c=>c.type===e);a&&(n=a.attrs)}if(!Bd([...r.node.marks],e,n))return;let s=r.index,o=t.start()+r.offset,u=s+1,l=o+r.node.nodeSize;for(;s>0&&Pl([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;u<t.parent.childCount&&Pl([...t.parent.child(u).marks],e,n);)l+=t.parent.child(u).nodeSize,u+=1;return{from:o,to:l}}function ft(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}var Cg=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=ft(t,r.schema),{doc:o,selection:u}=n,{$from:l,from:a,to:c}=u;if(i){const d=ou(l,s,e);if(d&&d.from<=a&&d.to>=c){const f=N.create(o,d.from,d.to);n.setSelection(f)}}return!0},Eg=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 $d(t){return t instanceof N}function $t(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function jd(t,e=null){if(!e)return null;const n=R.atStart(t),r=R.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?N.create(t,$t(0,i,s),$t(t.content.size,i,s)):N.create(t,$t(e,i,s),$t(e,i,s))}function zl(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ri(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Sg(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var vg=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(ri()||zl())&&r.dom.focus(),Sg()&&!ri()&&!zl()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!$d(n.state.selection))return o(),!0;const u=jd(i.doc,t)||n.state.selection,l=n.state.selection.eq(u);return s&&(l||i.setSelection(u),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Ag=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Mg=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Hd=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&&Hd(r)}return t};function wr(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Hd(n)}function er(t,e,n){if(t instanceof At||t instanceof E)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 E.fromArray(t.map(u=>e.nodeFromJSON(u)));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),er("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,u="";const l=new Po({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:a=>(o=!0,u=typeof a=="string"?a:a.outerHTML,null)}]}})});if(n.slice?at.fromSchema(l).parseSlice(wr(t),n.parseOptions):at.fromSchema(l).parse(wr(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${u}`)})}const s=at.fromSchema(e);return n.slice?s.parseSlice(wr(t),n.parseOptions).content:s.parse(wr(t),n.parseOptions)}return er("",e,n)}function Tg(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof ee||i instanceof le))return;const s=t.mapping.maps[r];let o=0;s.forEach((u,l,a,c)=>{o===0&&(o=c)}),t.setSelection(R.near(t.doc.resolve(o),n))}var _g=t=>!("type"in t),Dg=(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 u;const l=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},a={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{er(e,s.schema,{parseOptions:a,errorOnInvalidContent:!0})}catch(g){l(g)}try{u=er(e,s.schema,{parseOptions:a,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((_g(u)?u:[u]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),c===d&&h){const{parent:g}=r.doc.resolve(c);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(c-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof E){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,d)}else{m=u;const g=r.doc.resolve(c),b=g.node(),y=g.parentOffset===0,k=b.isText||b.isTextblock,w=b.content.size>0;y&&k&&w&&h&&(c=Math.max(0,c-1)),r.replaceWith(c,d,m)}n.updateSelection&&Tg(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},Ng=()=>({state:t,dispatch:e})=>tm(t,e),Og=()=>({state:t,dispatch:e})=>nm(t,e),Rg=()=>({state:t,dispatch:e})=>Uc(t,e),Ig=()=>({state:t,dispatch:e})=>Zc(t,e),Lg=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ji(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Fg=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ji(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Pg=()=>({state:t,dispatch:e})=>Q0(t,e),zg=()=>({state:t,dispatch:e})=>em(t,e);function qd(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Bg(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let u=0;u<e.length-1;u+=1){const l=e[u];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))ri()||qd()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var $g=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=Bg(t).split(/-(?!$)/),o=s.find(a=>!["Alt","Ctrl","Meta","Shift"].includes(a)),u=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}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",a=>a(n,u))});return l?.steps.forEach(a=>{const c=a.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function Nt(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?ne(e,t.schema):null,u=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);u.push({node:d,from:h,to:p})});const l=i-r,a=u.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>ni(d.node.attrs,n,{strict:!1}));return s?!!a.length:a.reduce((d,f)=>d+f.to-f.from,0)>=l}var jg=(t,e={})=>({state:n,dispatch:r})=>{const i=ne(t,n.schema);return Nt(n,i,e)?rm(n,r):!1},Hg=()=>({state:t,dispatch:e})=>ed(t,e),qg=t=>({state:e,dispatch:n})=>{const r=ne(t,e.schema);return mm(r)(e,n)},Vg=()=>({state:t,dispatch:e})=>Yc(t,e);function Gi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Bl(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var Wg=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const u=Gi(typeof t=="string"?t:t.name,r.schema);if(!u)return!1;u==="node"&&(s=ne(t,r.schema)),u==="mark"&&(o=ft(t,r.schema));let l=!1;return n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{s&&s===c.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,Bl(c.attrs,e))),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&(l=!0,i&&n.addMark(d,d+c.nodeSize,o.create(Bl(f.attrs,e))))})})}),l},Ug=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Kg=()=>({tr:t,dispatch:e})=>{if(e){const n=new De(t.doc);t.setSelection(n)}return!0},Jg=()=>({state:t,dispatch:e})=>Jc(t,e),Gg=()=>({state:t,dispatch:e})=>Xc(t,e),Zg=()=>({state:t,dispatch:e})=>um(t,e),Xg=()=>({state:t,dispatch:e})=>cm(t,e),Yg=()=>({state:t,dispatch:e})=>am(t,e);function fo(t,e,n={},r={}){return er(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Qg=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:u})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const a=fo(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),u.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Vd(t,e){const n=ft(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,l=>{o.push(...l.marks)});const u=o.find(l=>l.type.name===n.name);return u?{...u.attrs}:{}}function Wd(t,e){const n=new jo(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function eb(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 tb(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function Ud(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 Zi(t){return e=>Ud(e.$from,t)}function D(t,e,n){return t.config[e]===void 0&&t.parent?D(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?D(t.parent,e,n):null}):t.config[e]}function uu(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=D(e,"addExtensions",n);return r?[e,...uu(r())]:e}).flat(10)}function fr(t,e){const n=nn.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function Kd(t){return typeof t=="function"}function z(t,e=void 0,...n){return Kd(t)?e?t.bind(e)(...n):t(...n):t}function nb(t={}){return Object.keys(t).length===0&&t.constructor===Object}function yn(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 Jd(t){const e=[],{nodeExtensions:n,markExtensions:r}=yn(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(a=>a.name!=="text").map(a=>a.name),u=r.map(a=>a.name),l=[...o,...u];return t.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage,extensions:i},d=D(a,"addGlobalAttributes",c);if(!d)return;d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=l:h.types==="nodes"?p=o:h.types==="marks"?p=u:p=[],p.forEach(m=>{Object.entries(h.attributes).forEach(([g,b])=>{e.push({type:m,name:g,attribute:{...s,...b}})})})})}),i.forEach(a=>{const c={name:a.name,options:a.options,storage:a.storage},d=D(a,"addAttributes",c);if(!d)return;const f=d();Object.entries(f).forEach(([h,p])=>{const m={...s,...p};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:a.name,name:h,attribute:m})})}),e}function rb(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let u=0;u<o;u+=1){const l=t[u];if(l==="'"&&!i){r=!r,n+=l;continue}if(l==='"'&&!r){i=!i,n+=l;continue}if(!r&&!i){if(l==="("){s+=1,n+=l;continue}if(l===")"&&s>0){s-=1,n+=l;continue}if(l===";"&&s===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function $l(t){const e=[],n=rb(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const u=s.slice(0,o).trim(),l=s.slice(o+1).trim();u&&l&&e.push([u,l])}return e}function K(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const u=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],a=u.filter(c=>!l.includes(c));r[i]=[...l,...a].join(" ")}else if(i==="style"){const u=new Map([...$l(r[i]),...$l(s)]);r[i]=Array.from(u.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[i]=s}),r},{})}function tr(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)=>K(n,r),{})}function ib(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function jl(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 u=o.attribute.parseHTML?o.attribute.parseHTML(n):ib(n.getAttribute(o.name));return u==null?s:{...s,[o.name]:u}},{});return{...r,...i}}}}function Hl(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&nb(n)?!1:n!=null))}function ql(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function sb(t,e){var n;const r=Jd(t),{nodeExtensions:i,markExtensions:s}=yn(t),o=(n=i.find(a=>D(a,"topNode")))==null?void 0:n.name,u=Object.fromEntries(i.map(a=>{const c=r.filter(b=>b.type===a.name),d={name:a.name,options:a.options,storage:a.storage,editor:e},f=t.reduce((b,y)=>{const k=D(y,"extendNodeSchema",d);return{...b,...k?k(a):{}}},{}),h=Hl({...f,content:z(D(a,"content",d)),marks:z(D(a,"marks",d)),group:z(D(a,"group",d)),inline:z(D(a,"inline",d)),atom:z(D(a,"atom",d)),selectable:z(D(a,"selectable",d)),draggable:z(D(a,"draggable",d)),code:z(D(a,"code",d)),whitespace:z(D(a,"whitespace",d)),linebreakReplacement:z(D(a,"linebreakReplacement",d)),defining:z(D(a,"defining",d)),isolating:z(D(a,"isolating",d)),attrs:Object.fromEntries(c.map(ql))}),p=z(D(a,"parseHTML",d));p&&(h.parseDOM=p.map(b=>jl(b,c)));const m=D(a,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:tr(b,c)}));const g=D(a,"renderText",d);return g&&(h.toText=g),[a.name,h]})),l=Object.fromEntries(s.map(a=>{const c=r.filter(g=>g.type===a.name),d={name:a.name,options:a.options,storage:a.storage,editor:e},f=t.reduce((g,b)=>{const y=D(b,"extendMarkSchema",d);return{...g,...y?y(a):{}}},{}),h=Hl({...f,inclusive:z(D(a,"inclusive",d)),excludes:z(D(a,"excludes",d)),group:z(D(a,"group",d)),spanning:z(D(a,"spanning",d)),code:z(D(a,"code",d)),attrs:Object.fromEntries(c.map(ql))}),p=z(D(a,"parseHTML",d));p&&(h.parseDOM=p.map(g=>jl(g,c)));const m=D(a,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:tr(g,c)})),[a.name,h]}));return new Po({topNode:o,nodes:u,marks:l})}function ob(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function $n(t){return t.sort((n,r)=>{const i=D(n,"priority")||100,s=D(r,"priority")||100;return i>s?-1:i<s?1:0})}function Gd(t){const e=$n(uu(t)),n=ob(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Zd(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`

`,textSerializers:o={}}=n||{};let u="";return t.nodesBetween(r,i,(l,a,c,d)=>{var f;l.isBlock&&a>r&&(u+=s);const h=o?.[l.type.name];if(h)return c&&(u+=h({node:l,pos:a,parent:c,index:d,range:e})),!1;l.isText&&(u+=(f=l?.text)==null?void 0:f.slice(Math.max(r,a)-a,i-a))}),u}function ub(t,e){const n={from:0,to:t.content.size};return Zd(t,n,e)}function Xd(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function lb(t,e){const n=ne(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,u=>{s.push(u)});const o=s.reverse().find(u=>u.type.name===n.name);return o?{...o.attrs}:{}}function Yd(t,e){const n=Gi(typeof e=="string"?e:e.name,t.schema);return n==="node"?lb(t,e):n==="mark"?Vd(t,e):{}}function ab(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 cb(t){const e=ab(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 Qd(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((u,l)=>{o.push({from:u,to:l})});else{const{from:u,to:l}=n[s];if(u===void 0||l===void 0)return;o.push({from:u,to:l})}o.forEach(({from:u,to:l})=>{const a=e.slice(s).map(u,-1),c=e.slice(s).map(l),d=e.invert().map(a,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:a,to:c}})})}),cb(r)}function lu(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=ou(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var db=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const u=i.node(s);u?.type.name===e?o=u:s-=1}return[o,s]};function Mn(t,e){return e.nodes[t]||e.marks[t]||null}function Br(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}))}var fb=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,u)=>{var l,a;const c=((a=(l=i.type.spec).toText)==null?void 0:a.call(l,{node:i,pos:s,parent:o,index:u}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function ho(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?ft(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>ni(d.attrs,n,{strict:!1}));let o=0;const u=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,g)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;const b=Math.max(h,g),y=Math.min(p,g+m.nodeSize),k=y-b;o+=k,u.push(...m.marks.map(w=>({mark:w,from:b,to:y})))})}),o===0)return!1;const l=u.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>ni(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),a=u.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+a:l)>=o}function hb(t,e,n={}){if(!e)return Nt(t,null,n)||ho(t,null,n);const r=Gi(e,t.schema);return r==="node"?Nt(t,e,n):r==="mark"?ho(t,e,n):!1}var pb=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const s=Zi(u=>u.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},mb=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Vl(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Cs(t,e){const{nodeExtensions:n}=yn(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=z(D(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Xi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?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&&(Xi(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ef(t){return t instanceof O}var tf=class nf{constructor(e){this.position=e}static fromJSON(e){return new nf(e.position)}toJSON(){return{position:this.position}}};function gb(t,e){const n=e.mapping.mapResult(t.position);return{position:new tf(n.pos),mapResult:n}}function bb(t){return new tf(t)}function xb(t,e,n){var r;const{selection:i}=e;let s=null;if($d(i)&&(s=i.$cursor),s){const u=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(u)||!u.some(a=>a.type.excludes(n)))}const{ranges:o}=i;return o.some(({$from:u,$to:l})=>{let a=u.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(u.pos,l.pos,(c,d,f)=>{if(a)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));a=h&&p}return!a}),a})}var yb=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:u}=s,l=ft(t,r.schema);if(i)if(o){const a=Vd(r,l);n.addStoredMark(l.create({...a,...e}))}else u.forEach(a=>{const c=a.$from.pos,d=a.$to.pos;r.doc.nodesBetween(c,d,(f,h)=>{const p=Math.max(h,c),m=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&n.addMark(p,m,l.create({...b.attrs,...e}))}):n.addMark(p,m,l.create(e))})});return xb(r,n,l)},kb=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),wb=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=ne(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:u})=>rl(s,{...o,...e})(n)?!0:u.clearNodes()).command(({state:u})=>rl(s,{...o,...e})(u,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Cb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=$t(t,0,r.content.size),s=O.create(r,i);e.setSelection(s)}return!0},Eb=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,u;return typeof e=="number"?(o=e,u=e):e&&"from"in e&&"to"in e?(o=e.from,u=e.to):(o=s.from,u=s.to),i&&n.doc.nodesBetween(o,u,(l,a)=>{l.isText||n.setNodeMarkup(a,void 0,{...l.attrs,dir:t})}),!0},Sb=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=N.atStart(r).from,u=N.atEnd(r).to,l=$t(i,o,u),a=$t(s,o,u),c=N.create(r,l,a);e.setSelection(c)}return!0},vb=t=>({state:e,dispatch:n})=>{const r=ne(t,e.schema);return xm(r)(e,n)};function Wl(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var Ab=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:u,$to:l}=s,a=i.extensionManager.attributes,c=Br(a,u.node().type.name,u.node().attrs);if(s instanceof O&&s.node.isBlock)return!u.parentOffset||!ct(o,u.pos)?!1:(r&&(t&&Wl(n,i.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=u.depth===0?void 0:eb(u.node(-1).contentMatchAt(u.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,p=ct(e.doc,e.mapping.map(u.pos),1,h);if(!h&&!p&&ct(e.doc,e.mapping.map(u.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:c}]:void 0),r){if(p&&(s instanceof N&&e.deleteSelection(),e.split(e.mapping.map(u.pos),1,h),f&&!d&&!u.parentOffset&&u.parent.type!==f)){const m=e.mapping.map(u.before()),g=e.doc.resolve(m);u.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(u.before()),f)}t&&Wl(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Mb=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const u=ne(t,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const d=l.node(-1);if(d.type!==u)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==u||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=E.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let T=l.depth-y;T>=l.depth-3;T-=1)b=E.from(l.node(T).copy(b));const k=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,w={...Br(f,l.node().type.name,l.node().attrs),...e},C=((o=u.contentMatch.defaultType)==null?void 0:o.createAndFill(w))||void 0;b=b.append(E.from(u.createAndFill(null,C)||void 0));const v=l.before(l.depth-(y-1));n.replace(v,l.after(-k),new M(b,4-y,0));let A=-1;n.doc.nodesBetween(v,n.doc.content.size,(T,I)=>{if(A>-1)return!1;T.isTextblock&&T.content.size===0&&(A=I+1)}),A>-1&&n.setSelection(N.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const h=a.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...Br(f,d.type.name,d.attrs),...e},m={...Br(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,a.pos);const g=h?[{type:u,attrs:p},{type:h,attrs:m}]:[{type:u,attrs:p}];if(!ct(n.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:y}=r,{splittableMarks:k}=s.extensionManager,w=y||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!w||!i)return!0;const C=w.filter(v=>k.includes(v.type.name));n.ensureMarks(C)}return!0},Es=(t,e)=>{const n=Zi(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?.type&&Rt(t.doc,n.pos)&&t.join(n.pos),!0},Ss=(t,e)=>{const n=Zi(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?.type&&Rt(t.doc,r)&&t.join(r),!0};function Tb(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return N.between(r,i)}var _b=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:u,chain:l,commands:a,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=ne(t,o.schema),p=ne(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:y}=m,k=b.blockRange(y),w=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const C=Zi(Q=>Cs(Q.type.name,d))(m),v=m.from===0&&m.to===o.doc.content.size,A=o.doc.content.content,T=A.length===1?A[0]:null,I=v&&T&&Cs(T.type.name,d)?{node:T,pos:0}:null,$=C??I,re=!!C&&k.depth>=1&&k.depth-C.depth<=1,ke=!!I;if((re||ke)&&$){if($.node.type===h)return v&&ke?l().command(({tr:Q,dispatch:J})=>{const P=Tb(Q);return P?(Q.setSelection(P),J&&J(Q),!0):!1}).liftListItem(p).run():a.liftListItem(p);if(Cs($.node.type.name,d)&&h.validContent($.node.content))return l().command(()=>(s.setNodeMarkup($.pos,h),!0)).command(()=>Es(s,h)).command(()=>Ss(s,h)).run()}return!n||!w||!u?l().command(()=>c().wrapInList(h,r)?!0:a.clearNodes()).wrapInList(h,r).command(()=>Es(s,h)).command(()=>Ss(s,h)).run():l().command(()=>{const Q=c().wrapInList(h,r),J=w.filter(P=>f.includes(P.type.name));return s.ensureMarks(J),Q?!0:a.clearNodes()}).wrapInList(h,r).command(()=>Es(s,h)).command(()=>Ss(s,h)).run()},Db=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=ft(t,r.schema);return ho(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Nb=(t,e,n={})=>({state:r,commands:i})=>{const s=ne(t,r.schema),o=ne(e,r.schema),u=Nt(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),u?i.setNode(o,l):i.setNode(s,{...l,...n})},Ob=(t,e={})=>({state:n,commands:r})=>{const i=ne(t,n.schema);return Nt(n,i,e)?r.lift(i):r.wrapIn(i,e)},Rb=()=>({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,u=s.transform;for(let l=u.steps.length-1;l>=0;l-=1)o.step(u.steps[l].invert(u.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},Ib=()=>({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},Lb=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:u}=n,l=ft(t,r.schema),{$from:a,empty:c,ranges:d}=u;if(!i)return!0;if(c&&o){let{from:f,to:h}=u;const p=(s=a.marks().find(g=>g.type===l))==null?void 0:s.attrs,m=ou(a,l,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},Fb=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(u,l)=>{if(u.isText)return;const a={...u.attrs};delete a.dir,e.setNodeMarkup(l,void 0,a)}),!0},Pb=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const u=Gi(typeof t=="string"?t:t.name,r.schema);if(!u)return!1;u==="node"&&(s=ne(t,r.schema)),u==="mark"&&(o=ft(t,r.schema));let l=!1;return n.selection.ranges.forEach(a=>{const c=a.$from.pos,d=a.$to.pos;let f,h,p,m;n.selection.empty?r.doc.nodesBetween(c,d,(g,b)=>{s&&s===g.type&&(l=!0,p=Math.max(b,c),m=Math.min(b+g.nodeSize,d),f=b,h=g)}):r.doc.nodesBetween(c,d,(g,b)=>{b<c&&s&&s===g.type&&(l=!0,p=Math.max(b,c),m=Math.min(b+g.nodeSize,d),f=b,h=g),b>=c&&b<=d&&(s&&s===g.type&&(l=!0,i&&n.setNodeMarkup(b,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(y=>{if(o===y.type&&(l=!0,i)){const k=Math.max(b,c),w=Math.min(b+g.nodeSize,d);n.addMark(k,w,o.create({...y.attrs,...e}))}}))}),h&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&i&&n.addMark(p,m,o.create({...g.attrs,...e}))}))}),l},zb=(t,e={})=>({state:n,dispatch:r})=>{const i=ne(t,n.schema);return dm(i,e)(n,r)},Bb=(t,e={})=>({state:n,dispatch:r})=>{const i=ne(t,n.schema);return fm(i,e)(n,r)},$b=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Yi=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},jb=(t,e)=>{if(su(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 Cr(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:u}=t,{view:l}=n;if(l.composing)return!1;const a=l.state.doc.resolve(r);if(a.parent.type.spec.code||(e=a.nodeBefore||a.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=fb(a)+s;return o.forEach(f=>{if(c)return;const h=jb(d,f.find);if(!h)return;const p=l.state.tr,m=Ki({state:l.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:b,chain:y,can:k}=new Ji({editor:n,state:m});f.handler({state:m,range:g,match:h,commands:b,chain:y,can:k})===null||!p.steps.length||(f.undoable&&p.setMeta(u,{transform:p,from:r,to:i,text:s}),l.dispatch(p),c=!0)}),c}function Hb(t){const{editor:e,rules:n}=t,r=new V({state:{init(){return null},apply(i,s,o){const u=i.getMeta(r);if(u)return u;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=fr(E.from(c),o.schema);const{from:d}=l,f=d+c.length;Cr({editor:e,from:d,to:f,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,u){return Cr({editor:e,from:s,to:o,text:u,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Cr({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?Cr({editor:e,from:o.pos,to:o.pos,text:`
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function qb(t){return Object.prototype.toString.call(t).slice(8,-1)}function Er(t){return qb(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function rf(t,e){const n={...t};return Er(t)&&Er(e)&&Object.keys(e).forEach(r=>{Er(e[r])&&Er(t[r])?n[r]=rf(t[r],e[r]):n[r]=e[r]}),n}var au=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...z(D(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...z(D(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>rf(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Oe=class sf extends au{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new sf(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(a=>a?.type.name===n.name))return!1;const l=o.find(a=>a?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Vb(t){return typeof t=="number"}var Wb=class{constructor(t){this.find=t.find,this.handler=t.handler}},Ub=(t,e,n)=>{if(su(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 Kb(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:u}=t,{commands:l,chain:a,can:c}=new Ji({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,p)=>{var m,g,b,y,k;if((g=(m=h.type)==null?void 0:m.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(k=(y=(b=h.content)==null?void 0:b.size)!=null?y:h.nodeSize)!=null?k:0,C=Math.max(r,p),v=Math.min(i,p+w);if(C>=v)return;const A=h.isText?h.text||"":h.textBetween(C-p,v-p,void 0,"￼");Ub(A,s.find,o).forEach(I=>{if(I.index===void 0)return;const $=C+I.index+1,re=$+I[0].length,ke={from:n.tr.mapping.map($),to:n.tr.mapping.map(re)},Q=s.handler({state:n,range:ke,match:I,commands:l,chain:a,can:c,pasteEvent:o,dropEvent:u});d.push(Q)})}),d.every(h=>h!==null)}var Sr=null,Jb=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Gb(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u;try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}const l=({state:c,from:d,to:f,rule:h,pasteEvt:p})=>{const m=c.tr,g=Ki({state:c,transaction:m});if(!(!Kb({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:u})||!m.steps.length)){try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new V({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(Sr=e)},h=()=>{Sr&&(Sr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=r===d.dom.parentElement,u=f,!s){const h=Sr;h?.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,b=p.getMeta("applyPasteRules"),y=!!b;if(!m&&!g&&!y)return;if(y){let{text:C}=b;typeof C=="string"?C=C:C=fr(E.from(C),h.schema);const{from:v}=b,A=v+C.length,T=Jb(C);return l({rule:c,state:h,from:v,to:{b:A},pasteEvt:T})}const k=f.doc.content.findDiffStart(h.doc.content),w=f.doc.content.findDiffEnd(h.doc.content);if(!(!Vb(k)||!w||k===w.b))return l({rule:c,state:h,from:k,to:w,pasteEvt:o})}}))}var Qi=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Gd(t),this.schema=sb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Mn(e.name,this.schema)},r=D(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return $n([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Mn(r.name,this.schema)},s=[],o=D(r,"addKeyboardShortcuts",i);let u={};if(r.type==="mark"&&D(r,"exitable",i)&&(u.ArrowRight=()=>Oe.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:t})]));u={...u,...f}}const l=lg(u);s.push(l);const a=D(r,"addInputRules",i);if(Vl(r,t.options.enableInputRules)&&a){const f=a();if(f&&f.length){const h=Hb({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const c=D(r,"addPasteRules",i);if(Vl(r,t.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const h=Gb({editor:t,rules:f});s.push(...h)}}const d=D(r,"addProseMirrorPlugins",i);if(d){const f=d();s.push(...f)}return s})}get attributes(){return Jd(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=yn(this.extensions);return Object.fromEntries(e.filter(n=>!!D(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ne(n.name,this.schema)},s=D(n,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const u=(l,a,c,d,f)=>{const h=tr(l,r);return o({node:l,view:a,getPos:c,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:h})};return[n.name,u]}))}dispatchTransaction(t){const{editor:e}=this;return $n([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Mn(i.name,this.schema)},o=D(i,"dispatchTransaction",s);return o?u=>{o.call(s,{transaction:u,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return $n([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Mn(i.name,this.schema)},o=D(i,"transformPastedHTML",s);return o?(u,l)=>{const a=r(u,l);return o.call(s,a)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=yn(this.extensions);return Object.fromEntries(e.filter(n=>!!D(n,"addMarkView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ft(n.name,this.schema)},s=D(n,"addMarkView",i);if(!s)return[];const o=(u,l,a)=>{const c=tr(u,r);return s()({mark:u,view:l,inline:a,editor:t,extension:n,HTMLAttributes:c,updateAttributes:d=>{l2(u,t,d)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){const n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Mn(e.name,this.schema)};e.type==="mark"&&((n=z(D(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=D(e,"onBeforeCreate",r),s=D(e,"onCreate",r),o=D(e,"onUpdate",r),u=D(e,"onSelectionUpdate",r),l=D(e,"onTransaction",r),a=D(e,"onFocus",r),c=D(e,"onBlur",r),d=D(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),u&&this.editor.on("selectionUpdate",u),l&&this.editor.on("transaction",l),a&&this.editor.on("focus",a),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};Qi.resolve=Gd;Qi.sort=$n;Qi.flatten=uu;var of={};iu(of,{ClipboardTextSerializer:()=>lf,Commands:()=>af,Delete:()=>cf,Drop:()=>df,Editable:()=>ff,FocusEvents:()=>pf,Keymap:()=>mf,Paste:()=>gf,Tabindex:()=>bf,TextDirection:()=>xf,focusEventsPluginKey:()=>hf});var U=class uf extends au{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new uf(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},lf=U.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new V({key:new G("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)),u=Math.max(...s.map(c=>c.$to.pos)),l=Xd(n);return Zd(r,{from:o,to:u},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),af=U.create({name:"commands",addCommands(){return{...zd}}}),cf=U.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const s=()=>{var o,u,l,a;if((a=(l=(u=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:u.filterTransaction)==null?void 0:l.call(u,t))!=null?a:t.getMeta("y-sync$"))return;const c=Wd(t.before,[t,...e]);Qd(c).forEach(h=>{c.mapping.mapResult(h.oldRange.from).deletedAfter&&c.mapping.mapResult(h.oldRange.to).deletedBefore&&c.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,b=h.oldRange.from<=m&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:c.mapping.map(m),newTo:c.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:t,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((h,p)=>{var m,g;if(h instanceof je){const b=f.slice(p).map(h.from,-1),y=f.slice(p).map(h.to),k=f.invert().map(b,-1),w=f.invert().map(y),C=b>0?(m=c.doc.nodeAt(b-1))==null?void 0:m.marks.some(A=>A.eq(h.mark)):!1,v=(g=c.doc.nodeAt(y))==null?void 0:g.marks.some(A=>A.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:k,to:w},newRange:{from:b,to:y},partial:!!(v||C),editor:this.editor,transaction:t,combinedTransform:c})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),df=U.create({name:"drop",addProseMirrorPlugins(){return[new V({key:new G("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),ff=U.create({name:"editable",addProseMirrorPlugins(){return[new V({key:new G("editable"),props:{editable:()=>this.editor.options.editable}})]}}),hf=new G("focusEvents"),pf=U.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new V({key:hf,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}}}})]}}),mf=U.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:u})=>{const{selection:l,doc:a}=u,{empty:c,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?u.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?g===d.pos:R.atStart(a).from===f;return!c||!h.type.isTextblock||h.textContent.length||!b||b&&d.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 ri()||qd()?s:i},addProseMirrorPlugins(){return[new V({key:new G("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:u}=e.selection,l=R.atStart(e.doc).from,a=R.atEnd(e.doc).to;if(s||!(o===l&&u===a)||!Xi(n.doc))return;const f=n.tr,h=Ki({state:n,transaction:f}),{commands:p}=new Ji({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),gf=U.create({name:"paste",addProseMirrorPlugins(){return[new V({key:new G("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),bf=U.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new V({key:new G("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),xf=U.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=yn(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new V({key:new G("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Zb=class In{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 name(){return this.node.type.name}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: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 In(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 In(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 In(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=n.isInline,u=this.pos+r+(s?0:1);if(u<0||u>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(u);if(!i&&!o&&l.depth<=this.depth)return;const a=new In(l,this.editor,i,i||o?n:null);i&&(a.actualDepth=this.depth+1),e.push(a)}),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 u=0;u<o.length;u+=1){const l=o[u];if(s[l]!==n[l])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(l=>n[l]===o.node.attrs[l])&&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)}},Xb=`.ProseMirror {
  position: relative;
}

.ProseMirror {
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}

.ProseMirror [contenteditable="false"] {
  white-space: normal;
}

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
  white-space: pre-wrap;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

img.ProseMirror-separator {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
  margin: 0;
}

.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid black;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection *::-moz-selection {
  background: transparent;
}

.ProseMirror-hideselection * {
  caret-color: transparent;
}

.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}`;function Yb(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}var Qb=class extends $b{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:gb,createMappablePosition:bb},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),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:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=jd(e,this.options.autofocus);this.editorState=dn.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}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&&typeof document<"u"&&(this.css=Yb(Xb,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=Kd(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;const s=[...this.options.enableCoreExtensions?[ff,lf.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),af,pf,mf,bf.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),df,gf,cf,xf.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Qi(s,this)}createCommandManager(){this.commandManager=new Ji({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=fo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=fo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new Pd(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const u=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(u),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(a=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(a)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(a=>a.getMeta("focus")||a.getMeta("blur")),u=o?.getMeta("focus"),l=o?.getMeta("blur");u&&this.emit("focus",{editor:this,event:u.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(a=>a.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Yd(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return hb(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return fr(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`

`,textSerializers:n={}}=t||{};return ub(this.state.doc,{blockSeparator:e,textSerializers:{...Xd(this.schema),...n}})}get isEmpty(){return Xi(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Zb(e,this)}get $doc(){return this.$pos(0)}};function kn(t){return new Yi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=z(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],u=r[0];if(o){const l=u.search(/\S/),a=n.from+u.indexOf(o),c=a+o.length;if(lu(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>a).length)return null;c<n.to&&s.delete(c,n.to),a>n.from&&s.delete(n.from+l,a);const f=n.from+l+o.length;s.addMark(n.from+l,f,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function e2(t){return new Yi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=z(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let u=n.to;const l=t.type.create(i);if(r[1]){const a=r[0].lastIndexOf(r[1]);let c=o+a;c>u?c=u:u=c+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(c,u,l)}else if(r[0]){const a=t.type.isInline?o:o-1;s.insert(a,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(u))}s.scrollIntoView()},undoable:t.undoable})}function po(t){return new Yi({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=z(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)},undoable:t.undoable})}function wn(t){return new Yi({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=z(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),a=l&&$o(l,t.type,s);if(!a)return null;if(o.wrap(l,a),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Rt(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)},undoable:t.undoable})}function t2(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof O){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}var n2={};iu(n2,{createAtomBlockMarkdownSpec:()=>r2,createBlockMarkdownSpec:()=>i2,createInlineMarkdownSpec:()=>u2,parseAttributes:()=>cu,parseIndentedBlocks:()=>mo,renderNestedMarkdownContent:()=>fu,serializeAttributes:()=>du});function cu(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,a=>(n.push(a),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const a=i.map(c=>c.trim().slice(1));e.class=a.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,a,c])=>{var d;const f=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[a]=h.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(e[c]=!0)}),e}function du(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function r2(t){const{nodeName:e,name:n,parseAttributes:r=cu,serializeAttributes:i=du,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:u}=t,l=n||e,a=c=>{if(!u)return c;const d={};return u.forEach(f=>{f in c&&(d[f]=c[f])}),d};return{parseMarkdown:(c,d)=>{const f={...s,...c.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(c){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=c.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(c,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=c.match(h);if(!p)return;const m=p[1]||"",g=r(m);if(!o.find(y=>!(y in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:c=>{const d=a(c.attrs||{}),f=i(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function i2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=cu,serializeAttributes:s=du,defaultAttributes:o={},content:u="block",allowedAttributes:l}=t,a=n||e,c=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else u==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...o,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${a}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=d.match(m);if(!g)return;const[b,y=""]=g,k=i(y);let w=1;const C=b.length;let v="";const A=/^:::([\w-]*)(\s.*)?/gm,T=d.slice(C);for(A.lastIndex=0;;){const I=A.exec(T);if(I===null)break;const $=I.index,re=I[1];if(!((p=I[2])!=null&&p.endsWith(":::"))){if(re)w+=1;else if(w-=1,w===0){const ke=T.slice(0,$);v=ke.trim();const Q=d.slice(0,C+$+I[0].length);let J=[];if(v)if(u==="block")for(J=h.blockTokens(ke),J.forEach(P=>{P.text&&(!P.tokens||P.tokens.length===0)&&(P.tokens=h.inlineTokens(P.text))});J.length>0;){const P=J[J.length-1];if(P.type==="paragraph"&&(!P.text||P.text.trim()===""))J.pop();else break}else J=h.inlineTokens(v);return{type:e,raw:Q,attributes:k,content:v,tokens:J}}}}}},renderMarkdown:(d,f)=>{const h=c(d.attrs||{}),p=s(h),m=p?` {${p}}`:"",g=f.renderChildren(d.content||[],`

`);return`:::${a}${m}

${g}

:::`}}}function s2(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=n.exec(t)}return e}function o2(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function u2(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=s2,serializeAttributes:s=o2,defaultAttributes:o={},selfClosing:u=!1,allowedAttributes:l}=t,a=n||e,c=f=>{if(!l)return f;const h={};return l.forEach(p=>{const m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in f){const b=f[m];if(g!==void 0&&b===g)return;h[m]=b}}),h},d=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...o,...f.attributes};if(u)return h.createNode(e,p);const m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=u?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),m=p?.index;return m!==void 0?m:-1},tokenize(f,h,p){const m=u?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),g=f.match(m);if(!g)return;let b="",y="";if(u){const[,w]=g;y=w}else{const[,w,C]=g;y=w,b=C||""}const k=i(y.trim());return{type:e,raw:g[0],content:b.trim(),attributes:k}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const p=c(f.attrs||{}),m=s(p),g=m?` ${m}`:"";return u?`[${a}${g}]`:`[${a}${g}]${h}[/${a}]`}}}function mo(t,e,n){var r,i,s,o;const u=t.split(`
`),l=[];let a="",c=0;const d=e.baseIndentSize||2;for(;c<u.length;){const f=u[c],h=f.match(e.itemPattern);if(!h){if(l.length>0)break;if(f.trim()===""){c+=1,a=`${a}${f}
`;continue}else return}const p=e.extractItemData(h),{indentLevel:m,mainContent:g}=p;a=`${a}${f}
`;const b=[g];for(c+=1;c<u.length;){const C=u[c];if(C.trim()===""){const A=u.slice(c+1).findIndex($=>$.trim()!=="");if(A===-1)break;if((((i=(r=u[c+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){b.push(C),a=`${a}${C}
`,c+=1;continue}else break}if((((o=(s=C.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)b.push(C),a=`${a}${C}
`,c+=1;else break}let y;const k=b.slice(1);if(k.length>0){const C=k.map(v=>v.slice(m+d)).join(`
`);C.trim()&&(e.customNestedParser?y=e.customNestedParser(C):y=n.blockTokens(C))}const w=e.createToken(p,y);l.push(w)}if(l.length!==0)return{items:l,raw:a}}function fu(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[s,...o]=t.content,u=e.renderChildren([s]);let l=`${i}${u}`;return o&&o.length>0&&o.forEach((a,c)=>{var d,f;const h=(f=(d=e.renderChild)==null?void 0:d.call(e,a,c+1))!=null?f:e.renderChildren([a]);if(h!=null){const p=h.split(`
`).map(m=>m?e.indent(m):e.indent("")).join(`
`);l+=a.type==="paragraph"?`

${p}`:`
${p}`}}),l}function l2(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((u,l)=>{const a=s.mapping.map(l),c=s.mapping.map(l)+u.nodeSize;let d=null;if(u.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(a,c,t.type),s.addMark(a,c,h)}}),s.docChanged&&e.view.dispatch(s)}var F=class yf extends au{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new yf(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Qt(t){return new Wb({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=z(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,u=r[r.length-1],l=r[0];let a=n.to;if(u){const c=l.search(/\S/),d=n.from+l.indexOf(u),f=d+u.length;if(lu(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+c,d),a=n.from+c+u.length,o.addMark(n.from+c,a,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:a2,getOwnPropertySymbols:c2}=Object,{hasOwnProperty:d2}=Object.prototype;function vs(t,e){return function(r,i,s){return t(r,i,s)&&e(r,i,s)}}function vr(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:s}=i,o=s.get(n),u=s.get(r);if(o&&u)return o===r&&u===n;s.set(n,r),s.set(r,n);const l=t(n,r,i);return s.delete(n),s.delete(r),l}}function f2(t){return t?.[Symbol.toStringTag]}function Ul(t){return a2(t).concat(c2(t))}const h2=Object.hasOwn||((t,e)=>d2.call(t,e));function rn(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const p2="__v",m2="__o",g2="_owner",{getOwnPropertyDescriptor:Kl,keys:Jl}=Object;function b2(t,e){return t.byteLength===e.byteLength&&ii(new Uint8Array(t),new Uint8Array(e))}function x2(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function y2(t,e){return t.byteLength===e.byteLength&&ii(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function k2(t,e){return rn(t.getTime(),e.getTime())}function w2(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function C2(t,e){return t===e}function Gl(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.entries();let o,u,l=0;for(;(o=s.next())&&!o.done;){const a=e.entries();let c=!1,d=0;for(;(u=a.next())&&!u.done;){if(i[d]){d++;continue}const f=o.value,h=u.value;if(n.equals(f[0],h[0],l,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){c=i[d]=!0;break}d++}if(!c)return!1;l++}return!0}const E2=rn;function S2(t,e,n){const r=Jl(t);let i=r.length;if(Jl(e).length!==i)return!1;for(;i-- >0;)if(!kf(t,e,n,r[i]))return!1;return!0}function Tn(t,e,n){const r=Ul(t);let i=r.length;if(Ul(e).length!==i)return!1;let s,o,u;for(;i-- >0;)if(s=r[i],!kf(t,e,n,s)||(o=Kl(t,s),u=Kl(e,s),(o||u)&&(!o||!u||o.configurable!==u.configurable||o.enumerable!==u.enumerable||o.writable!==u.writable)))return!1;return!0}function v2(t,e){return rn(t.valueOf(),e.valueOf())}function A2(t,e){return t.source===e.source&&t.flags===e.flags}function Zl(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),s=t.values();let o,u;for(;(o=s.next())&&!o.done;){const l=e.values();let a=!1,c=0;for(;(u=l.next())&&!u.done;){if(!i[c]&&n.equals(o.value,u.value,o.value,u.value,t,e,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function ii(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function M2(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function kf(t,e,n,r){return(r===g2||r===m2||r===p2)&&(t.$$typeof||e.$$typeof)?!0:h2(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const T2="[object ArrayBuffer]",_2="[object Arguments]",D2="[object Boolean]",N2="[object DataView]",O2="[object Date]",R2="[object Error]",I2="[object Map]",L2="[object Number]",F2="[object Object]",P2="[object RegExp]",z2="[object Set]",B2="[object String]",$2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},j2="[object URL]",H2=Object.prototype.toString;function q2({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:u,areObjectsEqual:l,arePrimitiveWrappersEqual:a,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(g,b,y){if(g===b)return!0;if(g==null||b==null)return!1;const k=typeof g;if(k!==typeof b)return!1;if(k!=="object")return k==="number"?u(g,b,y):k==="function"?s(g,b,y):!1;const w=g.constructor;if(w!==b.constructor)return!1;if(w===Object)return l(g,b,y);if(Array.isArray(g))return e(g,b,y);if(w===Date)return r(g,b,y);if(w===RegExp)return c(g,b,y);if(w===Map)return o(g,b,y);if(w===Set)return d(g,b,y);const C=H2.call(g);if(C===O2)return r(g,b,y);if(C===P2)return c(g,b,y);if(C===I2)return o(g,b,y);if(C===z2)return d(g,b,y);if(C===F2)return typeof g.then!="function"&&typeof b.then!="function"&&l(g,b,y);if(C===j2)return h(g,b,y);if(C===R2)return i(g,b,y);if(C===_2)return l(g,b,y);if($2[C])return f(g,b,y);if(C===T2)return t(g,b,y);if(C===N2)return n(g,b,y);if(C===D2||C===L2||C===B2)return a(g,b,y);if(p){let v=p[C];if(!v){const A=f2(g);A&&(v=p[A])}if(v)return v(g,b,y)}return!1}}function V2({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:b2,areArraysEqual:n?Tn:x2,areDataViewsEqual:y2,areDatesEqual:k2,areErrorsEqual:w2,areFunctionsEqual:C2,areMapsEqual:n?vs(Gl,Tn):Gl,areNumbersEqual:E2,areObjectsEqual:n?Tn:S2,arePrimitiveWrappersEqual:v2,areRegExpsEqual:A2,areSetsEqual:n?vs(Zl,Tn):Zl,areTypedArraysEqual:n?vs(ii,Tn):ii,areUrlsEqual:M2,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=vr(r.areArraysEqual),s=vr(r.areMapsEqual),o=vr(r.areObjectsEqual),u=vr(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:u})}return r}function W2(t){return function(e,n,r,i,s,o,u){return t(e,n,u)}}function U2({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(u,l){const{cache:a=t?new WeakMap:void 0,meta:c}=n();return e(u,l,{cache:a,equals:r,meta:c,strict:i})};if(t)return function(u,l){return e(u,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const s={cache:void 0,equals:r,meta:void 0,strict:i};return function(u,l){return e(u,l,s)}}const K2=Lt();Lt({strict:!0});Lt({circular:!0});Lt({circular:!0,strict:!0});Lt({createInternalComparator:()=>rn});Lt({strict:!0,createInternalComparator:()=>rn});Lt({circular:!0,createInternalComparator:()=>rn});Lt({circular:!0,createInternalComparator:()=>rn,strict:!0});function Lt(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,s=V2(t),o=q2(s),u=n?n(o):W2(o);return U2({circular:e,comparator:o,createState:r,equals:u,strict:i})}var J2=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},G2=({contentComponent:t})=>{const e=ic.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return x.jsx(x.Fragment,{children:Object.values(e)})};function Z2(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:dp.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var X2=class extends Jt.Component{constructor(t){super(t),this.editorContentRef=Jt.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=Z2(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return x.jsxs(x.Fragment,{children:[x.jsx("div",{ref:J2(e,this.editorContentRef),...n}),t?.contentComponent&&x.jsx(G2,{contentComponent:t.contentComponent})]})}},Y2=_.forwardRef((t,e)=>{const n=Jt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Jt.createElement(X2,{key:n,innerRef:e,...t})}),wf=Jt.memo(Y2),Q2=typeof window<"u"?_.useLayoutEffect:_.useEffect,ex=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function tx(t){var e;const[n]=_.useState(()=>new ex(t.editor)),r=lp.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:K2);return Q2(()=>n.watch(t.editor),[t.editor,n]),_.useDebugValue(r),r}var Cf=typeof window>"u",nx=Cf||!!(typeof window<"u"&&window.next),rx=class Ef{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){var e;let n=(e=this.options.current.immediatelyRender)!=null?e:!0;return n&&(Cf||nx)&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...r)},onDelete:(...r)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...r)}};return new Qb(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Ef.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function ix(t={},e=[]){const n=_.useRef(t);n.current=t;const[r]=_.useState(()=>new rx(n)),i=ic.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return _.useDebugValue(i),_.useEffect(r.onRender(e)),tx({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),i}var Sf=_.createContext({editor:null});Sf.Consumer;var sx=_.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),ox=()=>_.useContext(sx);Jt.forwardRef((t,e)=>{const{onDragStart:n}=ox(),r=t.as||"div";return x.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Jt.createContext({markViewContentRef:()=>{}});var hu=_.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});hu.displayName="TiptapContext";var ux=()=>_.useContext(hu);function vf({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=_.useMemo(()=>({editor:r}),[r]),s=_.useMemo(()=>({editor:r}),[r]);return x.jsx(Sf.Provider,{value:s,children:x.jsx(hu.Provider,{value:i,children:n})})}vf.displayName="Tiptap";function Af({...t}){const{editor:e}=ux();return x.jsx(wf,{editor:e,...t})}Af.displayName="Tiptap.Content";Object.assign(vf,{Content:Af});var si=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},lx=/^\s*>\s$/,ax=F.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return si("blockquote",{...K(this.options.HTMLAttributes,t),children:si("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((i,s)=>{var o,u;const c=((u=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?u:e.renderChildren([i])).split(`
`).map(d=>d.trim()===""?n:`${n} ${d}`);r.push(c.join(`
`))}),r.join(`
${n}
`)},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[wn({find:lx,type:this.type})]}}),cx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,fx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,hx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,px=Oe.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 si("strong",{...K(this.options.HTMLAttributes,t),children:si("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,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[kn({find:cx,type:this.type}),kn({find:fx,type:this.type})]},addPasteRules(){return[Qt({find:dx,type:this.type}),Qt({find:hx,type:this.type})]}}),mx=/(^|[^`])`([^`]+)`(?!`)$/,gx=/(^|[^`])`([^`]+)`(?!`)/g,bx=Oe.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",K(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",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[kn({find:mx,type:this.type})]},addPasteRules(){return[Qt({find:gx,type:this.type})]}}),As=4,xx=/^```([a-z]+)?[\s\n]$/,yx=/^~~~([a-z]+)?[\s\n]$/,kx=F.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:As,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;if(!n)return null;const s=[...((e=t.firstElementChild)==null?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",K(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
`):r=`\`\`\`${i}

\`\`\``,r},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},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:As,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const u=" ".repeat(n);return o?t.commands.insertContent(u):t.commands.command(({tr:l})=>{const{from:a,to:c}=i,h=r.doc.textBetween(a,c,`
`,`
`).split(`
`).map(p=>u+p).join(`
`);return l.replaceWith(a,c,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:As,{state:r}=t,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:u})=>{var l;const{pos:a}=s,c=s.start(),d=s.end(),h=r.doc.textBetween(c,d,`
`,`
`).split(`
`);let p=0,m=0;const g=a-c;for(let v=0;v<h.length;v+=1){if(m+h[v].length>=g){p=v;break}m+=h[v].length+1}const y=((l=h[p].match(/^ */))==null?void 0:l[0])||"",k=Math.min(y.length,n);if(k===0)return!0;let w=c;for(let v=0;v<p;v+=1)w+=h[v].length+1;return u.delete(w,w+k),a-w<=k&&u.setSelection(N.create(u.doc,w)),!0}):t.commands.command(({tr:u})=>{const{from:l,to:a}=i,f=r.doc.textBetween(l,a,`
`,`
`).split(`
`).map(h=>{var p;const m=((p=h.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,n);return h.slice(g)}).join(`
`);return u.replaceWith(l,a,r.schema.text(f)),!0})},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(`

`);return!s||!o?!1:t.chain().command(({tr:u})=>(u.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 u=i.after();return u===void 0?!1:r.nodeAt(u)?t.commands.command(({tr:a})=>(a.setSelection(R.near(r.resolve(u))),!0)):t.commands.exitCode()}}},addInputRules(){return[po({find:xx,type:this.type,getAttributes:t=>({language:t[1]})}),po({find:yx,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new V({key:new G("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?.mode;if(!n||!s)return!1;const{tr:o,schema:u}=t.state,l=u.text(n.replace(/\r\n?/g,`
`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(N.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),wx=F.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`

`):""}),Cx=F.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",K(this.options.HTMLAttributes,t)]},renderText(){return`
`},renderMarkdown:()=>`  
`,parseMarkdown:()=>({type:"hardBreak"}),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:u}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:a,dispatch:c})=>{if(c&&l&&o){const d=l.filter(f=>u.includes(f.type.name));a.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ex=F.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]}`,K(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},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=>po({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),Sx=F.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",K(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!t2(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return ef(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:u})=>{if(u){const{$to:l}=o.selection,a=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(N.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(O.create(o.doc,l.pos)):o.setSelection(N.create(o.doc,l.pos));else{const c=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=c?.create();d&&(o.insert(a,d),o.setSelection(N.create(o.doc,a+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[e2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),vx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ax=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Mx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Tx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,_x=Oe.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",K(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)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[kn({find:vx,type:this.type}),kn({find:Mx,type:this.type})]},addPasteRules(){return[Qt({find:Ax,type:this.type}),Qt({find:Tx,type:this.type})]}});const Dx=" ögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Nx="ελ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",go="numeric",bo="ascii",xo="alpha",jn="asciinumeric",Ln="alphanumeric",yo="domain",Mf="emoji",Ox="scheme",Rx="slashscheme",Ms="whitespace";function Ix(t,e){return t in e||(e[t]=[]),e[t]}function jt(t,e,n){e[go]&&(e[jn]=!0,e[Ln]=!0),e[bo]&&(e[jn]=!0,e[xo]=!0),e[jn]&&(e[Ln]=!0),e[xo]&&(e[Ln]=!0),e[Ln]&&(e[yo]=!0),e[Mf]&&(e[yo]=!0);for(const r in e){const i=Ix(r,n);i.indexOf(t)<0&&i.push(t)}}function Lx(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Se(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Se.groups={};Se.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||Se.groups;let i;return e&&e.j?i=e:(i=new Se(e),n&&r&&jt(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||Se.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,u=i.go(t);if(u?(o=new Se,Object.assign(o.j,u.j),o.jr.push.apply(o.jr,u.jr),o.jd=u.jd,o.t=u.t):o=new Se,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(Lx(o.t,r),n);jt(s,l,r)}else n&&jt(s,n,r);o.t=s}return i.j[t]=o,o}};const L=(t,e,n,r,i)=>t.ta(e,n,r,i),Z=(t,e,n,r,i)=>t.tr(e,n,r,i),Xl=(t,e,n,r,i)=>t.ts(e,n,r,i),S=(t,e,n,r,i)=>t.tt(e,n,r,i),st="WORD",ko="UWORD",Tf="ASCIINUMERICAL",_f="ALPHANUMERICAL",nr="LOCALHOST",wo="TLD",Co="UTLD",$r="SCHEME",cn="SLASH_SCHEME",pu="NUM",Eo="WS",mu="NL",Hn="OPENBRACE",qn="CLOSEBRACE",oi="OPENBRACKET",ui="CLOSEBRACKET",li="OPENPAREN",ai="CLOSEPAREN",ci="OPENANGLEBRACKET",di="CLOSEANGLEBRACKET",fi="FULLWIDTHLEFTPAREN",hi="FULLWIDTHRIGHTPAREN",pi="LEFTCORNERBRACKET",mi="RIGHTCORNERBRACKET",gi="LEFTWHITECORNERBRACKET",bi="RIGHTWHITECORNERBRACKET",xi="FULLWIDTHLESSTHAN",yi="FULLWIDTHGREATERTHAN",ki="AMPERSAND",wi="APOSTROPHE",Ci="ASTERISK",gt="AT",Ei="BACKSLASH",Si="BACKTICK",vi="CARET",Ht="COLON",gu="COMMA",Ai="DOLLAR",We="DOT",Mi="EQUALS",bu="EXCLAMATION",Le="HYPHEN",Vn="PERCENT",Ti="PIPE",_i="PLUS",Di="POUND",Wn="QUERY",xu="QUOTE",Df="FULLWIDTHMIDDLEDOT",yu="SEMI",Ue="SLASH",Un="TILDE",Ni="UNDERSCORE",Nf="EMOJI",Oi="SYM";var Of=Object.freeze({__proto__:null,ALPHANUMERICAL:_f,AMPERSAND:ki,APOSTROPHE:wi,ASCIINUMERICAL:Tf,ASTERISK:Ci,AT:gt,BACKSLASH:Ei,BACKTICK:Si,CARET:vi,CLOSEANGLEBRACKET:di,CLOSEBRACE:qn,CLOSEBRACKET:ui,CLOSEPAREN:ai,COLON:Ht,COMMA:gu,DOLLAR:Ai,DOT:We,EMOJI:Nf,EQUALS:Mi,EXCLAMATION:bu,FULLWIDTHGREATERTHAN:yi,FULLWIDTHLEFTPAREN:fi,FULLWIDTHLESSTHAN:xi,FULLWIDTHMIDDLEDOT:Df,FULLWIDTHRIGHTPAREN:hi,HYPHEN:Le,LEFTCORNERBRACKET:pi,LEFTWHITECORNERBRACKET:gi,LOCALHOST:nr,NL:mu,NUM:pu,OPENANGLEBRACKET:ci,OPENBRACE:Hn,OPENBRACKET:oi,OPENPAREN:li,PERCENT:Vn,PIPE:Ti,PLUS:_i,POUND:Di,QUERY:Wn,QUOTE:xu,RIGHTCORNERBRACKET:mi,RIGHTWHITECORNERBRACKET:bi,SCHEME:$r,SEMI:yu,SLASH:Ue,SLASH_SCHEME:cn,SYM:Oi,TILDE:Un,TLD:wo,UNDERSCORE:Ni,UTLD:Co,UWORD:ko,WORD:st,WS:Eo});const rt=/[a-z]/,_n=/\p{L}/u,Ts=/\p{Emoji}/u,it=/\d/,_s=/\s/,Yl="\r",Ds=`
`,Fx="️",Px="‍",Ns="￼";let Ar=null,Mr=null;function zx(t=[]){const e={};Se.groups=e;const n=new Se;Ar==null&&(Ar=Ql(Dx)),Mr==null&&(Mr=Ql(Nx)),S(n,"'",wi),S(n,"{",Hn),S(n,"}",qn),S(n,"[",oi),S(n,"]",ui),S(n,"(",li),S(n,")",ai),S(n,"<",ci),S(n,">",di),S(n,"（",fi),S(n,"）",hi),S(n,"「",pi),S(n,"」",mi),S(n,"『",gi),S(n,"』",bi),S(n,"＜",xi),S(n,"＞",yi),S(n,"&",ki),S(n,"*",Ci),S(n,"@",gt),S(n,"`",Si),S(n,"^",vi),S(n,":",Ht),S(n,",",gu),S(n,"$",Ai),S(n,".",We),S(n,"=",Mi),S(n,"!",bu),S(n,"-",Le),S(n,"%",Vn),S(n,"|",Ti),S(n,"+",_i),S(n,"#",Di),S(n,"?",Wn),S(n,'"',xu),S(n,"/",Ue),S(n,";",yu),S(n,"~",Un),S(n,"_",Ni),S(n,"\\",Ei),S(n,"・",Df);const r=Z(n,it,pu,{[go]:!0});Z(r,it,r);const i=Z(r,rt,Tf,{[jn]:!0}),s=Z(r,_n,_f,{[Ln]:!0}),o=Z(n,rt,st,{[bo]:!0});Z(o,it,i),Z(o,rt,o),Z(i,it,i),Z(i,rt,i);const u=Z(n,_n,ko,{[xo]:!0});Z(u,rt),Z(u,it,s),Z(u,_n,u),Z(s,it,s),Z(s,rt),Z(s,_n,s);const l=S(n,Ds,mu,{[Ms]:!0}),a=S(n,Yl,Eo,{[Ms]:!0}),c=Z(n,_s,Eo,{[Ms]:!0});S(n,Ns,c),S(a,Ds,l),S(a,Ns,c),Z(a,_s,c),S(c,Yl),S(c,Ds),Z(c,_s,c),S(c,Ns,c);const d=Z(n,Ts,Nf,{[Mf]:!0});S(d,"#"),Z(d,Ts,d),S(d,Fx,d);const f=S(d,Px);S(f,"#"),Z(f,Ts,d);const h=[[rt,o],[it,i]],p=[[rt,null],[_n,u],[it,s]];for(let m=0;m<Ar.length;m++)ht(n,Ar[m],wo,st,h);for(let m=0;m<Mr.length;m++)ht(n,Mr[m],Co,ko,p);jt(wo,{tld:!0,ascii:!0},e),jt(Co,{utld:!0,alpha:!0},e),ht(n,"file",$r,st,h),ht(n,"mailto",$r,st,h),ht(n,"http",cn,st,h),ht(n,"https",cn,st,h),ht(n,"ftp",cn,st,h),ht(n,"ftps",cn,st,h),jt($r,{scheme:!0,ascii:!0},e),jt(cn,{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],y=t[m][1]?{[Ox]:!0}:{[Rx]:!0};g.indexOf("-")>=0?y[yo]=!0:rt.test(g)?it.test(g)?y[jn]=!0:y[bo]=!0:y[go]=!0,Xl(n,g,g,y)}return Xl(n,"localhost",nr,{ascii:!0}),n.jd=new Se(Oi),{start:n,tokens:Object.assign({groups:e},Of)}}function Rf(t,e){const n=Bx(e.replace(/[A-Z]/g,u=>u.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let u=t,l=null,a=0,c=null,d=-1,f=-1;for(;o<r&&(l=u.go(n[o]));)u=l,u.accepts()?(d=0,f=0,c=u):d>=0&&(d+=n[o].length,f++),a+=n[o].length,s+=n[o].length,o++;s-=d,o-=f,a-=d,i.push({t:c.t,v:e.slice(s-a,s),s:s-a,e:s})}return i}function Bx(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 ht(t,e,n,r,i){let s;const o=e.length;for(let u=0;u<o-1;u++){const l=e[u];t.j[l]?s=t.j[l]:(s=new Se(r),s.jr=i.slice(),t.j[l]=s),t=s}return s=new Se(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function Ql(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 rr={defaultProtocol:"http",events:null,format:ea,formatHref:ea,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ku(t,e=null){let n=Object.assign({},rr);t&&(n=Object.assign(n,t instanceof ku?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}ku.prototype={o:rr,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]:rr[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 ea(t){return t}function If(t,e){this.t="token",this.v=t,this.tk=e}If.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=rr.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={},u=t.get("className",n,e),l=t.get("target",n,e),a=t.get("rel",n,e),c=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,u&&(o.class=u),l&&(o.target=l),a&&(o.rel=a),c&&Object.assign(o,c),{tagName:i,attributes:o,content:s,eventListeners:d}}};function es(t,e){class n extends If{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 $x=es("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ta=es("text"),jx=es("nl"),Tr=es("url",{isLink:!0,toHref(t=rr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==nr&&t[1].t===Ht}}),Ie=t=>new Se(t);function Hx({groups:t}){const e=t.domain.concat([ki,Ci,gt,Ei,Si,vi,Ai,Mi,Le,pu,Vn,Ti,_i,Di,Ue,Oi,Un,Ni]),n=[wi,Ht,gu,We,bu,Vn,Wn,xu,yu,ci,di,Hn,qn,ui,oi,li,ai,fi,hi,pi,mi,gi,bi,xi,yi],r=[ki,wi,Ci,Ei,Si,vi,Ai,Mi,Le,Hn,qn,Vn,Ti,_i,Di,Wn,Ue,Oi,Un,Ni],i=Ie(),s=S(i,Un);L(s,r,s),L(s,t.domain,s);const o=Ie(),u=Ie(),l=Ie();L(i,t.domain,o),L(i,t.scheme,u),L(i,t.slashscheme,l),L(o,r,s),L(o,t.domain,o);const a=S(o,gt);S(s,gt,a),S(u,gt,a),S(l,gt,a);const c=S(s,We);L(c,r,s),L(c,t.domain,s);const d=Ie();L(a,t.domain,d),L(d,t.domain,d);const f=S(d,We);L(f,t.domain,d);const h=Ie($x);L(f,t.tld,h),L(f,t.utld,h),S(a,nr,h);const p=S(d,Le);S(p,Le,p),L(p,t.domain,d),L(h,t.domain,d),S(h,We,f),S(h,Le,p);const m=S(o,Le),g=S(o,We);S(m,Le,m),L(m,t.domain,o),L(g,r,s),L(g,t.domain,o);const b=Ie(Tr);L(g,t.tld,b),L(g,t.utld,b),L(b,t.domain,o),L(b,r,s),S(b,We,g),S(b,Le,m),S(b,gt,a);const y=S(b,Ht),k=Ie(Tr);L(y,t.numeric,k);const w=Ie(Tr),C=Ie();L(w,e,w),L(w,n,C),L(C,e,w),L(C,n,C),S(b,Ue,w),S(k,Ue,w);const v=S(u,Ht),A=S(l,Ht),T=S(A,Ue),I=S(T,Ue);L(u,t.domain,o),S(u,We,g),S(u,Le,m),L(l,t.domain,o),S(l,We,g),S(l,Le,m),L(v,t.domain,w),S(v,Ue,w),S(v,Wn,w),L(I,t.domain,w),L(I,e,w),S(I,Ue,w);const $=[[Hn,qn],[oi,ui],[li,ai],[ci,di],[fi,hi],[pi,mi],[gi,bi],[xi,yi]];for(let re=0;re<$.length;re++){const[ke,Q]=$[re],J=S(w,ke);S(C,ke,J);const P=Ie(Tr);L(J,e,P);const Ve=Ie();L(J,n,Ve),S(J,Q,w),L(P,e,P),L(P,n,Ve),L(Ve,e,P),L(Ve,n,Ve),S(P,Q,w),S(Ve,Q,w)}return S(i,nr,b),S(i,mu,jx),{start:i,tokens:Of}}function qx(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let u=t,l=null,a=null,c=0,d=null,f=-1;for(;i<r&&!(l=u.go(n[i].t));)o.push(n[i++]);for(;i<r&&(a=l||u.go(n[i].t));)l=null,u=a,u.accepts()?(f=0,d=u):f>=0&&f++,i++,c++;if(f<0)i-=c,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(Os(ta,e,o)),o=[]),i-=f,c-=f;const h=d.t,p=n.slice(i-c,i);s.push(Os(h,e,p))}}return o.length>0&&s.push(Os(ta,e,o)),s}function Os(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 Vx=typeof console<"u"&&console&&console.warn||(()=>{}),Wx="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",W={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ux(){return Se.groups={},W.scanner=null,W.parser=null,W.tokenQueue=[],W.pluginQueue=[],W.customSchemes=[],W.initialized=!1,W}function na(t,e=!1){if(W.initialized&&Vx(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Wx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);W.customSchemes.push([t,e])}function Kx(){W.scanner=zx(W.customSchemes);for(let t=0;t<W.tokenQueue.length;t++)W.tokenQueue[t][1]({scanner:W.scanner});W.parser=Hx(W.scanner.tokens);for(let t=0;t<W.pluginQueue.length;t++)W.pluginQueue[t][1]({scanner:W.scanner,parser:W.parser});return W.initialized=!0,W}function wu(t){return W.initialized||Kx(),qx(W.parser.start,t,Rf(W.scanner.start,t))}wu.scan=Rf;function Lf(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 ku(n),i=wu(t),s=[];for(let o=0;o<i.length;o++){const u=i[o];u.isLink&&(!e||u.t===e)&&r.check(u)&&s.push(u.toFormattedObject(r))}return s}var Cu="[\0-   ᠎ -\u2029 　]",Jx=new RegExp(Cu),Gx=new RegExp(`${Cu}$`),Zx=new RegExp(Cu,"g");function Xx(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Yx(t){return new V({key:new G("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),s=e.some(a=>a.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,u=Wd(n.doc,[...e]);if(Qd(u).forEach(({newRange:a})=>{const c=tb(r.doc,a,h=>h.isTextblock);let d,f;if(c.length>1)d=c[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const h=r.doc.textBetween(a.from,a.to," "," ");if(!Gx.test(h))return;d=c[0],f=r.doc.textBetween(d.pos,a.to,void 0," ")}if(d&&f){const h=f.split(Jx).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const g=wu(p).map(b=>b.toObject(t.defaultProtocol));if(!Xx(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=>{lu(b.from,b.to,r.doc).some(y=>y.mark.type===t.type)||o.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function Qx(t){return new V({key:new G("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const a=t.editor.view.dom;o=l.closest("a"),o&&!a.contains(o)&&(o=null)}if(!o)return!1;let u=!1;if(t.enableClickSelection&&(u=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const l=Yd(e.state,t.type.name),a=(i=o.href)!=null?i:l.href,c=(s=o.target)!=null?s:l.target;a&&(window.open(a,c),u=!0)}return u}}})}function ey(t){return new V({key:new G("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:s}=e,{selection:o}=s,{empty:u}=o;if(u)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=Lf(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a||i!==void 0&&!i(a.value)?!1:t.editor.commands.setMark(t.type,{href:a.href})}}})}function Ft(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(Zx,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Ff=Oe.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"){na(t);return}na(t.scheme,t.optionalSlashes)})},onDestroy(){Ux()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ft(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},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},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ft(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=>!!Ft(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",K(this.options.HTMLAttributes,t),0]:["a",K(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",u=(s=(i=t.attrs)==null?void 0:i.title)!=null?s:"",l=e.renderChildren(t);return u?`[${l}](${o} "${u}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ft(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 n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Ft(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Qt({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=Lf(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Ft(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&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?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Yx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Ft(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Qx({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(ey({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),ty=Object.defineProperty,ny=(t,e)=>{for(var n in e)ty(t,n,{get:e[n],enumerable:!0})},ry="listItem",ra="textStyle",ia=/^\s*([-+*])\s$/,Pf=F.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",K(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ry,this.editor.getAttributes(ra)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=wn({find:ia,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=wn({find:ia,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ra),editor:this.editor})),[t]}});function iy(t){var e,n;const r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function sy(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var zf=F.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",K(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0){if(iy(t))return{type:"listItem",content:[{type:"paragraph",content:sy(t.text||"",e)}]};if(t.tokens.some(o=>o.type==="paragraph"))i=r(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const l=t.tokens.slice(1),a=r(l);i.push(...a)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>fu(t,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),oy={};ny(oy,{findListItemPos:()=>hr,getNextListDepth:()=>Eu,handleBackspace:()=>So,handleDelete:()=>vo,hasListBefore:()=>Bf,hasListItemAfter:()=>uy,hasListItemBefore:()=>$f,listItemHasSubList:()=>jf,nextListIsDeeper:()=>Hf,nextListIsHigher:()=>qf});var hr=(t,e)=>{const{$from:n}=e.selection,r=ne(t,e.schema);let i=null,s=n.depth,o=n.pos,u=null;for(;s>0&&u===null;)i=n.node(s),i.type===r?u=s:(s-=1,o-=1);return u===null?null:{$pos:e.doc.resolve(o),depth:u}},Eu=(t,e)=>{const n=hr(t,e);if(!n)return!1;const[,r]=db(e,t,n.$pos.pos+4);return r},Bf=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),s=t.doc.resolve(i).node();return!(!s||!n.includes(s.type.name))},$f=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},jf=(t,e,n)=>{if(!n)return!1;const r=ne(t,e.schema);let i=!1;return n.descendants(s=>{s.type===r&&(i=!0)}),i},So=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Nt(t.state,e)&&Bf(t.state,e,n)){const{$anchor:u}=t.state.selection,l=t.state.doc.resolve(u.before()-1),a=[];l.node().descendants((f,h)=>{f.type.name===e&&a.push({node:f,pos:h})});const c=a.at(-1);if(!c)return!1;const d=t.state.doc.resolve(l.start()+c.pos+1);return t.chain().cut({from:u.start()-1,to:u.end()+1},d.end()).joinForward().run()}if(!Nt(t.state,e)||!mb(t.state))return!1;const r=hr(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=jf(e,t.state,s);return $f(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Hf=(t,e)=>{const n=Eu(t,e),r=hr(t,e);return!r||!n?!1:n>r.depth},qf=(t,e)=>{const n=Eu(t,e),r=hr(t,e);return!r||!n?!1:n<r.depth},vo=(t,e)=>{if(!Nt(t.state,e)||!pb(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:Hf(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():qf(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},uy=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},Vf=U.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&vo(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&vo(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&So(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&So(t,n,r)&&(e=!0)}),e}}}}),sa=/^(\s*)(\d+)\.\s+(.*)$/,ly=/^\s/;function ay(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function cy(t){const e=[],n=[];let r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&ay(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function dy(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],s=i.match(sa);if(!s)break;const[,o,u,l]=s,a=o.length,c=[l];let d=n+1;const f=[i];let h=!1;for(;d<t.length;){const p=t[d];if(p.match(sa))break;if(p.trim()==="")f.push(p),c.push(""),h=!0,d+=1;else if(p.match(ly))f.push(p),c.push(p.slice(a+2)),d+=1;else{if(h)break;f.push(p),c.push(p),d+=1}}e.push({indent:a,number:parseInt(u,10),content:c.join(`
`).trim(),contentLines:c,raw:f.join(`
`)}),r=d,n=d}return[e,r]}function Wf(t,e,n){const r=[];let i=0;for(;i<t.length;){const s=t[i];if(s.indent===e){const{paragraphLines:o,blockLines:u}=cy(s.contentLines),l=o.join(`
`).trim(),a=[];l&&a.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const c=u.join(`
`).trim();if(c){const h=n.blockTokens(c);a.push(...h)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(m=>m.indent)),p=Wf(f,h,n);a.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
`)})}r.push({type:"list_item",raw:s.raw,tokens:a}),i=d}else i+=1}return r}function fy(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var hy="listItem",oa="textStyle",ua=/^(\d+)\.\s$/,Uf=F.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",K(this.options.HTMLAttributes,n),0]:["ol",K(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?fy(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
`),[s,o]=dy(i);if(s.length===0)return;const u=Wf(s,0,n);return u.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:u,raw:i.slice(0,o).join(`
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(hy,this.editor.getAttributes(oa)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=wn({find:ua,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=wn({find:ua,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(oa)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),py=/^\s*(\[([( |x])?\])\s$/,my=F.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",K(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return fu(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),u=document.createElement("input"),l=document.createElement("div"),a=d=>{var f,h;u.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,u.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};a(t),s.contentEditable="false",u.type="checkbox",u.addEventListener("mousedown",d=>d.preventDefault()),u.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){u.checked=!u.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(u.checked=!u.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=t.attrs.checked,u.checked=t.attrs.checked,s.append(u,o),i.append(s,l),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)});let c=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,u.checked=d.attrs.checked,a(d);const f=r.extensionManager.attributes,h=tr(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return c.forEach(g=>{p.has(g)||(g in m?i.setAttribute(g,m[g]):i.removeAttribute(g))}),Object.entries(h).forEach(([g,b])=>{b==null?g in m?i.setAttribute(g,m[g]):i.removeAttribute(g):i.setAttribute(g,b)}),c=p,!0}}}},addInputRules(){return[wn({find:py,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),gy=F.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",K(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=s=>{const o=mo(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:u=>({indentLevel:u[1].length,mainContent:u[4],checked:u[3].toLowerCase()==="x"}),createToken:(u,l)=>({type:"taskItem",raw:"",mainContent:u.mainContent,indentLevel:u.indentLevel,checked:u.checked,text:u.mainContent,tokens:n.inlineTokens(u.mainContent),nestedTokens:l}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(s)},i=mo(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});U.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Pf.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(zf.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Vf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Uf.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(my.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(gy.configure(this.options.taskList)),t}});var _r="&nbsp;",Rs=" ",by=F.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",K(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===_r||n[0].text===_r||n[0].raw===Rs||n[0].text===Rs)&&r.length===1&&r[0].type==="text"&&(r[0].text===_r||r[0].text===Rs)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";const s=Array.isArray(t.content)?t.content:[];if(s.length===0){const o=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n?.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?_r:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),xy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,yy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,ky=Oe.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",K(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,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[kn({find:xy,type:this.type})]},addPasteRules(){return[Qt({find:yy,type:this.type})]}}),wy=F.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Cy=Oe.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",K(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Ey(t={}){return new V({view(e){return new Sy(e,t)}})}class Sy{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,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.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):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,u=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*u;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 a,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")a=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;a=d.left-l.scrollLeft*f,c=d.top-l.scrollTop*h}this.element.style.left=(r.left-a)/o+"px",this.element.style.top=(r.top-c)/u+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/u+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;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){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let u=Pc(this.editorView.state.doc,o,this.editorView.dragging.slice);u!=null&&(o=u)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class X extends R{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return X.valid(r)?new X(r):R.near(r)}content(){return M.empty}eq(e){return e instanceof X&&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 X(e.resolve(n.pos))}getBookmark(){return new Su(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!vy(e)||!Ay(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&&X.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let u=e.node(o);if(n>0?e.indexAfter(o)<u.childCount:e.index(o)>0){s=u.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(X.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!O.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let u=e.doc.resolve(i);if(X.valid(u))return u}return null}}}X.prototype.visible=!1;X.findFrom=X.findGapCursorFrom;R.jsonID("gapcursor",X);class Su{constructor(e){this.pos=e}map(e){return new Su(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return X.valid(n)?new X(n):R.near(n)}}function Kf(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function vy(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||Kf(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Ay(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||Kf(i.type))return!0;if(i.inlineContent)return!1}}return!0}function My(){return new V({props:{decorations:Ny,createSelectionBetween(t,e,n){return e.pos==n.pos&&X.valid(n)?new X(n):null},handleClick:_y,handleKeyDown:Ty,handleDOMEvents:{beforeinput:Dy}}})}const Ty=ru({ArrowLeft:Dr("horiz",-1),ArrowRight:Dr("horiz",1),ArrowUp:Dr("vert",-1),ArrowDown:Dr("vert",1)});function Dr(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,u=e>0?o.$to:o.$from,l=o.empty;if(o instanceof N){if(!s.endOfTextblock(n)||u.depth==0)return!1;l=!1,u=r.doc.resolve(e>0?u.after():u.before())}let a=X.findGapCursorFrom(u,e,l);return a?(i&&i(r.tr.setSelection(new X(a))),!0):!1}}function _y(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!X.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&O.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new X(r))),!0)}function Dy(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof X))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=E.empty;for(let o=r.length-1;o>=0;o--)i=E.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new M(i,0,0));return s.setSelection(N.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function Ny(t){if(!(t.selection instanceof X))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",j.create(t.doc,[ue.widget(t.selection.head,e,{key:"gapcursor"})])}var Ri=200,ae=function(){};ae.prototype.append=function(e){return e.length?(e=ae.from(e),!this.length&&e||e.length<Ri&&this.leafAppend(e)||this.length<Ri&&e.leafPrepend(this)||this.appendInner(e)):this};ae.prototype.prepend=function(e){return e.length?ae.from(e).append(this):this};ae.prototype.appendInner=function(e){return new Oy(this,e)};ae.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?ae.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ae.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ae.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)};ae.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};ae.from=function(e){return e instanceof ae?e:e&&e.length?new Jf(e):ae.empty};var Jf=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,u){for(var l=s;l<o;l++)if(i(this.values[l],u+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,u){for(var l=s-1;l>=o;l--)if(i(this.values[l],u+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ri)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ri)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}(ae);ae.empty=new Jf([]);var Oy=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 u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(s,u),o)===!1||s>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,s)-u,o+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(s,u)-u,o+u)===!1||s<u&&this.left.forEachInvertedInner(r,Math.min(i,u),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}(ae);const Ry=500;class $e{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,u,l,a=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new Ke(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],a.push(new Ke(p,void 0,void 0,a.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return u=i?d.selection.map(i.slice(s)):d.selection,l=new $e(this.items.slice(0,r).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:u}}addTransform(e,n,r,i){let s=[],o=this.eventCount,u=this.items,l=!i&&u.length?u.get(u.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new Ke(e.mapping.maps[c],d,n),h;(h=l&&l.merge(f))&&(f=h,c?s.pop():u=u.slice(0,u.length-1)),s.push(f),n&&(o++,n=void 0),i||(l=f)}let a=o-r.depth;return a>Ly&&(u=Iy(u,a),o-=a),new $e(u.append(s),o)}remapping(e,n){let r=new Gn;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 $e(this.items.append(e.map(n=>new Ke(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,u=this.eventCount;this.items.forEach(f=>{f.selection&&u--},i);let l=n;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(l+1,h));g&&u++,r.push(new Ke(p,m,g))}else r.push(new Ke(p))},i);let a=[];for(let f=n;f<o;f++)a.push(new Ke(s.maps[f]));let c=this.items.slice(0,i).append(a).append(r),d=new $e(c,u);return d.emptyItemCount()>Ry&&(d=d.compress(this.items.length-r.length)),d}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,u)=>{if(u>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),a=l&&l.getMap();if(r--,a&&n.appendMap(a,r),l){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let d=new Ke(a.invert(),l,c),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new $e(ae.from(i.reverse()),s)}}$e.empty=new $e(ae.empty,0);function Iy(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Ke{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 Ke(n.getMap().invert(),n,this.selection)}}}class bt{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const Ly=20;function Fy(t,e,n,r){let i=n.getMeta(Kt),s;if(i)return i.historyState;n.getMeta(By)&&(t=new bt(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Kt))return o.getMeta(Kt).redo?new bt(t.done.addTransform(n,void 0,r,jr(e)),t.undone,la(n.mapping.maps),t.prevTime,t.prevComposition):new bt(t.done,t.undone.addTransform(n,void 0,r,jr(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let u=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=u&&(t.prevTime<(n.time||0)-r.newGroupDelay||!Py(n,t.prevRanges)),a=o?Is(t.prevRanges,n.mapping):la(n.mapping.maps);return new bt(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,jr(e)),$e.empty,a,n.time,u??t.prevComposition)}else return(s=n.getMeta("rebased"))?new bt(t.done.rebased(n,s),t.undone.rebased(n,s),Is(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new bt(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Is(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Py(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 la(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 Is(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 zy(t,e,n){let r=jr(e),i=Kt.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),u=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new bt(n?u:s.remaining,n?s.remaining:u,null,0,-1);return s.transform.setSelection(o).setMeta(Kt,{redo:n,historyState:l})}let Ls=!1,aa=null;function jr(t){let e=t.plugins;if(aa!=e){Ls=!1,aa=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ls=!0;break}}return Ls}const Kt=new G("history"),By=new G("closeHistory");function $y(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new V({key:Kt,state:{init(){return new bt($e.empty,$e.empty,null,0,-1)},apply(e,n,r){return Fy(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?Zf:r=="historyRedo"?Xf:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Gf(t,e){return(n,r)=>{let i=Kt.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=zy(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Zf=Gf(!1,!0),Xf=Gf(!0,!0);U.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new V({key:new G("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const u=o-i,l=0,a=u;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const u=e.selection.$head.pos,l=s-r,a=u-l,c=u;return e.deleteRange(a,c),!(this.storage.characters({node:e.doc})>r)}})]}});var jy=U.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Ey(this.options)]}});U.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new V({key:new G("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!n||!r)return j.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,a)=>{if(l.isText)return;if(!(i>=a&&i<=a+l.nodeSize-1))return!1;o+=1});let u=0;return t.descendants((l,a)=>{if(l.isText||!(i>=a&&i<=a+l.nodeSize-1))return!1;if(u+=1,this.options.mode==="deepest"&&o-u>0||this.options.mode==="shallowest"&&u>1)return this.options.mode==="deepest";s.push(ue.node(a,a+l.nodeSize,{class:this.options.className}))}),j.create(t,s)}}})]}});var Hy=U.create({name:"gapCursor",addProseMirrorPlugins(){return[My()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=z(D(t,"allowGapCursor",n)))!=null?e:null}}}),ca="placeholder";function qy(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}U.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:ca,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${qy(this.options.dataAttribute)}`:`data-${ca}`;return[new V({key:new G("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,s=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((u,l)=>{const a=i>=l&&i<=l+u.nodeSize,c=!u.isLeaf&&Xi(u);if(!u.type.isTextblock)return this.options.includeChildren;if((a||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const f=ue.node(l,l+u.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:u,pos:l,hasAnchor:a}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),j.create(e,s)}}})]}});U.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new V({key:new G("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||ef(n.selection)||t.view.dragging?null:j.create(n.doc,[ue.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});var Vy="skipTrailingNode";function da({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var Wy=U.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new G(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new V({key:e,appendTransaction:(i,s,o)=>{const{doc:u,tr:l,schema:a}=o,c=e.getState(o),d=u.content.size,f=a.nodes[n];if(!i.some(h=>h.getMeta(Vy))&&c)return l.insert(d,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!da({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!da({node:o,types:r})}}})]}}),Uy=U.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Zf(t,e),redo:()=>({state:t,dispatch:e})=>Xf(t,e)}},addProseMirrorPlugins(){return[$y(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()}}}),Ky=U.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(px.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(ax.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Pf.configure(this.options.bulletList)),this.options.code!==!1&&i.push(bx.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(kx.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(wx.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(jy.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Hy.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Cx.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Ex.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Uy.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Sx.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(_x.configure(this.options.italic)),this.options.listItem!==!1&&i.push(zf.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Vf.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(Ff.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Uf.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(by.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(ky.configure(this.options.strike)),this.options.text!==!1&&i.push(wy.configure(this.options.text)),this.options.underline!==!1&&i.push(Cy.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(Wy.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Jy=Ky;let Ao,Mo;if(typeof WeakMap<"u"){let t=new WeakMap;Ao=e=>t.get(e),Mo=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Ao=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Mo=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Y=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let u=1;s<this.width&&this.map[e+u]==n;u++)s++;for(let u=1;o<this.height&&this.map[e+this.width*u]==n;u++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:u,top:l,bottom:a}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,l),right:Math.max(r,u),bottom:Math.max(s,a)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const u=(t+1)*this.width;for(;o<u&&this.map[o]<i;)o++;return o==u?s-1:this.map[o]}i=s}}static get(t){return Ao(t)||Mo(t,Gy(t))}};function Gy(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=Zy(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let a=0,c=e*n;a<c;a++)r[a]=0;for(let a=0,c=0;a<n;a++){const d=t.child(a);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:b,colwidth:y}=m.attrs;for(let k=0;k<b;k++){if(k+a>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:b-k});break}const w=i+k*e;for(let C=0;C<g;C++){r[w+C]==0?r[w+C]=c:(s||(s=[])).push({type:"collision",row:a,pos:c,n:g-C});const v=y&&y[C];if(v){const A=(w+C)%e*2,T=o[A];T==null||T!=v&&o[A+1]==1?(o[A]=v,o[A+1]=1):T==v&&o[A+1]++}}}i+=g,c+=m.nodeSize}const f=(a+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:a,n:h}),c++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const u=new Y(e,n,r,s);let l=!1;for(let a=0;!l&&a<o.length;a+=2)o[a]!=null&&o[a+1]<n&&(l=!0);return l&&Xy(u,o,t),u}function Zy(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const u=t.child(o);for(let l=0;l<u.childCount;l++){const a=u.child(l);o+a.attrs.rowspan>r&&(s+=a.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const u=i.child(o);s+=u.attrs.colspan,u.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function Xy(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let u=null;const l=o.attrs;for(let a=0;a<l.colspan;a++){const c=e[(i+a)%t.width*2];c!=null&&(!l.colwidth||l.colwidth[a]!=c)&&((u||(u=Yy(l)))[a]=c)}u&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:u})}}function Yy(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function ge(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const kt=new G("selectingCells");function en(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Qy(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function He(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function ts(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=en(e.$head)||ek(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function ek(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function To(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function tk(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function vu(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Yf(t,e,n){const r=t.node(-1),i=Y.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function tn(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Qf(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function nk(t,e,n){const r=ge(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var q=class ot extends R{constructor(e,n=e){const r=e.node(-1),i=Y.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),u=e.node(0),l=i.cellsInRect(o).filter(c=>c!=n.pos-s);l.unshift(n.pos-s);const a=l.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=s+c+1;return new Hc(u.resolve(f),u.resolve(f+d.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(To(r)&&To(i)&&vu(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?ot.rowSelection(r,i):s&&this.isColSelection()?ot.colSelection(r,i):new ot(r,i)}return N.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Y.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let l=i.top;l<i.bottom;l++){const a=[];for(let c=l*n.width+i.left,d=i.left;d<i.right;d++,c++){const f=n.map[c];if(s[f])continue;s[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=i.left-h.left,g=h.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=tn(b,0,m)),g>0&&(b=tn(b,b.colspan-g,g)),h.left<i.left){if(p=p.type.createAndFill(b),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(h.top<i.top||h.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}a.push(p)}o.push(e.child(l).copy(E.from(a)))}const u=this.isColSelection()&&this.isRowSelection()?e:o;return new M(E.from(u),1,1)}replace(e,n=M.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:u,$to:l}=i[o],a=e.mapping.slice(r);e.replace(a.map(u.pos),a.map(l.pos),o?M.empty:n)}const s=R.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new M(E.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Y.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Y.get(r),s=e.start(-1),o=i.findCell(e.pos-s),u=i.findCell(n.pos-s),l=e.node(0);return o.top<=u.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),u.bottom<i.height&&(n=l.resolve(s+i.map[i.width*(i.height-1)+u.right-1]))):(u.top>0&&(n=l.resolve(s+i.map[u.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new ot(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Y.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,u=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,u)==n.width}eq(e){return e instanceof ot&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Y.get(r),s=e.start(-1),o=i.findCell(e.pos-s),u=i.findCell(n.pos-s),l=e.node(0);return o.left<=u.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),u.right<i.width&&(n=l.resolve(s+i.map[i.width*(u.top+1)-1]))):(u.left>0&&(n=l.resolve(s+i.map[u.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new ot(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ot(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ot(e.resolve(n),e.resolve(r))}getBookmark(){return new rk(this.$anchorCell.pos,this.$headCell.pos)}};q.prototype.visible=!1;R.jsonID("cell",q);var rk=class eh{constructor(e,n){this.anchor=e,this.head=n}map(e){return new eh(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&vu(n,r)?new q(n,r):R.near(r,1)}};function ik(t){if(!(t.selection instanceof q))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ue.node(r,r+n.nodeSize,{class:"selectedCell"}))}),j.create(t.doc,e)}function sk({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function ok({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function uk(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof O&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=q.create(i,r.from);else if(o=="row"){const u=i.resolve(r.from+1);s=q.rowSelection(u,u)}else if(!n){const u=Y.get(r.node),l=r.from+1,a=l+u.map[u.width*u.height-1];s=q.create(i,l+1,a)}}else r instanceof N&&sk(r)?s=N.create(i,r.from):r instanceof N&&ok(r)&&(s=N.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const lk=new G("fix-tables");function th(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,u=0;o<s;o++){const l=e.child(o);for(let a=u,c=Math.min(i,o+3);a<c;a++)if(t.child(a)==l){u=a+1,n+=l.nodeSize;continue e}r(l,n),u<i&&t.child(u).sameMarkup(l)?th(t.child(u),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function nh(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ak(t,i,s,n))};return e?e.doc!=t.doc&&th(e.doc,t.doc,0,r):t.doc.descendants(r),n}function ak(t,e,n,r){const i=Y.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){const a=i.problems[l];if(a.type=="collision"){const c=e.nodeAt(a.pos);if(!c)continue;const d=c.attrs;for(let f=0;f<d.rowspan;f++)s[a.row+f]+=a.n;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,tn(d,d.colspan-a.n,a.n))}else if(a.type=="missing")s[a.row]+=a.n;else if(a.type=="overlong_rowspan"){const c=e.nodeAt(a.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-a.n})}else if(a.type=="colwidth mismatch"){const c=e.nodeAt(a.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+a.pos),null,{...c.attrs,colwidth:a.colwidth})}else if(a.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let o,u;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),u=l);for(let l=0,a=n+1;l<i.height;l++){const c=e.child(l),d=a+c.nodeSize,f=s[l];if(f>0){let h="cell";c.firstChild&&(h=c.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const b=ge(t.schema)[h].createAndFill();b&&p.push(b)}const m=(l==0||o==l-1)&&u==l?a+1:d-1;r.insert(r.mapping.map(m),p)}a=d}return r.setMeta(lk,{fixTables:!0})}function Ye(t){const e=t.selection,n=ts(t),r=n.node(-1),i=n.start(-1),s=Y.get(r);return{...e instanceof q?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function rh(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;nk(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const u=o*e.width+i;if(i>0&&i<e.width&&e.map[u-1]==e.map[u]){const l=e.map[u],a=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,Qf(a.attrs,i-e.colCount(l))),o+=a.attrs.rowspan-1}else{const l=s==null?ge(r.type.schema).cell:r.nodeAt(e.map[u+s]).type,a=e.positionAt(o,i,r);t.insert(t.mapping.map(n+a),l.createAndFill())}}return t}function ck(t,e){if(!He(t))return!1;if(e){const n=Ye(t);e(rh(t.tr,n,n.left))}return!0}function dk(t,e){if(!He(t))return!1;if(e){const n=Ye(t);e(rh(t.tr,n,n.right))}return!0}function fk(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const u=o*e.width+i,l=e.map[u],a=n.nodeAt(l),c=a.attrs;if(i>0&&e.map[u-1]==l||i<e.width-1&&e.map[u+1]==l)t.setNodeMarkup(t.mapping.slice(s).map(r+l),null,tn(c,i-e.colCount(l)));else{const d=t.mapping.slice(s).map(r+l);t.delete(d,d+a.nodeSize)}o+=c.rowspan}}function hk(t,e){if(!He(t))return!1;if(e){const n=Ye(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;fk(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Y.get(s)}e(r)}return!0}function pk(t,e,n){var r;const i=ge(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function ih(t,{map:e,tableStart:n,table:r},i){let s=n;for(let a=0;a<i;a++)s+=r.child(a).nodeSize;const o=[];let u=i>0?-1:0;pk(e,r,i+u)&&(u=i==0||i==e.height?null:0);for(let a=0,c=e.width*i;a<e.width;a++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),a+=f.colspan-1}else{var l;const d=u==null?ge(r.type.schema).cell:(l=r.nodeAt(e.map[c+u*e.width]))===null||l===void 0?void 0:l.type,f=d?.createAndFill();f&&o.push(f)}return t.insert(s,ge(r.type.schema).row.create(null,o)),t}function mk(t,e){if(!He(t))return!1;if(e){const n=Ye(t);e(ih(t.tr,n,n.top))}return!0}function gk(t,e){if(!He(t))return!1;if(e){const n=Ye(t);e(ih(t.tr,n,n.bottom))}return!0}function bk(t,{map:e,table:n,tableStart:r},i){let s=0;for(let a=0;a<i;a++)s+=n.child(a).nodeSize;const o=s+n.child(i).nodeSize,u=t.mapping.maps.length;t.delete(s+r,o+r);const l=new Set;for(let a=0,c=i*e.width;a<e.width;a++,c++){const d=e.map[c];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[c-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(u).map(d+r),null,{...f,rowspan:f.rowspan-1}),a+=f.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,a,n);t.insert(t.mapping.slice(u).map(r+m),p),a+=h.colspan-1}}}}function xk(t,e){if(!He(t))return!1;if(e){const n=Ye(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;bk(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Y.get(n.table)}e(r)}return!0}function fa(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function yk({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,u=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[u]==n[u+1])return!0;s+=t,u+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function ha(t,e){const n=t.selection;if(!(n instanceof q)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ye(t),{map:i}=r;if(yk(i,r))return!1;if(e){const s=t.tr,o={};let u=E.empty,l,a;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const f=i.map[c*i.width+d],h=r.table.nodeAt(f);if(!(o[f]||!h))if(o[f]=!0,l==null)l=f,a=h;else{fa(h)||(u=u.append(h.content));const p=s.mapping.map(f+r.tableStart);s.delete(p,p+h.nodeSize)}}if(l==null||a==null)return!0;if(s.setNodeMarkup(l+r.tableStart,null,{...Qf(a.attrs,a.attrs.colspan,r.right-r.left-a.attrs.colspan),rowspan:r.bottom-r.top}),u.size>0){const c=l+1+a.content.size,d=fa(a)?l+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,u)}s.setSelection(new q(s.doc.resolve(l+r.tableStart))),e(s)}return!0}function pa(t,e){const n=ge(t.schema);return kk(({node:r})=>n[r.type.spec.tableRole])(t,e)}function kk(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof q){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=Qy(r.$from),!i)return!1;s=(o=en(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let u=i.attrs;const l=[],a=u.colwidth;u.rowspan>1&&(u={...u,rowspan:1}),u.colspan>1&&(u={...u,colspan:1});const c=Ye(e),d=e.tr;for(let h=0;h<c.right-c.left;h++)l.push(a?{...u,colwidth:a&&a[h]?[a[h]]:null}:u);let f;for(let h=c.top;h<c.bottom;h++){let p=c.map.positionAt(h,c.left,c.table);h==c.top&&(p+=i.nodeSize);for(let m=c.left,g=0;m<c.right;m++,g++)m==c.left&&h==c.top||d.insert(f=d.mapping.map(p+c.tableStart,1),t({node:i,row:h,col:m}).createAndFill(l[g]))}d.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),l[0]),r instanceof q&&d.setSelection(new q(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function wk(t,e){return function(n,r){if(!He(n))return!1;const i=ts(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof q?n.selection.forEachCell((o,u)=>{o.attrs[t]!==e&&s.setNodeMarkup(u,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function Ck(t){return function(e,n){if(!He(e))return!1;if(n){const r=ge(e.schema),i=Ye(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),u=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)u[l].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[l],r.cell,u[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],r.header_cell,u[l].attrs);n(s)}return!0}}function ma(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function ir(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Ck(t):function(n,r){if(!He(n))return!1;if(r){const i=ge(n.schema),s=Ye(n),o=n.tr,u=ma("row",s,i),l=ma("column",s,i),a=(t==="column"?u:t==="row"&&l)?1:0,c=t=="column"?{left:0,top:a,right:1,bottom:s.map.height}:t=="row"?{left:a,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?l?i.cell:i.header_cell:t=="row"?u?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(f=>{const h=f+s.tableStart,p=o.doc.nodeAt(h);p&&o.setNodeMarkup(h,d,p.attrs)}),r(o)}return!0}}ir("row",{useDeprecatedLogic:!0});ir("column",{useDeprecatedLogic:!0});const Ek=ir("cell",{useDeprecatedLogic:!0});function Sk(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function ga(t){return function(e,n){if(!He(e))return!1;const r=Sk(ts(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(N.between(i,tk(i))).scrollIntoView())}return!0}}function vk(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Nr(t,e){const n=t.selection;if(!(n instanceof q))return!1;if(e){const r=t.tr,i=ge(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new M(i,0,0))}),r.docChanged&&e(r)}return!0}function Ak(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,u=[];if(s=="row")for(let l=0;l<e.childCount;l++){let a=e.child(l).content;const c=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(a=_o(ge(o).row,new M(a,c,d)).content),u.push(a)}else if(s=="cell"||s=="header_cell")u.push(n||r?_o(ge(o).row,new M(e,n,r)).content:e);else return null;return Mk(o,u)}function Mk(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:u,colspan:l}=s.child(o).attrs;for(let a=i;a<i+u;a++)n[a]=(n[a]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(E.empty),n[i]<r){const s=ge(t).cell.createAndFill(),o=[];for(let u=n[i];u<r;u++)o.push(s);e[i]=e[i].append(E.from(o))}return{height:e.length,width:r,rows:e}}function _o(t,e){const n=t.createAndFill();return new jo(n).replace(0,n.content.size,e).doc}function Tk({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let u=0;u<n.length;u++){const l=n[u],a=[];for(let c=s[u]||0,d=0;c<r;d++){let f=l.child(d%l.childCount);c+f.attrs.colspan>r&&(f=f.type.createChecked(tn(f.attrs,f.attrs.colspan,c+f.attrs.colspan-r),f.content)),a.push(f),c+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)s[u+h]=(s[u+h]||0)+f.attrs.colspan}o.push(E.from(a))}n=o,t=r}if(e!=i){const s=[];for(let o=0,u=0;o<i;o++,u++){const l=[],a=n[u%e];for(let c=0;c<a.childCount;c++){let d=a.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(E.from(l))}n=s,e=i}return{width:t,height:e,rows:n}}function _k(t,e,n,r,i,s,o){const u=t.doc.type.schema,l=ge(u);let a,c;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==l.cell?m=a||(a=l.cell.createAndFill()):m=c||(c=l.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);t.insert(t.mapping.slice(o).map(f-1+r),p)}if(s>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==l.header_cell;d.push(g?c||(c=l.header_cell.createAndFill()):a||(a=l.cell.createAndFill()))}const f=l.row.create(null,E.from(d)),h=[];for(let p=e.height;p<s;p++)h.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),h)}return!!(a||c)}function ba(t,e,n,r,i,s,o,u){if(o==0||o==e.height)return!1;let l=!1;for(let a=i;a<s;a++){const c=o*e.width+a,d=e.map[c];if(e.map[c-e.width]==d){l=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(u).map(d+r),null,{...f.attrs,rowspan:o-h}),t.insert(t.mapping.slice(u).map(e.positionAt(o,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-o})),a+=f.attrs.colspan-1}}return l}function xa(t,e,n,r,i,s,o,u){if(o==0||o==e.width)return!1;let l=!1;for(let a=i;a<s;a++){const c=a*e.width+o,d=e.map[c];if(e.map[c-1]==d){l=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(u).map(d+r);t.setNodeMarkup(p,null,tn(f.attrs,o-h,f.attrs.colspan-(o-h))),t.insert(p+f.nodeSize,f.type.createAndFill(tn(f.attrs,0,o-h))),a+=f.attrs.rowspan-1}}return l}function ya(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Y.get(s);const{top:u,left:l}=r,a=l+i.width,c=u+i.height,d=t.tr;let f=0;function h(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=Y.get(s),f=d.mapping.maps.length}_k(d,o,s,n,a,c,f)&&h(),ba(d,o,s,n,l,a,u,f)&&h(),ba(d,o,s,n,l,a,c,f)&&h(),xa(d,o,s,n,u,c,l,f)&&h(),xa(d,o,s,n,u,c,a,f)&&h();for(let p=u;p<c;p++){const m=o.positionAt(p,l,s),g=o.positionAt(p,a,s);d.replace(d.mapping.slice(f).map(m+n),d.mapping.slice(f).map(g+n),new M(i.rows[p-u],0,0))}h(),d.setSelection(new q(d.doc.resolve(n+o.positionAt(u,l,s)),d.doc.resolve(n+o.positionAt(c-1,a-1,s)))),e(d)}const Dk=ru({ArrowLeft:Or("horiz",-1),ArrowRight:Or("horiz",1),ArrowUp:Or("vert",-1),ArrowDown:Or("vert",1),"Shift-ArrowLeft":Rr("horiz",-1),"Shift-ArrowRight":Rr("horiz",1),"Shift-ArrowUp":Rr("vert",-1),"Shift-ArrowDown":Rr("vert",1),Backspace:Nr,"Mod-Backspace":Nr,Delete:Nr,"Mod-Delete":Nr});function Hr(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Or(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof q)return Hr(n,r,R.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=sh(i,t,e);if(o==null)return!1;if(t=="horiz")return Hr(n,r,R.near(n.doc.resolve(s.head+e),e));{const u=n.doc.resolve(o),l=Yf(u,t,e);let a;return l?a=R.near(l,1):e<0?a=R.near(n.doc.resolve(u.before(-1)),-1):a=R.near(n.doc.resolve(u.after(-1)),1),Hr(n,r,a)}}}function Rr(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof q)o=s;else{const l=sh(i,t,e);if(l==null)return!1;o=new q(n.doc.resolve(l))}const u=Yf(o.$headCell,t,e);return u?Hr(n,r,new q(o.$anchorCell,u)):!1}}function Nk(t,e){const n=t.state.doc,r=en(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new q(r))),!0):!1}function Ok(t,e,n){if(!He(t.state))return!1;let r=Ak(n);const i=t.state.selection;if(i instanceof q){r||(r={width:1,height:1,rows:[E.from(_o(ge(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),u=Y.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=Tk(r,u.right-u.left,u.bottom-u.top),ya(t.state,t.dispatch,o,u,r),!0}else if(r){const s=ts(t.state),o=s.start(-1);return ya(t.state,t.dispatch,o,Y.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function Rk(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=ka(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof q)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=en(t.state.selection.$anchor))!=null&&((n=Fs(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(l,a){let c=Fs(t,a);const d=kt.getState(t.state)==null;if(!c||!vu(l,c))if(d)c=l;else return;const f=new q(l,c);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(kt,l.pos),t.dispatch(h)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",u),kt.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(kt,-1))}function u(l){const a=l,c=kt.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(ka(t,a.target)!=r&&(d=Fs(t,e),!d))return o();d&&s(d,a)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",u)}function sh(t,e,n){if(!(t.state.selection instanceof N))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?o:null}}return null}function ka(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Fs(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&en(t.state.doc.resolve(r))||en(t.state.doc.resolve(i))}var Ik=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Do(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Do(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Do(t,e,n,r,i,s){let o=0,u=!0,l=e.firstChild;const a=t.firstChild;if(a){for(let d=0,f=0;d<a.childCount;d++){const{colspan:h,colwidth:p}=a.child(d).attrs;for(let m=0;m<h;m++,f++){const g=i==f?s:p&&p[m],b=g?g+"px":"";if(o+=g||r,g||(u=!1),l)l.style.width!=b&&(l.style.width=b),l=l.nextSibling;else{const y=document.createElement("col");y.style.width=b,e.appendChild(y)}}}for(;l;){var c;const d=l.nextSibling;(c=l.parentNode)===null||c===void 0||c.removeChild(l),l=d}u?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const _e=new G("tableColumnResizing");function Lk({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Ik,lastColumnResizable:i=!0}={}){const s=new V({key:_e,state:{init(o,u){var l;const a=(l=s.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,c=ge(u.schema).table.name;return r&&a&&(a[c]=(d,f)=>new r(d,n,f)),new Fk(-1,!1)},apply(o,u){return u.apply(o)}},props:{attributes:o=>{const u=_e.getState(o);return u&&u.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,u)=>{Pk(o,u,t,i)},mouseleave:o=>{zk(o)},mousedown:(o,u)=>{Bk(o,u,e,n)}},decorations:o=>{const u=_e.getState(o);if(u&&u.activeHandle>-1)return Vk(o,u.activeHandle)},nodeViews:{}}});return s}var Fk=class qr{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(_e);if(r&&r.setHandle!=null)return new qr(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new qr(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return To(e.doc.resolve(i))||(i=-1),new qr(i,n.dragging)}return n}};function Pk(t,e,n,r){if(!t.editable)return;const i=_e.getState(t.state);if(i&&!i.dragging){const s=jk(e.target);let o=-1;if(s){const{left:u,right:l}=s.getBoundingClientRect();e.clientX-u<=n?o=wa(t,e,"left",n):l-e.clientX<=n&&(o=wa(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const u=t.state.doc.resolve(o),l=u.node(-1),a=Y.get(l),c=u.start(-1);if(a.colCount(u.pos-c)+u.nodeAfter.attrs.colspan-1==a.width-1)return}oh(t,o)}}}function zk(t){if(!t.editable)return;const e=_e.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&oh(t,-1)}function Bk(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=_e.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const u=t.state.doc.nodeAt(o.activeHandle),l=$k(t,o.activeHandle,u.attrs);t.dispatch(t.state.tr.setMeta(_e,{setDragging:{startX:e.clientX,startWidth:l}}));function a(d){s.removeEventListener("mouseup",a),s.removeEventListener("mousemove",c);const f=_e.getState(t.state);f?.dragging&&(Hk(t,f.activeHandle,Ca(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(_e,{setDragging:null})))}function c(d){if(!d.which)return a(d);const f=_e.getState(t.state);if(f&&f.dragging){const h=Ca(f.dragging,d,n);Ea(t,f.activeHandle,h,r)}}return Ea(t,o.activeHandle,l,r),s.addEventListener("mouseup",a),s.addEventListener("mousemove",c),e.preventDefault(),!0}function $k(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let l=0;l<n;l++)r[l]&&(o-=r[l],u--);return o/u}function jk(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function wa(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,u=en(t.state.doc.resolve(o));if(!u)return-1;if(n=="right")return u.pos;const l=Y.get(u.node(-1)),a=u.start(-1),c=l.map.indexOf(u.pos-a);return c%l.width==0?-1:a+l.map[c-1]}function Ca(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function oh(t,e){t.dispatch(t.state.tr.setMeta(_e,{setHandle:e}))}function Hk(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Y.get(i),o=r.start(-1),u=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let a=0;a<s.height;a++){const c=a*s.width+u;if(a&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],f=i.nodeAt(d).attrs,h=f.colspan==1?0:u-s.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():qk(f.colspan);p[h]=n,l.setNodeMarkup(o+d,null,{...f,colwidth:p})}l.docChanged&&t.dispatch(l)}function Ea(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),u=Y.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Do(s,l.firstChild,l,r,u,n)}function qk(t){return Array(t).fill(0)}function Vk(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return j.empty;const s=Y.get(i),o=r.start(-1),u=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let a=0;a<s.height;a++){const c=u+a*s.width;if((u==s.width-1||s.map[c]!=s.map[c+1])&&(a==0||s.map[c]!=s.map[c-s.width])){var l;const d=s.map[c],f=o+d+i.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((l=_e.getState(t))===null||l===void 0)&&l.dragging&&n.push(ue.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(ue.widget(f,h))}}return j.create(t.doc,n)}function Wk({allowTableNodeSelection:t=!1}={}){return new V({key:kt,state:{init(){return null},apply(e,n){const r=e.getMeta(kt);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:ik,handleDOMEvents:{mousedown:Rk},createSelectionBetween(e){return kt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Nk,handleKeyDown:Dk,handlePaste:Ok},appendTransaction(e,n,r){return uk(r,nh(r,n),t)}})}function Ii(t){return t==="left"||t==="right"||t==="center"?t:null}function Uk(t){const e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return Ii(e||n)}function Kk(t){return Ii(t?.align)}function uh(){return{default:null,parseHTML:t=>Uk(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}var lh=F.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),i=r?r.split(",").map(s=>parseInt(s,10)):null;if(!i){const s=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&s&&s[o]){const u=s[o].getAttribute("width");return u?[parseInt(u,10)]:null}}return i}},align:uh()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",K(this.options.HTMLAttributes,t),0]}}),ah=F.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}},align:uh()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",K(this.options.HTMLAttributes,t),0]}}),ch=F.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",K(this.options.HTMLAttributes,t),0]}});function No(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Sa(t,e,n,r,i,s){var o;let u=0,l=!0,a=e.firstChild;const c=t.firstChild;if(c!==null)for(let f=0,h=0;f<c.childCount;f+=1){const{colspan:p,colwidth:m}=c.child(f).attrs;for(let g=0;g<p;g+=1,h+=1){const b=i===h?s:m&&m[g],y=b?`${b}px`:"";if(u+=b||r,b||(l=!1),a){if(a.style.width!==y){const[k,w]=No(r,b);a.style.setProperty(k,w)}a=a.nextSibling}else{const k=document.createElement("col"),[w,C]=No(r,b);k.style.setProperty(w,C),e.appendChild(k)}}}for(;a;){const f=a.nextSibling;(o=a.parentNode)==null||o.removeChild(a),a=f}const d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!d?(n.style.width=`${u}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${u}px`)}var Jk=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Sa(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,Sa(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function Gk(t,e,n,r){let i=0,s=!0;const o=[],u=t.firstChild;if(!u)return{};for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=n===f?r:p&&p[m];i+=g||e,g||(s=!1);const[b,y]=No(e,g);o.push(["col",{style:`${b}: ${y}`}])}}const l=s?`${i}px`:"",a=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:l,tableMinWidth:a}}function va(t,e){return t.createAndFill()}function Zk(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function Xk(t,e,n,r,i){const s=Zk(t),o=[],u=[];for(let a=0;a<n;a+=1){const c=va(s.cell);if(c&&u.push(c),r){const d=va(s.header_cell);d&&o.push(d)}}const l=[];for(let a=0;a<e;a+=1)l.push(s.row.createChecked(null,r&&a===0?o:u));return s.table.createChecked(null,l)}function Yk(t){return t instanceof q}var Ir=({editor:t})=>{const{selection:e}=t.state;if(!Yk(e))return!1;let n=0;const r=Ud(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},Qk="";function e3(t){return(t||"").replace(/\s+/g," ").trim()}function t3(t,e,n={}){var r;const i=(r=n.cellLineSeparator)!=null?r:Qk;if(!t||!t.content||t.content.length===0)return"";const s=[];t.content.forEach(m=>{const g=[];m.content&&m.content.forEach(b=>{let y="";b.content&&Array.isArray(b.content)&&b.content.length>1?y=b.content.map(A=>e.renderChildren(A)).join(i):y=b.content?e.renderChildren(b.content):"";const k=e3(y),w=b.type==="tableHeader",C=Kk(b.attrs);g.push({text:k,isHeader:w,align:C})}),s.push(g)});const o=s.reduce((m,g)=>Math.max(m,g.length),0);if(o===0)return"";const u=new Array(o).fill(0);s.forEach(m=>{var g;for(let b=0;b<o;b+=1){const k=(((g=m[b])==null?void 0:g.text)||"").length;k>u[b]&&(u[b]=k),u[b]<3&&(u[b]=3)}});const l=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),a=s[0],c=a.some(m=>m.isHeader),d=new Array(o).fill(null);s.forEach(m=>{var g;for(let b=0;b<o;b+=1)!d[b]&&((g=m[b])!=null&&g.align)&&(d[b]=m[b].align)});let f=`
`;const h=new Array(o).fill(0).map((m,g)=>c&&a[g]&&a[g].text||"");return f+=`| ${h.map((m,g)=>l(m,u[g])).join(" | ")} |
`,f+=`| ${u.map((m,g)=>{const b=Math.max(3,m),y=d[g];return y==="left"?`:${"-".repeat(b)}`:y==="right"?`${"-".repeat(b)}:`:y==="center"?`:${"-".repeat(b)}:`:"-".repeat(b)}).join(" | ")} |
`,(c?s.slice(1):s).forEach(m=>{f+=`| ${new Array(o).fill(0).map((g,b)=>l(m[b]&&m[b].text||"",u[b])).join(" | ")} |
`}),f}var n3=t3,dh=F.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Jk,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=Gk(t,this.options.cellMinWidth),s=e.style;function o(){return s||(r?`width: ${r}`:`min-width: ${i}`)}const u=["table",K(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},u]:u},parseMarkdown:(t,e)=>{const n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){const i=[];t.header.forEach((s,o)=>{var u;const l=Ii((u=r[o])!=null?u:s.align),a=l?{align:l}:{};i.push(e.createNode("tableHeader",a,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}return t.rows&&t.rows.forEach(i=>{const s=[];i.forEach((o,u)=>{var l;const a=Ii((l=r[u])!=null?l:o.align),c=a?{align:a}:{};s.push(e.createNode("tableCell",c,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>n3(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=Xk(s.schema,t,e,n);if(i){const u=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(N.near(r.doc.resolve(u)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>ck(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>dk(t,e),deleteColumn:()=>({state:t,dispatch:e})=>hk(t,e),addRowBefore:()=>({state:t,dispatch:e})=>mk(t,e),addRowAfter:()=>({state:t,dispatch:e})=>gk(t,e),deleteRow:()=>({state:t,dispatch:e})=>xk(t,e),deleteTable:()=>({state:t,dispatch:e})=>vk(t,e),mergeCells:()=>({state:t,dispatch:e})=>ha(t,e),splitCell:()=>({state:t,dispatch:e})=>pa(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ir("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ir("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Ek(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>ha(t,e)?!0:pa(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>wk(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>ga(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ga(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&nh(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=q.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ir,"Mod-Backspace":Ir,Delete:Ir,"Mod-Delete":Ir}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Lk({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Wk({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r})=>new e(n,this.options.cellMinWidth,r)},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:z(D(t,"tableRole",e))}}});U.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(dh.configure(this.options.table)),this.options.tableCell!==!1&&t.push(lh.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(ah.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ch.configure(this.options.tableRow)),t}});const Aa={};function r3(t){let e=Aa[t];if(e)return e;e=Aa[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return e}function Cn(t,e){typeof e!="string"&&(e=Cn.defaultChars);const n=r3(e);return t.replace(/(%[a-f0-9]{2})+/gi,function(r){let i="";for(let s=0,o=r.length;s<o;s+=3){const u=parseInt(r.slice(s+1,s+3),16);if(u<128){i+=n[u];continue}if((u&224)===192&&s+3<o){const l=parseInt(r.slice(s+4,s+6),16);if((l&192)===128){const a=u<<6&1984|l&63;a<128?i+="��":i+=String.fromCharCode(a),s+=3;continue}}if((u&240)===224&&s+6<o){const l=parseInt(r.slice(s+4,s+6),16),a=parseInt(r.slice(s+7,s+9),16);if((l&192)===128&&(a&192)===128){const c=u<<12&61440|l<<6&4032|a&63;c<2048||c>=55296&&c<=57343?i+="���":i+=String.fromCharCode(c),s+=6;continue}}if((u&248)===240&&s+9<o){const l=parseInt(r.slice(s+4,s+6),16),a=parseInt(r.slice(s+7,s+9),16),c=parseInt(r.slice(s+10,s+12),16);if((l&192)===128&&(a&192)===128&&(c&192)===128){let d=u<<18&1835008|l<<12&258048|a<<6&4032|c&63;d<65536||d>1114111?i+="����":(d-=65536,i+=String.fromCharCode(55296+(d>>10),56320+(d&1023))),s+=9;continue}}i+="�"}return i})}Cn.defaultChars=";/?:@&=+$,#";Cn.componentChars="";const Ma={};function i3(t){let e=Ma[t];if(e)return e;e=Ma[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=t[n];return e}function pr(t,e,n){typeof e!="string"&&(n=e,e=pr.defaultChars),typeof n>"u"&&(n=!0);const r=i3(e);let i="";for(let s=0,o=t.length;s<o;s++){const u=t.charCodeAt(s);if(n&&u===37&&s+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(s+1,s+3))){i+=t.slice(s,s+3),s+=2;continue}if(u<128){i+=r[u];continue}if(u>=55296&&u<=57343){if(u>=55296&&u<=56319&&s+1<o){const l=t.charCodeAt(s+1);if(l>=56320&&l<=57343){i+=encodeURIComponent(t[s]+t[s+1]),s++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(t[s])}return i}pr.defaultChars=";/?:@&=+$,-_.!~*'()#";pr.componentChars="-_.!~*'()";function Au(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function Li(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const s3=/^([a-z0-9.+-]+:)/i,o3=/:[0-9]*$/,u3=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l3=["<",">",'"',"`"," ","\r",`
`,"	"],a3=["{","}","|","\\","^","`"].concat(l3),c3=["'"].concat(a3),Ta=["%","/","?",";","#"].concat(c3),_a=["/","?","#"],d3=255,Da=/^[+a-z0-9A-Z_-]{0,63}$/,f3=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Na={javascript:!0,"javascript:":!0},Oa={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Mu(t,e){if(t&&t instanceof Li)return t;const n=new Li;return n.parse(t,e),n}Li.prototype.parse=function(t,e){let n,r,i,s=t;if(s=s.trim(),!e&&t.split("#").length===1){const a=u3.exec(s);if(a)return this.pathname=a[1],a[2]&&(this.search=a[2]),this}let o=s3.exec(s);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,s=s.substr(o.length)),(e||o||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=s.substr(0,2)==="//",i&&!(o&&Na[o])&&(s=s.substr(2),this.slashes=!0)),!Na[o]&&(i||o&&!Oa[o])){let a=-1;for(let p=0;p<_a.length;p++)r=s.indexOf(_a[p]),r!==-1&&(a===-1||r<a)&&(a=r);let c,d;a===-1?d=s.lastIndexOf("@"):d=s.lastIndexOf("@",a),d!==-1&&(c=s.slice(0,d),s=s.slice(d+1),this.auth=c),a=-1;for(let p=0;p<Ta.length;p++)r=s.indexOf(Ta[p]),r!==-1&&(a===-1||r<a)&&(a=r);a===-1&&(a=s.length),s[a-1]===":"&&a--;const f=s.slice(0,a);s=s.slice(a),this.parseHost(f),this.hostname=this.hostname||"";const h=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!h){const p=this.hostname.split(/\./);for(let m=0,g=p.length;m<g;m++){const b=p[m];if(b&&!b.match(Da)){let y="";for(let k=0,w=b.length;k<w;k++)b.charCodeAt(k)>127?y+="x":y+=b[k];if(!y.match(Da)){const k=p.slice(0,m),w=p.slice(m+1),C=b.match(f3);C&&(k.push(C[1]),w.unshift(C[2])),w.length&&(s=w.join(".")+s),this.hostname=k.join(".");break}}}}this.hostname.length>d3&&(this.hostname=""),h&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const u=s.indexOf("#");u!==-1&&(this.hash=s.substr(u),s=s.slice(0,u));const l=s.indexOf("?");return l!==-1&&(this.search=s.substr(l),s=s.slice(0,l)),s&&(this.pathname=s),Oa[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Li.prototype.parseHost=function(t){let e=o3.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const h3=Object.freeze(Object.defineProperty({__proto__:null,decode:Cn,encode:pr,format:Au,parse:Mu},Symbol.toStringTag,{value:"Module"})),fh=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,hh=/[\0-\x1F\x7F-\x9F]/,p3=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Tu=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\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-\u2E4F\u2E52-\u2E5D\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[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,ph=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,mh=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,m3=Object.freeze(Object.defineProperty({__proto__:null,Any:fh,Cc:hh,Cf:p3,P:Tu,S:ph,Z:mh},Symbol.toStringTag,{value:"Module"})),g3=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTǇǋǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉ǲኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻ǲᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤĳạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ﬃɩᾹ\0\0᾽g;耀ﬀig;耀ﬄ;쀀𝔣lig;耀ﬁlig;쀀fjƀaltῙ῜ῡt;晭ig;耀ﬂns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒α‚‰‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସǳ⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗǈⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼ǲ㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),b3=new Uint16Array("Ȁaglq	\x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var Ps;const x3=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),y3=(Ps=String.fromCodePoint)!==null&&Ps!==void 0?Ps:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function k3(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=x3.get(t))!==null&&e!==void 0?e:t}var oe;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(oe||(oe={}));const w3=32;var vt;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(vt||(vt={}));function Oo(t){return t>=oe.ZERO&&t<=oe.NINE}function C3(t){return t>=oe.UPPER_A&&t<=oe.UPPER_F||t>=oe.LOWER_A&&t<=oe.LOWER_F}function E3(t){return t>=oe.UPPER_A&&t<=oe.UPPER_Z||t>=oe.LOWER_A&&t<=oe.LOWER_Z||Oo(t)}function S3(t){return t===oe.EQUALS||E3(t)}var se;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(se||(se={}));var wt;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(wt||(wt={}));class v3{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=se.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=wt.Strict}startEntity(e){this.decodeMode=e,this.state=se.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case se.EntityStart:return e.charCodeAt(n)===oe.NUM?(this.state=se.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=se.NamedEntity,this.stateNamedEntity(e,n));case se.NumericStart:return this.stateNumericStart(e,n);case se.NumericDecimal:return this.stateNumericDecimal(e,n);case se.NumericHex:return this.stateNumericHex(e,n);case se.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|w3)===oe.LOWER_X?(this.state=se.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=se.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Oo(i)||C3(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Oo(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===oe.SEMI)this.consumed+=1;else if(this.decodeMode===wt.Strict)return 0;return this.emitCodePoint(k3(this.result),this.consumed),this.errors&&(e!==oe.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&vt.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=A3(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===wt.Attribute&&(s===0||S3(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&vt.VALUE_LENGTH)>>14,s!==0){if(o===oe.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==wt.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&vt.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~vt.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case se.NamedEntity:return this.result!==0&&(this.decodeMode!==wt.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case se.NumericDecimal:return this.emitNumericEntity(0,2);case se.NumericHex:return this.emitNumericEntity(0,3);case se.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case se.EntityStart:return 0}}}function gh(t){let e="";const n=new v3(t,r=>e+=y3(r));return function(i,s){let o=0,u=0;for(;(u=i.indexOf("&",u))>=0;){e+=i.slice(o,u),n.startEntity(s);const a=n.write(i,u+1);if(a<0){o=u+n.end();break}o=u+a,u=a===0?o+1:o}const l=e+i.slice(o);return e="",l}}function A3(t,e,n,r){const i=(e&vt.BRANCH_LENGTH)>>7,s=e&vt.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:t[n+l]-1}let o=n,u=o+i-1;for(;o<=u;){const l=o+u>>>1,a=t[l];if(a<r)o=l+1;else if(a>r)u=l-1;else return t[l+i]}return-1}const M3=gh(g3);gh(b3);function bh(t,e=wt.Legacy){return M3(t,e)}function T3(t){return Object.prototype.toString.call(t)}function _u(t){return T3(t)==="[object String]"}const _3=Object.prototype.hasOwnProperty;function D3(t,e){return _3.call(t,e)}function ns(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function xh(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function Du(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function Fi(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const yh=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,N3=/&([a-z#][a-z0-9]{1,31});/gi,O3=new RegExp(yh.source+"|"+N3.source,"gi"),R3=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function I3(t,e){if(e.charCodeAt(0)===35&&R3.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Du(r)?Fi(r):t}const n=bh(t);return n!==t?n:t}function L3(t){return t.indexOf("\\")<0?t:t.replace(yh,"$1")}function En(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(O3,function(e,n,r){return n||I3(e,r)})}const F3=/[&<>"]/,P3=/[&<>"]/g,z3={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function B3(t){return z3[t]}function Ot(t){return F3.test(t)?t.replace(P3,B3):t}const $3=/[.?*+^$[\]\\(){}|-]/g;function j3(t){return t.replace($3,"\\$&")}function H(t){switch(t){case 9:case 32:return!0}return!1}function sr(t){if(t>=8192&&t<=8202)return!0;switch(t){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}function or(t){return Tu.test(t)||ph.test(t)}function ur(t){switch(t){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 rs(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const H3={mdurl:h3,ucmicro:m3},q3=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:xh,assign:ns,escapeHtml:Ot,escapeRE:j3,fromCodePoint:Fi,has:D3,isMdAsciiPunct:ur,isPunctChar:or,isSpace:H,isString:_u,isValidEntityCode:Du,isWhiteSpace:sr,lib:H3,normalizeReference:rs,unescapeAll:En,unescapeMd:L3},Symbol.toStringTag,{value:"Module"}));function V3(t,e,n){let r,i,s,o;const u=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos<u;){if(s=t.src.charCodeAt(t.pos),s===93&&(r--,r===0)){i=!0;break}if(o=t.pos,t.md.inline.skipToken(t),s===91){if(o===t.pos-1)r++;else if(n)return t.pos=l,-1}}let a=-1;return i&&(a=t.pos),t.pos=l,a}function W3(t,e,n){let r,i=e;const s={ok:!1,pos:0,str:""};if(t.charCodeAt(i)===60){for(i++;i<n;){if(r=t.charCodeAt(i),r===10||r===60)return s;if(r===62)return s.pos=i+1,s.str=En(t.slice(e+1,i)),s.ok=!0,s;if(r===92&&i+1<n){i+=2;continue}i++}return s}let o=0;for(;i<n&&(r=t.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(t.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return s;if(r===41){if(o===0)break;o--}i++}return e===i||o!==0||(s.str=En(t.slice(e,i)),s.pos=i,s.ok=!0),s}function U3(t,e,n,r){let i,s=e;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(s>=n)return o;let u=t.charCodeAt(s);if(u!==34&&u!==39&&u!==40)return o;e++,s++,u===40&&(u=41),o.marker=u}for(;s<n;){if(i=t.charCodeAt(s),i===o.marker)return o.pos=s+1,o.str+=En(t.slice(e,s)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&s+1<n&&s++,s++}return o.can_continue=!0,o.str+=En(t.slice(e,s)),o}const K3=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:W3,parseLinkLabel:V3,parseLinkTitle:U3},Symbol.toStringTag,{value:"Module"})),Qe={};Qe.code_inline=function(t,e,n,r,i){const s=t[e];return"<code"+i.renderAttrs(s)+">"+Ot(s.content)+"</code>"};Qe.code_block=function(t,e,n,r,i){const s=t[e];return"<pre"+i.renderAttrs(s)+"><code>"+Ot(t[e].content)+`</code></pre>
`};Qe.fence=function(t,e,n,r,i){const s=t[e],o=s.info?En(s.info).trim():"";let u="",l="";if(o){const c=o.split(/(\s+)/g);u=c[0],l=c.slice(2).join("")}let a;if(n.highlight?a=n.highlight(s.content,u,l)||Ot(s.content):a=Ot(s.content),a.indexOf("<pre")===0)return a+`
`;if(o){const c=s.attrIndex("class"),d=s.attrs?s.attrs.slice():[];c<0?d.push(["class",n.langPrefix+u]):(d[c]=d[c].slice(),d[c][1]+=" "+n.langPrefix+u);const f={attrs:d};return`<pre><code${i.renderAttrs(f)}>${a}</code></pre>
`}return`<pre><code${i.renderAttrs(s)}>${a}</code></pre>
`};Qe.image=function(t,e,n,r,i){const s=t[e];return s.attrs[s.attrIndex("alt")][1]=i.renderInlineAsText(s.children,n,r),i.renderToken(t,e,n)};Qe.hardbreak=function(t,e,n){return n.xhtmlOut?`<br />
`:`<br>
`};Qe.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`<br />
`:`<br>
`:`
`};Qe.text=function(t,e){return Ot(t[e].content)};Qe.html_block=function(t,e){return t[e].content};Qe.html_inline=function(t,e){return t[e].content};function vn(){this.rules=ns({},Qe)}vn.prototype.renderAttrs=function(e){let n,r,i;if(!e.attrs)return"";for(i="",n=0,r=e.attrs.length;n<r;n++)i+=" "+Ot(e.attrs[n][0])+'="'+Ot(e.attrs[n][1])+'"';return i};vn.prototype.renderToken=function(e,n,r){const i=e[n];let s="";if(i.hidden)return"";i.block&&i.nesting!==-1&&n&&e[n-1].hidden&&(s+=`
`),s+=(i.nesting===-1?"</":"<")+i.tag,s+=this.renderAttrs(i),i.nesting===0&&r.xhtmlOut&&(s+=" /");let o=!1;if(i.block&&(o=!0,i.nesting===1&&n+1<e.length)){const u=e[n+1];(u.type==="inline"||u.hidden||u.nesting===-1&&u.tag===i.tag)&&(o=!1)}return s+=o?`>
`:">",s};vn.prototype.renderInline=function(t,e,n){let r="";const i=this.rules;for(let s=0,o=t.length;s<o;s++){const u=t[s].type;typeof i[u]<"u"?r+=i[u](t,s,e,n,this):r+=this.renderToken(t,s,e)}return r};vn.prototype.renderInlineAsText=function(t,e,n){let r="";for(let i=0,s=t.length;i<s;i++)switch(t[i].type){case"text":r+=t[i].content;break;case"image":r+=this.renderInlineAsText(t[i].children,e,n);break;case"html_inline":case"html_block":r+=t[i].content;break;case"softbreak":case"hardbreak":r+=`
`;break}return r};vn.prototype.render=function(t,e,n){let r="";const i=this.rules;for(let s=0,o=t.length;s<o;s++){const u=t[s].type;u==="inline"?r+=this.renderInline(t[s].children,e,n):typeof i[u]<"u"?r+=i[u](t,s,e,n,this):r+=this.renderToken(t,s,e,n)}return r};function Ae(){this.__rules__=[],this.__cache__=null}Ae.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};Ae.prototype.__compile__=function(){const t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(r){r.enabled&&(n&&r.alt.indexOf(n)<0||t.__cache__[n].push(r.fn))})})};Ae.prototype.at=function(t,e,n){const r=this.__find__(t),i=n||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=i.alt||[],this.__cache__=null};Ae.prototype.before=function(t,e,n,r){const i=this.__find__(t),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i,0,{name:e,enabled:!0,fn:n,alt:s.alt||[]}),this.__cache__=null};Ae.prototype.after=function(t,e,n,r){const i=this.__find__(t),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i+1,0,{name:e,enabled:!0,fn:n,alt:s.alt||[]}),this.__cache__=null};Ae.prototype.push=function(t,e,n){const r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};Ae.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!0,n.push(r)},this),this.__cache__=null,n};Ae.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)};Ae.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!1,n.push(r)},this),this.__cache__=null,n};Ae.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function qe(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}qe.prototype.attrIndex=function(e){if(!this.attrs)return-1;const n=this.attrs;for(let r=0,i=n.length;r<i;r++)if(n[r][0]===e)return r;return-1};qe.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]};qe.prototype.attrSet=function(e,n){const r=this.attrIndex(e),i=[e,n];r<0?this.attrPush(i):this.attrs[r]=i};qe.prototype.attrGet=function(e){const n=this.attrIndex(e);let r=null;return n>=0&&(r=this.attrs[n][1]),r};qe.prototype.attrJoin=function(e,n){const r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function kh(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}kh.prototype.Token=qe;const J3=/\r\n?|\n/g,G3=/\0/g;function Z3(t){let e;e=t.src.replace(J3,`
`),e=e.replace(G3,"�"),t.src=e}function X3(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function Y3(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const i=e[n];i.type==="inline"&&t.md.inline.parse(i.content,t.md,t.env,i.children)}}function Q3(t){return/^<a[>\s]/i.test(t)}function e6(t){return/^<\/a\s*>/i.test(t)}function t6(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if(e[n].type!=="inline"||!t.md.linkify.pretest(e[n].content))continue;let i=e[n].children,s=0;for(let o=i.length-1;o>=0;o--){const u=i[o];if(u.type==="link_close"){for(o--;i[o].level!==u.level&&i[o].type!=="link_open";)o--;continue}if(u.type==="html_inline"&&(Q3(u.content)&&s>0&&s--,e6(u.content)&&s++),!(s>0)&&u.type==="text"&&t.md.linkify.test(u.content)){const l=u.content;let a=t.md.linkify.match(l);const c=[];let d=u.level,f=0;a.length>0&&a[0].index===0&&o>0&&i[o-1].type==="text_special"&&(a=a.slice(1));for(let h=0;h<a.length;h++){const p=a[h].url,m=t.md.normalizeLink(p);if(!t.md.validateLink(m))continue;let g=a[h].text;a[h].schema?a[h].schema==="mailto:"&&!/^mailto:/i.test(g)?g=t.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=t.md.normalizeLinkText(g):g=t.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,"");const b=a[h].index;if(b>f){const C=new t.Token("text","",0);C.content=l.slice(f,b),C.level=d,c.push(C)}const y=new t.Token("link_open","a",1);y.attrs=[["href",m]],y.level=d++,y.markup="linkify",y.info="auto",c.push(y);const k=new t.Token("text","",0);k.content=g,k.level=d,c.push(k);const w=new t.Token("link_close","a",-1);w.level=--d,w.markup="linkify",w.info="auto",c.push(w),f=a[h].lastIndex}if(f<l.length){const h=new t.Token("text","",0);h.content=l.slice(f),h.level=d,c.push(h)}e[n].children=i=xh(i,o,c)}}}}const wh=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,n6=/\((c|tm|r)\)/i,r6=/\((c|tm|r)\)/ig,i6={c:"©",r:"®",tm:"™"};function s6(t,e){return i6[e.toLowerCase()]}function o6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(r6,s6)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function u6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&wh.test(r.content)&&(r.content=r.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–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function l6(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(n6.test(t.tokens[e].content)&&o6(t.tokens[e].children),wh.test(t.tokens[e].content)&&u6(t.tokens[e].children))}const a6=/['"]/,Ra=/['"]/g,Ia="’";function Lr(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function c6(t,e){let n;const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,s.type!=="text")continue;let u=s.content,l=0,a=u.length;e:for(;l<a;){Ra.lastIndex=l;const c=Ra.exec(u);if(!c)break;let d=!0,f=!0;l=c.index+1;const h=c[0]==="'";let p=32;if(c.index-1>=0)p=u.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){p=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(l<a)m=u.charCodeAt(l);else for(n=i+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){m=t[n].content.charCodeAt(0);break}const g=ur(p)||or(String.fromCharCode(p)),b=ur(m)||or(String.fromCharCode(m)),y=sr(p),k=sr(m);if(k?d=!1:b&&(y||g||(d=!1)),y?f=!1:g&&(k||b||(f=!1)),m===34&&c[0]==='"'&&p>=48&&p<=57&&(f=d=!1),d&&f&&(d=g,f=b),!d&&!f){h&&(s.content=Lr(s.content,c.index,Ia));continue}if(f)for(n=r.length-1;n>=0;n--){let w=r[n];if(r[n].level<o)break;if(w.single===h&&r[n].level===o){w=r[n];let C,v;h?(C=e.md.options.quotes[2],v=e.md.options.quotes[3]):(C=e.md.options.quotes[0],v=e.md.options.quotes[1]),s.content=Lr(s.content,c.index,v),t[w.token].content=Lr(t[w.token].content,w.pos,C),l+=v.length-1,w.token===i&&(l+=C.length-1),u=s.content,a=u.length,r.length=n;continue e}}d?r.push({token:i,pos:c.index,single:h,level:o}):f&&h&&(s.content=Lr(s.content,c.index,Ia))}}}function d6(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!a6.test(t.tokens[e].content)||c6(t.tokens[e].children,t)}function f6(t){let e,n;const r=t.tokens,i=r.length;for(let s=0;s<i;s++){if(r[s].type!=="inline")continue;const o=r[s].children,u=o.length;for(e=0;e<u;e++)o[e].type==="text_special"&&(o[e].type="text");for(e=n=0;e<u;e++)o[e].type==="text"&&e+1<u&&o[e+1].type==="text"?o[e+1].content=o[e].content+o[e+1].content:(e!==n&&(o[n]=o[e]),n++);e!==n&&(o.length=n)}}const zs=[["normalize",Z3],["block",X3],["inline",Y3],["linkify",t6],["replacements",l6],["smartquotes",d6],["text_join",f6]];function Nu(){this.ruler=new Ae;for(let t=0;t<zs.length;t++)this.ruler.push(zs[t][0],zs[t][1])}Nu.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)};Nu.prototype.State=kh;function et(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,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;const i=this.src;for(let s=0,o=0,u=0,l=0,a=i.length,c=!1;o<a;o++){const d=i.charCodeAt(o);if(!c)if(H(d)){u++,d===9?l+=4-l%4:l++;continue}else c=!0;(d===10||o===a-1)&&(d!==10&&o++,this.bMarks.push(s),this.eMarks.push(o),this.tShift.push(u),this.sCount.push(l),this.bsCount.push(0),c=!1,u=0,l=0,s=o+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}et.prototype.push=function(t,e,n){const r=new qe(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r};et.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};et.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};et.prototype.skipSpaces=function(e){for(let n=this.src.length;e<n;e++){const r=this.src.charCodeAt(e);if(!H(r))break}return e};et.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!H(this.src.charCodeAt(--e)))return e+1;return e};et.prototype.skipChars=function(e,n){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e};et.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e};et.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const s=new Array(n-e);for(let o=0,u=e;u<n;u++,o++){let l=0;const a=this.bMarks[u];let c=a,d;for(u+1<n||i?d=this.eMarks[u]+1:d=this.eMarks[u];c<d&&l<r;){const f=this.src.charCodeAt(c);if(H(f))f===9?l+=4-(l+this.bsCount[u])%4:l++;else if(c-a<this.tShift[u])l++;else break;c++}l>r?s[o]=new Array(l-r+1).join(" ")+this.src.slice(c,d):s[o]=this.src.slice(c,d)}return s.join("")};et.prototype.Token=qe;const h6=65536;function Bs(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function La(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),s=!1,o=0,u="";for(;r<n;)i===124&&(s?(u+=t.substring(o,r-1),o=r):(e.push(u+t.substring(o,r)),u="",o=r+1)),s=i===92,r++,i=t.charCodeAt(r);return e.push(u+t.substring(o)),e}function p6(t,e,n,r){if(e+2>n)return!1;let i=e+1;if(t.sCount[i]<t.blkIndent||t.sCount[i]-t.blkIndent>=4)return!1;let s=t.bMarks[i]+t.tShift[i];if(s>=t.eMarks[i])return!1;const o=t.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=t.eMarks[i])return!1;const u=t.src.charCodeAt(s++);if(u!==124&&u!==45&&u!==58&&!H(u)||o===45&&H(u))return!1;for(;s<t.eMarks[i];){const w=t.src.charCodeAt(s);if(w!==124&&w!==45&&w!==58&&!H(w))return!1;s++}let l=Bs(t,e+1),a=l.split("|");const c=[];for(let w=0;w<a.length;w++){const C=a[w].trim();if(!C){if(w===0||w===a.length-1)continue;return!1}if(!/^:?-+:?$/.test(C))return!1;C.charCodeAt(C.length-1)===58?c.push(C.charCodeAt(0)===58?"center":"right"):C.charCodeAt(0)===58?c.push("left"):c.push("")}if(l=Bs(t,e).trim(),l.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;a=La(l),a.length&&a[0]===""&&a.shift(),a.length&&a[a.length-1]===""&&a.pop();const d=a.length;if(d===0||d!==c.length)return!1;if(r)return!0;const f=t.parentType;t.parentType="table";const h=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),m=[e,0];p.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const b=t.push("tr_open","tr",1);b.map=[e,e+1];for(let w=0;w<a.length;w++){const C=t.push("th_open","th",1);c[w]&&(C.attrs=[["style","text-align:"+c[w]]]);const v=t.push("inline","",0);v.content=a[w].trim(),v.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let y,k=0;for(i=e+2;i<n&&!(t.sCount[i]<t.blkIndent);i++){let w=!1;for(let v=0,A=h.length;v<A;v++)if(h[v](t,i,n,!0)){w=!0;break}if(w||(l=Bs(t,i).trim(),!l)||t.sCount[i]-t.blkIndent>=4||(a=La(l),a.length&&a[0]===""&&a.shift(),a.length&&a[a.length-1]===""&&a.pop(),k+=d-a.length,k>h6))break;if(i===e+2){const v=t.push("tbody_open","tbody",1);v.map=y=[e+2,0]}const C=t.push("tr_open","tr",1);C.map=[i,i+1];for(let v=0;v<d;v++){const A=t.push("td_open","td",1);c[v]&&(A.attrs=[["style","text-align:"+c[v]]]);const T=t.push("inline","",0);T.content=a[v]?a[v].trim():"",T.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return y&&(t.push("tbody_close","tbody",-1),y[1]=i),t.push("table_close","table",-1),m[1]=i,t.parentType=f,t.line=i,!0}function m6(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,i=r;for(;r<n;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,i=r;continue}break}t.line=i;const s=t.push("code_block","code",0);return s.content=t.getLines(e,i,4+t.blkIndent,!1)+`
`,s.map=[e,t.line],!0}function g6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>s)return!1;const o=t.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let u=i;i=t.skipChars(i,o);let l=i-u;if(l<3)return!1;const a=t.src.slice(u,i),c=t.src.slice(i,s);if(o===96&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=e,f=!1;for(;d++,!(d>=n||(i=u=t.bMarks[d]+t.tShift[d],s=t.eMarks[d],i<s&&t.sCount[d]<t.blkIndent));)if(t.src.charCodeAt(i)===o&&!(t.sCount[d]-t.blkIndent>=4)&&(i=t.skipChars(i,o),!(i-u<l)&&(i=t.skipSpaces(i),!(i<s)))){f=!0;break}l=t.sCount[e],t.line=d+(f?1:0);const h=t.push("fence","code",0);return h.info=c,h.content=t.getLines(e+1,d,l,!0),h.markup=a,h.map=[e,t.line],!0}function b6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];const o=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const u=[],l=[],a=[],c=[],d=t.md.block.ruler.getRules("blockquote"),f=t.parentType;t.parentType="blockquote";let h=!1,p;for(p=e;p<n;p++){const k=t.sCount[p]<t.blkIndent;if(i=t.bMarks[p]+t.tShift[p],s=t.eMarks[p],i>=s)break;if(t.src.charCodeAt(i++)===62&&!k){let C=t.sCount[p]+1,v,A;t.src.charCodeAt(i)===32?(i++,C++,A=!1,v=!0):t.src.charCodeAt(i)===9?(v=!0,(t.bsCount[p]+C)%4===3?(i++,C++,A=!1):A=!0):v=!1;let T=C;for(u.push(t.bMarks[p]),t.bMarks[p]=i;i<s;){const I=t.src.charCodeAt(i);if(H(I))I===9?T+=4-(T+t.bsCount[p]+(A?1:0))%4:T++;else break;i++}h=i>=s,l.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(v?1:0),a.push(t.sCount[p]),t.sCount[p]=T-C,c.push(t.tShift[p]),t.tShift[p]=i-t.bMarks[p];continue}if(h)break;let w=!1;for(let C=0,v=d.length;C<v;C++)if(d[C](t,p,n,!0)){w=!0;break}if(w){t.lineMax=p,t.blkIndent!==0&&(u.push(t.bMarks[p]),l.push(t.bsCount[p]),c.push(t.tShift[p]),a.push(t.sCount[p]),t.sCount[p]-=t.blkIndent);break}u.push(t.bMarks[p]),l.push(t.bsCount[p]),c.push(t.tShift[p]),a.push(t.sCount[p]),t.sCount[p]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const b=[e,0];g.map=b,t.md.block.tokenize(t,e,p);const y=t.push("blockquote_close","blockquote",-1);y.markup=">",t.lineMax=o,t.parentType=f,b[1]=t.line;for(let k=0;k<c.length;k++)t.bMarks[k+e]=u[k],t.tShift[k+e]=c[k],t.sCount[k+e]=a[k],t.bsCount[k+e]=l[k];return t.blkIndent=m,!0}function x6(t,e,n,r){const i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.bMarks[e]+t.tShift[e];const o=t.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let u=1;for(;s<i;){const a=t.src.charCodeAt(s++);if(a!==o&&!H(a))return!1;a===o&&u++}if(u<3)return!1;if(r)return!0;t.line=e+1;const l=t.push("hr","hr",0);return l.map=[e,t.line],l.markup=Array(u+1).join(String.fromCharCode(o)),!0}function Fa(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(r++);if(i!==42&&i!==45&&i!==43)return-1;if(r<n){const s=t.src.charCodeAt(r);if(!H(s))return-1}return r}function Pa(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let i=n;if(i+1>=r)return-1;let s=t.src.charCodeAt(i++);if(s<48||s>57)return-1;for(;;){if(i>=r)return-1;if(s=t.src.charCodeAt(i++),s>=48&&s<=57){if(i-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return i<r&&(s=t.src.charCodeAt(i),!H(s))?-1:i}function y6(t,e){const n=t.level+2;for(let r=e+2,i=t.tokens.length-2;r<i;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function k6(t,e,n,r){let i,s,o,u,l=e,a=!0;if(t.sCount[l]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[l]>=t.blkIndent&&(c=!0);let d,f,h;if((h=Pa(t,l))>=0){if(d=!0,o=t.bMarks[l]+t.tShift[l],f=Number(t.src.slice(o,h-1)),c&&f!==1)return!1}else if((h=Fa(t,l))>=0)d=!1;else return!1;if(c&&t.skipSpaces(h)>=t.eMarks[l])return!1;if(r)return!0;const p=t.src.charCodeAt(h-1),m=t.tokens.length;d?(u=t.push("ordered_list_open","ol",1),f!==1&&(u.attrs=[["start",f]])):u=t.push("bullet_list_open","ul",1);const g=[l,0];u.map=g,u.markup=String.fromCharCode(p);let b=!1;const y=t.md.block.ruler.getRules("list"),k=t.parentType;for(t.parentType="list";l<n;){s=h,i=t.eMarks[l];const w=t.sCount[l]+h-(t.bMarks[l]+t.tShift[l]);let C=w;for(;s<i;){const P=t.src.charCodeAt(s);if(P===9)C+=4-(C+t.bsCount[l])%4;else if(P===32)C++;else break;s++}const v=s;let A;v>=i?A=1:A=C-w,A>4&&(A=1);const T=w+A;u=t.push("list_item_open","li",1),u.markup=String.fromCharCode(p);const I=[l,0];u.map=I,d&&(u.info=t.src.slice(o,h-1));const $=t.tight,re=t.tShift[l],ke=t.sCount[l],Q=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=T,t.tight=!0,t.tShift[l]=v-t.bMarks[l],t.sCount[l]=C,v>=i&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),(!t.tight||b)&&(a=!1),b=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=Q,t.tShift[l]=re,t.sCount[l]=ke,t.tight=$,u=t.push("list_item_close","li",-1),u.markup=String.fromCharCode(p),l=t.line,I[1]=l,l>=n||t.sCount[l]<t.blkIndent||t.sCount[l]-t.blkIndent>=4)break;let J=!1;for(let P=0,Ve=y.length;P<Ve;P++)if(y[P](t,l,n,!0)){J=!0;break}if(J)break;if(d){if(h=Pa(t,l),h<0)break;o=t.bMarks[l]+t.tShift[l]}else if(h=Fa(t,l),h<0)break;if(p!==t.src.charCodeAt(h-1))break}return d?u=t.push("ordered_list_close","ol",-1):u=t.push("bullet_list_close","ul",-1),u.markup=String.fromCharCode(p),g[1]=l,t.line=l,t.parentType=k,a&&y6(t,m),!0}function w6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],o=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==91)return!1;function u(y){const k=t.lineMax;if(y>=k||t.isEmpty(y))return null;let w=!1;if(t.sCount[y]-t.blkIndent>3&&(w=!0),t.sCount[y]<0&&(w=!0),!w){const A=t.md.block.ruler.getRules("reference"),T=t.parentType;t.parentType="reference";let I=!1;for(let $=0,re=A.length;$<re;$++)if(A[$](t,y,k,!0)){I=!0;break}if(t.parentType=T,I)return null}const C=t.bMarks[y]+t.tShift[y],v=t.eMarks[y];return t.src.slice(C,v+1)}let l=t.src.slice(i,s+1);s=l.length;let a=-1;for(i=1;i<s;i++){const y=l.charCodeAt(i);if(y===91)return!1;if(y===93){a=i;break}else if(y===10){const k=u(o);k!==null&&(l+=k,s=l.length,o++)}else if(y===92&&(i++,i<s&&l.charCodeAt(i)===10)){const k=u(o);k!==null&&(l+=k,s=l.length,o++)}}if(a<0||l.charCodeAt(a+1)!==58)return!1;for(i=a+2;i<s;i++){const y=l.charCodeAt(i);if(y===10){const k=u(o);k!==null&&(l+=k,s=l.length,o++)}else if(!H(y))break}const c=t.md.helpers.parseLinkDestination(l,i,s);if(!c.ok)return!1;const d=t.md.normalizeLink(c.str);if(!t.md.validateLink(d))return!1;i=c.pos;const f=i,h=o,p=i;for(;i<s;i++){const y=l.charCodeAt(i);if(y===10){const k=u(o);k!==null&&(l+=k,s=l.length,o++)}else if(!H(y))break}let m=t.md.helpers.parseLinkTitle(l,i,s);for(;m.can_continue;){const y=u(o);if(y===null)break;l+=y,i=s,s=l.length,o++,m=t.md.helpers.parseLinkTitle(l,i,s,m)}let g;for(i<s&&p!==i&&m.ok?(g=m.str,i=m.pos):(g="",i=f,o=h);i<s;){const y=l.charCodeAt(i);if(!H(y))break;i++}if(i<s&&l.charCodeAt(i)!==10&&g)for(g="",i=f,o=h;i<s;){const y=l.charCodeAt(i);if(!H(y))break;i++}if(i<s&&l.charCodeAt(i)!==10)return!1;const b=rs(l.slice(1,a));return b?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[b]>"u"&&(t.env.references[b]={title:g,href:d}),t.line=o),!0):!1}const C6=["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","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],E6="[a-zA-Z_:][a-zA-Z0-9:._-]*",S6="[^\"'=<>`\\x00-\\x20]+",v6="'[^']*'",A6='"[^"]*"',M6="(?:"+S6+"|"+v6+"|"+A6+")",T6="(?:\\s+"+E6+"(?:\\s*=\\s*"+M6+")?)",Ch="<[A-Za-z][A-Za-z0-9\\-]*"+T6+"*\\s*\\/?>",Eh="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",_6="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",D6="<[?][\\s\\S]*?[?]>",N6="<![A-Za-z][^>]*>",O6="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",R6=new RegExp("^(?:"+Ch+"|"+Eh+"|"+_6+"|"+D6+"|"+N6+"|"+O6+")"),I6=new RegExp("^(?:"+Ch+"|"+Eh+")"),un=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+C6.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(I6.source+"\\s*$"),/^$/,!1]];function L6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let o=t.src.slice(i,s),u=0;for(;u<un.length&&!un[u][0].test(o);u++);if(u===un.length)return!1;if(r)return un[u][2];let l=e+1;if(!un[u][1].test(o)){for(;l<n&&!(t.sCount[l]<t.blkIndent);l++)if(i=t.bMarks[l]+t.tShift[l],s=t.eMarks[l],o=t.src.slice(i,s),un[u][1].test(o)){o.length!==0&&l++;break}}t.line=l;const a=t.push("html_block","",0);return a.map=[e,l],a.content=t.getLines(e,l,t.blkIndent,!0),!0}function F6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.src.charCodeAt(i);if(o!==35||i>=s)return!1;let u=1;for(o=t.src.charCodeAt(++i);o===35&&i<s&&u<=6;)u++,o=t.src.charCodeAt(++i);if(u>6||i<s&&!H(o))return!1;if(r)return!0;s=t.skipSpacesBack(s,i);const l=t.skipCharsBack(s,35,i);l>i&&H(t.src.charCodeAt(l-1))&&(s=l),t.line=e+1;const a=t.push("heading_open","h"+String(u),1);a.markup="########".slice(0,u),a.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(i,s).trim(),c.map=[e,t.line],c.children=[];const d=t.push("heading_close","h"+String(u),-1);return d.markup="########".slice(0,u),!0}function P6(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let s=0,o,u=e+1;for(;u<n&&!t.isEmpty(u);u++){if(t.sCount[u]-t.blkIndent>3)continue;if(t.sCount[u]>=t.blkIndent){let h=t.bMarks[u]+t.tShift[u];const p=t.eMarks[u];if(h<p&&(o=t.src.charCodeAt(h),(o===45||o===61)&&(h=t.skipChars(h,o),h=t.skipSpaces(h),h>=p))){s=o===61?1:2;break}}if(t.sCount[u]<0)continue;let f=!1;for(let h=0,p=r.length;h<p;h++)if(r[h](t,u,n,!0)){f=!0;break}if(f)break}if(!s)return!1;const l=t.getLines(e,u,t.blkIndent,!1).trim();t.line=u+1;const a=t.push("heading_open","h"+String(s),1);a.markup=String.fromCharCode(o),a.map=[e,t.line];const c=t.push("inline","",0);c.content=l,c.map=[e,t.line-1],c.children=[];const d=t.push("heading_close","h"+String(s),-1);return d.markup=String.fromCharCode(o),t.parentType=i,!0}function z6(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),i=t.parentType;let s=e+1;for(t.parentType="paragraph";s<n&&!t.isEmpty(s);s++){if(t.sCount[s]-t.blkIndent>3||t.sCount[s]<0)continue;let a=!1;for(let c=0,d=r.length;c<d;c++)if(r[c](t,s,n,!0)){a=!0;break}if(a)break}const o=t.getLines(e,s,t.blkIndent,!1).trim();t.line=s;const u=t.push("paragraph_open","p",1);u.map=[e,t.line];const l=t.push("inline","",0);return l.content=o,l.map=[e,t.line],l.children=[],t.push("paragraph_close","p",-1),t.parentType=i,!0}const Fr=[["table",p6,["paragraph","reference"]],["code",m6],["fence",g6,["paragraph","reference","blockquote","list"]],["blockquote",b6,["paragraph","reference","blockquote","list"]],["hr",x6,["paragraph","reference","blockquote","list"]],["list",k6,["paragraph","reference","blockquote"]],["reference",w6],["html_block",L6,["paragraph","reference","blockquote"]],["heading",F6,["paragraph","reference","blockquote"]],["lheading",P6],["paragraph",z6]];function is(){this.ruler=new Ae;for(let t=0;t<Fr.length;t++)this.ruler.push(Fr[t][0],Fr[t][1],{alt:(Fr[t][2]||[]).slice()})}is.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),i=r.length,s=t.md.options.maxNesting;let o=e,u=!1;for(;o<n&&(t.line=o=t.skipEmptyLines(o),!(o>=n||t.sCount[o]<t.blkIndent));){if(t.level>=s){t.line=n;break}const l=t.line;let a=!1;for(let c=0;c<i;c++)if(a=r[c](t,o,n,!1),a){if(l>=t.line)throw new Error("block rule didn't increment state.line");break}if(!a)throw new Error("none of the block rules matched");t.tight=!u,t.isEmpty(t.line-1)&&(u=!0),o=t.line,o<n&&t.isEmpty(o)&&(u=!0,o++,t.line=o)}};is.prototype.parse=function(t,e,n,r){if(!t)return;const i=new this.State(t,e,n,r);this.tokenize(i,i.line,i.lineMax)};is.prototype.State=et;function mr(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.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,this.linkLevel=0}mr.prototype.pushPending=function(){const t=new qe("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};mr.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new qe(t,e,n);let i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};mr.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let s=t;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const o=s-t,u=s<n?this.src.charCodeAt(s):32,l=ur(i)||or(String.fromCharCode(i)),a=ur(u)||or(String.fromCharCode(u)),c=sr(i),d=sr(u),f=!d&&(!a||c||l),h=!c&&(!l||d||a);return{can_open:f&&(e||!h||l),can_close:h&&(e||!f||a),length:o}};mr.prototype.Token=qe;function B6(t){switch(t){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}}function $6(t,e){let n=t.pos;for(;n<t.posMax&&!B6(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const j6=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function H6(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(j6);if(!i)return!1;const s=i[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let u=o.url;if(u.length<=s.length)return!1;let l=u.length;for(;l>0&&u.charCodeAt(l-1)===42;)l--;l!==u.length&&(u=u.slice(0,l));const a=t.md.normalizeLink(u);if(!t.md.validateLink(a))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const c=t.push("link_open","a",1);c.attrs=[["href",a]],c.markup="linkify",c.info="auto";const d=t.push("text","",0);d.content=t.md.normalizeLinkText(u);const f=t.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return t.pos+=u.length-s.length,!0}function q6(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&t.pending.charCodeAt(s-1)===32;)s--;t.pending=t.pending.slice(0,s),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<i&&H(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const Ou=[];for(let t=0;t<256;t++)Ou.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Ou[t.charCodeAt(0)]=1});function V6(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(i=t.src.charCodeAt(n),!!H(i));)n++;return t.pos=n,!0}let s=t.src[n];if(i>=55296&&i<=56319&&n+1<r){const u=t.src.charCodeAt(n+1);u>=56320&&u<=57343&&(s+=t.src[n+1],n++)}const o="\\"+s;if(!e){const u=t.push("text_special","",0);i<256&&Ou[i]!==0?u.content=s:u.content=o,u.markup=o,u.info="escape"}return t.pos=n+1,!0}function W6(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const s=t.posMax;for(;n<s&&t.src.charCodeAt(n)===96;)n++;const o=t.src.slice(i,n),u=o.length;if(t.backticksScanned&&(t.backticks[u]||0)<=i)return e||(t.pending+=o),t.pos+=u,!0;let l=n,a;for(;(a=t.src.indexOf("`",l))!==-1;){for(l=a+1;l<s&&t.src.charCodeAt(l)===96;)l++;const c=l-a;if(c===u){if(!e){const d=t.push("code_inline","code",0);d.markup=o,d.content=t.src.slice(n,a).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=l,!0}t.backticks[c]=a}return t.backticksScanned=!0,e||(t.pending+=o),t.pos+=u,!0}function U6(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const i=t.scanDelims(t.pos,!0);let s=i.length;const o=String.fromCharCode(r);if(s<2)return!1;let u;s%2&&(u=t.push("text","",0),u.content=o,s--);for(let l=0;l<s;l+=2)u=t.push("text","",0),u.content=o+o,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return t.pos+=i.length,!0}function za(t,e){let n;const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(o.marker!==126||o.end===-1)continue;const u=e[o.end];n=t.tokens[o.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[u.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[u.token-1].type==="text"&&t.tokens[u.token-1].content==="~"&&r.push(u.token-1)}for(;r.length;){const s=r.pop();let o=s+1;for(;o<t.tokens.length&&t.tokens[o].type==="s_close";)o++;o--,s!==o&&(n=t.tokens[o],t.tokens[o]=t.tokens[s],t.tokens[s]=n)}}function K6(t){const e=t.tokens_meta,n=t.tokens_meta.length;za(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&za(t,e[r].delimiters)}const Sh={tokenize:U6,postProcess:K6};function J6(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const i=t.scanDelims(t.pos,r===42);for(let s=0;s<i.length;s++){const o=t.push("text","",0);o.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:i.length,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return t.pos+=i.length,!0}function Ba(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const s=e[i.end],o=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===s.token+1,u=String.fromCharCode(i.marker),l=t.tokens[i.token];l.type=o?"strong_open":"em_open",l.tag=o?"strong":"em",l.nesting=1,l.markup=o?u+u:u,l.content="";const a=t.tokens[s.token];a.type=o?"strong_close":"em_close",a.tag=o?"strong":"em",a.nesting=-1,a.markup=o?u+u:u,a.content="",o&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function G6(t){const e=t.tokens_meta,n=t.tokens_meta.length;Ba(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&Ba(t,e[r].delimiters)}const vh={tokenize:J6,postProcess:G6};function Z6(t,e){let n,r,i,s,o="",u="",l=t.pos,a=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,d=t.posMax,f=t.pos+1,h=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(h<0)return!1;let p=h+1;if(p<d&&t.src.charCodeAt(p)===40){for(a=!1,p++;p<d&&(n=t.src.charCodeAt(p),!(!H(n)&&n!==10));p++);if(p>=d)return!1;if(l=p,i=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),i.ok){for(o=t.md.normalizeLink(i.str),t.md.validateLink(o)?p=i.pos:o="",l=p;p<d&&(n=t.src.charCodeAt(p),!(!H(n)&&n!==10));p++);if(i=t.md.helpers.parseLinkTitle(t.src,p,t.posMax),p<d&&l!==p&&i.ok)for(u=i.str,p=i.pos;p<d&&(n=t.src.charCodeAt(p),!(!H(n)&&n!==10));p++);}(p>=d||t.src.charCodeAt(p)!==41)&&(a=!0),p++}if(a){if(typeof t.env.references>"u")return!1;if(p<d&&t.src.charCodeAt(p)===91?(l=p+1,p=t.md.helpers.parseLinkLabel(t,p),p>=0?r=t.src.slice(l,p++):p=h+1):p=h+1,r||(r=t.src.slice(f,h)),s=t.env.references[rs(r)],!s)return t.pos=c,!1;o=s.href,u=s.title}if(!e){t.pos=f,t.posMax=h;const m=t.push("link_open","a",1),g=[["href",o]];m.attrs=g,u&&g.push(["title",u]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=d,!0}function X6(t,e){let n,r,i,s,o,u,l,a,c="";const d=t.pos,f=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const h=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(s=p+1,s<f&&t.src.charCodeAt(s)===40){for(s++;s<f&&(n=t.src.charCodeAt(s),!(!H(n)&&n!==10));s++);if(s>=f)return!1;for(a=s,u=t.md.helpers.parseLinkDestination(t.src,s,t.posMax),u.ok&&(c=t.md.normalizeLink(u.str),t.md.validateLink(c)?s=u.pos:c=""),a=s;s<f&&(n=t.src.charCodeAt(s),!(!H(n)&&n!==10));s++);if(u=t.md.helpers.parseLinkTitle(t.src,s,t.posMax),s<f&&a!==s&&u.ok)for(l=u.str,s=u.pos;s<f&&(n=t.src.charCodeAt(s),!(!H(n)&&n!==10));s++);else l="";if(s>=f||t.src.charCodeAt(s)!==41)return t.pos=d,!1;s++}else{if(typeof t.env.references>"u")return!1;if(s<f&&t.src.charCodeAt(s)===91?(a=s+1,s=t.md.helpers.parseLinkLabel(t,s),s>=0?i=t.src.slice(a,s++):s=p+1):s=p+1,i||(i=t.src.slice(h,p)),o=t.env.references[rs(i)],!o)return t.pos=d,!1;c=o.href,l=o.title}if(!e){r=t.src.slice(h,p);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),b=[["src",c],["alt",""]];g.attrs=b,g.children=m,g.content=r,l&&b.push(["title",l])}return t.pos=s,t.posMax=f,!0}const Y6=/^([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])?)*)$/,Q6=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function ew(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const o=t.src.charCodeAt(n);if(o===60)return!1;if(o===62)break}const s=t.src.slice(r+1,n);if(Q6.test(s)){const o=t.md.normalizeLink(s);if(!t.md.validateLink(o))return!1;if(!e){const u=t.push("link_open","a",1);u.attrs=[["href",o]],u.markup="autolink",u.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(s);const a=t.push("link_close","a",-1);a.markup="autolink",a.info="auto"}return t.pos+=s.length+2,!0}if(Y6.test(s)){const o=t.md.normalizeLink("mailto:"+s);if(!t.md.validateLink(o))return!1;if(!e){const u=t.push("link_open","a",1);u.attrs=[["href",o]],u.markup="autolink",u.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(s);const a=t.push("link_close","a",-1);a.markup="autolink",a.info="auto"}return t.pos+=s.length+2,!0}return!1}function tw(t){return/^<a[>\s]/i.test(t)}function nw(t){return/^<\/a\s*>/i.test(t)}function rw(t){const e=t|32;return e>=97&&e<=122}function iw(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!rw(i))return!1;const s=t.src.slice(r).match(R6);if(!s)return!1;if(!e){const o=t.push("html_inline","",0);o.content=s[0],tw(o.content)&&t.linkLevel++,nw(o.content)&&t.linkLevel--}return t.pos+=s[0].length,!0}const sw=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,ow=/^&([a-z][a-z0-9]{1,31});/i;function uw(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const s=t.src.slice(n).match(sw);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),u=t.push("text_special","",0);u.content=Du(o)?Fi(o):Fi(65533),u.markup=s[0],u.info="entity"}return t.pos+=s[0].length,!0}}else{const s=t.src.slice(n).match(ow);if(s){const o=bh(s[0]);if(o!==s[0]){if(!e){const u=t.push("text_special","",0);u.content=o,u.markup=s[0],u.info="entity"}return t.pos+=s[0].length,!0}}}return!1}function $a(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const s=[];for(let o=0;o<n;o++){const u=t[o];if(s.push(0),(t[r].marker!==u.marker||i!==u.token-1)&&(r=o),i=u.token,u.length=u.length||0,!u.close)continue;e.hasOwnProperty(u.marker)||(e[u.marker]=[-1,-1,-1,-1,-1,-1]);const l=e[u.marker][(u.open?3:0)+u.length%3];let a=r-s[r]-1,c=a;for(;a>l;a-=s[a]+1){const d=t[a];if(d.marker===u.marker&&d.open&&d.end<0){let f=!1;if((d.close||u.open)&&(d.length+u.length)%3===0&&(d.length%3!==0||u.length%3!==0)&&(f=!0),!f){const h=a>0&&!t[a-1].open?s[a-1]+1:0;s[o]=o-a+h,s[a]=h,u.open=!1,d.end=o,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(e[u.marker][(u.open?3:0)+(u.length||0)%3]=c)}}function lw(t){const e=t.tokens_meta,n=t.tokens_meta.length;$a(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&$a(e[r].delimiters)}function aw(t){let e,n,r=0;const i=t.tokens,s=t.tokens.length;for(e=n=0;e<s;e++)i[e].nesting<0&&r--,i[e].level=r,i[e].nesting>0&&r++,i[e].type==="text"&&e+1<s&&i[e+1].type==="text"?i[e+1].content=i[e].content+i[e+1].content:(e!==n&&(i[n]=i[e]),n++);e!==n&&(i.length=n)}const $s=[["text",$6],["linkify",H6],["newline",q6],["escape",V6],["backticks",W6],["strikethrough",Sh.tokenize],["emphasis",vh.tokenize],["link",Z6],["image",X6],["autolink",ew],["html_inline",iw],["entity",uw]],js=[["balance_pairs",lw],["strikethrough",Sh.postProcess],["emphasis",vh.postProcess],["fragments_join",aw]];function gr(){this.ruler=new Ae;for(let t=0;t<$s.length;t++)this.ruler.push($s[t][0],$s[t][1]);this.ruler2=new Ae;for(let t=0;t<js.length;t++)this.ruler2.push(js[t][0],js[t][1])}gr.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,i=t.md.options.maxNesting,s=t.cache;if(typeof s[e]<"u"){t.pos=s[e];return}let o=!1;if(t.level<i){for(let u=0;u<r;u++)if(t.level++,o=n[u](t,!0),t.level--,o){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;o||t.pos++,s[e]=t.pos};gr.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos<r;){const s=t.pos;let o=!1;if(t.level<i){for(let u=0;u<n;u++)if(o=e[u](t,!1),o){if(s>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};gr.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let u=0;u<o;u++)s[u](i)};gr.prototype.State=mr;function cw(t){const e={};t=t||{},e.src_Any=fh.source,e.src_Cc=hh.source,e.src_Z=mh.source,e.src_P=Tu.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><｜]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.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]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|｜]|"+e.src_ZPCc+"))((?![$+<=>^`|｜])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|｜]|"+e.src_ZPCc+"))((?![$+<=>^`|｜])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Ro(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function ss(t){return Object.prototype.toString.call(t)}function dw(t){return ss(t)==="[object String]"}function fw(t){return ss(t)==="[object Object]"}function hw(t){return ss(t)==="[object RegExp]"}function ja(t){return ss(t)==="[object Function]"}function pw(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const Ah={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function mw(t){return Object.keys(t||{}).reduce(function(e,n){return e||Ah.hasOwnProperty(n)},!1)}const gw={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},bw="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]",xw="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function yw(t){t.__index__=-1,t.__text_cache__=""}function kw(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Ha(){return function(t,e){e.normalize(t)}}function Pi(t){const e=t.re=cw(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(bw),n.push(e.src_xn),e.src_tlds=n.join("|");function r(u){return u.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function s(u,l){throw new Error('(LinkifyIt) Invalid schema "'+u+'": '+l)}Object.keys(t.__schemas__).forEach(function(u){const l=t.__schemas__[u];if(l===null)return;const a={validate:null,link:null};if(t.__compiled__[u]=a,fw(l)){hw(l.validate)?a.validate=kw(l.validate):ja(l.validate)?a.validate=l.validate:s(u,l),ja(l.normalize)?a.normalize=l.normalize:l.normalize?s(u,l):a.normalize=Ha();return}if(dw(l)){i.push(u);return}s(u,l)}),i.forEach(function(u){t.__compiled__[t.__schemas__[u]]&&(t.__compiled__[u].validate=t.__compiled__[t.__schemas__[u]].validate,t.__compiled__[u].normalize=t.__compiled__[t.__schemas__[u]].normalize)}),t.__compiled__[""]={validate:null,normalize:Ha()};const o=Object.keys(t.__compiled__).filter(function(u){return u.length>0&&t.__compiled__[u]}).map(pw).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><｜]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><｜]|"+e.src_ZPCc+"))("+o+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),yw(t)}function ww(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function Io(t,e){const n=new ww(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function Ne(t,e){if(!(this instanceof Ne))return new Ne(t,e);e||mw(t)&&(e=t,t={}),this.__opts__=Ro({},Ah,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Ro({},gw,t),this.__compiled__={},this.__tlds__=xw,this.__tlds_replaced__=!1,this.re={},Pi(this)}Ne.prototype.add=function(e,n){return this.__schemas__[e]=n,Pi(this),this};Ne.prototype.set=function(e){return this.__opts__=Ro(this.__opts__,e),this};Ne.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,s,o,u,l,a,c;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(n=l.exec(e))!==null;)if(s=this.testSchemaAt(e,n[2],l.lastIndex),s){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(a=e.search(this.re.host_fuzzy_test),a>=0&&(this.__index__<0||a<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=r.index+r[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(i=e.match(this.re.email_fuzzy))!==null&&(o=i.index+i[1].length,u=i.index+i[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&u>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=u))),this.__index__>=0};Ne.prototype.pretest=function(e){return this.re.pretest.test(e)};Ne.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};Ne.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(Io(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(Io(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Ne.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,Io(this,0)):null};Ne.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,s){return r!==s[i-1]}).reverse(),Pi(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Pi(this),this)};Ne.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};Ne.prototype.onCompile=function(){};const pn=2147483647,Je=36,Ru=1,lr=26,Cw=38,Ew=700,Mh=72,Th=128,_h="-",Sw=/^xn--/,vw=/[^\0-\x7F]/,Aw=/[\x2E\u3002\uFF0E\uFF61]/g,Mw={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Hs=Je-Ru,Ge=Math.floor,qs=String.fromCharCode;function xt(t){throw new RangeError(Mw[t])}function Tw(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function Dh(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(Aw,".");const i=t.split("."),s=Tw(i,e).join(".");return r+s}function Nh(t){const e=[];let n=0;const r=t.length;for(;n<r;){const i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const s=t.charCodeAt(n++);(s&64512)==56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e}const _w=t=>String.fromCodePoint(...t),Dw=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Je},qa=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Oh=function(t,e,n){let r=0;for(t=n?Ge(t/Ew):t>>1,t+=Ge(t/e);t>Hs*lr>>1;r+=Je)t=Ge(t/Hs);return Ge(r+(Hs+1)*t/(t+Cw))},Rh=function(t){const e=[],n=t.length;let r=0,i=Th,s=Mh,o=t.lastIndexOf(_h);o<0&&(o=0);for(let u=0;u<o;++u)t.charCodeAt(u)>=128&&xt("not-basic"),e.push(t.charCodeAt(u));for(let u=o>0?o+1:0;u<n;){const l=r;for(let c=1,d=Je;;d+=Je){u>=n&&xt("invalid-input");const f=Dw(t.charCodeAt(u++));f>=Je&&xt("invalid-input"),f>Ge((pn-r)/c)&&xt("overflow"),r+=f*c;const h=d<=s?Ru:d>=s+lr?lr:d-s;if(f<h)break;const p=Je-h;c>Ge(pn/p)&&xt("overflow"),c*=p}const a=e.length+1;s=Oh(r-l,a,l==0),Ge(r/a)>pn-i&&xt("overflow"),i+=Ge(r/a),r%=a,e.splice(r++,0,i)}return String.fromCodePoint(...e)},Ih=function(t){const e=[];t=Nh(t);const n=t.length;let r=Th,i=0,s=Mh;for(const l of t)l<128&&e.push(qs(l));const o=e.length;let u=o;for(o&&e.push(_h);u<n;){let l=pn;for(const c of t)c>=r&&c<l&&(l=c);const a=u+1;l-r>Ge((pn-i)/a)&&xt("overflow"),i+=(l-r)*a,r=l;for(const c of t)if(c<r&&++i>pn&&xt("overflow"),c===r){let d=i;for(let f=Je;;f+=Je){const h=f<=s?Ru:f>=s+lr?lr:f-s;if(d<h)break;const p=d-h,m=Je-h;e.push(qs(qa(h+p%m,0))),d=Ge(p/m)}e.push(qs(qa(d,0))),s=Oh(i,a,u===o),i=0,++u}++i,++r}return e.join("")},Nw=function(t){return Dh(t,function(e){return Sw.test(e)?Rh(e.slice(4).toLowerCase()):e})},Ow=function(t){return Dh(t,function(e){return vw.test(e)?"xn--"+Ih(e):e})},Lh={version:"2.3.1",ucs2:{decode:Nh,encode:_w},decode:Rh,encode:Ih,toASCII:Ow,toUnicode:Nw},Rw={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},Iw={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},Lw={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},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","fragments_join"]}}},Fw={default:Rw,zero:Iw,commonmark:Lw},Pw=/^(vbscript|javascript|file|data):/,zw=/^data:image\/(gif|png|jpeg|webp);/;function Bw(t){const e=t.trim().toLowerCase();return Pw.test(e)?zw.test(e):!0}const Fh=["http:","https:","mailto:"];function $w(t){const e=Mu(t,!0);if(e.hostname&&(!e.protocol||Fh.indexOf(e.protocol)>=0))try{e.hostname=Lh.toASCII(e.hostname)}catch{}return pr(Au(e))}function jw(t){const e=Mu(t,!0);if(e.hostname&&(!e.protocol||Fh.indexOf(e.protocol)>=0))try{e.hostname=Lh.toUnicode(e.hostname)}catch{}return Cn(Au(e),Cn.defaultChars+"%")}function be(t,e){if(!(this instanceof be))return new be(t,e);e||_u(t)||(e=t||{},t="default"),this.inline=new gr,this.block=new is,this.core=new Nu,this.renderer=new vn,this.linkify=new Ne,this.validateLink=Bw,this.normalizeLink=$w,this.normalizeLinkText=jw,this.utils=q3,this.helpers=ns({},K3),this.options={},this.configure(t),e&&this.set(e)}be.prototype.set=function(t){return ns(this.options,t),this};be.prototype.configure=function(t){const e=this;if(_u(t)){const n=t;if(t=Fw[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};be.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};be.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};be.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};be.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};be.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};be.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};be.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const Hw=new Po({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function qw(t,e){if(t.isText&&e.isText&&B.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class Vw{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:B.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let n=this.top(),r=n.content,i=r[r.length-1],s=this.schema.text(e,n.marks),o;i&&(o=qw(i,s))?r[r.length-1]=o:r.push(s)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],i=this.tokenHandlers[r.type];if(!i)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");i(this,r,e,n)}}addNode(e,n,r){let i=this.top(),s=e.createAndFill(n,r,i?i.marks:[]);return s?(this.push(s),s):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:B.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function Dn(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function Vs(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function Va(t){return t[t.length-1]==`
`?t.slice(0,t.length-1):t}function Ws(){}function Ww(t,e){let n=Object.create(null);for(let r in e){let i=e[r];if(i.block){let s=t.nodeType(i.block);Vs(i,r)?n[r]=(o,u,l,a)=>{o.openNode(s,Dn(i,u,l,a)),o.addText(Va(u.content)),o.closeNode()}:(n[r+"_open"]=(o,u,l,a)=>o.openNode(s,Dn(i,u,l,a)),n[r+"_close"]=o=>o.closeNode())}else if(i.node){let s=t.nodeType(i.node);n[r]=(o,u,l,a)=>o.addNode(s,Dn(i,u,l,a))}else if(i.mark){let s=t.marks[i.mark];Vs(i,r)?n[r]=(o,u,l,a)=>{o.openMark(s.create(Dn(i,u,l,a))),o.addText(Va(u.content)),o.closeMark(s)}:(n[r+"_open"]=(o,u,l,a)=>o.openMark(s.create(Dn(i,u,l,a))),n[r+"_close"]=o=>o.closeMark(s))}else if(i.ignore)Vs(i,r)?n[r]=Ws:(n[r+"_open"]=Ws,n[r+"_close"]=Ws);else throw new RangeError("Unrecognized parsing spec "+JSON.stringify(i))}return n.text=(r,i)=>r.addText(i.content),n.inline=(r,i)=>r.parseTokens(i.children),n.softbreak=n.softbreak||(r=>r.addText(" ")),n}let Uw=class{constructor(e,n,r){this.schema=e,this.tokenizer=n,this.tokens=r,this.tokenHandlers=Ww(e,r)}parse(e,n={}){let r=new Vw(this.schema,this.tokenHandlers),i;r.parseTokens(this.tokenizer.parse(e,n));do i=r.closeNode();while(r.stack.length);return i||this.schema.topNodeType.createAndFill()}};function Wa(t,e){for(;++e<t.length;)if(t[e].type!="list_item_open")return t[e].hidden;return!1}new Uw(Hw,be("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(t,e,n)=>({tight:Wa(e,n)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,n)=>({order:+t.attrGet("start")||1,tight:Wa(e,n)})},heading:{block:"heading",getAttrs:t=>({level:+t.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:t=>({params:t.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:t=>({src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:t=>({href:t.attrGet("href"),title:t.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}});const Kw={open:"",close:"",mixable:!0};let Jw=class{constructor(e,n,r={}){this.nodes=e,this.marks=n,this.options=r}serialize(e,n={}){n=Object.assign({},this.options,n);let r=new Ph(this.nodes,this.marks,n);return r.renderContent(e),r.out}};const tt=new Jw({blockquote(t,e){t.wrapBlock("> ",null,e,()=>t.renderContent(e))},code_block(t,e){const n=e.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";t.write(r+(e.attrs.params||"")+`
`),t.text(e.textContent,!1),t.write(`
`),t.write(r),t.closeBlock(e)},heading(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e,!1),t.closeBlock(e)},horizontal_rule(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list(t,e){t.renderList(e,"  ",()=>(e.attrs.bullet||"*")+" ")},ordered_list(t,e){let n=e.attrs.order||1,r=String(n+e.childCount-1).length,i=t.repeat(" ",r+2);t.renderList(e,i,s=>{let o=String(n+s);return t.repeat(" ",r-o.length)+o+". "})},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+e.attrs.src.replace(/[\(\)]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(`\\
`);return}},text(t,e){t.text(e.text,!t.inAutolink)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open(t,e,n,r){return t.inAutolink=Gw(e,n,r),t.inAutolink?"<":"["},close(t,e,n,r){let{inAutolink:i}=t;return t.inAutolink=void 0,i?">":"]("+e.attrs.href.replace(/[\(\)"]/g,"\\$&")+(e.attrs.title?` "${e.attrs.title.replace(/"/g,'\\"')}"`:"")+")"},mixable:!0},code:{open(t,e,n,r){return Ua(n.child(r),-1)},close(t,e,n,r){return Ua(n.child(r-1),1)},escape:!1}});function Ua(t,e){let n=/`+/g,r,i=0;if(t.isText)for(;r=n.exec(t.text);)i=Math.max(i,r[0].length);let s=i>0&&e>0?" `":"`";for(let o=0;o<i;o++)s+="`";return i>0&&e<0&&(s+=" "),s}function Gw(t,e,n){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;let r=e.child(n);return!r.isText||r.text!=t.attrs.href||r.marks[r.marks.length-1]!=t?!1:n==e.childCount-1||!t.isInSet(e.child(n+1).marks)}let Ph=class{constructor(e,n,r){this.nodes=e,this.marks=n,this.options=r,this.delim="",this.out="",this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,typeof this.options.tightLists>"u"&&(this.options.tightLists=!1),typeof this.options.hardBreakNodeName>"u"&&(this.options.hardBreakNodeName="hard_break")}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
`),e>1){let n=this.delim,r=/\s+$/.exec(n);r&&(n=n.slice(0,n.length-r[0].length));for(let i=1;i<e;i++)this.out+=n+`
`}this.closed=null}}getMark(e){let n=this.marks[e];if(!n){if(this.options.strict!==!1)throw new Error(`Mark type \`${e}\` not supported by Markdown renderer`);n=Kw}return n}wrapBlock(e,n,r,i){let s=this.delim;this.write(n??e),this.delim+=e,i(),this.delim=s,this.closeBlock(r)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,n=!0){let r=e.split(`
`);for(let i=0;i<r.length;i++)this.write(),!n&&r[i][0]=="["&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+"\\!"),this.out+=n?this.esc(r[i],this.atBlockStart):r[i],i!=r.length-1&&(this.out+=`
`)}render(e,n,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,n,r);else{if(this.options.strict!==!1)throw new Error("Token type `"+e.type.name+"` not supported by Markdown renderer");e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}}renderContent(e){e.forEach((n,r,i)=>this.render(n,e,i))}renderInline(e,n=!0){this.atBlockStart=n;let r=[],i="",s=(o,u,l)=>{let a=o?o.marks:[];o&&o.type.name===this.options.hardBreakNodeName&&(a=a.filter(m=>{if(l+1==e.childCount)return!1;let g=e.child(l+1);return m.isInSet(g.marks)&&(!g.isText||/\S/.test(g.text))}));let c=i;if(i="",o&&o.isText&&a.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!m.isInSet(r)})){let[m,g,b]=/^(\s*)(.*)$/m.exec(o.text);g&&(c+=g,o=b?o.withText(b):null,o||(a=r))}if(o&&o.isText&&a.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!this.isMarkAhead(e,l+1,m)})){let[m,g,b]=/^(.*?)(\s*)$/m.exec(o.text);b&&(i=b,o=g?o.withText(g):null,o||(a=r))}let d=a.length?a[a.length-1]:null,f=d&&this.getMark(d.type.name).escape===!1,h=a.length-(f?1:0);e:for(let m=0;m<h;m++){let g=a[m];if(!this.getMark(g.type.name).mixable)break;for(let b=0;b<r.length;b++){let y=r[b];if(!this.getMark(y.type.name).mixable)break;if(g.eq(y)){m>b?a=a.slice(0,b).concat(g).concat(a.slice(b,m)).concat(a.slice(m+1,h)):b>m&&(a=a.slice(0,m).concat(a.slice(m+1,b)).concat(g).concat(a.slice(b,h)));continue e}}}let p=0;for(;p<Math.min(r.length,h)&&a[p].eq(r[p]);)++p;for(;p<r.length;)this.text(this.markString(r.pop(),!1,e,l),!1);if(c&&this.text(c),o){for(;r.length<h;){let m=a[r.length];r.push(m),this.text(this.markString(m,!0,e,l),!1),this.atBlockStart=!1}f&&o.isText?this.text(this.markString(d,!0,e,l)+o.text+this.markString(d,!1,e,l+1),!1):this.render(o,e,l),this.atBlockStart=!1}o?.isText&&o.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(s),s(null,0,e.childCount),this.atBlockStart=!1}renderList(e,n,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let i=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,s=this.inTightList;this.inTightList=i,e.forEach((o,u,l)=>{l&&i&&this.flushClose(1),this.wrapBlock(n,r(l),e,()=>this.render(o,e,l))}),this.inTightList=s}esc(e,n=!1){return e=e.replace(/[`*\\~\[\]_]/g,(r,i)=>r=="_"&&i>0&&i+1<e.length&&e[i-1].match(/\w/)&&e[i+1].match(/\w/)?r:"\\"+r),n&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,"\\$&")),e}quote(e){let n=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return n[0]+e+n[1]}repeat(e,n){let r="";for(let i=0;i<n;i++)r+=e;return r}markString(e,n,r,i){let s=this.getMark(e.type.name),o=n?s.open:s.close;return typeof o=="string"?o:o(this,e,r,i)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,n,r){for(;;n++){if(n>=e.childCount)return!1;let i=e.child(n);if(i.type.name!=this.options.hardBreakNodeName)return r.isInSet(i.marks);n++}}};var Lo=!0,zh=!1,Bh=!1,Zw=function(t,e){e&&(Lo=!e.enabled,zh=!!e.label,Bh=!!e.labelAfter),t.core.ruler.after("inline","github-task-lists",function(n){for(var r=n.tokens,i=2;i<r.length;i++)Yw(r,i)&&(Qw(r[i],n.Token),Ka(r[i-2],"class","task-list-item"+(Lo?"":" enabled")),Ka(r[Xw(r,i-2)],"class","contains-task-list"))})};function Ka(t,e,n){var r=t.attrIndex(e),i=[e,n];r<0?t.attrPush(i):t.attrs[r]=i}function Xw(t,e){for(var n=t[e].level-1,r=e-1;r>=0;r--)if(t[r].level===n)return r;return-1}function Yw(t,e){return iC(t[e])&&sC(t[e-1])&&oC(t[e-2])&&uC(t[e])}function Qw(t,e){if(t.children.unshift(eC(t,e)),t.children[1].content=t.children[1].content.slice(3),t.content=t.content.slice(3),zh)if(Bh){t.children.pop();var n="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);t.children[0].content=t.children[0].content.slice(0,-1)+' id="'+n+'">',t.children.push(rC(t.content,n,e))}else t.children.unshift(tC(e)),t.children.push(nC(e))}function eC(t,e){var n=new e("html_inline","",0),r=Lo?' disabled="" ':"";return t.content.indexOf("[ ] ")===0?n.content='<input class="task-list-item-checkbox"'+r+'type="checkbox">':(t.content.indexOf("[x] ")===0||t.content.indexOf("[X] ")===0)&&(n.content='<input class="task-list-item-checkbox" checked=""'+r+'type="checkbox">'),n}function tC(t){var e=new t("html_inline","",0);return e.content="<label>",e}function nC(t){var e=new t("html_inline","",0);return e.content="</label>",e}function rC(t,e,n){var r=new n("html_inline","",0);return r.content='<label class="task-list-item-label" for="'+e+'">'+t+"</label>",r.attrs=[{for:e}],r}function iC(t){return t.type==="inline"}function sC(t){return t.type==="paragraph_open"}function oC(t){return t.type==="list_item_open"}function uC(t){return t.content.indexOf("[ ] ")===0||t.content.indexOf("[x] ")===0||t.content.indexOf("[X] ")===0}const lC=Kh(Zw);var aC=Object.defineProperty,cC=(t,e,n)=>e in t?aC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zi=(t,e,n)=>(cC(t,typeof e!="symbol"?e+"":e,n),n);const dC=U.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:t=>t.getAttribute("data-tight")==="true"||!t.querySelector("p"),renderHTML:t=>({class:t.tight?this.options.tightClass:null,"data-tight":t.tight?"true":null})}}}]},addCommands(){var t=this;return{toggleTight:function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function s(o){if(!r.isActive(o))return!1;const u=r.getAttributes(o);return i.updateAttributes(o,{tight:e??!(u!=null&&u.tight)})}return t.options.listTypes.some(o=>s(o))}}}}}),Ja=be();function $h(t,e){return Ja.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new Ja.inline.State(t,null,null,[]).scanDelims(e,!0)}function jh(t,e,n,r){let i=t.substring(0,n)+t.substring(n+e.length);return i=i.substring(0,n+r)+e+i.substring(n+r),i}function fC(t,e,n,r){let i=n,s=t;for(;i<r&&!$h(s,i).can_open;)s=jh(s,e,i,1),i++;return{text:s,from:i,to:r}}function hC(t,e,n,r){let i=r,s=t;for(;i>n&&!$h(s,i).can_close;)s=jh(s,e,i,-1),i--;return{text:s,from:n,to:i}}function pC(t,e,n,r){let i={text:t,from:n,to:r};return i=fC(i.text,e,i.from,i.to),i=hC(i.text,e,i.from,i.to),i.to-i.from<e.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+e.length)),i.text}class mC extends Ph{constructor(e,n,r){super(e,n,r??{}),zi(this,"inTable",!1),this.inlines=[]}render(e,n,r){super.render(e,n,r);const i=this.inlines[this.inlines.length-1];if(i!=null&&i.start&&i!==null&&i!==void 0&&i.end){const{delimiter:s,start:o,end:u}=this.normalizeInline(i);this.out=pC(this.out,s,o,u),this.inlines.pop()}}markString(e,n,r,i){const s=this.marks[e.type.name];if(s.expelEnclosingWhitespace)if(n)this.inlines.push({start:this.out.length,delimiter:s.open});else{const o=this.inlines.pop();this.inlines.push({...o,end:this.out.length})}return super.markString(e,n,r,i)}normalizeInline(e){let{start:n,end:r}=e;for(;this.out.charAt(n).match(/\s/);)n++;return{...e,start:n}}}const Hh=Oe.create({name:"markdownHTMLMark",addStorage(){return{markdown:{serialize:{open(t,e){var n,r;return this.editor.storage.markdown.options.html?(n=(r=Ga(e))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:"":(console.warn(`Tiptap Markdown: "${e.type.name}" mark is only available in html mode`),"")},close(t,e){var n,r;return this.editor.storage.markdown.options.html&&(n=(r=Ga(e))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}},parse:{}}}}});function Ga(t){const e=t.type.schema,n=e.text(" ",[t]),i=fr(E.from(n),e).match(/^(<.*?>) (<\/.*?>)$/);return i?[i[1],i[2]]:null}function Iu(t){const e=`<body>${t}</body>`;return new window.DOMParser().parseFromString(e,"text/html").body}function gC(t){return t?.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bC(t){const e=t.parentElement,n=e.cloneNode();for(;e.firstChild&&e.firstChild!==t;)n.appendChild(e.firstChild);n.childNodes.length>0&&e.parentElement.insertBefore(n,e),e.parentElement.insertBefore(t,e),e.childNodes.length===0&&e.remove()}function xC(t){const e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}const us=F.create({name:"markdownHTMLNode",addStorage(){return{markdown:{serialize(t,e,n){this.editor.storage.markdown.options.html?t.write(yC(e,n)):(console.warn(`Tiptap Markdown: "${e.type.name}" node is only available in html mode`),t.write(`[${e.type.name}]`)),e.isBlock&&t.closeBlock(e)},parse:{}}}}});function yC(t,e){const n=t.type.schema,r=fr(E.from(t),n);return t.isBlock&&(e instanceof E||e.type.name===n.topNodeType.name)?kC(r):r}function kC(t){const n=Iu(t).firstElementChild;return n.innerHTML=n.innerHTML.trim()?`
${n.innerHTML}
`:`
`,n.outerHTML}const wC=F.create({name:"blockquote"}),CC=wC.extend({addStorage(){return{markdown:{serialize:tt.nodes.blockquote,parse:{}}}}}),EC=F.create({name:"bulletList"}),qh=EC.extend({addStorage(){return{markdown:{serialize(t,e){return t.renderList(e,"  ",()=>(this.editor.storage.markdown.options.bulletListMarker||"-")+" ")},parse:{}}}}}),SC=F.create({name:"codeBlock"}),vC=SC.extend({addStorage(){return{markdown:{serialize(t,e){t.write("```"+(e.attrs.language||"")+`
`),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:(e=this.options.languageClassPrefix)!==null&&e!==void 0?e:"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}}}}),AC=F.create({name:"hardBreak"}),Vh=AC.extend({addStorage(){return{markdown:{serialize(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(t.inTable?us.storage.markdown.serialize.call(this,t,e,n):`\\
`);return}},parse:{}}}}}),MC=F.create({name:"heading"}),TC=MC.extend({addStorage(){return{markdown:{serialize:tt.nodes.heading,parse:{}}}}}),_C=F.create({name:"horizontalRule"}),DC=_C.extend({addStorage(){return{markdown:{serialize:tt.nodes.horizontal_rule,parse:{}}}}}),NC=F.create({name:"image"}),OC=NC.extend({addStorage(){return{markdown:{serialize:tt.nodes.image,parse:{}}}}}),RC=F.create({name:"listItem"}),IC=RC.extend({addStorage(){return{markdown:{serialize:tt.nodes.list_item,parse:{}}}}}),LC=F.create({name:"orderedList"});function FC(t,e,n){let r=0;for(;n-r>0&&e.child(n-r-1).type.name===t.type.name;r++);return r}const PC=LC.extend({addStorage(){return{markdown:{serialize(t,e,n,r){const i=e.attrs.start||1,s=String(i+e.childCount-1).length,o=t.repeat(" ",s+2),l=FC(e,n,r)%2?") ":". ";t.renderList(e,o,a=>{const c=String(i+a);return t.repeat(" ",s-c.length)+c+l})},parse:{}}}}}),zC=F.create({name:"paragraph"}),BC=zC.extend({addStorage(){return{markdown:{serialize:tt.nodes.paragraph,parse:{}}}}});function Us(t){var e,n;return(e=t==null||(n=t.content)===null||n===void 0?void 0:n.content)!==null&&e!==void 0?e:[]}const $C=F.create({name:"table"}),jC=$C.extend({addStorage(){return{markdown:{serialize(t,e,n){if(!HC(e)){us.storage.markdown.serialize.call(this,t,e,n);return}t.inTable=!0,e.forEach((r,i,s)=>{if(t.write("| "),r.forEach((o,u,l)=>{l&&t.write(" | ");const a=o.firstChild;a.textContent.trim()&&t.renderInline(a)}),t.write(" |"),t.ensureNewLine(),!s){const o=Array.from({length:r.childCount}).map(()=>"---").join(" | ");t.write(`| ${o} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function Za(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function HC(t){const e=Us(t),n=e[0],r=e.slice(1);return!(Us(n).some(i=>i.type.name!=="tableHeader"||Za(i)||i.childCount>1)||r.some(i=>Us(i).some(s=>s.type.name==="tableHeader"||Za(s)||s.childCount>1)))}const qC=F.create({name:"taskItem"}),VC=qC.extend({addStorage(){return{markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){[...t.querySelectorAll(".task-list-item")].forEach(e=>{const n=e.querySelector("input");e.setAttribute("data-type","taskItem"),n&&(e.setAttribute("data-checked",n.checked),n.remove())})}}}}}}),WC=F.create({name:"taskList"}),UC=WC.extend({addStorage(){return{markdown:{serialize:qh.storage.markdown.serialize,parse:{setup(t){t.use(lC)},updateDOM(t){[...t.querySelectorAll(".contains-task-list")].forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),KC=F.create({name:"text"}),JC=KC.extend({addStorage(){return{markdown:{serialize(t,e){t.text(gC(e.text))},parse:{}}}}}),GC=Oe.create({name:"bold"}),ZC=GC.extend({addStorage(){return{markdown:{serialize:tt.marks.strong,parse:{}}}}}),XC=Oe.create({name:"code"}),YC=XC.extend({addStorage(){return{markdown:{serialize:tt.marks.code,parse:{}}}}}),QC=Oe.create({name:"italic"}),e4=QC.extend({addStorage(){return{markdown:{serialize:tt.marks.em,parse:{}}}}}),t4=Oe.create({name:"link"}),n4=t4.extend({addStorage(){return{markdown:{serialize:tt.marks.link,parse:{}}}}}),r4=Oe.create({name:"strike"}),i4=r4.extend({addStorage(){return{markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}}}}),s4=[CC,qh,vC,Vh,TC,DC,us,OC,IC,PC,BC,jC,VC,UC,JC,ZC,YC,Hh,e4,n4,i4];function Bi(t){var e,n;const r=(e=t.storage)===null||e===void 0?void 0:e.markdown,i=(n=s4.find(s=>s.name===t.name))===null||n===void 0?void 0:n.storage.markdown;return r||i?{...i,...r}:null}class o4{constructor(e){zi(this,"editor",null),this.editor=e}serialize(e){const n=new mC(this.nodes,this.marks,{hardBreakNodeName:Vh.name});return n.renderContent(e),n.out}get nodes(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(n=>[n,this.serializeNode(us)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="node"&&this.serializeNode(n)).map(n=>[n.name,this.serializeNode(n)]))!==null&&e!==void 0?e:[])}}get marks(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(n=>[n,this.serializeMark(Hh)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="mark"&&this.serializeMark(n)).map(n=>[n.name,this.serializeMark(n)]))!==null&&e!==void 0?e:[])}}serializeNode(e){var n;return(n=Bi(e))===null||n===void 0||(n=n.serialize)===null||n===void 0?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;const r=(n=Bi(e))===null||n===void 0?void 0:n.serialize;return r?{...r,open:typeof r.open=="function"?r.open.bind({editor:this.editor,options:e.options}):r.open,close:typeof r.close=="function"?r.close.bind({editor:this.editor,options:e.options}):r.close}:null}}class u4{constructor(e,n){zi(this,"editor",null),zi(this,"md",null);let{html:r,linkify:i,breaks:s}=n;this.editor=e,this.md=this.withPatchedRenderer(be({html:r,linkify:i,breaks:s}))}parse(e){let{inline:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(s=>{var o;return(o=Bi(s))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.setup)===null||o===void 0?void 0:o.call({editor:this.editor,options:s.options},this.md)});const r=this.md.render(e),i=Iu(r);return this.editor.extensionManager.extensions.forEach(s=>{var o;return(o=Bi(s))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.updateDOM)===null||o===void 0?void 0:o.call({editor:this.editor,options:s.options},i)}),this.normalizeDOM(i,{inline:n,content:e}),i.innerHTML}return e}normalizeDOM(e,n){let{inline:r,content:i}=n;return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(s=>{var o;((o=s.nextSibling)===null||o===void 0?void 0:o.nodeType)===Node.TEXT_NODE&&!s.closest("pre")&&(s.nextSibling.textContent=s.nextSibling.textContent.replace(/^\n/,""))}),r&&this.normalizeInline(e,i),e}normalizeBlocks(e){const r=Object.values(this.editor.schema.nodes).filter(i=>i.isBlock).map(i=>{var s;return(s=i.spec.parseDOM)===null||s===void 0?void 0:s.map(o=>o.tag)}).flat().filter(Boolean).join(",");r&&[...e.querySelectorAll(r)].forEach(i=>{i.parentElement.matches("p")&&bC(i)})}normalizeInline(e,n){var r;if((r=e.firstElementChild)!==null&&r!==void 0&&r.matches("p")){var i,s,o,u;const l=e.firstElementChild,{nextElementSibling:a}=l,c=(i=(s=n.match(/^\s+/))===null||s===void 0?void 0:s[0])!==null&&i!==void 0?i:"",d=a?"":(o=(u=n.match(/\s+$/))===null||u===void 0?void 0:u[0])!==null&&o!==void 0?o:"";if(n.match(/^\n\n/)){l.innerHTML=`${l.innerHTML}${d}`;return}xC(l),e.innerHTML=`${c}${e.innerHTML}${d}`}}withPatchedRenderer(e){const n=r=>function(){const i=r(...arguments);return i===`
`?i:i[i.length-1]===`
`?i.slice(0,-1):i};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const l4=U.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new V({key:new G("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return at.fromSchema(this.editor.schema).parseSlice(Iu(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),a4=U.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=of.Commands.config.addCommands();return{setContent:(e,n)=>r=>t.setContent(r.editor.storage.markdown.parser.parse(e),n)(r),insertContentAt:(e,n,r)=>i=>t.insertContentAt(e,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new u4(this.editor,this.options),serializer:new o4(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[dC.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),l4.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),c4=new be({html:!1,linkify:!0,typographer:!0,breaks:!1});function d4({markdown:t,className:e}){const n=_.useMemo(()=>c4.render(t||""),[t]);return t.trim()?x.jsx("div",{className:we("min-h-[400px]","prose prose-base lg:prose-lg max-w-none","prose-headings:text-ink prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-3xl prose-h1:mt-0 prose-h1:mb-4","prose-h2:text-2xl prose-h2:mt-8 prose-h2:mb-3","prose-h3:text-xl prose-h3:mt-6 prose-h3:mb-2","prose-p:text-ink prose-p:leading-relaxed","prose-li:text-ink prose-li:marker:text-ink-dim","prose-strong:text-ink prose-strong:font-semibold","prose-a:text-accent prose-a:no-underline hover:prose-a:underline","prose-code:rounded prose-code:bg-surface-subtle prose-code:px-1 prose-code:py-[1px] prose-code:text-accent-ink prose-code:font-medium prose-code:before:hidden prose-code:after:hidden","prose-pre:bg-surface-subtle prose-pre:text-ink prose-pre:border prose-pre:border-border","prose-blockquote:border-accent/40 prose-blockquote:text-ink-muted prose-blockquote:not-italic","prose-hr:border-border","prose-table:text-sm",e),dangerouslySetInnerHTML:{__html:n}}):x.jsx("div",{className:we("min-h-[400px] text-sm text-ink-dim",e),children:"Nothing to preview yet. Switch to Edit or click Re-generate."})}const Xa=[{id:"h1",label:"Heading 1",hint:"Section title",icon:uc,apply:t=>t.chain().focus().toggleHeading({level:1}).run()},{id:"h2",label:"Heading 2",hint:"Subsection",icon:lc,apply:t=>t.chain().focus().toggleHeading({level:2}).run()},{id:"h3",label:"Heading 3",hint:"Subhead",icon:ac,apply:t=>t.chain().focus().toggleHeading({level:3}).run()},{id:"ul",label:"Bullet list",hint:"Unordered list",icon:rc,apply:t=>t.chain().focus().toggleBulletList().run()},{id:"ol",label:"Ordered list",hint:"Numbered list",icon:cc,apply:t=>t.chain().focus().toggleOrderedList().run()},{id:"code",label:"Code block",hint:"Monospace",icon:sc,apply:t=>t.chain().focus().toggleCodeBlock().run()},{id:"quote",label:"Quote",hint:"Block quote",icon:Kp,apply:t=>t.chain().focus().toggleBlockquote().run()},{id:"table",label:"Table",hint:"3×3 with header",icon:oc,apply:t=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{id:"hr",label:"Divider",hint:"Horizontal rule",icon:tc,apply:t=>t.chain().focus().setHorizontalRule().run()}];function f4({editor:t}){const[e,n]=_.useState(null),[r,i]=_.useState(0),[s,o]=_.useState(""),u=_.useRef(null),l=_.useMemo(()=>{if(!s)return Xa;const c=s.toLowerCase();return Xa.filter(d=>d.label.toLowerCase().includes(c)||d.hint.toLowerCase().includes(c))},[s]);_.useEffect(()=>{if(!t)return;function c(){if(!t)return;const{state:d,view:f}=t,{$from:h}=d.selection,p=h.parent.textContent;if(p.startsWith("/")){o(p.slice(1)),i(0);const m=f.coordsAtPos(h.pos),g=f.dom.getBoundingClientRect();n({top:m.bottom-g.top+4,left:m.left-g.left})}else e&&n(null)}return t.on("selectionUpdate",c),t.on("update",c),()=>{t.off("selectionUpdate",c),t.off("update",c)}},[t,e]),_.useEffect(()=>{if(!e||!t)return;function c(d){if(d.key==="Escape"){n(null);return}if(d.key==="ArrowDown")d.preventDefault(),i(f=>(f+1)%Math.max(l.length,1));else if(d.key==="ArrowUp")d.preventDefault(),i(f=>(f-1+l.length)%Math.max(l.length,1));else if(d.key==="Enter"){const f=l[r];f&&(d.preventDefault(),a(f))}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[e,l,r,t]);function a(c){if(!t)return;const{$from:d}=t.state.selection,f=d.start(),h=d.pos;t.chain().focus().deleteRange({from:f,to:h}).run(),c.apply(t),n(null),o("")}return!t||!e||l.length===0?null:x.jsx("div",{ref:u,role:"listbox","aria-label":"Insert block",style:{top:e.top,left:e.left},className:"absolute z-30 w-64 rounded-md border border-border bg-surface-raised p-1 shadow-md",children:l.map((c,d)=>{const f=c.icon,h=d===r;return x.jsxs("button",{type:"button",role:"option","aria-selected":h,onMouseEnter:()=>i(d),onClick:()=>a(c),className:we("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs transition-colors",h?"bg-accent-soft text-accent-ink":"text-ink"),children:[x.jsx("span",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded bg-surface-subtle text-ink-muted",children:x.jsx(f,{size:12})}),x.jsxs("span",{className:"min-w-0 flex-1",children:[x.jsx("div",{className:"truncate font-medium",children:c.label}),x.jsx("div",{className:"truncate text-[10px] text-ink-dim",children:c.hint})]})]},c.id)})})}const Ya=we("prose prose-base lg:prose-lg max-w-none","prose-headings:text-ink prose-headings:font-semibold prose-headings:tracking-tight","prose-h1:text-3xl prose-h1:mt-0 prose-h1:mb-4","prose-h2:text-2xl prose-h2:mt-8 prose-h2:mb-3","prose-h3:text-xl prose-h3:mt-6 prose-h3:mb-2","prose-p:text-ink prose-p:leading-relaxed","prose-li:text-ink prose-li:marker:text-ink-dim","prose-strong:text-ink prose-strong:font-semibold","prose-a:text-accent prose-a:no-underline hover:prose-a:underline","prose-code:rounded prose-code:bg-surface-subtle prose-code:px-1 prose-code:py-[1px] prose-code:text-accent-ink prose-code:font-medium prose-code:before:hidden prose-code:after:hidden","prose-pre:bg-surface-subtle prose-pre:text-ink prose-pre:border prose-pre:border-border","prose-blockquote:border-accent/40 prose-blockquote:text-ink-muted prose-blockquote:not-italic","prose-hr:border-border","prose-table:text-sm prose-th:text-ink prose-td:text-ink prose-td:border-border prose-th:border-border"),h4=new be({html:!1,linkify:!0,typographer:!0,breaks:!1}),p4=/^\s*```(?:markdown|md)?\s*\n([\s\S]*?)\n```\s*$/i;function Vr(t){if(!t)return t;const e=t.trim().match(p4);return e?e[1]:t}function Ks(t){return h4.render(Vr(t))}function m4({initialMarkdown:t,onChange:e,view:n,readOnly:r=!1,surfaceRef:i,onEditorReady:s}){const o=_.useMemo(()=>Vr(t),[t]),[u,l]=_.useState(o),a=_.useRef(o),c=ix({extensions:[Jy,Ff.configure({openOnClick:!1}),dh.configure({resizable:!1}),ch,ah,lh,a4.configure({html:!0,tightLists:!0,linkify:!0,breaks:!1})],content:Ks(o),editable:!r&&n==="edit",onUpdate({editor:f}){const h=f.storage.markdown?.getMarkdown()??"";l(h),e(h)}});_.useEffect(()=>{c&&c.setEditable(!r&&n==="edit")},[c,n,r]),_.useEffect(()=>(s?.(c??null),()=>s?.(null)),[c,s]),_.useEffect(()=>{if(!c)return;const f=Vr(t);f!==a.current&&(a.current=f,c.commands.setContent(Ks(f),{emitUpdate:!1}),l(f))},[t,c]);function d(f){l(f),e(f),c&&c.commands.setContent(Ks(f),{emitUpdate:!1})}return n==="preview"?x.jsx(d4,{markdown:Vr(u),className:Ya}):n==="source"?x.jsx("textarea",{value:u,onChange:f=>d(f.target.value),readOnly:r,spellCheck:!1,className:"min-h-[500px] w-full resize-y border-0 bg-transparent p-0 font-mono text-sm text-ink outline-none focus:outline-none"}):x.jsxs("div",{ref:i??void 0,className:"relative",children:[x.jsx(wf,{editor:c,className:we("[&_.ProseMirror]:min-h-[500px] [&_.ProseMirror]:outline-none",Ya)}),x.jsx(f4,{editor:c})]})}function g4({pageId:t,pageTitle:e}){const[n,r]=_.useState(!1),[i,s]=_.useState(null),o=_.useRef(null);_.useEffect(()=>{function l(a){o.current?.contains(a.target)||r(!1)}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[]);async function u(l){s(l);try{const a=Qh(),c={};a&&(c.Authorization=`Bearer ${a}`);const d=await fetch(`/api/pages/${encodeURIComponent(t)}/export/${l}`,{headers:c});if(!d.ok)throw new Error(`Export failed: ${d.status}`);const f=await d.blob(),p=(d.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/i),g=`${b4(e)||"page"}.${l}`,b=p?.[1]??g,y=URL.createObjectURL(f),k=document.createElement("a");k.href=y,k.download=b,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(y)}finally{s(null),r(!1)}}return x.jsxs("div",{ref:o,className:"relative inline-block",children:[x.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-haspopup":"menu","aria-expanded":n,className:"inline-flex items-center gap-1.5 rounded-md border border-accent/30 bg-accent-soft/40 px-3 py-1.5 text-sm font-medium text-accent-ink transition-colors hover:border-accent/50 hover:bg-accent-soft",children:[x.jsx(pp,{size:14}),"Export",x.jsx(Yh,{size:12})]}),n&&x.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-10 w-44 rounded-md border border-border bg-surface-raised p-1 shadow-md",children:[x.jsx(Qa,{icon:x.jsx(Fo,{size:13}),label:"Markdown (.md)",onClick:()=>u("md"),busy:i==="md"}),x.jsx(Qa,{icon:x.jsx(Np,{size:13}),label:"PDF (.pdf)",onClick:()=>u("pdf"),busy:i==="pdf"})]})]})}function Qa({icon:t,label:e,onClick:n,busy:r}){return x.jsxs("button",{type:"button",onClick:n,disabled:r,role:"menuitem",className:we("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-ink hover:bg-surface-subtle",r&&"cursor-wait opacity-60"),children:[t,x.jsx("span",{className:"flex-1",children:e}),r&&x.jsx("span",{className:"text-[10px] text-ink-dim",children:"..."})]})}function b4(t){return t.replace(/[^A-Za-z0-9_.-]+/g,"_").slice(0,80)}const x4=/^(#{1,3})\s+(.+?)\s*$/gm;function Wh(t,e){const n=t.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")||"section";let r=n,i=1;for(;e.has(r);)r=`${n}-${i++}`;return e.add(r),r}function y4(t){const e=[],n=new Set,r=t.replace(/```[\s\S]*?```/g,"");for(const i of r.matchAll(x4)){const s=i[1].length,o=i[2].replace(/`/g,"").trim();o&&e.push({id:Wh(o,n),text:o,level:s})}return e}function k4({markdown:t,scrollRoot:e}){const n=_.useMemo(()=>y4(t),[t]),[r,i]=_.useState(null),s=_.useRef(null);_.useEffect(()=>{if(!e||n.length===0)return;const u=e.querySelectorAll("h1, h2, h3"),l=new Set;if(u.forEach(a=>{const c=(a.textContent||"").trim();if(!c)return;const d=Wh(c,l);a.id=d}),s.current?.disconnect(),!(typeof IntersectionObserver>"u"))return s.current=new IntersectionObserver(a=>{const c=a.filter(d=>d.isIntersecting).sort((d,f)=>d.boundingClientRect.top-f.boundingClientRect.top)[0];c&&i(c.target.id)},{root:e,rootMargin:"0px 0px -70% 0px",threshold:0}),u.forEach(a=>s.current?.observe(a)),()=>s.current?.disconnect()},[t,e,n.length]);function o(u){if(!e)return;const l=e.querySelector(`#${CSS.escape(u)}`);l&&(l.scrollIntoView({behavior:"smooth",block:"start"}),i(u))}return x.jsxs("nav",{"aria-label":"Page outline",className:"sticky top-4 space-y-2",children:[x.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink-dim",children:"Outline"}),n.length===0?x.jsxs("p",{className:"text-[11px] text-ink-dim",children:["No headings yet. Add one with ",x.jsx("code",{children:"#"}),", ",x.jsx("code",{children:"##"}),", or ",x.jsx("code",{children:"###"}),"."]}):x.jsx("ul",{className:"space-y-0.5",children:n.map(u=>x.jsx("li",{children:x.jsx("button",{type:"button",onClick:()=>o(u.id),className:we("block w-full truncate rounded px-2 py-1 text-left text-[12px] transition-colors",u.level===1&&"font-medium",u.level===2&&"pl-4",u.level===3&&"pl-6 text-[11px]",r===u.id?"bg-accent-soft text-accent-ink":"text-ink-muted hover:bg-surface-subtle hover:text-ink"),title:u.text,children:u.text})},u.id))})]})}function w4({pending:t,onSubmit:e}){const[n,r]=_.useState(!1),[i,s]=_.useState(""),o=_.useRef(null);_.useEffect(()=>{if(!n)return;function l(a){o.current&&(o.current.contains(a.target)||r(!1))}return window.addEventListener("mousedown",l),()=>window.removeEventListener("mousedown",l)},[n]);function u(l){l.preventDefault(),e(i.trim()),r(!1)}return x.jsxs("div",{ref:o,className:"relative w-full",children:[x.jsxs("button",{type:"button",onClick:()=>r(l=>!l),disabled:t,"aria-haspopup":"dialog","aria-expanded":n,className:we("inline-flex w-full items-center justify-center gap-1.5 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors",t?"cursor-not-allowed border-border bg-surface text-ink-dim":"border-border bg-surface text-ink hover:border-accent/40 hover:bg-surface-subtle"),children:[t?x.jsx(ep,{size:12,className:"animate-spin"}):x.jsx(Pu,{size:12}),"Re-generate"]}),n&&x.jsxs("form",{onSubmit:u,role:"dialog","aria-label":"Re-generate page",className:"absolute right-0 z-20 mt-1 w-72 rounded-md border border-border bg-surface-raised p-3 shadow-md",children:[x.jsxs("label",{className:"block text-[11px] font-medium text-ink-muted",children:["Steering prompt",x.jsx("span",{className:"ml-1 font-normal text-ink-dim",children:"(optional)"})]}),x.jsx("textarea",{autoFocus:!0,value:i,onChange:l=>s(l.target.value),placeholder:"e.g. focus on column-level transforms",rows:3,className:"mt-1 w-full rounded border border-border bg-surface px-2 py-1.5 text-xs text-ink focus:border-accent/60 focus:outline-none"}),x.jsx("p",{className:"mt-1 text-[10px] text-ink-dim",children:"Leaves the original intent in place; the steering text rides on the next version row so you can compare runs later."}),x.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[x.jsx("button",{type:"button",onClick:()=>r(!1),className:"rounded px-2 py-1 text-[11px] text-ink-muted hover:text-ink",children:"Cancel"}),x.jsxs("button",{type:"submit",className:"inline-flex items-center gap-1 rounded bg-accent px-3 py-1 text-[11px] font-medium text-white hover:bg-accent/90",children:[x.jsx(Pu,{size:11}),"Generate"]})]})]})]})}function C4(t){const e=new Date(t).getTime();if(Number.isNaN(e))return t;const n=Date.now()-e,r=Math.round(n/1e3);if(r<45)return"just now";const i=Math.round(r/60);if(i<60)return`${i} min ago`;const s=Math.round(i/60);if(s<24)return`${s} h ago`;const o=Math.round(s/24);return o<7?`${o} d ago`:new Date(t).toLocaleDateString()}function E4({open:t,onClose:e,versions:n,currentBody:r,restoring:i,onRestore:s}){return _.useEffect(()=>{if(!t)return;function o(u){u.key==="Escape"&&e()}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,e]),t?x.jsxs("div",{className:"fixed inset-0 z-40",children:[x.jsx("div",{role:"presentation",onClick:e,className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]"}),x.jsxs("aside",{role:"dialog","aria-label":"Version history",className:"absolute right-0 top-0 flex h-full w-full max-w-md flex-col border-l border-border bg-surface-raised shadow-xl",children:[x.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[x.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-medium text-ink",children:[x.jsx(nc,{size:14}),"Version history"]}),x.jsx("button",{type:"button",onClick:e,"aria-label":"Close",className:"inline-flex h-7 w-7 items-center justify-center rounded text-ink-muted hover:bg-surface-subtle hover:text-ink",children:x.jsx(tp,{size:14})})]}),x.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:n.length===0?x.jsx("p",{className:"px-1 py-4 text-xs text-ink-dim",children:"No versions yet. Saves and re-generations land here."}):x.jsx("ul",{className:"space-y-2",children:n.map(o=>{const u=o.markdown_body===r;return x.jsxs("li",{className:we("rounded-md border border-border bg-surface p-3",u&&"border-accent/40"),children:[x.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[x.jsxs("span",{className:"text-xs font-medium text-ink",children:["v",o.version_no]}),x.jsx("span",{className:"text-[11px] text-ink-dim",children:C4(o.saved_at)})]}),o.note&&x.jsx("p",{className:"mb-2 text-[11px] text-ink-muted",children:o.note}),x.jsx("div",{className:"mb-2 line-clamp-2 font-mono text-[11px] text-ink-dim",children:o.markdown_body.slice(0,200)||"(empty)"}),x.jsxs("div",{className:"flex items-center justify-between gap-2",children:[x.jsxs("span",{className:"text-[10px] text-ink-dim",children:[o.markdown_body.length.toLocaleString()," chars"]}),u?x.jsx("span",{className:"text-[10px] font-medium text-accent-ink",children:"current"}):x.jsxs("button",{type:"button",onClick:()=>s(o),disabled:i,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-2 py-1 text-[11px] text-ink-muted hover:border-accent/40 hover:text-ink disabled:cursor-not-allowed disabled:opacity-60",children:[x.jsx(gp,{size:11}),"Restore"]})]})]},o.version_no)})})})]})]}):null}const S4=5e3,ec="amx-pages-focus",v4={draft:"neutral",published:"positive",deleted:"warning"};function U4(){const t=fp(),e=hp(),n=np(),r=t.pageId??"",i=xp(r),s=yp(r),o=kp(r),u=wp(r),[l,a]=_.useState(""),[c,d]=_.useState(""),[f,h]=_.useState([]),[p,m]=_.useState(null),[g,b]=_.useState(!1),[y,k]=_.useState(()=>r0()),[w,C]=_.useState(!1),[v,A]=_.useState(null),[T,I]=_.useState(()=>{try{return window.sessionStorage.getItem(ec)==="1"}catch{return!1}}),$=_.useRef(!1),re=_.useRef(null),ke=_.useRef(null);_.useEffect(()=>{!i.data||$.current||($.current=!0,a(i.data.title),d(i.data.markdown_body),h(i.data.sources??[]),m(new Date(i.data.updated_at)))},[i.data]),_.useEffect(()=>{if(!(!$.current||!r))return re.current&&window.clearTimeout(re.current),re.current=window.setTimeout(()=>{Q()},S4),()=>{re.current&&window.clearTimeout(re.current)}},[l,c]),_.useEffect(()=>{try{window.sessionStorage.setItem(ec,T?"1":"0")}catch{}},[T]);async function Q(ie){if(r){b(!0);try{const Re=await s.mutateAsync({title:l.trim()||"Untitled",markdown_body:ie??c});m(new Date(Re.updated_at))}catch(Re){n.push({title:Re.message,tone:"error"})}finally{b(!1)}}}async function J(ie){if(r)try{const Re=await o.mutateAsync();d(Re.markdown_body),a(Re.title),m(new Date(Re.updated_at)),ie&&await s.mutateAsync({markdown_body:Re.markdown_body,note:`steering: ${ie}`}),n.push({title:"Page regenerated",tone:"success"})}catch(Re){n.push({title:Re.message,tone:"error"})}}async function P(){if(window.confirm("Delete this page?"))try{await u.mutateAsync(),n.push({title:"Page deleted",tone:"success"}),e("/pages")}catch(ie){n.push({title:ie.message,tone:"error"})}}async function Ve(ie){d(ie.markdown_body),C(!1),await Q(ie.markdown_body),n.push({title:`Restored v${ie.version_no}`,tone:"success"})}const Me=i.data,Lu=_.useMemo(()=>Me?.versions??[],[Me?.versions]);if(i.isLoading)return x.jsx("div",{className:"mx-auto w-full max-w-7xl px-4 py-6",children:x.jsx(M4,{})});if(i.error||!Me)return x.jsx("div",{className:"mx-auto w-full max-w-7xl px-4 py-6 text-sm text-critical",children:i.error?.message??"Page not found."});const Uh=y!=="edit";return x.jsxs("div",{className:we("mx-auto w-full px-4 py-6 sm:px-6",T?"max-w-3xl":"max-w-7xl"),children:[x.jsxs("header",{className:"mb-6",children:[x.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-ink-dim",children:[x.jsx("button",{type:"button",onClick:()=>e("/pages"),className:"hover:text-ink",children:"Pages"}),x.jsx(rp,{size:11}),x.jsx("span",{className:"truncate normal-case tracking-normal text-ink-muted",children:Me.title||"Untitled"})]}),x.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-3",children:[x.jsx("input",{value:l,onChange:ie=>a(ie.target.value),placeholder:"Untitled","aria-label":"Page title",className:"min-w-0 flex-1 bg-transparent text-3xl font-semibold tracking-tight text-ink outline-none placeholder:text-ink-dim focus:border-b focus:border-accent/40 lg:text-4xl"}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx(bp,{tone:v4[Me.status]??"neutral",children:Me.status}),x.jsx(A4,{saving:g,lastSavedAt:p}),x.jsx(g4,{pageId:Me.id,pageTitle:l}),x.jsx(Fu,{variant:"secondary",leadingIcon:x.jsx(ip,{size:14}),onClick:()=>e("/pages/new"),title:"Start a new documentation page",children:"New"})]})]})]}),x.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[x.jsx(i0,{value:y,onChange:k}),x.jsxs("div",{className:"flex items-center gap-1",children:[!T&&x.jsxs("button",{type:"button",onClick:()=>C(!0),className:"inline-flex items-center gap-1 rounded-md border border-border bg-surface px-2.5 py-1 text-xs text-ink-muted hover:border-accent/40 hover:bg-surface-subtle hover:text-ink",children:[x.jsx(nc,{size:12}),"Versions",x.jsx("span",{className:"ml-1 rounded-full bg-surface-subtle px-1.5 text-[10px] font-medium text-ink-dim",children:Lu.length})]}),x.jsxs("button",{type:"button",onClick:()=>I(ie=>!ie),"aria-pressed":T,className:"inline-flex items-center gap-1 rounded-md border border-border bg-surface px-2.5 py-1 text-xs text-ink-muted hover:border-accent/40 hover:bg-surface-subtle hover:text-ink",title:T?"Exit focus mode":"Enter focus mode",children:[T?x.jsx(qp,{size:12}):x.jsx(jp,{size:12}),T?"Exit focus":"Focus mode"]})]})]}),x.jsx("div",{className:"mb-4 border-b border-border pb-2",children:x.jsx(t0,{editor:v,disabled:Uh})}),x.jsxs("div",{className:we("grid gap-8",T?"grid-cols-1":"lg:grid-cols-[180px_minmax(0,1fr)_280px]"),children:[!T&&x.jsx("div",{className:"order-2 lg:order-1",children:x.jsx(k4,{markdown:c,scrollRoot:ke.current})}),x.jsxs("div",{className:we("order-1 min-w-0",T?"":"lg:order-2"),children:[x.jsx(m4,{initialMarkdown:Me.markdown_body,onChange:d,view:y,surfaceRef:ke,onEditorReady:A}),x.jsx(e0,{markdown:c,assetCount:Me.assets.length,modelUsed:Me.model_used})]}),!T&&x.jsxs("aside",{className:"order-3 divide-y divide-border lg:order-3",children:[x.jsx(Js,{title:"Assets",children:Me.assets.length===0?x.jsx("p",{className:"text-[11px] text-ink-dim",children:"No assets attached."}):x.jsx("div",{className:"-mx-1 space-y-0.5",children:Me.assets.map((ie,Re)=>x.jsx(Xp,{asset:ie},`${ie.kind}-${ie.ref}-${Re}`))})}),x.jsx(Js,{title:"Sources",children:x.jsx(mp,{pageId:Me.id,sources:f,onChange:h})}),x.jsx(Js,{title:"Actions",children:x.jsxs("div",{className:"space-y-2",children:[x.jsx(w4,{pending:o.isPending,onSubmit:J}),x.jsx(Fu,{variant:"danger",onClick:P,loading:u.isPending,leadingIcon:x.jsx(sp,{size:13}),fullWidth:!0,children:"Delete"})]})})]})]}),x.jsx(E4,{open:w,onClose:()=>C(!1),versions:Lu,currentBody:c,restoring:g,onRestore:Ve})]})}function Js({title:t,children:e}){return x.jsxs("section",{className:"space-y-2 py-4 first:pt-0 last:pb-0",children:[x.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink-dim",children:t}),e]})}function A4({saving:t,lastSavedAt:e}){return t?x.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-ink-dim",children:[x.jsx(op,{size:11,className:"animate-spin"}),"Saving..."]}):e?x.jsxs("span",{className:"text-[11px] text-ink-dim",children:["Saved ",e.toLocaleTimeString()]}):x.jsx("span",{className:"text-[11px] text-ink-dim",children:"Not saved"})}function M4(){return x.jsxs("div",{className:"space-y-4",children:[x.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-surface-subtle"}),x.jsx("div",{className:"h-9 w-1/2 animate-pulse rounded bg-surface-subtle"}),x.jsx("div",{className:"h-7 w-40 animate-pulse rounded bg-surface-subtle"}),x.jsxs("div",{className:"grid gap-8 lg:grid-cols-[180px_minmax(0,1fr)_280px]",children:[x.jsx("div",{className:"h-64 animate-pulse rounded-md bg-surface-subtle"}),x.jsx("div",{className:"h-96 animate-pulse rounded-md bg-surface-subtle"}),x.jsx("div",{className:"h-64 animate-pulse rounded-md bg-surface-subtle"})]})]})}export{U4 as default};
