@pod-os/elements 0.30.2-rc.ca6f577.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/elements.cjs.js +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/pos-document.cjs.entry.js +9 -6
  4. package/dist/cjs/pos-document.cjs.entry.js.map +1 -1
  5. package/dist/cjs/pos-markdown-document.cjs.entry.js +13481 -14042
  6. package/dist/cjs/pos-markdown-document.cjs.entry.js.map +1 -1
  7. package/dist/collection/components/pos-document/pos-document.js +10 -7
  8. package/dist/collection/components/pos-document/pos-document.js.map +1 -1
  9. package/dist/collection/components/pos-markdown-document/pos-markdown-document.css +17 -0
  10. package/dist/collection/components/pos-markdown-document/pos-markdown-document.js +33 -25
  11. package/dist/collection/components/pos-markdown-document/pos-markdown-document.js.map +1 -1
  12. package/dist/collection/components/pos-markdown-document/rich-editor/PosImageNode.js +25 -21
  13. package/dist/collection/components/pos-markdown-document/rich-editor/PosImageNode.js.map +1 -1
  14. package/dist/collection/components/pos-markdown-document/rich-editor/PosRichLinkMark.js +20 -16
  15. package/dist/collection/components/pos-markdown-document/rich-editor/PosRichLinkMark.js.map +1 -1
  16. package/dist/collection/components/pos-markdown-document/rich-editor/RichEditor.js +10 -24
  17. package/dist/collection/components/pos-markdown-document/rich-editor/RichEditor.js.map +1 -1
  18. package/dist/components/pos-document2.js +10 -7
  19. package/dist/components/pos-document2.js.map +1 -1
  20. package/dist/components/pos-markdown-document2.js +13483 -14044
  21. package/dist/components/pos-markdown-document2.js.map +1 -1
  22. package/dist/elements/elements.esm.js +1 -1
  23. package/dist/elements/elements.esm.js.map +1 -1
  24. package/dist/elements/p-08f92489.entry.js +2 -0
  25. package/dist/elements/p-08f92489.entry.js.map +1 -0
  26. package/dist/elements/p-4f8297e8.entry.js +2 -0
  27. package/dist/elements/p-4f8297e8.entry.js.map +1 -0
  28. package/dist/esm/elements.js +1 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/pos-document.entry.js +9 -6
  31. package/dist/esm/pos-document.entry.js.map +1 -1
  32. package/dist/esm/pos-markdown-document.entry.js +13481 -14042
  33. package/dist/esm/pos-markdown-document.entry.js.map +1 -1
  34. package/dist/types/components/pos-document/pos-document.d.ts +1 -1
  35. package/dist/types/components/pos-markdown-document/pos-markdown-document.d.ts +5 -5
  36. package/dist/types/components/pos-markdown-document/rich-editor/PosImageNode.d.ts +2 -0
  37. package/dist/types/components/pos-markdown-document/rich-editor/PosRichLinkMark.d.ts +2 -0
  38. package/dist/types/components/pos-markdown-document/rich-editor/RichEditor.d.ts +1 -9
  39. package/dist/types/components.d.ts +4 -4
  40. package/package.json +9 -11
  41. package/dist/collection/components/pos-markdown-document/html2markdown.js +0 -10
  42. package/dist/collection/components/pos-markdown-document/html2markdown.js.map +0 -1
  43. package/dist/collection/components/pos-markdown-document/markdown2html.js +0 -5
  44. package/dist/collection/components/pos-markdown-document/markdown2html.js.map +0 -1
  45. package/dist/collection/components/pos-markdown-document/sanitize.js +0 -10
  46. package/dist/collection/components/pos-markdown-document/sanitize.js.map +0 -1
  47. package/dist/elements/p-581ed3ee.entry.js +0 -3
  48. package/dist/elements/p-581ed3ee.entry.js.map +0 -1
  49. package/dist/elements/p-ff3f95dc.entry.js +0 -2
  50. package/dist/elements/p-ff3f95dc.entry.js.map +0 -1
  51. package/dist/types/components/pos-markdown-document/html2markdown.d.ts +0 -1
  52. package/dist/types/components/pos-markdown-document/markdown2html.d.ts +0 -1
  53. package/dist/types/components/pos-markdown-document/sanitize.d.ts +0 -4
@@ -1,3 +0,0 @@
1
- import{r as t,i as e,h as r}from"./p-97889672.js";import{o as n,j as i,k as s,l as o,S as l,h as u,t as f}from"./p-5a025614.js";import"./p-c066fd50.js";function a(t,e){return n(((r,n)=>{let s=0;r.subscribe(i(n,(r=>{n.next(t.call(e,r,s++))})))}))}function h(t,e,r){const l=o(t)||e||r?{next:t,error:e,complete:r}:t;return l?n(((t,e)=>{var r;(r=l.subscribe)===null||r===void 0?void 0:r.call(l);let n=true;t.subscribe(i(e,(t=>{var r;(r=l.next)===null||r===void 0?void 0:r.call(l,t);e.next(t)}),(()=>{var t;n=false;(t=l.complete)===null||t===void 0?void 0:t.call(l);e.complete()}),(t=>{var r;n=false;(r=l.error)===null||r===void 0?void 0:r.call(l,t);e.error(t)}),(()=>{var t,e;if(n){(t=l.unsubscribe)===null||t===void 0?void 0:t.call(l)}(e=l.finalize)===null||e===void 0?void 0:e.call(l)})))})):s}var c=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};var d={exports:{}};
2
- /*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */(function(t,e){(function(e,r){t.exports=r()})(c,(function(){const{entries:t,setPrototypeOf:e,isFrozen:r,getPrototypeOf:n,getOwnPropertyDescriptor:i}=Object;let{freeze:s,seal:o,create:l}=Object;let{apply:u,construct:f}=typeof Reflect!=="undefined"&&Reflect;if(!s){s=function t(e){return e}}if(!o){o=function t(e){return e}}if(!u){u=function t(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++){i[s-2]=arguments[s]}return e.apply(r,i)}}if(!f){f=function t(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++){n[i-1]=arguments[i]}return new e(...n)}}const a=S(Array.prototype.forEach);const h=S(Array.prototype.lastIndexOf);const c=S(Array.prototype.pop);const d=S(Array.prototype.push);const p=S(Array.prototype.splice);const m=S(String.prototype.toLowerCase);const g=S(String.prototype.toString);const w=S(String.prototype.match);const b=S(String.prototype.replace);const v=S(String.prototype.indexOf);const y=S(String.prototype.trim);const k=S(Object.prototype.hasOwnProperty);const x=S(RegExp.prototype.test);const M=E(TypeError);function S(t){return function(e){if(e instanceof RegExp){e.lastIndex=0}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++){n[i-1]=arguments[i]}return u(t,e,n)}}function E(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++){r[n]=arguments[n]}return f(t,r)}}function T(t,n){let i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:m;if(e){e(t,null)}let s=n.length;while(s--){let e=n[s];if(typeof e==="string"){const t=i(e);if(t!==e){if(!r(n)){n[s]=t}e=t}}t[e]=true}return t}function A(t){for(let e=0;e<t.length;e++){const r=k(t,e);if(!r){t[e]=null}}return t}function O(e){const r=l(null);for(const[n,i]of t(e)){const t=k(e,n);if(t){if(Array.isArray(i)){r[n]=A(i)}else if(i&&typeof i==="object"&&i.constructor===Object){r[n]=O(i)}else{r[n]=i}}}return r}function R(t,e){while(t!==null){const r=i(t,e);if(r){if(r.get){return S(r.get)}if(typeof r.value==="function"){return S(r.value)}}t=n(t)}function r(){return null}return r}const $=s(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]);const C=s(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]);const L=s(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]);const N=s(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]);const P=s(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]);const D=s(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]);const I=s(["#text"]);const H=s(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]);const j=s(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]);const _=s(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]);const B=s(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]);const z=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm);const F=o(/<%[\w\W]*|[\w\W]*%>/gm);const U=o(/\$\{[\w\W]*/gm);const q=o(/^data-[\-\w.\u00B7-\uFFFF]+$/);const K=o(/^aria-[\-\w]+$/);const J=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);const W=o(/^(?:\w+script|data):/i);const V=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);const G=o(/^html$/i);const Z=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Y=Object.freeze({__proto__:null,ARIA_ATTR:K,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:Z,DATA_ATTR:q,DOCTYPE_NAME:G,ERB_EXPR:F,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:W,MUSTACHE_EXPR:z,TMPLIT_EXPR:U});const X={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12};const Q=function t(){return typeof window==="undefined"?null:window};const tt=function t(e,r){if(typeof e!=="object"||typeof e.createPolicy!=="function"){return null}let n=null;const i="data-tt-policy-suffix";if(r&&r.hasAttribute(i)){n=r.getAttribute(i)}const s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML(t){return t},createScriptURL(t){return t}})}catch(t){console.warn("TrustedTypes policy "+s+" could not be created.");return null}};const et=function t(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function rt(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Q();const r=t=>rt(t);r.version="3.2.7";r.removed=[];if(!e||!e.document||e.document.nodeType!==X.document||!e.Element){r.isSupported=false;return r}let{document:n}=e;const i=n;const o=i.currentScript;const{DocumentFragment:u,HTMLTemplateElement:f,Node:S,Element:E,NodeFilter:A,NamedNodeMap:z=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:F,DOMParser:U,trustedTypes:q}=e;const K=E.prototype;const W=R(K,"cloneNode");const V=R(K,"remove");const Z=R(K,"nextSibling");const nt=R(K,"childNodes");const it=R(K,"parentNode");if(typeof f==="function"){const t=n.createElement("template");if(t.content&&t.content.ownerDocument){n=t.content.ownerDocument}}let st;let ot="";const{implementation:lt,createNodeIterator:ut,createDocumentFragment:ft,getElementsByTagName:at}=n;const{importNode:ht}=i;let ct=et();r.isSupported=typeof t==="function"&&typeof it==="function"&&lt&&lt.createHTMLDocument!==undefined;const{MUSTACHE_EXPR:dt,ERB_EXPR:pt,TMPLIT_EXPR:mt,DATA_ATTR:gt,ARIA_ATTR:wt,IS_SCRIPT_OR_DATA:bt,ATTR_WHITESPACE:vt,CUSTOM_ELEMENT:yt}=Y;let{IS_ALLOWED_URI:kt}=Y;let xt=null;const Mt=T({},[...$,...C,...L,...P,...I]);let St=null;const Et=T({},[...H,...j,..._,...B]);let Tt=Object.seal(l(null,{tagNameCheck:{writable:true,configurable:false,enumerable:true,value:null},attributeNameCheck:{writable:true,configurable:false,enumerable:true,value:null},allowCustomizedBuiltInElements:{writable:true,configurable:false,enumerable:true,value:false}}));let At=null;let Ot=null;let Rt=true;let $t=true;let Ct=false;let Lt=true;let Nt=false;let Pt=true;let Dt=false;let It=false;let Ht=false;let jt=false;let _t=false;let Bt=false;let zt=true;let Ft=false;const Ut="user-content-";let qt=true;let Kt=false;let Jt={};let Wt=null;const Vt=T({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Gt=null;const Zt=T({},["audio","video","img","source","image","track"]);let Yt=null;const Xt=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]);const Qt="http://www.w3.org/1998/Math/MathML";const te="http://www.w3.org/2000/svg";const ee="http://www.w3.org/1999/xhtml";let re=ee;let ne=false;let ie=null;const se=T({},[Qt,te,ee],g);let oe=T({},["mi","mo","mn","ms","mtext"]);let le=T({},["annotation-xml"]);const ue=T({},["title","style","font","a","script"]);let fe=null;const ae=["application/xhtml+xml","text/html"];const he="text/html";let ce=null;let de=null;const pe=n.createElement("form");const me=function t(e){return e instanceof RegExp||e instanceof Function};const ge=function t(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(de&&de===e){return}if(!e||typeof e!=="object"){e={}}e=O(e);fe=ae.indexOf(e.PARSER_MEDIA_TYPE)===-1?he:e.PARSER_MEDIA_TYPE;ce=fe==="application/xhtml+xml"?g:m;xt=k(e,"ALLOWED_TAGS")?T({},e.ALLOWED_TAGS,ce):Mt;St=k(e,"ALLOWED_ATTR")?T({},e.ALLOWED_ATTR,ce):Et;ie=k(e,"ALLOWED_NAMESPACES")?T({},e.ALLOWED_NAMESPACES,g):se;Yt=k(e,"ADD_URI_SAFE_ATTR")?T(O(Xt),e.ADD_URI_SAFE_ATTR,ce):Xt;Gt=k(e,"ADD_DATA_URI_TAGS")?T(O(Zt),e.ADD_DATA_URI_TAGS,ce):Zt;Wt=k(e,"FORBID_CONTENTS")?T({},e.FORBID_CONTENTS,ce):Vt;At=k(e,"FORBID_TAGS")?T({},e.FORBID_TAGS,ce):O({});Ot=k(e,"FORBID_ATTR")?T({},e.FORBID_ATTR,ce):O({});Jt=k(e,"USE_PROFILES")?e.USE_PROFILES:false;Rt=e.ALLOW_ARIA_ATTR!==false;$t=e.ALLOW_DATA_ATTR!==false;Ct=e.ALLOW_UNKNOWN_PROTOCOLS||false;Lt=e.ALLOW_SELF_CLOSE_IN_ATTR!==false;Nt=e.SAFE_FOR_TEMPLATES||false;Pt=e.SAFE_FOR_XML!==false;Dt=e.WHOLE_DOCUMENT||false;jt=e.RETURN_DOM||false;_t=e.RETURN_DOM_FRAGMENT||false;Bt=e.RETURN_TRUSTED_TYPE||false;Ht=e.FORCE_BODY||false;zt=e.SANITIZE_DOM!==false;Ft=e.SANITIZE_NAMED_PROPS||false;qt=e.KEEP_CONTENT!==false;Kt=e.IN_PLACE||false;kt=e.ALLOWED_URI_REGEXP||J;re=e.NAMESPACE||ee;oe=e.MATHML_TEXT_INTEGRATION_POINTS||oe;le=e.HTML_INTEGRATION_POINTS||le;Tt=e.CUSTOM_ELEMENT_HANDLING||{};if(e.CUSTOM_ELEMENT_HANDLING&&me(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)){Tt.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck}if(e.CUSTOM_ELEMENT_HANDLING&&me(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)){Tt.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck}if(e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==="boolean"){Tt.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements}if(Nt){$t=false}if(_t){jt=true}if(Jt){xt=T({},I);St=[];if(Jt.html===true){T(xt,$);T(St,H)}if(Jt.svg===true){T(xt,C);T(St,j);T(St,B)}if(Jt.svgFilters===true){T(xt,L);T(St,j);T(St,B)}if(Jt.mathMl===true){T(xt,P);T(St,_);T(St,B)}}if(e.ADD_TAGS){if(xt===Mt){xt=O(xt)}T(xt,e.ADD_TAGS,ce)}if(e.ADD_ATTR){if(St===Et){St=O(St)}T(St,e.ADD_ATTR,ce)}if(e.ADD_URI_SAFE_ATTR){T(Yt,e.ADD_URI_SAFE_ATTR,ce)}if(e.FORBID_CONTENTS){if(Wt===Vt){Wt=O(Wt)}T(Wt,e.FORBID_CONTENTS,ce)}if(qt){xt["#text"]=true}if(Dt){T(xt,["html","head","body"])}if(xt.table){T(xt,["tbody"]);delete At.tbody}if(e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=="function"){throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.')}if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=="function"){throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.')}st=e.TRUSTED_TYPES_POLICY;ot=st.createHTML("")}else{if(st===undefined){st=tt(q,o)}if(st!==null&&typeof ot==="string"){ot=st.createHTML("")}}if(s){s(e)}de=e};const we=T({},[...C,...L,...N]);const be=T({},[...P,...D]);const ve=function t(e){let r=it(e);if(!r||!r.tagName){r={namespaceURI:re,tagName:"template"}}const n=m(e.tagName);const i=m(r.tagName);if(!ie[e.namespaceURI]){return false}if(e.namespaceURI===te){if(r.namespaceURI===ee){return n==="svg"}if(r.namespaceURI===Qt){return n==="svg"&&(i==="annotation-xml"||oe[i])}return Boolean(we[n])}if(e.namespaceURI===Qt){if(r.namespaceURI===ee){return n==="math"}if(r.namespaceURI===te){return n==="math"&&le[i]}return Boolean(be[n])}if(e.namespaceURI===ee){if(r.namespaceURI===te&&!le[i]){return false}if(r.namespaceURI===Qt&&!oe[i]){return false}return!be[n]&&(ue[n]||!we[n])}if(fe==="application/xhtml+xml"&&ie[e.namespaceURI]){return true}return false};const ye=function t(e){d(r.removed,{element:e});try{it(e).removeChild(e)}catch(t){V(e)}};const ke=function t(e,n){try{d(r.removed,{attribute:n.getAttributeNode(e),from:n})}catch(t){d(r.removed,{attribute:null,from:n})}n.removeAttribute(e);if(e==="is"){if(jt||_t){try{ye(n)}catch(t){}}else{try{n.setAttribute(e,"")}catch(t){}}}};const xe=function t(e){let r=null;let i=null;if(Ht){e="<remove></remove>"+e}else{const t=w(e,/^[\r\n\t ]+/);i=t&&t[0]}if(fe==="application/xhtml+xml"&&re===ee){e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>"}const s=st?st.createHTML(e):e;if(re===ee){try{r=(new U).parseFromString(s,fe)}catch(t){}}if(!r||!r.documentElement){r=lt.createDocument(re,"template",null);try{r.documentElement.innerHTML=ne?ot:s}catch(t){}}const o=r.body||r.documentElement;if(e&&i){o.insertBefore(n.createTextNode(i),o.childNodes[0]||null)}if(re===ee){return at.call(r,Dt?"html":"body")[0]}return Dt?r.documentElement:o};const Me=function t(e){return ut.call(e.ownerDocument||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT|A.SHOW_PROCESSING_INSTRUCTION|A.SHOW_CDATA_SECTION,null)};const Se=function t(e){return e instanceof F&&(typeof e.nodeName!=="string"||typeof e.textContent!=="string"||typeof e.removeChild!=="function"||!(e.attributes instanceof z)||typeof e.removeAttribute!=="function"||typeof e.setAttribute!=="function"||typeof e.namespaceURI!=="string"||typeof e.insertBefore!=="function"||typeof e.hasChildNodes!=="function")};const Ee=function t(e){return typeof S==="function"&&e instanceof S};function Te(t,e,n){a(t,(t=>{t.call(r,e,n,de)}))}const Ae=function t(e){let n=null;Te(ct.beforeSanitizeElements,e,null);if(Se(e)){ye(e);return true}const i=ce(e.nodeName);Te(ct.uponSanitizeElement,e,{tagName:i,allowedTags:xt});if(Pt&&e.hasChildNodes()&&!Ee(e.firstElementChild)&&x(/<[/\w!]/g,e.innerHTML)&&x(/<[/\w!]/g,e.textContent)){ye(e);return true}if(e.nodeType===X.progressingInstruction){ye(e);return true}if(Pt&&e.nodeType===X.comment&&x(/<[/\w]/g,e.data)){ye(e);return true}if(!xt[i]||At[i]){if(!At[i]&&Re(i)){if(Tt.tagNameCheck instanceof RegExp&&x(Tt.tagNameCheck,i)){return false}if(Tt.tagNameCheck instanceof Function&&Tt.tagNameCheck(i)){return false}}if(qt&&!Wt[i]){const t=it(e)||e.parentNode;const r=nt(e)||e.childNodes;if(r&&t){const n=r.length;for(let i=n-1;i>=0;--i){const n=W(r[i],true);n.__removalCount=(e.__removalCount||0)+1;t.insertBefore(n,Z(e))}}}ye(e);return true}if(e instanceof E&&!ve(e)){ye(e);return true}if((i==="noscript"||i==="noembed"||i==="noframes")&&x(/<\/no(script|embed|frames)/i,e.innerHTML)){ye(e);return true}if(Nt&&e.nodeType===X.text){n=e.textContent;a([dt,pt,mt],(t=>{n=b(n,t," ")}));if(e.textContent!==n){d(r.removed,{element:e.cloneNode()});e.textContent=n}}Te(ct.afterSanitizeElements,e,null);return false};const Oe=function t(e,r,i){if(zt&&(r==="id"||r==="name")&&(i in n||i in pe)){return false}if($t&&!Ot[r]&&x(gt,r));else if(Rt&&x(wt,r));else if(!St[r]||Ot[r]){if(Re(e)&&(Tt.tagNameCheck instanceof RegExp&&x(Tt.tagNameCheck,e)||Tt.tagNameCheck instanceof Function&&Tt.tagNameCheck(e))&&(Tt.attributeNameCheck instanceof RegExp&&x(Tt.attributeNameCheck,r)||Tt.attributeNameCheck instanceof Function&&Tt.attributeNameCheck(r,e))||r==="is"&&Tt.allowCustomizedBuiltInElements&&(Tt.tagNameCheck instanceof RegExp&&x(Tt.tagNameCheck,i)||Tt.tagNameCheck instanceof Function&&Tt.tagNameCheck(i)));else{return false}}else if(Yt[r]);else if(x(kt,b(i,vt,"")));else if((r==="src"||r==="xlink:href"||r==="href")&&e!=="script"&&v(i,"data:")===0&&Gt[e]);else if(Ct&&!x(bt,b(i,vt,"")));else if(i){return false}else;return true};const Re=function t(e){return e!=="annotation-xml"&&w(e,yt)};const $e=function t(e){Te(ct.beforeSanitizeAttributes,e,null);const{attributes:n}=e;if(!n||Se(e)){return}const i={attrName:"",attrValue:"",keepAttr:true,allowedAttributes:St,forceKeepAttr:undefined};let s=n.length;while(s--){const t=n[s];const{name:o,namespaceURI:l,value:u}=t;const f=ce(o);const h=u;let d=o==="value"?h:y(h);i.attrName=f;i.attrValue=d;i.keepAttr=true;i.forceKeepAttr=undefined;Te(ct.uponSanitizeAttribute,e,i);d=i.attrValue;if(Ft&&(f==="id"||f==="name")){ke(o,e);d=Ut+d}if(Pt&&x(/((--!?|])>)|<\/(style|title|textarea)/i,d)){ke(o,e);continue}if(f==="attributename"&&w(d,"href")){ke(o,e);continue}if(i.forceKeepAttr){continue}if(!i.keepAttr){ke(o,e);continue}if(!Lt&&x(/\/>/i,d)){ke(o,e);continue}if(Nt){a([dt,pt,mt],(t=>{d=b(d,t," ")}))}const p=ce(e.nodeName);if(!Oe(p,f,d)){ke(o,e);continue}if(st&&typeof q==="object"&&typeof q.getAttributeType==="function"){if(l);else{switch(q.getAttributeType(p,f)){case"TrustedHTML":{d=st.createHTML(d);break}case"TrustedScriptURL":{d=st.createScriptURL(d);break}}}}if(d!==h){try{if(l){e.setAttributeNS(l,o,d)}else{e.setAttribute(o,d)}if(Se(e)){ye(e)}else{c(r.removed)}}catch(t){ke(o,e)}}}Te(ct.afterSanitizeAttributes,e,null)};const Ce=function t(e){let r=null;const n=Me(e);Te(ct.beforeSanitizeShadowDOM,e,null);while(r=n.nextNode()){Te(ct.uponSanitizeShadowNode,r,null);Ae(r);$e(r);if(r.content instanceof u){t(r.content)}}Te(ct.afterSanitizeShadowDOM,e,null)};r.sanitize=function(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let n=null;let s=null;let o=null;let l=null;ne=!t;if(ne){t="\x3c!--\x3e"}if(typeof t!=="string"&&!Ee(t)){if(typeof t.toString==="function"){t=t.toString();if(typeof t!=="string"){throw M("dirty is not a string, aborting")}}else{throw M("toString is not a function")}}if(!r.isSupported){return t}if(!It){ge(e)}r.removed=[];if(typeof t==="string"){Kt=false}if(Kt){if(t.nodeName){const e=ce(t.nodeName);if(!xt[e]||At[e]){throw M("root node is forbidden and cannot be sanitized in-place")}}}else if(t instanceof S){n=xe("\x3c!----\x3e");s=n.ownerDocument.importNode(t,true);if(s.nodeType===X.element&&s.nodeName==="BODY"){n=s}else if(s.nodeName==="HTML"){n=s}else{n.appendChild(s)}}else{if(!jt&&!Nt&&!Dt&&t.indexOf("<")===-1){return st&&Bt?st.createHTML(t):t}n=xe(t);if(!n){return jt?null:Bt?ot:""}}if(n&&Ht){ye(n.firstChild)}const f=Me(Kt?t:n);while(o=f.nextNode()){Ae(o);$e(o);if(o.content instanceof u){Ce(o.content)}}if(Kt){return t}if(jt){if(_t){l=ft.call(n.ownerDocument);while(n.firstChild){l.appendChild(n.firstChild)}}else{l=n}if(St.shadowroot||St.shadowrootmode){l=ht.call(i,l,true)}return l}let h=Dt?n.outerHTML:n.innerHTML;if(Dt&&xt["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&x(G,n.ownerDocument.doctype.name)){h="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+h}if(Nt){a([dt,pt,mt],(t=>{h=b(h,t," ")}))}return st&&Bt?st.createHTML(h):h};r.setConfig=function(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};ge(t);It=true};r.clearConfig=function(){de=null;It=false};r.isValidAttribute=function(t,e,r){if(!de){ge({})}const n=ce(t);const i=ce(e);return Oe(n,i,r)};r.addHook=function(t,e){if(typeof e!=="function"){return}d(ct[t],e)};r.removeHook=function(t,e){if(e!==undefined){const r=h(ct[t],e);return r===-1?undefined:p(ct[t],r,1)[0]}return c(ct[t])};r.removeHooks=function(t){ct[t]=[]};r.removeAllHooks=function(){ct=et()};return r}var nt=rt();return nt}))})(d);const p=d.exports;function m(t){return{value:p.sanitize(t,{ADD_TAGS:["pos-rich-link","pos-image"],ADD_ATTR:["uri"]})}}function g(t){this.content=t}g.prototype={constructor:g,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?undefined:this.content[e+1]},update:function(t,e,r){var n=r&&r!=t?this.remove(r):this;var i=n.find(t),s=n.content.slice();if(i==-1){s.push(r||t,e)}else{s[i+1]=e;if(r)s[i]=r}return new g(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var r=this.content.slice();r.splice(e,2);return new g(r)},addToStart:function(t,e){return new g([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var r=this.remove(t).content.slice();r.push(t,e);return new g(r)},addBefore:function(t,e,r){var n=this.remove(e),i=n.content.slice();var s=n.find(t);i.splice(s==-1?i.length:s,0,e,r);return new g(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){t=g.from(t);if(!t.size)return this;return new g(t.content.concat(this.subtract(t).content))},append:function(t){t=g.from(t);if(!t.size)return this;return new g(this.subtract(t).content.concat(t.content))},subtract:function(t){var e=this;t=g.from(t);for(var r=0;r<t.content.length;r+=2)e=e.remove(t.content[r]);return e},toObject:function(){var t={};this.forEach((function(e,r){t[e]=r}));return t},get size(){return this.content.length>>1}};g.from=function(t){if(t instanceof g)return t;var e=[];if(t)for(var r in t)e.push(r,t[r]);return new g(e)};function w(t,e,r){for(let n=0;;n++){if(n==t.childCount||n==e.childCount)return t.childCount==e.childCount?null:r;let i=t.child(n),s=e.child(n);if(i==s){r+=i.nodeSize;continue}if(!i.sameMarkup(s))return r;if(i.isText&&i.text!=s.text){for(let t=0;i.text[t]==s.text[t];t++)r++;return r}if(i.content.size||s.content.size){let t=w(i.content,s.content,r+1);if(t!=null)return t}r+=i.nodeSize}}function b(t,e,r,n){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:r,b:n};let o=t.child(--i),l=e.child(--s),u=o.nodeSize;if(o==l){r-=u;n-=u;continue}if(!o.sameMarkup(l))return{a:r,b:n};if(o.isText&&o.text!=l.text){let t=0,e=Math.min(o.text.length,l.text.length);while(t<e&&o.text[o.text.length-t-1]==l.text[l.text.length-t-1]){t++;r--;n--}return{a:r,b:n}}if(o.content.size||l.content.size){let t=b(o.content,l.content,r-1,n-1);if(t)return t}r-=u;n-=u}}class v{constructor(t,e){this.content=t;this.size=e||0;if(e==null)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,r,n=0,i){for(let s=0,o=0;o<e;s++){let l=this.content[s],u=o+l.nodeSize;if(u>t&&r(l,n+o,i||null,s)!==false&&l.content.size){let i=o+1;l.nodesBetween(Math.max(0,t-i),Math.min(l.content.size,e-i),r,n+i)}o=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,n){let i="",s=true;this.nodesBetween(t,e,((o,l)=>{let u=o.isText?o.text.slice(Math.max(t,l)-l,e-l):!o.isLeaf?"":n?typeof n==="function"?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"";if(o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&r){if(s)s=false;else i+=r}i+=u}),0);return i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,n=this.content.slice(),i=0;if(e.isText&&e.sameMarkup(r)){n[n.length-1]=e.withText(e.text+r.text);i=1}for(;i<t.content.length;i++)n.push(t.content[i]);return new v(n,this.size+t.size)}cut(t,e=this.size){if(t==0&&e==this.size)return this;let r=[],n=0;if(e>t)for(let i=0,s=0;s<e;i++){let o=this.content[i],l=s+o.nodeSize;if(l>t){if(s<t||l>e){if(o.isText)o=o.cut(Math.max(0,t-s),Math.min(o.text.length,e-s));else o=o.cut(Math.max(0,t-s-1),Math.min(o.content.size,e-s-1))}r.push(o);n+=o.nodeSize}s=l}return new v(r,n)}cutByIndex(t,e){if(t==e)return v.empty;if(t==0&&e==this.content.length)return this;return new v(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let n=this.content.slice();let i=this.size+e.nodeSize-r.nodeSize;n[t]=e;return new v(n,i)}addToStart(t){return new v([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new v(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return false;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return false;return true}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(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let n=this.content[e];t(n,r,e);r+=n.nodeSize}}findDiffStart(t,e=0){return w(this,t,e)}findDiffEnd(t,e=this.size,r=t.size){return b(this,t,e,r)}findIndex(t){if(t==0)return k(0,t);if(t==this.size)return k(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,r=0;;e++){let n=this.child(e),i=r+n.nodeSize;if(i>=t){if(i==t)return k(e+1,i);return k(e,r)}r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return v.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new v(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return v.empty;let e,r=0;for(let n=0;n<t.length;n++){let i=t[n];r+=i.nodeSize;if(n&&i.isText&&t[n-1].sameMarkup(i)){if(!e)e=t.slice(0,n);e[e.length-1]=i.withText(e[e.length-1].text+i.text)}else if(e){e.push(i)}}return new v(e||t,r)}static from(t){if(!t)return v.empty;if(t instanceof v)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new v([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}v.empty=new v([],0);const y={index:0,offset:0};function k(t,e){y.index=t;y.offset=e;return y}function x(t,e){if(t===e)return true;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return false;let r=Array.isArray(t);if(Array.isArray(e)!=r)return false;if(r){if(t.length!=e.length)return false;for(let r=0;r<t.length;r++)if(!x(t[r],e[r]))return false}else{for(let r in t)if(!(r in e)||!x(t[r],e[r]))return false;for(let r in e)if(!(r in t))return false}return true}class M{constructor(t,e){this.type=t;this.attrs=e}addToSet(t){let e,r=false;for(let n=0;n<t.length;n++){let i=t[n];if(this.eq(i))return t;if(this.type.excludes(i.type)){if(!e)e=t.slice(0,n)}else if(i.type.excludes(this.type)){return t}else{if(!r&&i.type.rank>this.type.rank){if(!e)e=t.slice(0,n);e.push(this);r=true}if(e)e.push(i)}}if(!e)e=t.slice();if(!r)e.push(this);return e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return true;return false}eq(t){return this==t||this.type==t.type&&x(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);let n=r.create(e.attrs);r.checkAttrs(n.attrs);return n}static sameSet(t,e){if(t==e)return true;if(t.length!=e.length)return false;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return false;return true}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return M.none;if(t instanceof M)return[t];let e=t.slice();e.sort(((t,e)=>t.type.rank-e.type.rank));return e}}M.none=[];class S extends Error{}class E{constructor(t,e,r){this.content=t;this.openStart=e;this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=A(this.content,t+this.openStart,e);return r&&new E(r,this.openStart,this.openEnd)}removeBetween(t,e){return new E(T(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};if(this.openStart>0)t.openStart=this.openStart;if(this.openEnd>0)t.openEnd=this.openEnd;return t}static fromJSON(t,e){if(!e)return E.empty;let r=e.openStart||0,n=e.openEnd||0;if(typeof r!="number"||typeof n!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new E(v.fromJSON(t,e.content),r,n)}static maxOpen(t,e=true){let r=0,n=0;for(let n=t.firstChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=t.lastChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.lastChild)n++;return new E(t,r,n)}}E.empty=new E(v.empty,0,0);function T(t,e,r){let{index:n,offset:i}=t.findIndex(e),s=t.maybeChild(n);let{index:o,offset:l}=t.findIndex(r);if(i==e||s.isText){if(l!=r&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(r))}if(n!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(n,s.copy(T(s.content,e-i-1,r-i-1)))}function A(t,e,r,n){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText){if(n&&!n.canReplace(i,i,r))return null;return t.cut(0,e).append(r).append(t.cut(e))}let l=A(o.content,e-s-1,r,o);return l&&t.replaceChild(i,o.copy(l))}function O(t,e,r){if(r.openStart>t.depth)throw new S("Inserted content deeper than insertion position");if(t.depth-r.openStart!=e.depth-r.openEnd)throw new S("Inconsistent open depths");return R(t,e,r,0)}function R(t,e,r,n){let i=t.index(n),s=t.node(n);if(i==e.index(n)&&n<t.depth-r.openStart){let o=R(t,e,r,n+1);return s.copy(s.content.replaceChild(i,o))}else if(!r.content.size){return P(s,I(t,e,n))}else if(!r.openStart&&!r.openEnd&&t.depth==n&&e.depth==n){let n=t.parent,i=n.content;return P(n,i.cut(0,t.parentOffset).append(r.content).append(i.cut(e.parentOffset)))}else{let{start:i,end:o}=H(r,t);return P(s,D(t,i,o,e,n))}}function $(t,e){if(!e.type.compatibleContent(t.type))throw new S("Cannot join "+e.type.name+" onto "+t.type.name)}function C(t,e,r){let n=t.node(r);$(n,e.node(r));return n}function L(t,e){let r=e.length-1;if(r>=0&&t.isText&&t.sameMarkup(e[r]))e[r]=t.withText(e[r].text+t.text);else e.push(t)}function N(t,e,r,n){let i=(e||t).node(r);let s=0,o=e?e.index(r):i.childCount;if(t){s=t.index(r);if(t.depth>r){s++}else if(t.textOffset){L(t.nodeAfter,n);s++}}for(let t=s;t<o;t++)L(i.child(t),n);if(e&&e.depth==r&&e.textOffset)L(e.nodeBefore,n)}function P(t,e){t.type.checkContent(e);return t.copy(e)}function D(t,e,r,n,i){let s=t.depth>i&&C(t,e,i+1);let o=n.depth>i&&C(r,n,i+1);let l=[];N(null,t,i,l);if(s&&o&&e.index(i)==r.index(i)){$(s,o);L(P(s,D(t,e,r,n,i+1)),l)}else{if(s)L(P(s,I(t,e,i+1)),l);N(e,r,i,l);if(o)L(P(o,I(r,n,i+1)),l)}N(n,null,i,l);return new v(l)}function I(t,e,r){let n=[];N(null,t,r,n);if(t.depth>r){let i=C(t,e,r+1);L(P(i,I(t,e,r+1)),n)}N(e,null,r,n);return new v(n)}function H(t,e){let r=e.depth-t.openStart,n=e.node(r);let i=n.copy(t.content);for(let t=r-1;t>=0;t--)i=e.node(t).copy(v.from(i));return{start:i.resolveNoCache(t.openStart+r),end:i.resolveNoCache(i.content.size-t.openEnd-r)}}class j{constructor(t,e,r){this.pos=t;this.path=e;this.parentOffset=r;this.depth=e.length/3-1}resolveDepth(t){if(t==null)return this.depth;if(t<0)return this.depth+t;return t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){t=this.resolveDepth(t);return this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){t=this.resolveDepth(t);return t==0?0:this.path[t*3-1]+1}end(t){t=this.resolveDepth(t);return this.start(t)+this.node(t).content.size}before(t){t=this.resolveDepth(t);if(!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){t=this.resolveDepth(t);if(!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=t.child(e);return r?t.child(e).cut(r):n}get nodeBefore(){let t=this.index(this.depth);let e=this.pos-this.path[this.path.length-1];if(e)return this.parent.child(t).cut(0,e);return t==0?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[e*3],n=e==0?0:this.path[e*3-1]+1;for(let e=0;e<t;e++)n+=r.child(e).nodeSize;return n}marks(){let t=this.parent,e=this.index();if(t.content.size==0)return M.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),n=t.maybeChild(e);if(!r){let t=r;r=n;n=t}let i=r.marks;for(var s=0;s<i.length;s++)if(i[s].type.spec.inclusive===false&&(!n||!i[s].isInSet(n.marks)))i=i[s--].removeFromSet(i);return i}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.marks,n=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)if(r[i].type.spec.inclusive===false&&(!n||!r[i].isInSet(n.marks)))r=r[i--].removeFromSet(r);return r}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new F(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[];let n=0,i=e;for(let e=t;;){let{index:t,offset:s}=e.content.findIndex(i);let o=i-s;r.push(e,t,n+s);if(!o)break;e=e.child(t);if(e.isText)break;i=o-1;n+=s+1}return new j(e,r,i)}static resolveCached(t,e){let r=z.get(t);if(r){for(let t=0;t<r.elts.length;t++){let n=r.elts[t];if(n.pos==e)return n}}else{z.set(t,r=new _)}let n=r.elts[r.i]=j.resolve(t,e);r.i=(r.i+1)%B;return n}}class _{constructor(){this.elts=[];this.i=0}}const B=12,z=new WeakMap;class F{constructor(t,e,r){this.$from=t;this.$to=e;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 U=Object.create(null);class q{constructor(t,e,r,n=M.none){this.type=t;this.attrs=e;this.marks=n;this.content=r||v.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,r,n=0){this.content.nodesBetween(t,e,r,n,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,r,n){return this.content.textBetween(t,e,r,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,r){return this.type==t&&x(this.attrs,e||t.defaultAttrs||U)&&M.sameSet(this.marks,r||M.none)}copy(t=null){if(t==this.content)return this;return new q(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new q(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){if(t==0&&e==this.content.size)return this;return this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=false){if(t==e)return E.empty;let n=this.resolve(t),i=this.resolve(e);let s=r?0:n.sharedDepth(e);let o=n.start(s),l=n.node(s);let u=l.content.cut(n.pos-o,i.pos-o);return new E(u,n.depth-s,i.depth-s)}replace(t,e,r){return O(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:n}=e.content.findIndex(t);e=e.maybeChild(r);if(!e)return null;if(n==t||e.isText)return e;t-=n+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let n=this.content.child(e-1);return{node:n,index:e-1,offset:r-n.nodeSize}}resolve(t){return j.resolveCached(this,t)}resolveNoCache(t){return j.resolve(this,t)}rangeHasMark(t,e,r){let n=false;if(e>t)this.nodesBetween(t,e,(t=>{if(r.isInSet(t.marks))n=true;return!n}));return n}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 t=this.type.name;if(this.content.size)t+="("+this.content.toStringInner()+")";return J(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=v.empty,n=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,n,i);let o=s&&s.matchFragment(this.content,e);if(!o||!o.validEnd)return false;for(let t=n;t<i;t++)if(!this.type.allowsMarks(r.child(t).marks))return false;return true}canReplaceWith(t,e,r,n){if(n&&!this.type.allowsMarks(n))return false;let i=this.contentMatchAt(t).matchType(r);let s=i&&i.matchFragment(this.content,e);return s?s.validEnd:false}canAppend(t){if(t.content.size)return this.canReplace(this.childCount,this.childCount,t.content);else return this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);this.type.checkAttrs(this.attrs);let t=M.none;for(let e=0;e<this.marks.length;e++){let r=this.marks[e];r.type.checkAttrs(r.attrs);t=r.addToSet(t)}if(!M.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}if(this.content.size)t.content=this.content.toJSON();if(this.marks.length)t.marks=this.marks.map((t=>t.toJSON()));return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r=undefined;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if(e.type=="text"){if(typeof e.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let n=v.fromJSON(t,e.content);let i=t.nodeType(e.type).create(e.attrs,n,r);i.type.checkAttrs(i.attrs);return i}}q.prototype.text=undefined;class K extends q{constructor(t,e,r,n){super(t,e,null,n);if(!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);return J(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new K(this.type,this.attrs,this.text,t)}withText(t){if(t==this.text)return this;return new K(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){if(t==0&&e==this.text.length)return this;return this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();t.text=this.text;return t}}function J(t,e){for(let r=t.length-1;r>=0;r--)e=t[r].type.name+"("+e+")";return e}class W{constructor(t){this.validEnd=t;this.next=[];this.wrapCache=[]}static parse(t,e){let r=new V(t,e);if(r.next==null)return W.empty;let n=G(r);if(r.next)r.err("Unexpected trailing text");let i=st(rt(n));ot(i,r);return i}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let n=this;for(let i=e;n&&i<r;i++)n=n.matchType(t.child(i).type);return n}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!(e.isText||e.hasRequiredAttrs()))return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return true;return false}fillBefore(t,e=false,r=0){let n=[this];function i(s,o){let l=s.matchFragment(t,r);if(l&&(!e||l.validEnd))return v.from(o.map((t=>t.createAndFill())));for(let t=0;t<s.next.length;t++){let{type:e,next:r}=s.next[t];if(!(e.isText||e.hasRequiredAttrs())&&n.indexOf(r)==-1){n.push(r);let t=i(r,o.concat(e));if(t)return t}}return null}return i(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);this.wrapCache.push(t,e);return e}computeWrapping(t){let e=Object.create(null),r=[{match:this,type:null,via:null}];while(r.length){let n=r.shift(),i=n.match;if(i.matchType(t)){let t=[];for(let e=n;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<i.next.length;t++){let{type:s,next:o}=i.next[t];if(!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in e)&&(!n.type||o.validEnd)){r.push({match:s.contentMatch,type:s,via:n});e[s.name]=true}}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function e(r){t.push(r);for(let n=0;n<r.next.length;n++)if(t.indexOf(r.next[n].next)==-1)e(r.next[n].next)}e(this);return t.map(((e,r)=>{let n=r+(e.validEnd?"*":" ")+" ";for(let r=0;r<e.next.length;r++)n+=(r?", ":"")+e.next[r].type.name+"->"+t.indexOf(e.next[r].next);return n})).join("\n")}}W.empty=new W(true);class V{constructor(t,e){this.string=t;this.nodeTypes=e;this.inline=null;this.pos=0;this.tokens=t.split(/\s*(?=\b|\W|$)/);if(this.tokens[this.tokens.length-1]=="")this.tokens.pop();if(this.tokens[0]=="")this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||true)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function G(t){let e=[];do{e.push(Z(t))}while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Z(t){let e=[];do{e.push(Y(t))}while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Y(t){let e=et(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=Q(t,e);else break}return e}function X(t){if(/\D/.test(t.next))t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);t.pos++;return e}function Q(t,e){let r=X(t),n=r;if(t.eat(",")){if(t.next!="}")n=X(t);else n=-1}if(!t.eat("}"))t.err("Unclosed braced range");return{type:"range",min:r,max:n,expr:e}}function tt(t,e){let r=t.nodeTypes,n=r[e];if(n)return[n];let i=[];for(let t in r){let n=r[t];if(n.isInGroup(e))i.push(n)}if(i.length==0)t.err("No node type or group '"+e+"' found");return i}function et(t){if(t.eat("(")){let e=G(t);if(!t.eat(")"))t.err("Missing closing paren");return e}else if(!/\W/.test(t.next)){let e=tt(t,t.next).map((e=>{if(t.inline==null)t.inline=e.isInline;else if(t.inline!=e.isInline)t.err("Mixing inline and block content");return{type:"name",value:e}}));t.pos++;return e.length==1?e[0]:{type:"choice",exprs:e}}else{t.err("Unexpected token '"+t.next+"'")}}function rt(t){let e=[[]];i(s(t,0),r());return e;function r(){return e.push([])-1}function n(t,r,n){let i={term:n,to:r};e[t].push(i);return i}function i(t,e){t.forEach((t=>t.to=e))}function s(t,e){if(t.type=="choice"){return t.exprs.reduce(((t,r)=>t.concat(s(r,e))),[])}else if(t.type=="seq"){for(let n=0;;n++){let o=s(t.exprs[n],e);if(n==t.exprs.length-1)return o;i(o,e=r())}}else if(t.type=="star"){let o=r();n(e,o);i(s(t.expr,o),o);return[n(o)]}else if(t.type=="plus"){let o=r();i(s(t.expr,e),o);i(s(t.expr,o),o);return[n(o)]}else if(t.type=="opt"){return[n(e)].concat(s(t.expr,e))}else if(t.type=="range"){let o=e;for(let e=0;e<t.min;e++){let e=r();i(s(t.expr,o),e);o=e}if(t.max==-1){i(s(t.expr,o),o)}else{for(let e=t.min;e<t.max;e++){let e=r();n(o,e);i(s(t.expr,o),e);o=e}}return[n(o)]}else if(t.type=="name"){return[n(e,undefined,t.value)]}else{throw new Error("Unknown expr type")}}}function nt(t,e){return e-t}function it(t,e){let r=[];n(e);return r.sort(nt);function n(e){let i=t[e];if(i.length==1&&!i[0].term)return n(i[0].to);r.push(e);for(let t=0;t<i.length;t++){let{term:e,to:s}=i[t];if(!e&&r.indexOf(s)==-1)n(s)}}}function st(t){let e=Object.create(null);return r(it(t,0));function r(n){let i=[];n.forEach((e=>{t[e].forEach((({term:e,to:r})=>{if(!e)return;let n;for(let t=0;t<i.length;t++)if(i[t][0]==e)n=i[t][1];it(t,r).forEach((t=>{if(!n)i.push([e,n=[]]);if(n.indexOf(t)==-1)n.push(t)}))}))}));let s=e[n.join(",")]=new W(n.indexOf(t.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(nt);s.next.push({type:i[t][0],next:e[n.join(",")]||r(n)})}return s}}function ot(t,e){for(let r=0,n=[t];r<n.length;r++){let t=n[r],i=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:r,next:o}=t.next[e];s.push(r.name);if(i&&!(r.isText||r.hasRequiredAttrs()))i=false;if(n.indexOf(o)==-1)n.push(o)}if(i)e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function lt(t){let e=Object.create(null);for(let r in t){let n=t[r];if(!n.hasDefault)return null;e[r]=n.default}return e}function ut(t,e){let r=Object.create(null);for(let n in t){let i=e&&e[n];if(i===undefined){let e=t[n];if(e.hasDefault)i=e.default;else throw new RangeError("No value supplied for attribute "+n)}r[n]=i}return r}function ft(t,e,r,n){for(let n in e)if(!(n in t))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let r in t){let n=t[r];if(n.validate)n.validate(e[r])}}function at(t,e){let r=Object.create(null);if(e)for(let n in e)r[n]=new dt(t,n,e[n]);return r}class ht{constructor(t,e,r){this.name=t;this.schema=e;this.spec=r;this.markSet=null;this.groups=r.group?r.group.split(" "):[];this.attrs=at(t,r.attrs);this.defaultAttrs=lt(this.attrs);this.contentMatch=null;this.inlineContent=null;this.isBlock=!(r.inline||t=="text");this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==W.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return true;return false}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){if(!t&&this.defaultAttrs)return this.defaultAttrs;else return ut(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new q(this,this.computeAttrs(t),v.from(e),M.setFrom(r))}createChecked(t=null,e,r){e=v.from(e);this.checkContent(e);return new q(this,this.computeAttrs(t),e,M.setFrom(r))}createAndFill(t=null,e,r){t=this.computeAttrs(t);e=v.from(e);if(e.size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let n=this.contentMatch.matchFragment(e);let i=n&&n.fillBefore(v.empty,true);if(!i)return null;return new q(this,t,e.append(i),M.setFrom(r))}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return false;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return false;return true}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){ft(this.attrs,t,"node")}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return true;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return false;return true}allowedMarks(t){if(this.markSet==null)return t;let e;for(let r=0;r<t.length;r++){if(!this.allowsMarkType(t[r].type)){if(!e)e=t.slice(0,r)}else if(e){e.push(t[r])}}return!e?t:e.length?e:M.none}static compile(t,e){let r=Object.create(null);t.forEach(((t,n)=>r[t]=new ht(t,e,n)));let n=e.spec.topNode||"doc";if(!r[n])throw new RangeError("Schema is missing its top node type ('"+n+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let t in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}function ct(t,e,r){let n=r.split("|");return r=>{let i=r===null?"null":typeof r;if(n.indexOf(i)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${t}, got ${i}`)}}class dt{constructor(t,e,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default");this.default=r.default;this.validate=typeof r.validate=="string"?ct(t,e,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class pt{constructor(t,e,r,n){this.name=t;this.rank=e;this.schema=r;this.spec=n;this.attrs=at(t,n.attrs);this.excluded=null;let i=lt(this.attrs);this.instance=i?new M(this,i):null}create(t=null){if(!t&&this.instance)return this.instance;return new M(this,ut(this.attrs,t))}static compile(t,e){let r=Object.create(null),n=0;t.forEach(((t,i)=>r[t]=new pt(t,n++,e,i)));return r}removeFromSet(t){for(var e=0;e<t.length;e++)if(t[e].type==this){t=t.slice(0,e).concat(t.slice(e+1));e--}return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){ft(this.attrs,t,"mark")}excludes(t){return this.excluded.indexOf(t)>-1}}class mt{constructor(t){this.linebreakReplacement=null;this.cached=Object.create(null);let e=this.spec={};for(let r in t)e[r]=t[r];e.nodes=g.from(t.nodes),e.marks=g.from(t.marks||{}),this.nodes=ht.compile(this.spec.nodes,this);this.marks=pt.compile(this.spec.marks,this);let r=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],n=e.spec.content||"",i=e.spec.marks;e.contentMatch=r[n]||(r[n]=W.parse(n,this.nodes));e.inlineContent=e.contentMatch.inlineContent;if(e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet=i=="_"?null:i?gt(this,i.split(" ")):i==""||!e.inlineContent?[]:null}for(let t in this.marks){let e=this.marks[t],r=e.spec.excludes;e.excluded=r==null?[e]:r==""?[]:gt(this,r.split(" "))}this.nodeFromJSON=t=>q.fromJSON(this,t);this.markFromJSON=t=>M.fromJSON(this,t);this.topNodeType=this.nodes[this.spec.topNode||"doc"];this.cached.wrappings=Object.create(null)}node(t,e=null,r,n){if(typeof t=="string")t=this.nodeType(t);else if(!(t instanceof ht))throw new RangeError("Invalid node type: "+t);else if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")");return t.createChecked(e,r,n)}text(t,e){let r=this.nodes.text;return new K(r,r.defaultAttrs,t,M.setFrom(e))}mark(t,e){if(typeof t=="string")t=this.marks[t];return t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function gt(t,e){let r=[];for(let n=0;n<e.length;n++){let i=e[n],s=t.marks[i],o=s;if(s){r.push(s)}else{for(let e in t.marks){let n=t.marks[e];if(i=="_"||n.spec.group&&n.spec.group.split(" ").indexOf(i)>-1)r.push(o=n)}}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return r}function wt(t){return t.tag!=null}function bt(t){return t.style!=null}class vt{constructor(t,e){this.schema=t;this.rules=e;this.tags=[];this.styles=[];let r=this.matchedStyles=[];e.forEach((t=>{if(wt(t)){this.tags.push(t)}else if(bt(t)){let e=/[^=]*/.exec(t.style)[0];if(r.indexOf(e)<0)r.push(e);this.styles.push(t)}}));this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return false;let r=t.nodes[e.node];return r.contentMatch.matchType(r)}))}parse(t,e={}){let r=new Ot(this,e,false);r.addAll(t,M.none,e.from,e.to);return r.finish()}parseSlice(t,e={}){let r=new Ot(this,e,true);r.addAll(t,M.none,e.from,e.to);return E.maxOpen(r.finish())}matchTag(t,e,r){for(let n=r?this.tags.indexOf(r)+1:0;n<this.tags.length;n++){let r=this.tags[n];if($t(t,r.tag)&&(r.namespace===undefined||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){let e=r.getAttrs(t);if(e===false)continue;r.attrs=e||undefined}return r}}}matchStyle(t,e,r,n){for(let i=n?this.styles.indexOf(n)+1:0;i<this.styles.length;i++){let n=this.styles[i],s=n.style;if(s.indexOf(t)!=0||n.context&&!r.matchesContext(n.context)||s.length>t.length&&(s.charCodeAt(t.length)!=61||s.slice(t.length+1)!=e))continue;if(n.getAttrs){let t=n.getAttrs(e);if(t===false)continue;n.attrs=t||undefined}return n}}static schemaRules(t){let e=[];function r(t){let r=t.priority==null?50:t.priority,n=0;for(;n<e.length;n++){let t=e[n],i=t.priority==null?50:t.priority;if(i<r)break}e.splice(n,0,t)}for(let e in t.marks){let n=t.marks[e].spec.parseDOM;if(n)n.forEach((t=>{r(t=Ct(t));if(!(t.mark||t.ignore||t.clearMark))t.mark=e}))}for(let e in t.nodes){let n=t.nodes[e].spec.parseDOM;if(n)n.forEach((t=>{r(t=Ct(t));if(!(t.node||t.ignore||t.mark))t.node=e}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new vt(t,vt.schemaRules(t)))}}const yt={address:true,article:true,aside:true,blockquote:true,canvas:true,dd:true,div:true,dl:true,fieldset:true,figcaption:true,figure:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,li:true,noscript:true,ol:true,output:true,p:true,pre:true,section:true,table:true,tfoot:true,ul:true};const kt={head:true,noscript:true,object:true,script:true,style:true,title:true};const xt={ol:true,ul:true};const Mt=1,St=2,Et=4;function Tt(t,e,r){if(e!=null)return(e?Mt:0)|(e==="full"?St:0);return t&&t.whitespace=="pre"?Mt|St:r&~Et}class At{constructor(t,e,r,n,i,s){this.type=t;this.attrs=e;this.marks=r;this.solid=n;this.options=s;this.content=[];this.activeMarks=M.none;this.match=i||(s&Et?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(v.from(t));if(e){this.match=this.type.contentMatch.matchFragment(e)}else{let e=this.type.contentMatch,r;if(r=e.findWrapping(t.type)){this.match=e;return r}else{return null}}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Mt)){let t=this.content[this.content.length-1],e;if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let r=t;if(t.text.length==e[0].length)this.content.pop();else this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-e[0].length))}}let e=v.from(this.content);if(!t&&this.match)e=e.append(this.match.fillBefore(v.empty,true));return this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){if(this.type)return this.type.inlineContent;if(this.content.length)return this.content[0].isInline;return t.parentNode&&!yt.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Ot{constructor(t,e,r){this.parser=t;this.options=e;this.isOpen=r;this.open=0;this.localPreserveWS=false;let n=e.topNode,i;let s=Tt(null,e.preserveWhitespace,0)|(r?Et:0);if(n)i=new At(n.type,n.attrs,M.none,true,e.topMatch||n.type.contentMatch,s);else if(r)i=new At(null,null,M.none,true,null,s);else i=new At(t.schema.topNodeType,null,M.none,true,null,s);this.nodes=[i];this.find=e.findPositions;this.needsBlock=false}get top(){return this.nodes[this.open]}addDOM(t,e){if(t.nodeType==3)this.addTextNode(t,e);else if(t.nodeType==1)this.addElement(t,e)}addTextNode(t,e){let r=t.nodeValue;let n=this.top,i=n.options&St?"full":this.localPreserveWS||(n.options&Mt)>0;if(i==="full"||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(!i){r=r.replace(/[ \t\r\n\u000c]+/g," ");if(/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let e=n.content[n.content.length-1];let i=t.previousSibling;if(!e||i&&i.nodeName=="BR"||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))r=r.slice(1)}}else if(i!=="full"){r=r.replace(/\r?\n|\r/g," ")}else{r=r.replace(/\r\n?/g,"\n")}if(r)this.insertNode(this.parser.schema.text(r),e,!/\S/.test(r));this.findInText(t)}else{this.findInside(t)}}addElement(t,e,r){let n=this.localPreserveWS,i=this.top;if(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))this.localPreserveWS=true;let s=t.nodeName.toLowerCase(),o;if(xt.hasOwnProperty(s)&&this.parser.normalizeLists)Rt(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,r));t:if(l?l.ignore:kt.hasOwnProperty(s)){this.findInside(t);this.ignoreFallback(t,e)}else if(!l||l.skip||l.closeParent){if(l&&l.closeParent)this.open=Math.max(0,this.open-1);else if(l&&l.skip.nodeType)t=l.skip;let r,n=this.needsBlock;if(yt.hasOwnProperty(s)){if(i.content.length&&i.content[0].isInline&&this.open){this.open--;i=this.top}r=true;if(!i.type)this.needsBlock=true}else if(!t.firstChild){this.leafFallback(t,e);break t}let o=l&&l.skip?e:this.readStyles(t,e);if(o)this.addAll(t,o);if(r)this.sync(i);this.needsBlock=n}else{let r=this.readStyles(t,e);if(r)this.addElementByRule(t,l,r,l.consuming===false?o:undefined)}this.localPreserveWS=n}leafFallback(t,e){if(t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent)this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){if(t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent))this.findPlace(this.parser.schema.text("-"),e,true)}readStyles(t,e){let r=t.style;if(r&&r.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let n=this.parser.matchedStyles[t],i=r.getPropertyValue(n);if(i)for(let t=undefined;;){let r=this.parser.matchStyle(n,i,this,t);if(!r)break;if(r.ignore)return null;if(r.clearMark)e=e.filter((t=>!r.clearMark(t)));else e=e.concat(this.parser.schema.marks[r.mark].create(r.attrs));if(r.consuming===false)t=r;else break}}return e}addElementByRule(t,e,r,n){let i,s;if(e.node){s=this.parser.schema.nodes[e.node];if(!s.isLeaf){let t=this.enter(s,e.attrs||null,r,e.preserveWhitespace);if(t){i=true;r=t}}else if(!this.insertNode(s.create(e.attrs),r,t.nodeName=="BR")){this.leafFallback(t,r)}}else{let t=this.parser.schema.marks[e.mark];r=r.concat(t.create(e.attrs))}let o=this.top;if(s&&s.isLeaf){this.findInside(t)}else if(n){this.addElement(t,r,n)}else if(e.getContent){this.findInside(t);e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,r,false)))}else{let n=t;if(typeof e.contentElement=="string")n=t.querySelector(e.contentElement);else if(typeof e.contentElement=="function")n=e.contentElement(t);else if(e.contentElement)n=e.contentElement;this.findAround(t,n,true);this.addAll(n,r);this.findAround(t,n,false)}if(i&&this.sync(o))this.open--}addAll(t,e,r,n){let i=r||0;for(let s=r?t.childNodes[r]:t.firstChild,o=n==null?null:t.childNodes[n];s!=o;s=s.nextSibling,++i){this.findAtPoint(t,i);this.addDOM(s,e)}this.findAtPoint(t,i)}findPlace(t,e,r){let n,i;for(let e=this.open,s=0;e>=0;e--){let o=this.nodes[e];let l=o.findWrapping(t);if(l&&(!n||n.length>l.length+s)){n=l;i=o;if(!l.length)break}if(o.solid){if(r)break;s+=2}}if(!n)return null;this.sync(i);for(let t=0;t<n.length;t++)e=this.enterInner(n[t],null,e,false);return e}insertNode(t,e,r){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();if(t)e=this.enterInner(t,null,e)}let n=this.findPlace(t,e,r);if(n){this.closeExtra();let e=this.top;if(e.match)e.match=e.match.matchType(t.type);let r=M.none;for(let i of n.concat(t.marks))if(e.type?e.type.allowsMarkType(i.type):Lt(i.type,t.type))r=i.addToSet(r);e.content.push(t.mark(r));return true}return false}enter(t,e,r,n){let i=this.findPlace(t.create(e),r,false);if(i)i=this.enterInner(t,e,r,true,n);return i}enterInner(t,e,r,n=false,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let o=Tt(t,i,s.options);if(s.options&Et&&s.content.length==0)o|=Et;let l=M.none;r=r.filter((e=>{if(s.type?s.type.allowsMarkType(e.type):Lt(e.type,t)){l=e.addToSet(l);return false}return true}));this.nodes.push(new At(t,e,l,n,null,o));this.open++;return r}closeExtra(t=false){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){this.open=0;this.closeExtra(this.isOpen);return this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t){this.open=e;return true}else if(this.localPreserveWS){this.nodes[e].options|=Mt}}return false}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let e=r.length-1;e>=0;e--)t+=r[e].nodeSize;if(e)t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++){if(this.find[r].node==t&&this.find[r].offset==e)this.find[r].pos=this.currentPos}}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++){if(this.find[e].pos==null&&t.nodeType==1&&t.contains(this.find[e].node))this.find[e].pos=this.currentPos}}findAround(t,e,r){if(t!=e&&this.find)for(let n=0;n<this.find.length;n++){if(this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)){let t=e.compareDocumentPosition(this.find[n].node);if(t&(r?2:4))this.find[n].pos=this.currentPos}}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++){if(this.find[e].node==t)this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset)}}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/");let r=this.options.context;let n=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type);let i=-(r?r.depth+1:0)+(n?0:1);let s=(t,o)=>{for(;t>=0;t--){let l=e[t];if(l==""){if(t==e.length-1||t==0)continue;for(;o>=i;o--)if(s(t-1,o))return true;return false}else{let t=o>0||o==0&&n?this.nodes[o].type:r&&o>=i?r.node(o-i).type:null;if(!t||t.name!=l&&!t.isInGroup(l))return false;o--}}return true};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function Rt(t){for(let e=t.firstChild,r=null;e;e=e.nextSibling){let t=e.nodeType==1?e.nodeName.toLowerCase():null;if(t&&xt.hasOwnProperty(t)&&r){r.appendChild(e);e=r}else if(t=="li"){r=e}else if(t){r=null}}}function $t(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Ct(t){let e={};for(let r in t)e[r]=t[r];return e}function Lt(t,e){let r=e.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(t))continue;let s=[],o=t=>{s.push(t);for(let r=0;r<t.edgeCount;r++){let{type:n,next:i}=t.edge(r);if(n==e)return true;if(s.indexOf(i)<0&&o(i))return true}};if(o(i.contentMatch))return true}}class Nt{constructor(t,e){this.nodes=t;this.marks=e}serializeFragment(t,e={},r){if(!r)r=Dt(e).createDocumentFragment();let n=r,i=[];t.forEach((t=>{if(i.length||t.marks.length){let r=0,s=0;while(r<i.length&&s<t.marks.length){let e=t.marks[s];if(!this.marks[e.type.name]){s++;continue}if(!e.eq(i[r][0])||e.type.spec.spanning===false)break;r++;s++}while(r<i.length)n=i.pop()[1];while(s<t.marks.length){let r=t.marks[s++];let o=this.serializeMark(r,t.isInline,e);if(o){i.push([r,n]);n.appendChild(o.dom);n=o.contentDOM||o.dom}}}n.appendChild(this.serializeNodeInner(t,e))}));return r}serializeNodeInner(t,e){let{dom:r,contentDOM:n}=_t(Dt(e),this.nodes[t.type.name](t),null,t.attrs);if(n){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,n)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let n=t.marks.length-1;n>=0;n--){let i=this.serializeMark(t.marks[n],t.isInline,e);if(i){(i.contentDOM||i.dom).appendChild(r);r=i.dom}}return r}serializeMark(t,e,r={}){let n=this.marks[t.type.name];return n&&_t(Dt(r),n(t,e),null,t.attrs)}static renderSpec(t,e,r=null,n){return _t(t,e,r,n)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Nt(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=Pt(t.nodes);if(!e.text)e.text=t=>t.text;return e}static marksFromSchema(t){return Pt(t.marks)}}function Pt(t){let e={};for(let r in t){let n=t[r].spec.toDOM;if(n)e[r]=n}return e}function Dt(t){return t.document||window.document}const It=new WeakMap;function Ht(t){let e=It.get(t);if(e===undefined)It.set(t,e=jt(t));return e}function jt(t){let e=null;function r(t){if(t&&typeof t=="object"){if(Array.isArray(t)){if(typeof t[0]=="string"){if(!e)e=[];e.push(t)}else{for(let e=0;e<t.length;e++)r(t[e])}}else{for(let e in t)r(t[e])}}}r(t);return e}function _t(t,e,r,n){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=Ht(n))&&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(" ");if(o>0){r=i.slice(0,o);i=i.slice(o+1)}let l;let u=r?t.createElementNS(r,i):t.createElement(i);let f=e[1],a=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){a=2;for(let t in f)if(f[t]!=null){let e=t.indexOf(" ");if(e>0)u.setAttributeNS(t.slice(0,e),t.slice(e+1),f[t]);else if(t=="style"&&u.style)u.style.cssText=f[t];else u.setAttribute(t,f[t])}}for(let i=a;i<e.length;i++){let s=e[i];if(s===0){if(i<e.length-1||i>a)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:e,contentDOM:i}=_t(t,s,r,n);u.appendChild(e);if(i){if(l)throw new RangeError("Multiple content holes");l=i}}}return{dom:u,contentDOM:l}}const Bt=65535;const zt=Math.pow(2,16);function Ft(t,e){return t+e*zt}function Ut(t){return t&Bt}function qt(t){return(t-(t&Bt))/zt}const Kt=1,Jt=2,Wt=4,Vt=8;class Gt{constructor(t,e,r){this.pos=t;this.delInfo=e;this.recover=r}get deleted(){return(this.delInfo&Vt)>0}get deletedBefore(){return(this.delInfo&(Kt|Wt))>0}get deletedAfter(){return(this.delInfo&(Jt|Wt))>0}get deletedAcross(){return(this.delInfo&Wt)>0}}class Zt{constructor(t,e=false){this.ranges=t;this.inverted=e;if(!t.length&&Zt.empty)return Zt.empty}recover(t){let e=0,r=Ut(t);if(!this.inverted)for(let t=0;t<r;t++)e+=this.ranges[t*3+2]-this.ranges[t*3+1];return this.ranges[r*3]+e+qt(t)}mapResult(t,e=1){return this._map(t,e,false)}map(t,e=1){return this._map(t,e,true)}_map(t,e,r){let n=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?n:0);if(l>t)break;let u=this.ranges[o+i],f=this.ranges[o+s],a=l+u;if(t<=a){let i=!u?e:t==l?-1:t==a?1:e;let s=l+n+(i<0?0:f);if(r)return s;let h=t==(e<0?l:a)?null:Ft(o/3,t-l);let c=t==l?Jt:t==a?Kt:Wt;if(e<0?t!=l:t!=a)c|=Vt;return new Gt(s,c,h)}n+=f-u}return r?t+n:new Gt(t+n,0,null)}touches(t,e){let r=0,n=Ut(e);let i=this.inverted?2:1,s=this.inverted?1:2;for(let e=0;e<this.ranges.length;e+=3){let o=this.ranges[e]-(this.inverted?r:0);if(o>t)break;let l=this.ranges[e+i],u=o+l;if(t<=u&&e==n*3)return true;r+=this.ranges[e+s]-l}return false}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let s=this.ranges[n],o=s-(this.inverted?i:0),l=s+(this.inverted?0:i);let u=this.ranges[n+e],f=this.ranges[n+r];t(o,o+u,l,l+f);i+=f-u}}invert(){return new Zt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Zt.empty:new Zt(t<0?[0,-t,0]:[0,0,t])}}Zt.empty=new Zt([]);class Yt{constructor(t,e,r=0,n=(t?t.length:0)){this.mirror=e;this.from=r;this.to=n;this._maps=t||[];this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new Yt(this._maps,this.mirror,t,e)}appendMap(t,e){if(!this.ownData){this._maps=this._maps.slice();this.mirror=this.mirror&&this.mirror.slice();this.ownData=true}this.to=this._maps.push(t);if(e!=null)this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,r=this._maps.length;e<t._maps.length;e++){let n=t.getMirror(e);this.appendMap(t._maps[e],n!=null&&n<e?r+n:undefined)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){if(!this.mirror)this.mirror=[];this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this._maps.length+t._maps.length;e>=0;e--){let n=t.getMirror(e);this.appendMap(t._maps[e].invert(),n!=null&&n>e?r-n-1:undefined)}}invert(){let t=new Yt;t.appendMappingInverted(this);return t}map(t,e=1){if(this.mirror)return this._map(t,e,true);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,false)}_map(t,e,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this._maps[r],s=i.mapResult(t,e);if(s.recover!=null){let e=this.getMirror(r);if(e!=null&&e>r&&e<this.to){r=e;t=this._maps[e].recover(s.recover);continue}}n|=s.delInfo;t=s.pos}return r?t:new Gt(t,n,null)}}const Xt=Object.create(null);class Qt{getMap(){return Zt.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Xt[e.stepType];if(!r)throw new RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in Xt)throw new RangeError("Duplicate use of step JSON ID "+t);Xt[t]=e;e.prototype.jsonID=t;return e}}class te{constructor(t,e){this.doc=t;this.failed=e}static ok(t){return new te(t,null)}static fail(t){return new te(null,t)}static fromReplace(t,e,r,n){try{return te.ok(t.replace(e,r,n))}catch(t){if(t instanceof S)return te.fail(t.message);throw t}}}function ee(t,e,r){let n=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);if(s.content.size)s=s.copy(ee(s.content,e,s));if(s.isInline)s=e(s,r,i);n.push(s)}return v.fromArray(n)}class re extends Qt{constructor(t,e,r){super();this.from=t;this.to=e;this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from);let n=r.node(r.sharedDepth(this.to));let i=new E(ee(e.content,((t,e)=>{if(!t.isAtom||!e.type.allowsMarkType(this.mark.type))return t;return t.mark(this.mark.addToSet(t.marks))}),n),e.openStart,e.openEnd);return te.fromReplace(t,this.from,this.to,i)}invert(){return new ne(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);if(e.deleted&&r.deleted||e.pos>=r.pos)return null;return new re(e.pos,r.pos,this.mark)}merge(t){if(t instanceof re&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new re(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark);return null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new re(e.from,e.to,t.markFromJSON(e.mark))}}Qt.jsonID("addMark",re);class ne extends Qt{constructor(t,e,r){super();this.from=t;this.to=e;this.mark=r}apply(t){let e=t.slice(this.from,this.to);let r=new E(ee(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return te.fromReplace(t,this.from,this.to,r)}invert(){return new re(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);if(e.deleted&&r.deleted||e.pos>=r.pos)return null;return new ne(e.pos,r.pos,this.mark)}merge(t){if(t instanceof ne&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from)return new ne(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark);return null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ne(e.from,e.to,t.markFromJSON(e.mark))}}Qt.jsonID("removeMark",ne);class ie extends Qt{constructor(t,e){super();this.pos=t;this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return te.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return te.fromReplace(t,this.pos,this.pos+1,new E(v.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let r=0;r<e.marks.length;r++)if(!e.marks[r].isInSet(t))return new ie(this.pos,e.marks[r]);return new ie(this.pos,this.mark)}}return new se(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ie(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ie(e.pos,t.markFromJSON(e.mark))}}Qt.jsonID("addNodeMark",ie);class se extends Qt{constructor(t,e){super();this.pos=t;this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return te.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return te.fromReplace(t,this.pos,this.pos+1,new E(v.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(!e||!this.mark.isInSet(e.marks))return this;return new ie(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new se(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new se(e.pos,t.markFromJSON(e.mark))}}Qt.jsonID("removeNodeMark",se);class oe extends Qt{constructor(t,e,r,n=false){super();this.from=t;this.to=e;this.slice=r;this.structure=n}apply(t){if(this.structure&&ue(t,this.from,this.to))return te.fail("Structure replace would overwrite content");return te.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Zt([this.from,this.to-this.from,this.slice.size])}invert(t){return new oe(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);if(e.deletedAcross&&r.deletedAcross)return null;return new oe(e.pos,Math.max(e.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof oe)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let e=this.slice.size+t.slice.size==0?E.empty:new E(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new oe(this.from,this.to+(t.to-t.from),e,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let e=this.slice.size+t.slice.size==0?E.empty:new E(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new oe(t.from,this.to,e,this.structure)}else{return null}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};if(this.slice.size)t.slice=this.slice.toJSON();if(this.structure)t.structure=true;return t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new oe(e.from,e.to,E.fromJSON(t,e.slice),!!e.structure)}}Qt.jsonID("replace",oe);class le extends Qt{constructor(t,e,r,n,i,s,o=false){super();this.from=t;this.to=e;this.gapFrom=r;this.gapTo=n;this.slice=i;this.insert=s;this.structure=o}apply(t){if(this.structure&&(ue(t,this.from,this.gapFrom)||ue(t,this.gapTo,this.to)))return te.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return te.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);if(!r)return te.fail("Content does not fit in gap");return te.fromReplace(t,this.from,this.to,r)}getMap(){return new Zt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new le(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);let n=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1);let i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);if(e.deletedAcross&&r.deletedAcross||n<e.pos||i>r.pos)return null;return new le(e.pos,r.pos,n,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};if(this.slice.size)t.slice=this.slice.toJSON();if(this.structure)t.structure=true;return t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new le(e.from,e.to,e.gapFrom,e.gapTo,E.fromJSON(t,e.slice),e.insert,!!e.structure)}}Qt.jsonID("replaceAround",le);function ue(t,e,r){let n=t.resolve(e),i=r-e,s=n.depth;while(i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount){s--;i--}if(i>0){let t=n.node(s).maybeChild(n.indexAfter(s));while(i>0){if(!t||t.isLeaf)return true;t=t.firstChild;i--}}return false}function fe(t,e,r,n){let i=[],s=[];let o,l;t.doc.nodesBetween(e,r,((t,u,f)=>{if(!t.isInline)return;let a=t.marks;if(!n.isInSet(a)&&f.type.allowsMarkType(n.type)){let f=Math.max(u,e),h=Math.min(u+t.nodeSize,r);let c=n.addToSet(a);for(let t=0;t<a.length;t++){if(!a[t].isInSet(c)){if(o&&o.to==f&&o.mark.eq(a[t]))o.to=h;else i.push(o=new ne(f,h,a[t]))}}if(l&&l.to==f)l.to=h;else s.push(l=new re(f,h,n))}}));i.forEach((e=>t.step(e)));s.forEach((e=>t.step(e)))}function ae(t,e,r,n){let i=[],s=0;t.doc.nodesBetween(e,r,((t,o)=>{if(!t.isInline)return;s++;let l=null;if(n instanceof pt){let e=t.marks,r;while(r=n.isInSet(e)){(l||(l=[])).push(r);e=r.removeFromSet(e)}}else if(n){if(n.isInSet(t.marks))l=[n]}else{l=t.marks}if(l&&l.length){let n=Math.min(o+t.nodeSize,r);for(let t=0;t<l.length;t++){let r=l[t],u;for(let t=0;t<i.length;t++){let e=i[t];if(e.step==s-1&&r.eq(i[t].style))u=e}if(u){u.to=n;u.step=s}else{i.push({style:r,from:Math.max(o,e),to:n,step:s})}}}}));i.forEach((e=>t.step(new ne(e.from,e.to,e.style))))}function he(t,e,r,n=r.contentMatch,i=true){let s=t.doc.nodeAt(e);let o=[],l=e+1;for(let e=0;e<s.childCount;e++){let u=s.child(e),f=l+u.nodeSize;let a=n.matchType(u.type);if(!a){o.push(new oe(l,f,E.empty))}else{n=a;for(let e=0;e<u.marks.length;e++)if(!r.allowsMarkType(u.marks[e].type))t.step(new ne(l,f,u.marks[e]));if(i&&u.isText&&r.whitespace!="pre"){let t,e=/\r?\n|\r/g,n;while(t=e.exec(u.text)){if(!n)n=new E(v.from(r.schema.text(" ",r.allowedMarks(u.marks))),0,0);o.push(new oe(l+t.index,l+t.index+t[0].length,n))}}}l=f}if(!n.validEnd){let e=n.fillBefore(v.empty,true);t.replace(l,l,new E(e,0,0))}for(let e=o.length-1;e>=0;e--)t.step(o[e])}function ce(t,e,r){return(e==0||t.canReplace(e,t.childCount))&&(r==t.childCount||t.canReplace(0,r))}function de(t){let e=t.parent;let r=e.content.cutByIndex(t.startIndex,t.endIndex);for(let e=t.depth;;--e){let n=t.$from.node(e);let i=t.$from.index(e),s=t.$to.indexAfter(e);if(e<t.depth&&n.canReplace(i,s,r))return e;if(e==0||n.type.spec.isolating||!ce(n,i,s))break}return null}function pe(t,e,r){let{$from:n,$to:i,depth:s}=e;let o=n.before(s+1),l=i.after(s+1);let u=o,f=l;let a=v.empty,h=0;for(let t=s,e=false;t>r;t--)if(e||n.index(t)>0){e=true;a=v.from(n.node(t).copy(a));h++}else{u--}let c=v.empty,d=0;for(let t=s,e=false;t>r;t--)if(e||i.after(t+1)<i.end(t)){e=true;c=v.from(i.node(t).copy(c));d++}else{f++}t.step(new le(u,f,o,l,new E(a.append(c),h,d),a.size-h,true))}function me(t,e,r=null,n=t){let i=we(t,e);let s=i&&be(n,e);if(!s)return null;return i.map(ge).concat({type:e,attrs:r}).concat(s.map(ge))}function ge(t){return{type:t,attrs:null}}function we(t,e){let{parent:r,startIndex:n,endIndex:i}=t;let s=r.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return r.canReplaceWith(n,i,o)?s:null}function be(t,e){let{parent:r,startIndex:n,endIndex:i}=t;let s=r.child(n);let o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=o.length?o[o.length-1]:e;let u=l.contentMatch;for(let t=n;u&&t<i;t++)u=u.matchType(r.child(t).type);if(!u||!u.validEnd)return null;return o}function ve(t,e,r){let n=v.empty;for(let t=r.length-1;t>=0;t--){if(n.size){let e=r[t].type.contentMatch.matchFragment(n);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=v.from(r[t].type.create(r[t].attrs,n))}let i=e.start,s=e.end;t.step(new le(i,s,i,s,new E(n,0,0),r.length,true))}function ye(t,e,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,r,((e,r)=>{let o=typeof i=="function"?i(e):i;if(e.isTextblock&&!e.hasMarkup(n,o)&&Me(t.doc,t.mapping.slice(s).map(r),n)){let i=null;if(n.schema.linebreakReplacement){let t=n.whitespace=="pre",e=!!n.contentMatch.matchType(n.schema.linebreakReplacement);if(t&&!e)i=false;else if(!t&&e)i=true}if(i===false)xe(t,e,r,s);he(t,t.mapping.slice(s).map(r,1),n,undefined,i===null);let l=t.mapping.slice(s);let u=l.map(r,1),f=l.map(r+e.nodeSize,1);t.step(new le(u,f,u+1,f-1,new E(v.from(n.create(o,null,e.marks)),0,0),1,true));if(i===true)ke(t,e,r,s);return false}}))}function ke(t,e,r,n){e.forEach(((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;while(o=l.exec(i.text)){let i=t.mapping.slice(n).map(r+1+s+o.index);t.replaceWith(i,i+1,e.type.schema.linebreakReplacement.create())}}}))}function xe(t,e,r,n){e.forEach(((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let i=t.mapping.slice(n).map(r+1+s);t.replaceWith(i,i+1,e.type.schema.text("\n"))}}))}function Me(t,e,r){let n=t.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}function Se(t,e,r,n,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");if(!r)r=s.type;let o=r.create(n,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!r.validContent(s.content))throw new RangeError("Invalid content for node type "+r.name);t.step(new le(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new E(v.from(o),0,0),1,true))}function Ee(t,e,r=1,n){let i=t.resolve(e),s=i.depth-r;let o=n&&n[n.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 false;for(let t=i.depth-1,e=r-2;t>s;t--,e--){let r=i.node(t),s=i.index(t);if(r.type.spec.isolating)return false;let o=r.content.cutByIndex(s,r.childCount);let l=n&&n[e+1];if(l)o=o.replaceChild(0,l.type.create(l.attrs));let u=n&&n[e]||r;if(!r.canReplace(s+1,r.childCount)||!u.type.validContent(o))return false}let l=i.indexAfter(s);let u=n&&n[0];return i.node(s).canReplaceWith(l,l,u?u.type:i.node(s+1).type)}function Te(t,e,r=1,n){let i=t.doc.resolve(e),s=v.empty,o=v.empty;for(let t=i.depth,e=i.depth-r,l=r-1;t>e;t--,l--){s=v.from(i.node(t).copy(s));let e=n&&n[l];o=v.from(e?e.type.create(e.attrs,o):i.node(t).copy(o))}t.step(new oe(e,e,new E(s.append(o),r,r),true))}function Ae(t,e){let r=t.resolve(e),n=r.index();return Re(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function Oe(t,e){if(!e.content.size)t.type.compatibleContent(e.type);let r=t.contentMatchAt(t.childCount);let{linebreakReplacement:n}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i);let o=s.type==n?t.type.schema.nodes.text:s.type;r=r.matchType(o);if(!r)return false;if(!t.type.allowsMarks(s.marks))return false}return r.validEnd}function Re(t,e){return!!(t&&e&&!t.isLeaf&&Oe(t,e))}function $e(t,e,r=-1){let n=t.resolve(e);for(let t=n.depth;;t--){let i,s,o=n.index(t);if(t==n.depth){i=n.nodeBefore;s=n.nodeAfter}else if(r>0){i=n.node(t+1);o++;s=n.node(t).maybeChild(o)}else{i=n.node(t).maybeChild(o-1);s=n.node(t+1)}if(i&&!i.isTextblock&&Re(i,s)&&n.node(t).canReplace(o,o+1))return e;if(t==0)break;e=r<0?n.before(t):n.after(t)}}function Ce(t,e,r){let n=null;let{linebreakReplacement:i}=t.doc.type.schema;let s=t.doc.resolve(e-r),o=s.node().type;if(i&&o.inlineContent){let t=o.whitespace=="pre";let e=!!o.contentMatch.matchType(i);if(t&&!e)n=false;else if(!t&&e)n=true}let l=t.steps.length;if(n===false){let n=t.doc.resolve(e+r);xe(t,n.node(),n.before(),l)}if(o.inlineContent)he(t,e+r-1,o,s.node().contentMatchAt(s.index()),n==null);let u=t.mapping.slice(l),f=u.map(e-r);t.step(new oe(f,u.map(e+r,-1),E.empty,true));if(n===true){let e=t.doc.resolve(f);ke(t,e.node(),e.before(),t.steps.length)}return t}function Le(t,e,r){let n=t.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),r))return e;if(n.parentOffset==0)for(let t=n.depth-1;t>=0;t--){let e=n.index(t);if(n.node(t).canReplaceWith(e,e,r))return n.before(t+1);if(e>0)return null}if(n.parentOffset==n.parent.content.size)for(let t=n.depth-1;t>=0;t--){let e=n.indexAfter(t);if(n.node(t).canReplaceWith(e,e,r))return n.after(t+1);if(e<n.node(t).childCount)return null}return null}function Ne(t,e,r){let n=t.resolve(e);if(!r.content.size)return e;let i=r.content;for(let t=0;t<r.openStart;t++)i=i.firstChild.content;for(let t=1;t<=(r.openStart==0&&r.size?2:1);t++){for(let e=n.depth;e>=0;e--){let r=e==n.depth?0:n.pos<=(n.start(e+1)+n.end(e+1))/2?-1:1;let s=n.index(e)+(r>0?1:0);let o=n.node(e),l=false;if(t==1){l=o.canReplace(s,s,i)}else{let t=o.contentMatchAt(s).findWrapping(i.firstChild.type);l=t&&o.canReplaceWith(s,s,t[0])}if(l)return r==0?n.pos:r<0?n.before(e+1):n.after(e+1)}}return null}function Pe(t,e,r=e,n=E.empty){if(e==r&&!n.size)return null;let i=t.resolve(e),s=t.resolve(r);if(De(i,s,n))return new oe(e,r,n);return new Ie(i,s,n).fit()}function De(t,e,r){return!r.openStart&&!r.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),r.content)}class Ie{constructor(t,e,r){this.$from=t;this.$to=e;this.unplaced=r;this.frontier=[];this.placed=v.empty;for(let e=0;e<=t.depth;e++){let r=t.node(e);this.frontier.push({type:r.type,match:r.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=v.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){while(this.unplaced.size){let t=this.findFittable();if(t)this.placeNodes(t);else this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth;let r=this.$from,n=this.close(t<0?this.$to:r.doc.resolve(t));if(!n)return null;let i=this.placed,s=r.depth,o=n.depth;while(s&&o&&i.childCount==1){i=i.firstChild.content;s--;o--}let l=new E(i,s,o);if(t>-1)return new le(r.pos,t,this.$to.pos,this.$to.end(),l,e);if(l.size||r.pos!=this.$to.pos)return new oe(r.pos,n.pos,l);return null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,n=this.unplaced.openEnd;r<t;r++){let i=e.firstChild;if(e.childCount>1)n=0;if(i.type.spec.isolating&&n<=r){t=r;break}e=i.content}for(let e=1;e<=2;e++){for(let r=e==1?t:this.unplaced.openStart;r>=0;r--){let t,n=null;if(r){n=_e(this.unplaced.content,r-1).firstChild;t=n.content}else{t=this.unplaced.content}let i=t.firstChild;for(let t=this.depth;t>=0;t--){let{type:s,match:o}=this.frontier[t],l,u=null;if(e==1&&(i?o.matchType(i.type)||(u=o.fillBefore(v.from(i),false)):n&&s.compatibleContent(n.type)))return{sliceDepth:r,frontierDepth:t,parent:n,inject:u};else if(e==2&&i&&(l=o.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:t,parent:n,wrap:l};if(n&&o.matchType(n.type))break}}}}openMore(){let{content:t,openStart:e,openEnd:r}=this.unplaced;let n=_e(t,e);if(!n.childCount||n.firstChild.isLeaf)return false;this.unplaced=new E(t,e+1,Math.max(r,n.size+e>=t.size-r?e+1:0));return true}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced;let n=_e(t,e);if(n.childCount<=1&&e>0){let i=t.size-e<=e+n.size;this.unplaced=new E(He(t,e-1,1),e-1,i?e-1:r)}else{this.unplaced=new E(He(t,e,1),e,r)}}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:n,wrap:i}){while(this.depth>e)this.closeFrontierNode();if(i)for(let t=0;t<i.length;t++)this.openFrontierNode(i[t]);let s=this.unplaced,o=r?r.content:s.content;let l=s.openStart-t;let u=0,f=[];let{match:a,type:h}=this.frontier[e];if(n){for(let t=0;t<n.childCount;t++)f.push(n.child(t));a=a.matchFragment(n)}let c=o.size+t-(s.content.size-s.openEnd);while(u<o.childCount){let t=o.child(u),e=a.matchType(t.type);if(!e)break;u++;if(u>1||l==0||t.content.size){a=e;f.push(Be(t.mark(h.allowedMarks(t.marks)),u==1?l:0,u==o.childCount?c:-1))}}let d=u==o.childCount;if(!d)c=-1;this.placed=je(this.placed,e,v.from(f));this.frontier[e].match=a;if(d&&c<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1)this.closeFrontierNode();for(let t=0,e=o;t<c;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)});e=t.content}this.unplaced=!d?new E(He(s.content,t,u),s.openStart,s.openEnd):t==0?E.empty:new E(He(s.content,t-1,1),t-1,c<0?s.openEnd:t-1)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],e;if(!t.type.isTextblock||!ze(this.$to,this.$to.depth,t.type,t.match,false)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:r}=this.$to,n=this.$to.after(r);while(r>1&&n==this.$to.end(--r))++n;return n}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:n}=this.frontier[e];let i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1));let s=ze(t,e,n,r,i);if(!s)continue;for(let r=e-1;r>=0;r--){let{match:e,type:n}=this.frontier[r];let i=ze(t,r,n,e,true);if(!i||i.childCount)continue t}return{depth:e,fit:s,move:i?t.doc.resolve(t.after(e+1)):t}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;while(this.depth>e.depth)this.closeFrontierNode();if(e.fit.childCount)this.placed=je(this.placed,e.depth,e.fit);t=e.move;for(let r=e.depth+1;r<=t.depth;r++){let e=t.node(r),n=e.type.contentMatch.fillBefore(e.content,true,t.index(r));this.openFrontierNode(e.type,e.attrs,n)}return t}openFrontierNode(t,e=null,r){let n=this.frontier[this.depth];n.match=n.match.matchType(t);this.placed=je(this.placed,this.depth,v.from(t.create(e,r)));this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop();let e=t.match.fillBefore(v.empty,true);if(e.childCount)this.placed=je(this.placed,this.frontier.length,e)}}function He(t,e,r){if(e==0)return t.cutByIndex(r,t.childCount);return t.replaceChild(0,t.firstChild.copy(He(t.firstChild.content,e-1,r)))}function je(t,e,r){if(e==0)return t.append(r);return t.replaceChild(t.childCount-1,t.lastChild.copy(je(t.lastChild.content,e-1,r)))}function _e(t,e){for(let r=0;r<e;r++)t=t.firstChild.content;return t}function Be(t,e,r){if(e<=0)return t;let n=t.content;if(e>1)n=n.replaceChild(0,Be(n.firstChild,e-1,n.childCount==1?r-1:0));if(e>0){n=t.type.contentMatch.fillBefore(n).append(n);if(r<=0)n=n.append(t.type.contentMatch.matchFragment(n).fillBefore(v.empty,true))}return t.copy(n)}function ze(t,e,r,n,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!r.compatibleContent(s.type))return null;let l=n.fillBefore(s.content,true,o);return l&&!Fe(r,s.content,o)?l:null}function Fe(t,e,r){for(let n=r;n<e.childCount;n++)if(!t.allowsMarks(e.child(n).marks))return true;return false}function Ue(t){return t.spec.defining||t.spec.definingForContent}function qe(t,e,r,n){if(!n.size)return t.deleteRange(e,r);let i=t.doc.resolve(e),s=t.doc.resolve(r);if(De(i,s,n))return t.step(new oe(e,r,n));let o=Ve(i,t.doc.resolve(r));if(o[o.length-1]==0)o.pop();let l=-(i.depth+1);o.unshift(l);for(let t=i.depth,e=i.pos-1;t>0;t--,e--){let r=i.node(t).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;if(o.indexOf(t)>-1)l=t;else if(i.before(t)==e)o.splice(1,0,-t)}let u=o.indexOf(l);let f=[],a=n.openStart;for(let t=n.content,e=0;;e++){let r=t.firstChild;f.push(r);if(e==n.openStart)break;t=r.content}for(let t=a-1;t>=0;t--){let e=f[t],r=Ue(e.type);if(r&&!e.sameMarkup(i.node(Math.abs(l)-1)))a=t;else if(r||!e.type.isTextblock)break}for(let e=n.openStart;e>=0;e--){let l=(e+a+1)%(n.openStart+1);let h=f[l];if(!h)continue;for(let e=0;e<o.length;e++){let f=o[(e+u)%o.length],a=true;if(f<0){a=false;f=-f}let c=i.node(f-1),d=i.index(f-1);if(c.canReplaceWith(d,d,h.type,h.marks))return t.replace(i.before(f),a?s.after(f):r,new E(Ke(n.content,0,n.openStart,l),l,n.openEnd))}}let h=t.steps.length;for(let l=o.length-1;l>=0;l--){t.replace(e,r,n);if(t.steps.length>h)break;let u=o[l];if(u<0)continue;e=i.before(u);r=s.after(u)}}function Ke(t,e,r,n,i){if(e<r){let i=t.firstChild;t=t.replaceChild(0,i.copy(Ke(i.content,e+1,r,n,i)))}if(e>n){let e=i.contentMatchAt(0);let r=e.fillBefore(t).append(t);t=r.append(e.matchFragment(r).fillBefore(v.empty,true))}return t}function Je(t,e,r,n){if(!n.isInline&&e==r&&t.doc.resolve(e).parent.content.size){let i=Le(t.doc,e,n.type);if(i!=null)e=r=i}t.replaceRange(e,r,new E(v.from(n),0,0))}function We(t,e,r){let n=t.doc.resolve(e),i=t.doc.resolve(r);let s=Ve(n,i);for(let e=0;e<s.length;e++){let r=s[e],o=e==s.length-1;if(o&&r==0||n.node(r).type.contentMatch.validEnd)return t.delete(n.start(r),i.end(r));if(r>0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return t.delete(n.before(r),i.after(r))}for(let s=1;s<=n.depth&&s<=i.depth;s++){if(e-n.start(s)==n.depth-s&&r>n.end(s)&&i.end(s)-r!=i.depth-s&&n.start(s-1)==i.start(s-1)&&n.node(s-1).canReplace(n.index(s-1),i.index(s-1)))return t.delete(n.before(s),r)}t.delete(e,r)}function Ve(t,e){let r=[],n=Math.min(t.depth,e.depth);for(let i=n;i>=0;i--){let n=t.start(i);if(n<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;if(n==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==n-1)r.push(i)}return r}class Ge extends Qt{constructor(t,e,r){super();this.pos=t;this.attr=e;this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return te.fail("No node at attribute step's position");let r=Object.create(null);for(let t in e.attrs)r[t]=e.attrs[t];r[this.attr]=this.value;let n=e.type.create(r,null,e.marks);return te.fromReplace(t,this.pos,this.pos+1,new E(v.from(n),0,e.isLeaf?0:1))}getMap(){return Zt.empty}invert(t){return new Ge(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ge(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ge(e.pos,e.attr,e.value)}}Qt.jsonID("attr",Ge);class Ze extends Qt{constructor(t,e){super();this.attr=t;this.value=e}apply(t){let e=Object.create(null);for(let r in t.attrs)e[r]=t.attrs[r];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return te.ok(r)}getMap(){return Zt.empty}invert(t){return new Ze(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ze(e.attr,e.value)}}Qt.jsonID("docAttr",Ze);let Ye=class extends Error{};Ye=function t(e){let r=Error.call(this,e);r.__proto__=t.prototype;return r};Ye.prototype=Object.create(Error.prototype);Ye.prototype.constructor=Ye;Ye.prototype.name="TransformError";class Xe{constructor(t){this.doc=t;this.steps=[];this.docs=[];this.mapping=new Yt}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Ye(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);if(!e.failed)this.addStep(t,e.doc);return e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc);this.steps.push(t);this.mapping.appendMap(t.getMap());this.doc=e}replace(t,e=t,r=E.empty){let n=Pe(this.doc,t,e,r);if(n)this.step(n);return this}replaceWith(t,e,r){return this.replace(t,e,new E(v.from(r),0,0))}delete(t,e){return this.replace(t,e,E.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){qe(this,t,e,r);return this}replaceRangeWith(t,e,r){Je(this,t,e,r);return this}deleteRange(t,e){We(this,t,e);return this}lift(t,e){pe(this,t,e);return this}join(t,e=1){Ce(this,t,e);return this}wrap(t,e){ve(this,t,e);return this}setBlockType(t,e=t,r,n=null){ye(this,t,e,r,n);return this}setNodeMarkup(t,e,r=null,n){Se(this,t,e,r,n);return this}setNodeAttribute(t,e,r){this.step(new Ge(t,e,r));return this}setDocAttribute(t,e){this.step(new Ze(t,e));return this}addNodeMark(t,e){this.step(new ie(t,e));return this}removeNodeMark(t,e){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(e instanceof M){if(e.isInSet(r.marks))this.step(new se(t,e))}else{let n=r.marks,i,s=[];while(i=e.isInSet(n)){s.push(new se(t,i));n=i.removeFromSet(n)}for(let t=s.length-1;t>=0;t--)this.step(s[t])}return this}split(t,e=1,r){Te(this,t,e,r);return this}addMark(t,e,r){fe(this,t,e,r);return this}removeMark(t,e,r){ae(this,t,e,r);return this}clearIncompatible(t,e,r){he(this,t,e,r);return this}}const Qe=Object.create(null);class tr{constructor(t,e,r){this.$anchor=t;this.$head=e;this.ranges=r||[new er(t.min(e),t.max(e))]}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 t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return false;return true}content(){return this.$from.doc.slice(this.from,this.to,true)}replace(t,e=E.empty){let r=e.content.lastChild,n=null;for(let t=0;t<e.openEnd;t++){n=r;r=r.lastChild}let i=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:u}=s[o],f=t.mapping.slice(i);t.replaceRange(f.map(l.pos),f.map(u.pos),o?E.empty:e);if(o==0)hr(t,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(t,e){let r=t.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:s,$to:o}=n[i],l=t.mapping.slice(r);let u=l.map(s.pos),f=l.map(o.pos);if(i){t.deleteRange(u,f)}else{t.replaceRangeWith(u,f,e);hr(t,r,e.isInline?-1:1)}}}static findFrom(t,e,r=false){let n=t.parent.inlineContent?new ir(t):ar(t.node(0),t.parent,t.pos,t.index(),e,r);if(n)return n;for(let n=t.depth-1;n>=0;n--){let i=e<0?ar(t.node(0),t.node(n),t.before(n+1),t.index(n),e,r):ar(t.node(0),t.node(n),t.after(n+1),t.index(n)+1,e,r);if(i)return i}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new ur(t.node(0))}static atStart(t){return ar(t,t,0,0,1)||new ur(t)}static atEnd(t){return ar(t,t,t.content.size,t.childCount,-1)||new ur(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Qe[e.type];if(!r)throw new RangeError(`No selection type ${e.type} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in Qe)throw new RangeError("Duplicate use of selection JSON ID "+t);Qe[t]=e;e.prototype.jsonID=t;return e}getBookmark(){return ir.between(this.$anchor,this.$head).getBookmark()}}tr.prototype.visible=true;class er{constructor(t,e){this.$from=t;this.$to=e}}let rr=false;function nr(t){if(!rr&&!t.parent.inlineContent){rr=true;console["warn"]("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")")}}class ir extends tr{constructor(t,e=t){nr(t);nr(e);super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let r=t.resolve(e.map(this.head));if(!r.parent.inlineContent)return tr.near(r);let n=t.resolve(e.map(this.anchor));return new ir(n.parent.inlineContent?n:r,r)}replace(t,e=E.empty){super.replace(t,e);if(e==E.empty){let e=this.$from.marksAcross(this.$to);if(e)t.ensureMarks(e)}}eq(t){return t instanceof ir&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new sr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if(typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ir(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){let n=t.resolve(e);return new this(n,r==e?n:t.resolve(r))}static between(t,e,r){let n=t.pos-e.pos;if(!r||n)r=n>=0?1:-1;if(!e.parent.inlineContent){let t=tr.findFrom(e,r,true)||tr.findFrom(e,-r,true);if(t)e=t.$head;else return tr.near(e,r)}if(!t.parent.inlineContent){if(n==0){t=e}else{t=(tr.findFrom(t,-r,true)||tr.findFrom(t,r,true)).$anchor;if(t.pos<e.pos!=n<0)t=e}}return new ir(t,e)}}tr.jsonID("text",ir);class sr{constructor(t,e){this.anchor=t;this.head=e}map(t){return new sr(t.map(this.anchor),t.map(this.head))}resolve(t){return ir.between(t.resolve(this.anchor),t.resolve(this.head))}}class or extends tr{constructor(t){let e=t.nodeAfter;let r=t.node(0).resolve(t.pos+e.nodeSize);super(t,r);this.node=e}map(t,e){let{deleted:r,pos:n}=e.mapResult(this.anchor);let i=t.resolve(n);if(r)return tr.near(i);return new or(i)}content(){return new E(v.from(this.node),0,0)}eq(t){return t instanceof or&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new lr(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new or(t.resolve(e.anchor))}static create(t,e){return new or(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==false}}or.prototype.visible=false;tr.jsonID("node",or);class lr{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new sr(r,r):new lr(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;if(r&&or.isSelectable(r))return new or(e);return tr.near(e)}}class ur extends tr{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=E.empty){if(e==E.empty){t.delete(0,t.doc.content.size);let e=tr.atStart(t.doc);if(!e.eq(t.selection))t.setSelection(e)}else{super.replace(t,e)}}toJSON(){return{type:"all"}}static fromJSON(t){return new ur(t)}map(t){return new ur(t)}eq(t){return t instanceof ur}getBookmark(){return fr}}tr.jsonID("all",ur);const fr={map(){return this},resolve(t){return new ur(t)}};function ar(t,e,r,n,i,s=false){if(e.inlineContent)return ir.create(t,r);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let n=e.child(o);if(!n.isAtom){let e=ar(t,n,r+i,i<0?n.childCount:0,i,s);if(e)return e}else if(!s&&or.isSelectable(n)){return or.create(t,r-(i<0?n.nodeSize:0))}r+=n.nodeSize*i}return null}function hr(t,e,r){let n=t.steps.length-1;if(n<e)return;let i=t.steps[n];if(!(i instanceof oe||i instanceof le))return;let s=t.mapping.maps[n],o;s.forEach(((t,e,r,n)=>{if(o==null)o=n}));t.setSelection(tr.near(t.doc.resolve(o),r))}const cr=1,dr=2,pr=4;class mr extends Xe{constructor(t){super(t.doc);this.curSelectionFor=0;this.updated=0;this.meta=Object.create(null);this.time=Date.now();this.curSelection=t.selection;this.storedMarks=t.storedMarks}get selection(){if(this.curSelectionFor<this.steps.length){this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor));this.curSelectionFor=this.steps.length}return this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");this.curSelection=t;this.curSelectionFor=this.steps.length;this.updated=(this.updated|cr)&~dr;this.storedMarks=null;return this}get selectionSet(){return(this.updated&cr)>0}setStoredMarks(t){this.storedMarks=t;this.updated|=dr;return this}ensureMarks(t){if(!M.sameSet(this.storedMarks||this.selection.$from.marks(),t))this.setStoredMarks(t);return this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&dr)>0}addStep(t,e){super.addStep(t,e);this.updated=this.updated&~dr;this.storedMarks=null}setTime(t){this.time=t;return this}replaceSelection(t){this.selection.replace(this,t);return this}replaceSelectionWith(t,e=true){let r=this.selection;if(e)t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||M.none));r.replaceWith(this,t);return this}deleteSelection(){this.selection.replace(this);return this}insertText(t,e,r){let n=this.doc.type.schema;if(e==null){if(!t)return this.deleteSelection();return this.replaceSelectionWith(n.text(t),true)}else{if(r==null)r=e;r=r==null?e:r;if(!t)return this.deleteRange(e,r);let i=this.storedMarks;if(!i){let t=this.doc.resolve(e);i=r==e?t.marks():t.marksAcross(this.doc.resolve(r))}this.replaceRangeWith(e,r,n.text(t,i));if(!this.selection.empty)this.setSelection(tr.near(this.selection.$to));return this}}setMeta(t,e){this.meta[typeof t=="string"?t:t.key]=e;return this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return false;return true}scrollIntoView(){this.updated|=pr;return this}get scrolledIntoView(){return(this.updated&pr)>0}}function gr(t,e){return!e||!t?t:t.bind(e)}class wr{constructor(t,e,r){this.name=t;this.init=gr(e.init,r);this.apply=gr(e.apply,r)}}const br=[new wr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new wr("selection",{init(t,e){return t.selection||tr.atStart(e.doc)},apply(t){return t.selection}}),new wr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,r,n){return n.selection.$cursor?t.storedMarks:null}}),new wr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class vr{constructor(t,e){this.schema=t;this.plugins=[];this.pluginsByKey=Object.create(null);this.fields=br.slice();if(e)e.forEach((t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t);this.pluginsByKey[t.key]=t;if(t.spec.state)this.fields.push(new wr(t.key,t.spec.state,t))}))}}class yr{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=e){let e=this.config.plugins[r];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return false}return true}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],r=this.applyInner(t),n=null;for(;;){let i=false;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=n?n[s].n:0,u=n?n[s].state:this;let f=l<e.length&&o.spec.appendTransaction.call(o,l?e.slice(l):e,u,r);if(f&&r.filterTransaction(f,s)){f.setMeta("appendedTransaction",t);if(!n){n=[];for(let t=0;t<this.config.plugins.length;t++)n.push(t<s?{state:r,n:e.length}:{state:this,n:0})}e.push(f);r=r.applyInner(f);i=true}if(n)n[s]={state:r,n:e.length}}}if(!i)return{state:r,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new yr(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let i=r[n];e[i.name]=i.apply(t,this[i.name],this,e)}return e}get tr(){return new mr(this)}static create(t){let e=new vr(t.doc?t.doc.type.schema:t.schema,t.plugins);let r=new yr(e);for(let n=0;n<e.fields.length;n++)r[e.fields[n].name]=e.fields[n].init(t,r);return r}reconfigure(t){let e=new vr(this.schema,t.plugins);let r=e.fields,n=new yr(e);for(let e=0;e<r.length;e++){let i=r[e].name;n[i]=this.hasOwnProperty(i)?this[i]:r[e].init(t,n)}return n}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks)e.storedMarks=this.storedMarks.map((t=>t.toJSON()));if(t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=t[r],i=n.spec.state;if(i&&i.toJSON)e[r]=i.toJSON.call(n,this[n.key])}return e}static fromJSON(t,e,r){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let n=new vr(t.schema,t.plugins);let i=new yr(n);n.fields.forEach((n=>{if(n.name=="doc"){i.doc=q.fromJSON(t.schema,e.doc)}else if(n.name=="selection"){i.selection=tr.fromJSON(i.doc,e.selection)}else if(n.name=="storedMarks"){if(e.storedMarks)i.storedMarks=e.storedMarks.map(t.schema.markFromJSON)}else{if(r)for(let s in r){let o=r[s],l=o.spec.state;if(o.key==n.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(e,s)){i[n.name]=l.fromJSON.call(o,t,e[s],i);return}}i[n.name]=n.init(t,i)}}));return i}}function kr(t,e,r){for(let n in t){let i=t[n];if(i instanceof Function)i=i.bind(e);else if(n=="handleDOMEvents")i=kr(i,e,{});r[n]=i}return r}class xr{constructor(t){this.spec=t;this.props={};if(t.props)kr(t.props,this,this.props);this.key=t.key?t.key.key:Sr("plugin")}getState(t){return t[this.key]}}const Mr=Object.create(null);function Sr(t){if(t in Mr)return t+"$"+ ++Mr[t];Mr[t]=0;return t+"$"}class Er{constructor(t="key"){this.key=Sr(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Tr=function(t){for(var e=0;;e++){t=t.previousSibling;if(!t)return e}};const Ar=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Or=null;const Rr=function(t,e,r){let n=Or||(Or=document.createRange());n.setEnd(t,r==null?t.nodeValue.length:r);n.setStart(t,e||0);return n};const $r=function(){Or=null};const Cr=function(t,e,r,n){return r&&(Nr(t,e,r,n,-1)||Nr(t,e,r,n,1))};const Lr=/^(img|br|input|textarea|hr)$/i;function Nr(t,e,r,n,i){var s;for(;;){if(t==r&&e==n)return true;if(e==(i<0?0:Pr(t))){let r=t.parentNode;if(!r||r.nodeType!=1||jr(t)||Lr.test(t.nodeName)||t.contentEditable=="false")return false;e=Tr(t)+(i<0?0:1);t=r}else if(t.nodeType==1){let r=t.childNodes[e+(i<0?-1:0)];if(r.nodeType==1&&r.contentEditable=="false"){if((s=r.pmViewDesc)===null||s===void 0?void 0:s.ignoreForSelection)e+=i;else return false}else{t=r;e=i<0?Pr(t):0}}else{return false}}}function Pr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Dr(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=Pr(t)}else if(t.parentNode&&!jr(t)){e=Tr(t);t=t.parentNode}else{return null}}}function Ir(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&&!jr(t)){e=Tr(t)+1;t=t.parentNode}else{return null}}}function Hr(t,e,r){for(let n=e==0,i=e==Pr(t);n||i;){if(t==r)return true;let e=Tr(t);t=t.parentNode;if(!t)return false;n=n&&e==0;i=i&&e==Pr(t)}}function jr(t){let e;for(let r=t;r;r=r.parentNode)if(e=r.pmViewDesc)break;return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const _r=function(t){return t.focusNode&&Cr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Br(t,e){let r=document.createEvent("Event");r.initEvent("keydown",true,true);r.keyCode=t;r.key=r.code=e;return r}function zr(t){let e=t.activeElement;while(e&&e.shadowRoot)e=e.shadowRoot.activeElement;return e}function Fr(t,e,r){if(t.caretPositionFromPoint){try{let n=t.caretPositionFromPoint(e,r);if(n)return{node:n.offsetNode,offset:Math.min(Pr(n.offsetNode),n.offset)}}catch(t){}}if(t.caretRangeFromPoint){let n=t.caretRangeFromPoint(e,r);if(n)return{node:n.startContainer,offset:Math.min(Pr(n.startContainer),n.startOffset)}}}const Ur=typeof navigator!="undefined"?navigator:null;const qr=typeof document!="undefined"?document:null;const Kr=Ur&&Ur.userAgent||"";const Jr=/Edge\/(\d+)/.exec(Kr);const Wr=/MSIE \d/.exec(Kr);const Vr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kr);const Gr=!!(Wr||Vr||Jr);const Zr=Wr?document.documentMode:Vr?+Vr[1]:Jr?+Jr[1]:0;const Yr=!Gr&&/gecko\/(\d+)/i.test(Kr);Yr&&+(/Firefox\/(\d+)/.exec(Kr)||[0,0])[1];const Xr=!Gr&&/Chrome\/(\d+)/.exec(Kr);const Qr=!!Xr;const tn=Xr?+Xr[1]:0;const en=!Gr&&!!Ur&&/Apple Computer/.test(Ur.vendor);const rn=en&&(/Mobile\/\w+/.test(Kr)||!!Ur&&Ur.maxTouchPoints>2);const nn=rn||(Ur?/Mac/.test(Ur.platform):false);const sn=Ur?/Win/.test(Ur.platform):false;const on=/Android \d/.test(Kr);const ln=!!qr&&"webkitFontSmoothing"in qr.documentElement.style;const un=ln?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function fn(t){let e=t.defaultView&&t.defaultView.visualViewport;if(e)return{left:0,right:e.width,top:0,bottom:e.height};return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function an(t,e){return typeof t=="number"?t:t[e]}function hn(t){let e=t.getBoundingClientRect();let r=e.width/t.offsetWidth||1;let n=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*r,top:e.top,bottom:e.top+t.clientHeight*n}}function cn(t,e,r){let n=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5;let s=t.dom.ownerDocument;for(let o=r||t.dom;;){if(!o)break;if(o.nodeType!=1){o=Ar(o);continue}let t=o;let r=t==s.body;let l=r?fn(s):hn(t);let u=0,f=0;if(e.top<l.top+an(n,"top"))f=-(l.top-e.top+an(i,"top"));else if(e.bottom>l.bottom-an(n,"bottom"))f=e.bottom-e.top>l.bottom-l.top?e.top+an(i,"top")-l.top:e.bottom-l.bottom+an(i,"bottom");if(e.left<l.left+an(n,"left"))u=-(l.left-e.left+an(i,"left"));else if(e.right>l.right-an(n,"right"))u=e.right-l.right+an(i,"right");if(u||f){if(r){s.defaultView.scrollBy(u,f)}else{let r=t.scrollLeft,n=t.scrollTop;if(f)t.scrollTop+=f;if(u)t.scrollLeft+=u;let i=t.scrollLeft-r,s=t.scrollTop-n;e={left:e.left-i,top:e.top-s,right:e.right-i,bottom:e.bottom-s}}}let a=r?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(a))break;o=a=="absolute"?o.offsetParent:Ar(o)}}function dn(t){let e=t.dom.getBoundingClientRect(),r=Math.max(0,e.top);let n,i;for(let s=(e.left+e.right)/2,o=r+1;o<Math.min(innerHeight,e.bottom);o+=5){let e=t.root.elementFromPoint(s,o);if(!e||e==t.dom||!t.dom.contains(e))continue;let l=e.getBoundingClientRect();if(l.top>=r-20){n=e;i=l.top;break}}return{refDOM:n,refTop:i,stack:pn(t.dom)}}function pn(t){let e=[],r=t.ownerDocument;for(let n=t;n;n=Ar(n)){e.push({dom:n,top:n.scrollTop,left:n.scrollLeft});if(t==r)break}return e}function mn({refDOM:t,refTop:e,stack:r}){let n=t?t.getBoundingClientRect().top:0;gn(r,n==0?0:n-e)}function gn(t,e){for(let r=0;r<t.length;r++){let{dom:n,top:i,left:s}=t[r];if(n.scrollTop!=i+e)n.scrollTop=i+e;if(n.scrollLeft!=s)n.scrollLeft=s}}let wn=null;function bn(t){if(t.setActive)return t.setActive();if(wn)return t.focus(wn);let e=pn(t);t.focus(wn==null?{get preventScroll(){wn={preventScroll:true};return true}}:undefined);if(!wn){wn=false;gn(e,0)}}function vn(t,e){let r,n=2e8,i,s=0;let o=e.top,l=e.top;let u,f;for(let a=t.firstChild,h=0;a;a=a.nextSibling,h++){let t;if(a.nodeType==1)t=a.getClientRects();else if(a.nodeType==3)t=Rr(a).getClientRects();else continue;for(let c=0;c<t.length;c++){let d=t[c];if(d.top<=o&&d.bottom>=l){o=Math.max(d.bottom,o);l=Math.min(d.top,l);let t=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(t<n){r=a;n=t;i=t&&r.nodeType==3?{left:d.right<e.left?d.right:d.left,top:e.top}:e;if(a.nodeType==1&&t)s=h+(e.left>=(d.left+d.right)/2?1:0);continue}}else if(d.top>e.top&&!u&&d.left<=e.left&&d.right>=e.left){u=a;f={left:Math.max(d.left,Math.min(d.right,e.left)),top:d.top}}if(!r&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom))s=h+1}}if(!r&&u){r=u;i=f;n=0}if(r&&r.nodeType==3)return yn(r,i);if(!r||n&&r.nodeType==1)return{node:t,offset:s};return vn(r,i)}function yn(t,e){let r=t.nodeValue.length;let n=document.createRange();for(let i=0;i<r;i++){n.setEnd(t,i+1);n.setStart(t,i);let r=On(n,1);if(r.top==r.bottom)continue;if(kn(e,r))return{node:t,offset:i+(e.left>=(r.left+r.right)/2?1:0)}}return{node:t,offset:0}}function kn(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function xn(t,e){let r=t.parentNode;if(r&&/^li$/i.test(r.nodeName)&&e.left<t.getBoundingClientRect().left)return r;return t}function Mn(t,e,r){let{node:n,offset:i}=vn(e,r),s=-1;if(n.nodeType==1&&!n.firstChild){let t=n.getBoundingClientRect();s=t.left!=t.right&&r.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(n,i,s)}function Sn(t,e,r,n){let i=-1;for(let r=e,s=false;;){if(r==t.dom)break;let e=t.docView.nearestDesc(r,true),o;if(!e)return null;if(e.dom.nodeType==1&&(e.node.isBlock&&e.parent||!e.contentDOM)&&((o=e.dom.getBoundingClientRect()).width||o.height)){if(e.node.isBlock&&e.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(e.dom.nodeName)){if(!s&&o.left>n.left||o.top>n.top)i=e.posBefore;else if(!s&&o.right<n.left||o.bottom<n.top)i=e.posAfter;s=true}if(!e.contentDOM&&i<0&&!e.node.isText){let t=e.node.isBlock?n.top<(o.top+o.bottom)/2:n.left<(o.left+o.right)/2;return t?e.posBefore:e.posAfter}}r=e.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,r,-1)}function En(t,e,r){let n=t.childNodes.length;if(n&&r.top<r.bottom){for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-r.top)/(r.bottom-r.top))-2)),s=i;;){let r=t.childNodes[s];if(r.nodeType==1){let t=r.getClientRects();for(let n=0;n<t.length;n++){let i=t[n];if(kn(e,i))return En(r,e,i)}}if((s=(s+1)%n)==i)break}}return t}function Tn(t,e){let r=t.dom.ownerDocument,n,i=0;let s=Fr(r,e.left,e.top);if(s)({node:n,offset:i}=s);let o=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);let l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let r=t.dom.getBoundingClientRect();if(!kn(e,r))return null;o=En(t.dom,e,r);if(!o)return null}if(en){for(let t=o;n&&t;t=Ar(t))if(t.draggable)n=undefined}o=xn(o,e);if(n){if(Yr&&n.nodeType==1){i=Math.min(i,n.childNodes.length);if(i<n.childNodes.length){let t=n.childNodes[i],r;if(t.nodeName=="IMG"&&(r=t.getBoundingClientRect()).right<=e.left&&r.bottom>e.top)i++}}let r;if(ln&&i&&n.nodeType==1&&(r=n.childNodes[i-1]).nodeType==1&&r.contentEditable=="false"&&r.getBoundingClientRect().top>=e.top)i--;if(n==t.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom)l=t.state.doc.content.size;else if(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")l=Sn(t,n,i,e)}if(l==null)l=Mn(t,o,e);let u=t.docView.nearestDesc(o,true);return{pos:l,inside:u?u.posAtStart-u.border:-1}}function An(t){return t.top<t.bottom||t.left<t.right}function On(t,e){let r=t.getClientRects();if(r.length){let t=r[e<0?0:r.length-1];if(An(t))return t}return Array.prototype.find.call(r,An)||t.getBoundingClientRect()}const Rn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function $n(t,e,r){let{node:n,offset:i,atom:s}=t.docView.domFromPos(e,r<0?-1:1);let o=ln||Yr;if(n.nodeType==3){if(o&&(Rn.test(n.nodeValue)||(r<0?!i:i==n.nodeValue.length))){let t=On(Rr(n,i,i),r);if(Yr&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let e=On(Rr(n,i-1,i-1),-1);if(e.top==t.top){let r=On(Rr(n,i,i+1),-1);if(r.top!=t.top)return Cn(r,r.left<e.left)}}return t}else{let t=i,e=i,s=r<0?1:-1;if(r<0&&!i){e++;s=-1}else if(r>=0&&i==n.nodeValue.length){t--;s=1}else if(r<0){t--}else{e++}return Cn(On(Rr(n,t,e),s),s<0)}}let l=t.state.doc.resolve(e-(s||0));if(!l.parent.inlineContent){if(s==null&&i&&(r<0||i==Pr(n))){let t=n.childNodes[i-1];if(t.nodeType==1)return Ln(t.getBoundingClientRect(),false)}if(s==null&&i<Pr(n)){let t=n.childNodes[i];if(t.nodeType==1)return Ln(t.getBoundingClientRect(),true)}return Ln(n.getBoundingClientRect(),r>=0)}if(s==null&&i&&(r<0||i==Pr(n))){let t=n.childNodes[i-1];let e=t.nodeType==3?Rr(t,Pr(t)-(o?0:1)):t.nodeType==1&&(t.nodeName!="BR"||!t.nextSibling)?t:null;if(e)return Cn(On(e,1),false)}if(s==null&&i<Pr(n)){let t=n.childNodes[i];while(t.pmViewDesc&&t.pmViewDesc.ignoreForCoords)t=t.nextSibling;let e=!t?null:t.nodeType==3?Rr(t,0,o?0:1):t.nodeType==1?t:null;if(e)return Cn(On(e,-1),true)}return Cn(On(n.nodeType==3?Rr(n):n,-r),r>=0)}function Cn(t,e){if(t.width==0)return t;let r=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:r,right:r}}function Ln(t,e){if(t.height==0)return t;let r=e?t.top:t.bottom;return{top:r,bottom:r,left:t.left,right:t.right}}function Nn(t,e,r){let n=t.state,i=t.root.activeElement;if(n!=e)t.updateState(e);if(i!=t.dom)t.focus();try{return r()}finally{if(n!=e)t.updateState(n);if(i!=t.dom&&i)i.focus()}}function Pn(t,e,r){let n=e.selection;let i=r=="up"?n.$from:n.$to;return Nn(t,e,(()=>{let{node:e}=t.docView.domFromPos(i.pos,r=="up"?-1:1);for(;;){let r=t.docView.nearestDesc(e,true);if(!r)break;if(r.node.isBlock){e=r.contentDOM||r.dom;break}e=r.dom.parentNode}let n=$n(t,i.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(t.nodeType==1)e=t.getClientRects();else if(t.nodeType==3)e=Rr(t,0,t.nodeValue.length).getClientRects();else continue;for(let t=0;t<e.length;t++){let i=e[t];if(i.bottom>i.top+1&&(r=="up"?n.top-i.top>(i.bottom-n.top)*2:i.bottom-n.bottom>(n.bottom-i.top)*2))return false}}return true}))}const Dn=/[\u0590-\u08ac]/;function In(t,e,r){let{$head:n}=e.selection;if(!n.parent.isTextblock)return false;let i=n.parentOffset,s=!i,o=i==n.parent.content.size;let l=t.domSelection();if(!l)return n.pos==n.start()||n.pos==n.end();if(!Dn.test(n.parent.textContent)||!l.modify)return r=="left"||r=="backward"?s:o;return Nn(t,e,(()=>{let{focusNode:e,focusOffset:i,anchorNode:s,anchorOffset:o}=t.domSelectionRange();let u=l.caretBidiLevel;l.modify("move",r,"character");let f=n.depth?t.docView.domAfterPos(n.before()):t.dom;let{focusNode:a,focusOffset:h}=t.domSelectionRange();let c=a&&!f.contains(a.nodeType==1?a:a.parentNode)||e==a&&i==h;try{l.collapse(s,o);if(e&&(e!=s||i!=o)&&l.extend)l.extend(e,i)}catch(t){}if(u!=null)l.caretBidiLevel=u;return c}))}let Hn=null;let jn=null;let _n=false;function Bn(t,e,r){if(Hn==e&&jn==r)return _n;Hn=e;jn=r;return _n=r=="up"||r=="down"?Pn(t,e,r):In(t,e,r)}const zn=0,Fn=1,Un=2,qn=3;class Kn{constructor(t,e,r,n){this.parent=t;this.children=e;this.dom=r;this.contentDOM=n;this.dirty=zn;r.pmViewDesc=this}matchesWidget(t){return false}matchesMark(t){return false}matchesNode(t,e,r){return false}matchesHack(t){return false}parseRule(){return null}stopEvent(t){return false}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=undefined;if(this.dom.pmViewDesc==this)this.dom.pmViewDesc=undefined;for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,r=this.posAtStart;;e++){let n=this.children[e];if(n==t)return r;r+=n.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(t,e,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode)){if(r<0){let r,n;if(t==this.contentDOM){r=t.childNodes[e-1]}else{while(t.parentNode!=this.contentDOM)t=t.parentNode;r=t.previousSibling}while(r&&!((n=r.pmViewDesc)&&n.parent==this))r=r.previousSibling;return r?this.posBeforeChild(n)+n.size:this.posAtStart}else{let r,n;if(t==this.contentDOM){r=t.childNodes[e]}else{while(t.parentNode!=this.contentDOM)t=t.parentNode;r=t.nextSibling}while(r&&!((n=r.pmViewDesc)&&n.parent==this))r=r.nextSibling;return r?this.posBeforeChild(n):this.posAtEnd}}let n;if(t==this.dom&&this.contentDOM){n=e>Tr(this.contentDOM)}else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){n=t.compareDocumentPosition(this.contentDOM)&2}else if(this.dom.firstChild){if(e==0)for(let e=t;;e=e.parentNode){if(e==this.dom){n=false;break}if(e.previousSibling)break}if(n==null&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){n=true;break}if(e.nextSibling)break}}return(n==null?r>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=false){for(let r=true,n=t;n;n=n.parentNode){let i=this.getDesc(n),s;if(i&&(!e||i.node)){if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))r=false;else return i}}}getDesc(t){let e=t.pmViewDesc;for(let t=e;t;t=t.parent)if(t==this)return e}posFromDOM(t,e,r){for(let n=t;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(t,e,r)}return-1}descAt(t){for(let e=0,r=0;e<this.children.length;e++){let n=this.children[e],i=r+n.size;if(r==t&&i!=r){while(!n.border&&n.children.length){for(let t=0;t<n.children.length;t++){let e=n.children[t];if(e.size){n=e;break}}}return n}if(t<i)return n.descAt(t-r-n.border);r=i}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,n=0;for(let e=0;r<this.children.length;r++){let i=this.children[r],s=e+i.size;if(s>t||i instanceof Xn){n=t-e;break}e=s}if(n)return this.children[r].domFromPos(n-this.children[r].border,e);for(let t;r&&!(t=this.children[r-1]).size&&t instanceof Jn&&t.side>=0;r--){}if(e<=0){let t,n=true;for(;;r--,n=false){t=r?this.children[r-1]:null;if(!t||t.dom.parentNode==this.contentDOM)break}if(t&&e&&n&&!t.border&&!t.domAtom)return t.domFromPos(t.size,e);return{node:this.contentDOM,offset:t?Tr(t.dom)+1:0}}else{let t,n=true;for(;;r++,n=false){t=r<this.children.length?this.children[r]:null;if(!t||t.dom.parentNode==this.contentDOM)break}if(t&&n&&!t.border&&!t.domAtom)return t.domFromPos(0,e);return{node:this.contentDOM,offset:t?Tr(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let s=r,o=0;;o++){let r=this.children[o],l=s+r.size;if(n==-1&&t<=l){let i=s+r.border;if(t>=i&&e<=l-r.border&&r.node&&r.contentDOM&&this.contentDOM.contains(r.contentDOM))return r.parseRange(t,e,i);t=s;for(let e=o;e>0;e--){let r=this.children[e-1];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(1)){n=Tr(r.dom)+1;break}t-=r.size}if(n==-1)n=0}if(n>-1&&(l>e||o==this.children.length-1)){e=l;for(let t=o+1;t<this.children.length;t++){let r=this.children[t];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(-1)){i=Tr(r.dom);break}e+=r.size}if(i==-1)i=this.contentDOM.childNodes.length;break}s=l}return{node:this.contentDOM,from:t,to:e,fromOffset:n,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return false;let e=this.children[t<0?0:this.children.length-1];return e.size==0||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:r}=this.domFromPos(t,0);if(e.nodeType!=1||r==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[r]}setSelection(t,e,r,n=false){let i=Math.min(t,e),s=Math.max(t,e);for(let o=0,l=0;o<this.children.length;o++){let u=this.children[o],f=l+u.size;if(i>l&&s<f)return u.setSelection(t-l-u.border,e-l-u.border,r,n);l=f}let o=this.domFromPos(t,t?-1:1);let l=e==t?o:this.domFromPos(e,e?-1:1);let u=r.root.getSelection();let f=r.domSelectionRange();let a=false;if((Yr||en)&&t==e){let{node:t,offset:e}=o;if(t.nodeType==3){a=!!(e&&t.nodeValue[e-1]=="\n");if(a&&e==t.nodeValue.length){for(let e=t,r;e;e=e.parentNode){if(r=e.nextSibling){if(r.nodeName=="BR")o=l={node:r.parentNode,offset:Tr(r)+1};break}let t=e.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}}else{let r=t.childNodes[e-1];a=r&&(r.nodeName=="BR"||r.contentEditable=="false")}}if(Yr&&f.focusNode&&f.focusNode!=l.node&&f.focusNode.nodeType==1){let t=f.focusNode.childNodes[f.focusOffset];if(t&&t.contentEditable=="false")n=true}if(!(n||a&&en)&&Cr(o.node,o.offset,f.anchorNode,f.anchorOffset)&&Cr(l.node,l.offset,f.focusNode,f.focusOffset))return;let h=false;if((u.extend||t==e)&&!(a&&Yr)){u.collapse(o.node,o.offset);try{if(t!=e)u.extend(l.node,l.offset);h=true}catch(t){}}if(!h){if(t>e){let t=o;o=l;l=t}let r=document.createRange();r.setEnd(l.node,l.offset);r.setStart(o.node,o.offset);u.removeAllRanges();u.addRange(r)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let r=0,n=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==s?t<=s&&e>=r:t<s&&e>r){let n=r+i.border,o=s-i.border;if(t>=n&&e<=o){this.dirty=t==r||e==s?Un:Fn;if(t==n&&e==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM))i.dirty=qn;else i.markDirty(t-n,e-n);return}else{i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Un:qn}}r=s}this.dirty=Un}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let r=t==1?Un:Fn;if(e.dirty<r)e.dirty=r}}get domAtom(){return false}get ignoreForCoords(){return false}get ignoreForSelection(){return false}isText(t){return false}}class Jn extends Kn{constructor(t,e,r,n){let i,s=e.type.toDOM;if(typeof s=="function")s=s(r,(()=>{if(!i)return n;if(i.parent)return i.parent.posBeforeChild(i)}));if(!e.type.spec.raw){if(s.nodeType!=1){let t=document.createElement("span");t.appendChild(s);s=t}s.contentEditable="false";s.classList.add("ProseMirror-widget")}super(t,[],s,null);this.widget=e;this.widget=e;i=this}matchesWidget(t){return this.dirty==zn&&t.type.eq(this.widget.type)}parseRule(){return{ignore:true}}stopEvent(t){let e=this.widget.spec.stopEvent;return e?e(t):false}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom);super.destroy()}get domAtom(){return true}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Wn extends Kn{constructor(t,e,r,n){super(t,[],e,null);this.textDOM=r;this.text=n}get size(){return this.text.length}localPosFromDOM(t,e){if(t!=this.textDOM)return this.posAtStart+(e?this.size:0);return this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Vn extends Kn{constructor(t,e,r,n,i){super(t,[],r,n);this.mark=e;this.spec=i}static create(t,e,r,n){let i=n.nodeViews[e.type.name];let s=i&&i(e,n,r);if(!s||!s.dom)s=Nt.renderSpec(document,e.type.spec.toDOM(e,r),null,e.attrs);return new Vn(t,e,s.dom,s.contentDOM||s.dom,s)}parseRule(){if(this.dirty&qn||this.mark.type.spec.reparseInView)return null;return{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=qn&&this.mark.eq(t)}markDirty(t,e){super.markDirty(t,e);if(this.dirty!=zn){let t=this.parent;while(!t.node)t=t.parent;if(t.dirty<this.dirty)t.dirty=this.dirty;this.dirty=zn}}slice(t,e,r){let n=Vn.create(this.parent,this.mark,true,r);let i=this.children,s=this.size;if(e<s)i=mi(i,e,s,r);if(t>0)i=mi(i,0,t,r);for(let t=0;t<i.length;t++)i[t].parent=n;n.children=i;return n}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){if(this.spec.destroy)this.spec.destroy();super.destroy()}}class Gn extends Kn{constructor(t,e,r,n,i,s,o,l,u){super(t,[],i,s);this.node=e;this.outerDeco=r;this.innerDeco=n;this.nodeDOM=o}static create(t,e,r,n,i,s){let o=i.nodeViews[e.type.name],l;let u=o&&o(e,i,(()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)}),r,n);let f=u&&u.dom,a=u&&u.contentDOM;if(e.isText){if(!f)f=document.createTextNode(e.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else if(!f){let t=Nt.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:f,contentDOM:a}=t)}if(!a&&!e.isText&&f.nodeName!="BR"){if(!f.hasAttribute("contenteditable"))f.contentEditable="false";if(e.type.spec.draggable)f.draggable=true}let h=f;f=oi(f,r,e);if(u)return l=new Qn(t,e,r,n,f,a||null,h,u,i,s+1);else if(e.isText)return new Yn(t,e,r,n,f,h,i);else return new Gn(t,e,r,n,f,a||null,h,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre")t.preserveWhitespace="full";if(!this.contentDOM){t.getContent=()=>this.node.content}else if(!this.contentLost){t.contentElement=this.contentDOM}else{for(let e=this.children.length-1;e>=0;e--){let r=this.children[e];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}if(!t.contentElement)t.getContent=()=>v.empty}return t}matchesNode(t,e,r){return this.dirty==zn&&t.eq(this.node)&&li(e,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let r=this.node.inlineContent,n=e;let i=t.composing?this.localCompositionInfo(t,e):null;let s=i&&i.pos>-1?i:null;let o=i&&i.pos<0;let l=new fi(this,s&&s.node,t);ci(this.node,this.innerDeco,((e,i,s)=>{if(e.spec.marks)l.syncToMarks(e.spec.marks,r,t);else if(e.type.side>=0&&!s)l.syncToMarks(i==this.node.childCount?M.none:this.node.child(i).marks,r,t);l.placeWidget(e,t,n)}),((e,s,u,f)=>{l.syncToMarks(e.marks,r,t);let a;if(l.findNodeMatch(e,s,u,f));else if(o&&t.state.selection.from>n&&t.state.selection.to<n+e.nodeSize&&(a=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(e,s,u,a,t));else if(l.updateNextNode(e,s,u,t,f,n));else{l.addNode(e,s,u,t,n)}n+=e.nodeSize}));l.syncToMarks([],r,t);if(this.node.isTextblock)l.addTextblockHacks();l.destroyRest();if(l.changed||this.dirty==Un){if(s)this.protectLocalComposition(t,s);ti(this.contentDOM,this.children,t);if(rn)di(this.dom)}}localCompositionInfo(t,e){let{from:r,to:n}=t.state.selection;if(!(t.state.selection instanceof ir)||r<e||n>e+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let t=i.nodeValue;let s=pi(this.node.content,t,r-e,n-e);return s<0?null:{node:i,pos:s,text:t}}else{return{node:i,pos:-1,text:""}}}protectLocalComposition(t,{node:e,pos:r,text:n}){if(this.getDesc(e))return;let i=e;for(;;i=i.parentNode){if(i.parentNode==this.contentDOM)break;while(i.previousSibling)i.parentNode.removeChild(i.previousSibling);while(i.nextSibling)i.parentNode.removeChild(i.nextSibling);if(i.pmViewDesc)i.pmViewDesc=undefined}let s=new Wn(this,i,e,n);t.input.compositionNodes.push(s);this.children=mi(this.children,r,r+n.length,t,s)}update(t,e,r,n){if(this.dirty==qn||!t.sameMarkup(this.node))return false;this.updateInner(t,e,r,n);return true}updateInner(t,e,r,n){this.updateOuterDeco(e);this.node=t;this.innerDeco=r;if(this.contentDOM)this.updateChildren(n,this.posAtStart);this.dirty=zn}updateOuterDeco(t){if(li(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1;let r=this.dom;this.dom=ii(this.dom,this.nodeDOM,ni(this.outerDeco,this.node,e),ni(t,this.node,e));if(this.dom!=r){r.pmViewDesc=undefined;this.dom.pmViewDesc=this}this.outerDeco=t}selectNode(){if(this.nodeDOM.nodeType==1){this.nodeDOM.classList.add("ProseMirror-selectednode");if(this.contentDOM||!this.node.type.spec.draggable)this.nodeDOM.draggable=true}}deselectNode(){if(this.nodeDOM.nodeType==1){this.nodeDOM.classList.remove("ProseMirror-selectednode");if(this.contentDOM||!this.node.type.spec.draggable)this.nodeDOM.removeAttribute("draggable")}}get domAtom(){return this.node.isAtom}}function Zn(t,e,r,n,i){oi(n,e,t);let s=new Gn(undefined,t,e,r,n,n,n,i,0);if(s.contentDOM)s.updateChildren(i,0);return s}class Yn extends Gn{constructor(t,e,r,n,i,s,o){super(t,e,r,n,i,null,s,o,0)}parseRule(){let t=this.nodeDOM.parentNode;while(t&&t!=this.dom&&!t.pmIsDeco)t=t.parentNode;return{skip:t||true}}update(t,e,r,n){if(this.dirty==qn||this.dirty!=zn&&!this.inParent()||!t.sameMarkup(this.node))return false;this.updateOuterDeco(e);if((this.dirty!=zn||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue){this.nodeDOM.nodeValue=t.text;if(n.trackWrites==this.nodeDOM)n.trackWrites=null}this.node=t;this.dirty=zn;return true}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return true;return false}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,r){if(t==this.nodeDOM)return this.posAtStart+Math.min(e,this.node.text.length);return super.localPosFromDOM(t,e,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,e,r){let n=this.node.cut(t,e),i=document.createTextNode(n.text);return new Yn(this.parent,n,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,e){super.markDirty(t,e);if(this.dom!=this.nodeDOM&&(t==0||e==this.nodeDOM.nodeValue.length))this.dirty=qn}get domAtom(){return false}isText(t){return this.node.text==t}}class Xn extends Kn{parseRule(){return{ignore:true}}matchesHack(t){return this.dirty==zn&&this.dom.nodeName==t}get domAtom(){return true}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Qn extends Gn{constructor(t,e,r,n,i,s,o,l,u,f){super(t,e,r,n,i,s,o,u,f);this.spec=l}update(t,e,r,n){if(this.dirty==qn)return false;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,e,r);if(i)this.updateInner(t,e,r,n);return i}else if(!this.contentDOM&&!t.isLeaf){return false}else{return super.update(t,e,r,n)}}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,r,n){this.spec.setSelection?this.spec.setSelection(t,e,r.root):super.setSelection(t,e,r,n)}destroy(){if(this.spec.destroy)this.spec.destroy();super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):false}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function ti(t,e,r){let n=t.firstChild,i=false;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){while(l!=n){n=ui(n);i=true}n=n.nextSibling}else{i=true;t.insertBefore(l,n)}if(o instanceof Vn){let e=n?n.previousSibling:t.lastChild;ti(o.contentDOM,o.children,r);n=e?e.nextSibling:t.firstChild}}while(n){n=ui(n);i=true}if(i&&r.trackWrites==t)r.trackWrites=null}const ei=function(t){if(t)this.nodeName=t};ei.prototype=Object.create(null);const ri=[new ei];function ni(t,e,r){if(t.length==0)return ri;let n=r?ri[0]:new ei,i=[n];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(!o)continue;if(o.nodeName)i.push(n=new ei(o.nodeName));for(let t in o){let s=o[t];if(s==null)continue;if(r&&i.length==1)i.push(n=new ei(e.isInline?"span":"div"));if(t=="class")n.class=(n.class?n.class+" ":"")+s;else if(t=="style")n.style=(n.style?n.style+";":"")+s;else if(t!="nodeName")n[t]=s}}return i}function ii(t,e,r,n){if(r==ri&&n==ri)return e;let i=e;for(let e=0;e<n.length;e++){let s=n[e],o=r[e];if(e){let e;if(o&&o.nodeName==s.nodeName&&i!=t&&(e=i.parentNode)&&e.nodeName.toLowerCase()==s.nodeName){i=e}else{e=document.createElement(s.nodeName);e.pmIsDeco=true;e.appendChild(i);o=ri[0];i=e}}si(i,o||ri[0],s)}return i}function si(t,e,r){for(let n in e)if(n!="class"&&n!="style"&&n!="nodeName"&&!(n in r))t.removeAttribute(n);for(let n in r)if(n!="class"&&n!="style"&&n!="nodeName"&&r[n]!=e[n])t.setAttribute(n,r[n]);if(e.class!=r.class){let n=e.class?e.class.split(" ").filter(Boolean):[];let i=r.class?r.class.split(" ").filter(Boolean):[];for(let e=0;e<n.length;e++)if(i.indexOf(n[e])==-1)t.classList.remove(n[e]);for(let e=0;e<i.length;e++)if(n.indexOf(i[e])==-1)t.classList.add(i[e]);if(t.classList.length==0)t.removeAttribute("class")}if(e.style!=r.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,n;while(n=r.exec(e.style))t.style.removeProperty(n[1])}if(r.style)t.style.cssText+=r.style}}function oi(t,e,r){return ii(t,t,ri,ni(e,r,t.nodeType!=1))}function li(t,e){if(t.length!=e.length)return false;for(let r=0;r<t.length;r++)if(!t[r].type.eq(e[r].type))return false;return true}function ui(t){let e=t.nextSibling;t.parentNode.removeChild(t);return e}class fi{constructor(t,e,r){this.lock=e;this.view=r;this.index=0;this.stack=[];this.changed=false;this.top=t;this.preMatch=ai(t.node.content,t)}destroyBetween(t,e){if(t==e)return;for(let r=t;r<e;r++)this.top.children[r].destroy();this.top.children.splice(t,e-t);this.changed=true}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,r){let n=0,i=this.stack.length>>1;let s=Math.min(i,t.length);while(n<s&&(n==i-1?this.top:this.stack[n+1<<1]).matchesMark(t[n])&&t[n].type.spec.spanning!==false)n++;while(n<i){this.destroyRest();this.top.dirty=zn;this.index=this.stack.pop();this.top=this.stack.pop();i--}while(i<t.length){this.stack.push(this.top,this.index+1);let n=-1;for(let e=this.index;e<Math.min(this.index+3,this.top.children.length);e++){let r=this.top.children[e];if(r.matchesMark(t[i])&&!this.isLocked(r.dom)){n=e;break}}if(n>-1){if(n>this.index){this.changed=true;this.destroyBetween(this.index,n)}this.top=this.top.children[this.index]}else{let n=Vn.create(this.top,t[i],e,r);this.top.children.splice(this.index,0,n);this.top=n;this.changed=true}this.index=0;i++}}findNodeMatch(t,e,r,n){let i=-1,s;if(n>=this.preMatch.index&&(s=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&s.matchesNode(t,e,r)){i=this.top.children.indexOf(s,this.index)}else{for(let n=this.index,s=Math.min(this.top.children.length,n+5);n<s;n++){let s=this.top.children[n];if(s.matchesNode(t,e,r)&&!this.preMatch.matched.has(s)){i=n;break}}}if(i<0)return false;this.destroyBetween(this.index,i);this.index++;return true}updateNodeAt(t,e,r,n,i){let s=this.top.children[n];if(s.dirty==qn&&s.dom==s.contentDOM)s.dirty=Un;if(!s.update(t,e,r,i))return false;this.destroyBetween(this.index,n);this.index++;return true}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++){if(this.top.children[t]==e)return t}return-1}t=e}}updateNextNode(t,e,r,n,i,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof Gn){let u=this.preMatch.matched.get(l);if(u!=null&&u!=i)return false;let f=l.dom,a;let h=this.isLocked(f)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=qn&&li(e,l.outerDeco));if(!h&&l.update(t,e,r,n)){this.destroyBetween(this.index,o);if(l.dom!=f)this.changed=true;this.index++;return true}else if(!h&&(a=this.recreateWrapper(l,t,e,r,n,s))){this.destroyBetween(this.index,o);this.top.children[this.index]=a;if(a.contentDOM){a.dirty=Un;a.updateChildren(n,s+1);a.dirty=zn}this.changed=true;this.index++;return true}break}}return false}recreateWrapper(t,e,r,n,i,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!li(r,t.outerDeco)||!n.eq(t.innerDeco))return null;let o=Gn.create(this.top,e,r,n,i,s);if(o.contentDOM){o.children=t.children;t.children=[];for(let t of o.children)t.parent=o}t.destroy();return o}addNode(t,e,r,n,i){let s=Gn.create(this.top,t,e,r,n,i);if(s.contentDOM)s.updateChildren(n,i+1);this.top.children.splice(this.index++,0,s);this.changed=true}placeWidget(t,e,r){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(n&&n.matchesWidget(t)&&(t==n.widget||!n.widget.type.toDOM.parentNode)){this.index++}else{let n=new Jn(this.top,t,e,r);this.top.children.splice(this.index++,0,n);this.changed=true}}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;while(t instanceof Vn){e=t;t=e.children[e.children.length-1]}if(!t||!(t instanceof Yn)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text)){if((en||Qr)&&t&&t.dom.contentEditable=="false")this.addHackNode("IMG",e);this.addHackNode("BR",this.top)}}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t)){this.index++}else{let r=document.createElement(t);if(t=="IMG"){r.className="ProseMirror-separator";r.alt=""}if(t=="BR")r.className="ProseMirror-trailingBreak";let n=new Xn(this.top,[],r,null);if(e!=this.top)e.children.push(n);else e.children.splice(this.index++,0,n);this.changed=true}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function ai(t,e){let r=e,n=r.children.length;let i=t.childCount,s=new Map,o=[];t:while(i>0){let l;for(;;){if(n){let t=r.children[n-1];if(t instanceof Vn){r=t;n=t.children.length}else{l=t;n--;break}}else if(r==e){break t}else{n=r.parent.children.indexOf(r);r=r.parent}}let u=l.node;if(!u)continue;if(u!=t.child(i-1))break;--i;s.set(l,i);o.push(l)}return{index:i,matched:s,matches:o.reverse()}}function hi(t,e){return t.type.side-e.type.side}function ci(t,e,r,n){let i=e.locals(t),s=0;if(i.length==0){for(let r=0;r<t.childCount;r++){let o=t.child(r);n(o,i,e.forChild(s,o),r);s+=o.nodeSize}return}let o=0,l=[],u=null;for(let f=0;;){let a,h;while(o<i.length&&i[o].to==s){let t=i[o++];if(t.widget){if(!a)a=t;else(h||(h=[a])).push(t)}}if(a){if(h){h.sort(hi);for(let t=0;t<h.length;t++)r(h[t],f,!!u)}else{r(a,f,!!u)}}let c,d;if(u){d=-1;c=u;u=null}else if(f<t.childCount){d=f;c=t.child(f++)}else{break}for(let t=0;t<l.length;t++)if(l[t].to<=s)l.splice(t--,1);while(o<i.length&&i[o].from<=s&&i[o].to>s)l.push(i[o++]);let p=s+c.nodeSize;if(c.isText){let t=p;if(o<i.length&&i[o].from<t)t=i[o].from;for(let e=0;e<l.length;e++)if(l[e].to<t)t=l[e].to;if(t<p){u=c.cut(t-s);c=c.cut(0,t-s);p=t;d=-1}}else{while(o<i.length&&i[o].to<p)o++}let m=c.isInline&&!c.isLeaf?l.filter((t=>!t.inline)):l.slice();n(c,m,e.forChild(s,c),d);s=p}}function di(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 pi(t,e,r,n){for(let i=0,s=0;i<t.childCount&&s<=n;){let o=t.child(i++),l=s;s+=o.nodeSize;if(!o.isText)continue;let u=o.text;while(i<t.childCount){let e=t.child(i++);s+=e.nodeSize;if(!e.isText)break;u+=e.text}if(s>=r){if(s>=n&&u.slice(n-e.length-l,n-l)==e)return n-e.length;let t=l<n?u.lastIndexOf(e,n-l-1):-1;if(t>=0&&t+e.length+l>=r)return l+t;if(r==n&&u.length>=n+e.length-l&&u.slice(n-l,n-l+e.length)==e)return n}}return-1}function mi(t,e,r,n,i){let s=[];for(let o=0,l=0;o<t.length;o++){let u=t[o],f=l,a=l+=u.size;if(f>=r||a<=e){s.push(u)}else{if(f<e)s.push(u.slice(0,e-f,n));if(i){s.push(i);i=undefined}if(a>r)s.push(u.slice(r-f,u.size,n))}}return s}function gi(t,e=null){let r=t.domSelectionRange(),n=t.state.doc;if(!r.focusNode)return null;let i=t.docView.nearestDesc(r.focusNode),s=i&&i.size==0;let o=t.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let l=n.resolve(o),u,f;if(_r(r)){u=o;while(i&&!i.node)i=i.parent;let t=i.node;if(i&&t.isAtom&&or.isSelectable(t)&&i.parent&&!(t.isInline&&Hr(r.focusNode,r.focusOffset,i.dom))){let t=i.posBefore;f=new or(o==t?l:n.resolve(t))}}else{if(r instanceof t.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let e=o,i=o;for(let n=0;n<r.rangeCount;n++){let s=r.getRangeAt(n);e=Math.min(e,t.docView.posFromDOM(s.startContainer,s.startOffset,1));i=Math.max(i,t.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(e<0)return null;[u,o]=i==t.state.selection.anchor?[i,e]:[e,i];l=n.resolve(o)}else{u=t.docView.posFromDOM(r.anchorNode,r.anchorOffset,1)}if(u<0)return null}let a=n.resolve(u);if(!f){let r=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;f=Ai(t,a,l,r)}return f}function wi(t){return t.editable?t.hasFocus():Ri(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bi(t,e=false){let r=t.state.selection;Ei(t,r);if(!wi(t))return;if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Qr){let e=t.domSelectionRange(),r=t.domObserver.currentSelection;if(e.anchorNode&&r.anchorNode&&Cr(e.anchorNode,e.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=true;t.domObserver.setCurSelection();return}}t.domObserver.disconnectSelection();if(t.cursorWrapper){Si(t)}else{let{anchor:n,head:i}=r,s,o;if(vi&&!(r instanceof ir)){if(!r.$from.parent.inlineContent)s=yi(t,r.from);if(!r.empty&&!r.$from.parent.inlineContent)o=yi(t,r.to)}t.docView.setSelection(n,i,t,e);if(vi){if(s)xi(s);if(o)xi(o)}if(r.visible){t.dom.classList.remove("ProseMirror-hideselection")}else{t.dom.classList.add("ProseMirror-hideselection");if("onselectionchange"in document)Mi(t)}}t.domObserver.setCurSelection();t.domObserver.connectSelection()}const vi=en||Qr&&tn<63;function yi(t,e){let{node:r,offset:n}=t.docView.domFromPos(e,0);let i=n<r.childNodes.length?r.childNodes[n]:null;let s=n?r.childNodes[n-1]:null;if(en&&i&&i.contentEditable=="false")return ki(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return ki(i);else if(s)return ki(s)}}function ki(t){t.contentEditable="true";if(en&&t.draggable){t.draggable=false;t.wasDraggable=true}return t}function xi(t){t.contentEditable="false";if(t.wasDraggable){t.draggable=true;t.wasDraggable=null}}function Mi(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let r=t.domSelectionRange();let n=r.anchorNode,i=r.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{if(r.anchorNode!=n||r.anchorOffset!=i){e.removeEventListener("selectionchange",t.input.hideSelectionGuard);setTimeout((()=>{if(!wi(t)||t.state.selection.visible)t.dom.classList.remove("ProseMirror-hideselection")}),20)}})}function Si(t){let e=t.domSelection();if(!e)return;let r=t.cursorWrapper.dom,n=r.nodeName=="IMG";if(n)e.collapse(r.parentNode,Tr(r)+1);else e.collapse(r,0);if(!n&&!t.state.selection.visible&&Gr&&Zr<=11){r.disabled=true;r.disabled=false}}function Ei(t,e){if(e instanceof or){let r=t.docView.descAt(e.from);if(r!=t.lastSelectedViewDesc){Ti(t);if(r)r.selectNode();t.lastSelectedViewDesc=r}}else{Ti(t)}}function Ti(t){if(t.lastSelectedViewDesc){if(t.lastSelectedViewDesc.parent)t.lastSelectedViewDesc.deselectNode();t.lastSelectedViewDesc=undefined}}function Ai(t,e,r,n){return t.someProp("createSelectionBetween",(n=>n(t,e,r)))||ir.between(e,r,n)}function Oi(t){if(t.editable&&!t.hasFocus())return false;return Ri(t)}function Ri(t){let e=t.domSelectionRange();if(!e.anchorNode)return false;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(t){return false}}function $i(t){let e=t.docView.domFromPos(t.state.selection.anchor,0);let r=t.domSelectionRange();return Cr(e.node,e.offset,r.anchorNode,r.anchorOffset)}function Ci(t,e){let{$anchor:r,$head:n}=t.selection;let i=e>0?r.max(n):r.min(n);let s=!i.parent.inlineContent?i:i.depth?t.doc.resolve(e>0?i.after():i.before()):null;return s&&tr.findFrom(s,e)}function Li(t,e){t.dispatch(t.state.tr.setSelection(e).scrollIntoView());return true}function Ni(t,e,r){let n=t.state.selection;if(n instanceof ir){if(r.indexOf("s")>-1){let{$head:r}=n,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return false;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return Li(t,new ir(n.$anchor,s))}else if(!n.empty){return false}else if(t.endOfTextblock(e>0?"forward":"backward")){let r=Ci(t.state,e);if(r&&r instanceof or)return Li(t,r);return false}else if(!(nn&&r.indexOf("m")>-1)){let r=n.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return false;let o=e<0?r.pos-i.nodeSize:r.pos;if(!(i.isAtom||(s=t.docView.descAt(o))&&!s.contentDOM))return false;if(or.isSelectable(i)){return Li(t,new or(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r))}else if(ln){return Li(t,new ir(t.state.doc.resolve(e<0?o:o+i.nodeSize)))}else{return false}}}else if(n instanceof or&&n.node.isInline){return Li(t,new ir(e>0?n.$to:n.$from))}else{let r=Ci(t.state,e);if(r)return Li(t,r);return false}}function Pi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Di(t,e){let r=t.pmViewDesc;return r&&r.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ii(t,e){return e<0?Hi(t):ji(t)}function Hi(t){let e=t.domSelectionRange();let r=e.focusNode,n=e.focusOffset;if(!r)return;let i,s,o=false;if(Yr&&r.nodeType==1&&n<Pi(r)&&Di(r.childNodes[n],-1))o=true;for(;;){if(n>0){if(r.nodeType!=1){break}else{let t=r.childNodes[n-1];if(Di(t,-1)){i=r;s=--n}else if(t.nodeType==3){r=t;n=r.nodeValue.length}else break}}else if(_i(r)){break}else{let e=r.previousSibling;while(e&&Di(e,-1)){i=r.parentNode;s=Tr(e);e=e.previousSibling}if(!e){r=r.parentNode;if(r==t.dom)break;n=0}else{r=e;n=Pi(r)}}}if(o)Fi(t,r,n);else if(i)Fi(t,i,s)}function ji(t){let e=t.domSelectionRange();let r=e.focusNode,n=e.focusOffset;if(!r)return;let i=Pi(r);let s,o;for(;;){if(n<i){if(r.nodeType!=1)break;let t=r.childNodes[n];if(Di(t,1)){s=r;o=++n}else break}else if(_i(r)){break}else{let e=r.nextSibling;while(e&&Di(e,1)){s=e.parentNode;o=Tr(e)+1;e=e.nextSibling}if(!e){r=r.parentNode;if(r==t.dom)break;n=i=0}else{r=e;n=0;i=Pi(r)}}}if(s)Fi(t,s,o)}function _i(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Bi(t,e){while(t&&e==t.childNodes.length&&!jr(t)){e=Tr(t)+1;t=t.parentNode}while(t&&e<t.childNodes.length){let r=t.childNodes[e];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r;e=0}}function zi(t,e){while(t&&!e&&!jr(t)){e=Tr(t);t=t.parentNode}while(t&&e){let r=t.childNodes[e-1];if(r.nodeType==3)return r;if(r.nodeType==1&&r.contentEditable=="false")break;t=r;e=t.childNodes.length}}function Fi(t,e,r){if(e.nodeType!=3){let t,n;if(n=Bi(e,r)){e=n;r=0}else if(t=zi(e,r)){e=t;r=t.nodeValue.length}}let n=t.domSelection();if(!n)return;if(_r(n)){let t=document.createRange();t.setEnd(e,r);t.setStart(e,r);n.removeAllRanges();n.addRange(t)}else if(n.extend){n.extend(e,r)}t.domObserver.setCurSelection();let{state:i}=t;setTimeout((()=>{if(t.state==i)bi(t)}),50)}function Ui(t,e){let r=t.state.doc.resolve(e);if(!(Qr||sn)&&r.parent.inlineContent){let n=t.coordsAtPos(e);if(e>r.start()){let r=t.coordsAtPos(e-1);let i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left<n.left?"ltr":"rtl"}if(e<r.end()){let r=t.coordsAtPos(e+1);let i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left>n.left?"ltr":"rtl"}}let n=getComputedStyle(t.dom).direction;return n=="rtl"?"rtl":"ltr"}function qi(t,e,r){let n=t.state.selection;if(n instanceof ir&&!n.empty||r.indexOf("s")>-1)return false;if(nn&&r.indexOf("m")>-1)return false;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let r=Ci(t.state,e);if(r&&r instanceof or)return Li(t,r)}if(!i.parent.inlineContent){let r=e<0?i:s;let o=n instanceof ur?tr.near(r,e):tr.findFrom(r,e);return o?Li(t,o):false}return false}function Ki(t,e){if(!(t.state.selection instanceof ir))return true;let{$head:r,$anchor:n,empty:i}=t.state.selection;if(!r.sameParent(n))return true;if(!i)return false;if(t.endOfTextblock(e>0?"forward":"backward"))return true;let s=!r.textOffset&&(e<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){let n=t.state.tr;if(e<0)n.delete(r.pos-s.nodeSize,r.pos);else n.delete(r.pos,r.pos+s.nodeSize);t.dispatch(n);return true}return false}function Ji(t,e,r){t.domObserver.stop();e.contentEditable=r;t.domObserver.start()}function Wi(t){if(!en||t.state.selection.$head.parentOffset>0)return false;let{focusNode:e,focusOffset:r}=t.domSelectionRange();if(e&&e.nodeType==1&&r==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Ji(t,r,"true");setTimeout((()=>Ji(t,r,"false")),20)}return false}function Vi(t){let e="";if(t.ctrlKey)e+="c";if(t.metaKey)e+="m";if(t.altKey)e+="a";if(t.shiftKey)e+="s";return e}function Gi(t,e){let r=e.keyCode,n=Vi(e);if(r==8||nn&&r==72&&n=="c"){return Ki(t,-1)||Ii(t,-1)}else if(r==46&&!e.shiftKey||nn&&r==68&&n=="c"){return Ki(t,1)||Ii(t,1)}else if(r==13||r==27){return true}else if(r==37||nn&&r==66&&n=="c"){let e=r==37?Ui(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ni(t,e,n)||Ii(t,e)}else if(r==39||nn&&r==70&&n=="c"){let e=r==39?Ui(t,t.state.selection.from)=="ltr"?1:-1:1;return Ni(t,e,n)||Ii(t,e)}else if(r==38||nn&&r==80&&n=="c"){return qi(t,-1,n)||Ii(t,-1)}else if(r==40||nn&&r==78&&n=="c"){return Wi(t)||qi(t,1,n)||Ii(t,1)}else if(n==(nn?"m":"c")&&(r==66||r==73||r==89||r==90)){return true}return false}function Zi(t,e){t.someProp("transformCopied",(r=>{e=r(e,t)}));let r=[],{content:n,openStart:i,openEnd:s}=e;while(i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1){i--;s--;let t=n.firstChild;r.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null);n=t.content}let o=t.someProp("clipboardSerializer")||Nt.fromSchema(t.state.schema);let l=us(),u=l.createElement("div");u.appendChild(o.serializeFragment(n,{document:l}));let f=u.firstChild,a,h=0;while(f&&f.nodeType==1&&(a=ss[f.nodeName.toLowerCase()])){for(let t=a.length-1;t>=0;t--){let e=l.createElement(a[t]);while(u.firstChild)e.appendChild(u.firstChild);u.appendChild(e);h++}f=u.firstChild}if(f&&f.nodeType==1)f.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(r)}`);let c=t.someProp("clipboardTextSerializer",(r=>r(e,t)))||e.content.textBetween(0,e.content.size,"\n\n");return{dom:u,text:c,slice:e}}function Yi(t,e,r,n,i){let s=i.parent.type.spec.code;let o,l;if(!r&&!e)return null;let u=!!e&&(n||s||!r);if(u){t.someProp("transformPastedText",(r=>{e=r(e,s||n,t)}));if(s){l=new E(v.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0);t.someProp("transformPasted",(e=>{l=e(l,t,true)}));return l}let r=t.someProp("clipboardTextParser",(r=>r(e,i,n,t)));if(r){l=r}else{let r=i.marks();let{schema:n}=t.state,s=Nt.fromSchema(n);o=document.createElement("div");e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=o.appendChild(document.createElement("p"));if(t)e.appendChild(s.serializeNode(n.text(t,r)))}))}}else{t.someProp("transformPastedHTML",(e=>{r=e(r,t)}));o=hs(r);if(ln)cs(o)}let f=o&&o.querySelector("[data-pm-slice]");let a=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(a&&a[3])for(let t=+a[3];t>0;t--){let t=o.firstChild;while(t&&t.nodeType!=1)t=t.nextSibling;if(!t)break;o=t}if(!l){let e=t.someProp("clipboardParser")||t.someProp("domParser")||vt.fromSchema(t.state.schema);l=e.parseSlice(o,{preserveWhitespace:!!(u||a),context:i,ruleFromNode(t){if(t.nodeName=="BR"&&!t.nextSibling&&t.parentNode&&!Xi.test(t.parentNode.nodeName))return{ignore:true};return null}})}if(a){l=ds(is(l,+a[1],+a[2]),a[4])}else{l=E.maxOpen(Qi(l.content,i),true);if(l.openStart||l.openEnd){let t=0,e=0;for(let e=l.content.firstChild;t<l.openStart&&!e.type.spec.isolating;t++,e=e.firstChild){}for(let t=l.content.lastChild;e<l.openEnd&&!t.type.spec.isolating;e++,t=t.lastChild){}l=is(l,t,e)}}t.someProp("transformPasted",(e=>{l=e(l,t,u)}));return l}const Xi=/^(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 Qi(t,e){if(t.childCount<2)return t;for(let r=e.depth;r>=0;r--){let n=e.node(r);let i=n.contentMatchAt(e.index(r));let s,o=[];t.forEach((t=>{if(!o)return;let e=i.findWrapping(t.type),r;if(!e)return o=null;if(r=o.length&&s.length&&es(e,s,t,o[o.length-1],0)){o[o.length-1]=r}else{if(o.length)o[o.length-1]=rs(o[o.length-1],s.length);let r=ts(t,e);o.push(r);i=i.matchType(r.type);s=e}}));if(o)return v.from(o)}return t}function ts(t,e,r=0){for(let n=e.length-1;n>=r;n--)t=e[n].create(null,v.from(t));return t}function es(t,e,r,n,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=es(t,e,r,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));let o=n.contentMatchAt(n.childCount);if(o.matchType(i==t.length-1?r.type:t[i+1]))return n.copy(n.content.append(v.from(ts(r,t,i+1))))}}function rs(t,e){if(e==0)return t;let r=t.content.replaceChild(t.childCount-1,rs(t.lastChild,e-1));let n=t.contentMatchAt(t.childCount).fillBefore(v.empty,true);return t.copy(r.append(n))}function ns(t,e,r,n,i,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;if(t.childCount>1)s=0;if(i<n-1)l=ns(l,e,r,n,i+1,s);if(i>=r)l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(v.empty,true));return t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function is(t,e,r){if(e<t.openStart)t=new E(ns(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd);if(r<t.openEnd)t=new E(ns(t.content,1,r,t.openEnd,0,0),t.openStart,r);return t}const ss={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 ls=null;function us(){return ls||(ls=document.implementation.createHTMLDocument("title"))}let fs=null;function as(t){let e=window.trustedTypes;if(!e)return t;if(!fs)fs=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t});return fs.createHTML(t)}function hs(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);if(e)t=t.slice(e[0].length);let r=us().createElement("div");let n=/<([a-z][^>\s]+)/i.exec(t),i;if(i=n&&ss[n[1].toLowerCase()])t=i.map((t=>"<"+t+">")).join("")+t+i.map((t=>"</"+t+">")).reverse().join("");r.innerHTML=as(t);if(i)for(let t=0;t<i.length;t++)r=r.querySelector(i[t])||r;return r}function cs(t){let e=t.querySelectorAll(Qr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<e.length;r++){let n=e[r];if(n.childNodes.length==1&&n.textContent==" "&&n.parentNode)n.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),n)}}function ds(t,e){if(!t.size)return t;let r=t.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch(e){return t}let{content:i,openStart:s,openEnd:o}=t;for(let t=n.length-2;t>=0;t-=2){let e=r.nodes[n[t]];if(!e||e.hasRequiredAttrs())break;i=v.from(e.create(n[t+1],i));s++;o++}return new E(i,s,o)}const ps={};const ms={};const gs={touchstart:true,touchmove:true};class ws{constructor(){this.shiftKey=false;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=false;this.compositionNode=null;this.composingTimeout=-1;this.compositionNodes=[];this.compositionEndedAt=-2e8;this.compositionID=1;this.compositionPendingChanges=0;this.domChangeCount=0;this.eventHandlers=Object.create(null);this.hideSelectionGuard=null}}function bs(t){for(let e in ps){let r=ps[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{if(Ms(t,e)&&!xs(t,e)&&(t.editable||!(e.type in ms)))r(t,e)},gs[e]?{passive:true}:undefined)}if(en)t.dom.addEventListener("input",(()=>null));ks(t)}function vs(t,e){t.input.lastSelectionOrigin=e;t.input.lastSelectionTime=Date.now()}function ys(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 ks(t){t.someProp("handleDOMEvents",(e=>{for(let r in e)if(!t.input.eventHandlers[r])t.dom.addEventListener(r,t.input.eventHandlers[r]=e=>xs(t,e))}))}function xs(t,e){return t.someProp("handleDOMEvents",(r=>{let n=r[e.type];return n?n(t,e)||e.defaultPrevented:false}))}function Ms(t,e){if(!e.bubbles)return true;if(e.defaultPrevented)return false;for(let r=e.target;r!=t.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(e))return false;return true}function Ss(t,e){if(!xs(t,e)&&ps[e.type]&&(t.editable||!(e.type in ms)))ps[e.type](t,e)}ms.keydown=(t,e)=>{let r=e;t.input.shiftKey=r.keyCode==16||r.shiftKey;if(js(t,r))return;t.input.lastKeyCode=r.keyCode;t.input.lastKeyCodeTime=Date.now();if(on&&Qr&&r.keyCode==13)return;if(r.keyCode!=229)t.domObserver.forceFlush();if(rn&&r.keyCode==13&&!r.ctrlKey&&!r.altKey&&!r.metaKey){let e=Date.now();t.input.lastIOSEnter=e;t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{if(t.input.lastIOSEnter==e){t.someProp("handleKeyDown",(e=>e(t,Br(13,"Enter"))));t.input.lastIOSEnter=0}}),200)}else if(t.someProp("handleKeyDown",(e=>e(t,r)))||Gi(t,r)){r.preventDefault()}else{vs(t,"key")}};ms.keyup=(t,e)=>{if(e.keyCode==16)t.input.shiftKey=false};ms.keypress=(t,e)=>{let r=e;if(js(t,r)||!r.charCode||r.ctrlKey&&!r.altKey||nn&&r.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,r)))){r.preventDefault();return}let n=t.state.selection;if(!(n instanceof ir)||!n.$from.sameParent(n.$to)){let e=String.fromCharCode(r.charCode);let i=()=>t.state.tr.insertText(e).scrollIntoView();if(!/[\r\n]/.test(e)&&!t.someProp("handleTextInput",(r=>r(t,n.$from.pos,n.$to.pos,e,i))))t.dispatch(i());r.preventDefault()}};function Es(t){return{left:t.clientX,top:t.clientY}}function Ts(t,e){let r=e.x-t.clientX,n=e.y-t.clientY;return r*r+n*n<100}function As(t,e,r,n,i){if(n==-1)return false;let s=t.state.doc.resolve(n);for(let n=s.depth+1;n>0;n--){if(t.someProp(e,(e=>n>s.depth?e(t,r,s.nodeAfter,s.before(n),i,true):e(t,r,s.node(n),s.before(n),i,false))))return true}return false}function Os(t,e,r){if(!t.focused)t.focus();if(t.state.selection.eq(e))return;let n=t.state.tr.setSelection(e);if(r=="pointer")n.setMeta("pointer",true);t.dispatch(n)}function Rs(t,e){if(e==-1)return false;let r=t.state.doc.resolve(e),n=r.nodeAfter;if(n&&n.isAtom&&or.isSelectable(n)){Os(t,new or(r),"pointer");return true}return false}function $s(t,e){if(e==-1)return false;let r=t.state.selection,n,i;if(r instanceof or)n=r.node;let s=t.state.doc.resolve(e);for(let t=s.depth+1;t>0;t--){let e=t>s.depth?s.nodeAfter:s.node(t);if(or.isSelectable(e)){if(n&&r.$from.depth>0&&t>=r.$from.depth&&s.before(r.$from.depth+1)==r.$from.pos)i=s.before(r.$from.depth);else i=s.before(t);break}}if(i!=null){Os(t,or.create(t.state.doc,i),"pointer");return true}else{return false}}function Cs(t,e,r,n,i){return As(t,"handleClickOn",e,r,n)||t.someProp("handleClick",(r=>r(t,e,n)))||(i?$s(t,r):Rs(t,r))}function Ls(t,e,r,n){return As(t,"handleDoubleClickOn",e,r,n)||t.someProp("handleDoubleClick",(r=>r(t,e,n)))}function Ns(t,e,r,n){return As(t,"handleTripleClickOn",e,r,n)||t.someProp("handleTripleClick",(r=>r(t,e,n)))||Ps(t,r,n)}function Ps(t,e,r){if(r.button!=0)return false;let n=t.state.doc;if(e==-1){if(n.inlineContent){Os(t,ir.create(n,0,n.content.size),"pointer");return true}return false}let i=n.resolve(e);for(let e=i.depth+1;e>0;e--){let r=e>i.depth?i.nodeAfter:i.node(e);let s=i.before(e);if(r.inlineContent)Os(t,ir.create(n,s+1,s+1+r.content.size),"pointer");else if(or.isSelectable(r))Os(t,or.create(n,s),"pointer");else continue;return true}}function Ds(t){return qs(t)}const Is=nn?"metaKey":"ctrlKey";ps.mousedown=(t,e)=>{let r=e;t.input.shiftKey=r.shiftKey;let n=Ds(t);let i=Date.now(),s="singleClick";if(i-t.input.lastClick.time<500&&Ts(r,t.input.lastClick)&&!r[Is]&&t.input.lastClick.button==r.button){if(t.input.lastClick.type=="singleClick")s="doubleClick";else if(t.input.lastClick.type=="doubleClick")s="tripleClick"}t.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:s,button:r.button};let o=t.posAtCoords(Es(r));if(!o)return;if(s=="singleClick"){if(t.input.mouseDown)t.input.mouseDown.done();t.input.mouseDown=new Hs(t,o,r,!!n)}else if((s=="doubleClick"?Ls:Ns)(t,o.pos,o.inside,r)){r.preventDefault()}else{vs(t,"pointer")}};class Hs{constructor(t,e,r,n){this.view=t;this.pos=e;this.event=r;this.flushed=n;this.delayedSelectionSync=false;this.mightDrag=null;this.startDoc=t.state.doc;this.selectNode=!!r[Is];this.allowDefault=r.shiftKey;let i,s;if(e.inside>-1){i=t.state.doc.nodeAt(e.inside);s=e.inside}else{let r=t.state.doc.resolve(e.pos);i=r.parent;s=r.depth?r.before():0}const o=n?null:r.target;const l=o?t.docView.nearestDesc(o,true):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=t.state;if(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==false||u instanceof or&&u.from<=s&&u.to>s)this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Yr&&!this.target.hasAttribute("contentEditable"))};if(this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)){this.view.domObserver.stop();if(this.mightDrag.addAttr)this.target.draggable=true;if(this.mightDrag.setUneditable)setTimeout((()=>{if(this.view.input.mouseDown==this)this.target.setAttribute("contentEditable","false")}),20);this.view.domObserver.start()}t.root.addEventListener("mouseup",this.up=this.up.bind(this));t.root.addEventListener("mousemove",this.move=this.move.bind(this));vs(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up);this.view.root.removeEventListener("mousemove",this.move);if(this.mightDrag&&this.target){this.view.domObserver.stop();if(this.mightDrag.addAttr)this.target.removeAttribute("draggable");if(this.mightDrag.setUneditable)this.target.removeAttribute("contentEditable");this.view.domObserver.start()}if(this.delayedSelectionSync)setTimeout((()=>bi(this.view)));this.view.input.mouseDown=null}up(t){this.done();if(!this.view.dom.contains(t.target))return;let e=this.pos;if(this.view.state.doc!=this.startDoc)e=this.view.posAtCoords(Es(t));this.updateAllowDefault(t);if(this.allowDefault||!e){vs(this.view,"pointer")}else if(Cs(this.view,e.pos,e.inside,t,this.selectNode)){t.preventDefault()}else if(t.button==0&&(this.flushed||en&&this.mightDrag&&!this.mightDrag.node.isAtom||Qr&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)){Os(this.view,tr.near(this.view.state.doc.resolve(e.pos)),"pointer");t.preventDefault()}else{vs(this.view,"pointer")}}move(t){this.updateAllowDefault(t);vs(this.view,"pointer");if(t.buttons==0)this.done()}updateAllowDefault(t){if(!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4))this.allowDefault=true}}ps.touchstart=t=>{t.input.lastTouch=Date.now();Ds(t);vs(t,"pointer")};ps.touchmove=t=>{t.input.lastTouch=Date.now();vs(t,"pointer")};ps.contextmenu=t=>Ds(t);function js(t,e){if(t.composing)return true;if(en&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500){t.input.compositionEndedAt=-2e8;return true}return false}const _s=on?5e3:-1;ms.compositionstart=ms.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,r=e.selection.$to;if(e.selection instanceof ir&&(e.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some((t=>t.type.spec.inclusive===false)))){t.markCursor=t.state.storedMarks||r.marks();qs(t,true);t.markCursor=null}else{qs(t,!e.selection.empty);if(Yr&&e.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let e=t.domSelectionRange();for(let r=e.focusNode,n=e.focusOffset;r&&r.nodeType==1&&n!=0;){let e=n<0?r.lastChild:r.childNodes[n-1];if(!e)break;if(e.nodeType==3){let r=t.domSelection();if(r)r.collapse(e,e.nodeValue.length);break}else{r=e;n=-1}}}}t.input.composing=true}Bs(t,_s)};ms.compositionend=(t,e)=>{if(t.composing){t.input.composing=false;t.input.compositionEndedAt=e.timeStamp;t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0;t.input.compositionNode=null;if(t.input.compositionPendingChanges)Promise.resolve().then((()=>t.domObserver.flush()));t.input.compositionID++;Bs(t,20)}};function Bs(t,e){clearTimeout(t.input.composingTimeout);if(e>-1)t.input.composingTimeout=setTimeout((()=>qs(t)),e)}function zs(t){if(t.composing){t.input.composing=false;t.input.compositionEndedAt=Us()}while(t.input.compositionNodes.length>0)t.input.compositionNodes.pop().markParentsDirty()}function Fs(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let r=Dr(e.focusNode,e.focusOffset);let n=Ir(e.focusNode,e.focusOffset);if(r&&n&&r!=n){let e=n.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(r==i||n==i)return i;if(!e||!e.isText(n.nodeValue)){return n}else if(t.input.compositionNode==n){let t=r.pmViewDesc;if(!(!t||!t.isText(r.nodeValue)))return n}}return r||n}function Us(){let t=document.createEvent("Event");t.initEvent("event",true,true);return t.timeStamp}function qs(t,e=false){if(on&&t.domObserver.flushingSoon>=0)return;t.domObserver.forceFlush();zs(t);if(e||t.docView&&t.docView.dirty){let r=gi(t),n=t.state.selection;if(r&&!r.eq(n))t.dispatch(t.state.tr.setSelection(r));else if((t.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent)t.dispatch(t.state.tr.deleteSelection());else t.updateState(t.state);return true}return false}function Ks(t,e){if(!t.dom.parentNode)return;let r=t.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(e);r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e);t.dom.blur();n.removeAllRanges();n.addRange(i);setTimeout((()=>{if(r.parentNode)r.parentNode.removeChild(r);t.focus()}),50)}const Js=Gr&&Zr<15||rn&&un<604;ps.copy=ms.cut=(t,e)=>{let r=e;let n=t.state.selection,i=r.type=="cut";if(n.empty)return;let s=Js?null:r.clipboardData;let o=n.content(),{dom:l,text:u}=Zi(t,o);if(s){r.preventDefault();s.clearData();s.setData("text/html",l.innerHTML);s.setData("text/plain",u)}else{Ks(t,l)}if(i)t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Ws(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Vs(t,e){if(!t.dom.parentNode)return;let r=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code;let n=t.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));if(!r)n.contentEditable="true";n.style.cssText="position: fixed; left: -10000px; top: 10px";n.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout((()=>{t.focus();if(n.parentNode)n.parentNode.removeChild(n);if(r)Gs(t,n.value,null,i,e);else Gs(t,n.textContent,n.innerHTML,i,e)}),50)}function Gs(t,e,r,n,i){let s=Yi(t,e,r,n,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,i,s||E.empty))))return true;if(!s)return false;let o=Ws(s);let l=o?t.state.tr.replaceSelectionWith(o,n):t.state.tr.replaceSelection(s);t.dispatch(l.scrollIntoView().setMeta("paste",true).setMeta("uiEvent","paste"));return true}function Zs(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let r=t.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}ms.paste=(t,e)=>{let r=e;if(t.composing&&!on)return;let n=Js?null:r.clipboardData;let i=t.input.shiftKey&&t.input.lastKeyCode!=45;if(n&&Gs(t,Zs(n),n.getData("text/html"),i,r))r.preventDefault();else Vs(t,r)};class Ys{constructor(t,e,r){this.slice=t;this.move=e;this.node=r}}const Xs=nn?"altKey":"ctrlKey";function Qs(t,e){let r=t.someProp("dragCopies",(t=>!t(e)));return r!=null?r:!e[Xs]}ps.dragstart=(t,e)=>{let r=e;let n=t.input.mouseDown;if(n)n.done();if(!r.dataTransfer)return;let i=t.state.selection;let s=i.empty?null:t.posAtCoords(Es(r));let o;if(s&&s.pos>=i.from&&s.pos<=(i instanceof or?i.to-1:i.to));else if(n&&n.mightDrag){o=or.create(t.state.doc,n.mightDrag.pos)}else if(r.target&&r.target.nodeType==1){let e=t.docView.nearestDesc(r.target,true);if(e&&e.node.type.spec.draggable&&e!=t.docView)o=or.create(t.state.doc,e.posBefore)}let l=(o||t.state.selection).content();let{dom:u,text:f,slice:a}=Zi(t,l);if(!r.dataTransfer.files.length||!Qr||tn>120)r.dataTransfer.clearData();r.dataTransfer.setData(Js?"Text":"text/html",u.innerHTML);r.dataTransfer.effectAllowed="copyMove";if(!Js)r.dataTransfer.setData("text/plain",f);t.dragging=new Ys(a,Qs(t,r),o)};ps.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{if(t.dragging==e)t.dragging=null}),50)};ms.dragover=ms.dragenter=(t,e)=>e.preventDefault();ms.drop=(t,e)=>{let r=e;let n=t.dragging;t.dragging=null;if(!r.dataTransfer)return;let i=t.posAtCoords(Es(r));if(!i)return;let s=t.state.doc.resolve(i.pos);let o=n&&n.slice;if(o){t.someProp("transformPasted",(e=>{o=e(o,t,false)}))}else{o=Yi(t,Zs(r.dataTransfer),Js?null:r.dataTransfer.getData("text/html"),false,s)}let l=!!(n&&Qs(t,r));if(t.someProp("handleDrop",(e=>e(t,r,o||E.empty,l)))){r.preventDefault();return}if(!o)return;r.preventDefault();let u=o?Ne(t.state.doc,s.pos,o):s.pos;if(u==null)u=s.pos;let f=t.state.tr;if(l){let{node:t}=n;if(t)t.replace(f);else f.deleteSelection()}let a=f.mapping.map(u);let h=o.openStart==0&&o.openEnd==0&&o.content.childCount==1;let c=f.doc;if(h)f.replaceRangeWith(a,a,o.content.firstChild);else f.replaceRange(a,a,o);if(f.doc.eq(c))return;let d=f.doc.resolve(a);if(h&&or.isSelectable(o.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(o.content.firstChild)){f.setSelection(new or(d))}else{let e=f.mapping.map(u);f.mapping.maps[f.mapping.maps.length-1].forEach(((t,r,n,i)=>e=i));f.setSelection(Ai(t,d,f.doc.resolve(e)))}t.focus();t.dispatch(f.setMeta("uiEvent","drop"))};ps.focus=t=>{t.input.lastFocus=Date.now();if(!t.focused){t.domObserver.stop();t.dom.classList.add("ProseMirror-focused");t.domObserver.start();t.focused=true;setTimeout((()=>{if(t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange()))bi(t)}),20)}};ps.blur=(t,e)=>{let r=e;if(t.focused){t.domObserver.stop();t.dom.classList.remove("ProseMirror-focused");t.domObserver.start();if(r.relatedTarget&&t.dom.contains(r.relatedTarget))t.domObserver.currentSelection.clear();t.focused=false}};ps.beforeinput=(t,e)=>{let r=e;if(Qr&&on&&r.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;t.dom.blur();t.focus();if(t.someProp("handleKeyDown",(e=>e(t,Br(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;if(r&&r.pos>0)t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())}),50)}};for(let t in ms)ps[t]=ms[t];function to(t,e){if(t==e)return true;for(let r in t)if(t[r]!==e[r])return false;for(let r in e)if(!(r in t))return false;return true}class eo{constructor(t,e){this.toDOM=t;this.spec=e||oo;this.side=this.spec.side||0}map(t,e,r,n){let{pos:i,deleted:s}=t.mapResult(e.from+n,this.side<0?-1:1);return s?null:new io(i-r,i-r,this)}valid(){return true}eq(t){return this==t||t instanceof eo&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&to(this.spec,t.spec))}destroy(t){if(this.spec.destroy)this.spec.destroy(t)}}class ro{constructor(t,e){this.attrs=t;this.spec=e||oo}map(t,e,r,n){let i=t.map(e.from+n,this.spec.inclusiveStart?-1:1)-r;let s=t.map(e.to+n,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new io(i,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof ro&&to(this.attrs,t.attrs)&&to(this.spec,t.spec)}static is(t){return t.type instanceof ro}destroy(){}}class no{constructor(t,e){this.attrs=t;this.spec=e||oo}map(t,e,r,n){let i=t.mapResult(e.from+n,1);if(i.deleted)return null;let s=t.mapResult(e.to+n,-1);if(s.deleted||s.pos<=i.pos)return null;return new io(i.pos-r,s.pos-r,this)}valid(t,e){let{index:r,offset:n}=t.content.findIndex(e.from),i;return n==e.from&&!(i=t.child(r)).isText&&n+i.nodeSize==e.to}eq(t){return this==t||t instanceof no&&to(this.attrs,t.attrs)&&to(this.spec,t.spec)}destroy(){}}class io{constructor(t,e,r){this.from=t;this.to=e;this.type=r}copy(t,e){return new io(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,r){return this.type.map(t,this,e,r)}static widget(t,e,r){return new io(t,t,new eo(e,r))}static inline(t,e,r,n){return new io(t,e,new ro(r,n))}static node(t,e,r,n){return new io(t,e,new no(r,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof ro}get widget(){return this.type instanceof eo}}const so=[],oo={};class lo{constructor(t,e){this.local=t.length?t:so;this.children=e.length?e:so}static create(t,e){return e.length?go(e,t,0,oo):uo}find(t,e,r){let n=[];this.findInner(t==null?0:t,e==null?1e9:e,n,0,r);return n}findInner(t,e,r,n,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];if(o.from<=e&&o.to>=t&&(!i||i(o.spec)))r.push(o.copy(o.from+n,o.to+n))}for(let s=0;s<this.children.length;s+=3){if(this.children[s]<e&&this.children[s+1]>t){let o=this.children[s]+1;this.children[s+2].findInner(t-o,e-o,r,n+o,i)}}}map(t,e,r){if(this==uo||t.maps.length==0)return this;return this.mapInner(t,e,0,0,r||oo)}mapInner(t,e,r,n,i){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(t,r,n);if(l&&l.type.valid(e,l))(s||(s=[])).push(l);else if(i.onRemove)i.onRemove(this.local[o].spec)}if(this.children.length)return ao(this.children,s||[],t,e,r,n,i);else return s?new lo(s.sort(wo),so):uo}add(t,e){if(!e.length)return this;if(this==uo)return lo.create(t,e);return this.addInner(t,e,0)}addInner(t,e,r){let n,i=0;t.forEach(((t,s)=>{let o=s+r,l;if(!(l=po(e,t,o)))return;if(!n)n=this.children.slice();while(i<n.length&&n[i]<s)i+=3;if(n[i]==s)n[i+2]=n[i+2].addInner(t,l,o+1);else n.splice(i,0,s,s+t.nodeSize,go(l,t,o+1,oo));i+=3}));let s=ho(i?mo(e):e,-r);for(let e=0;e<s.length;e++)if(!s[e].type.valid(t,s[e]))s.splice(e--,1);return new lo(s.length?this.local.concat(s).sort(wo):this.local,n||this.children)}remove(t){if(t.length==0||this==uo)return this;return this.removeInner(t,0)}removeInner(t,e){let r=this.children,n=this.local;for(let n=0;n<r.length;n+=3){let i;let s=r[n]+e,o=r[n+1]+e;for(let e=0,r;e<t.length;e++)if(r=t[e]){if(r.from>s&&r.to<o){t[e]=null;(i||(i=[])).push(r)}}if(!i)continue;if(r==this.children)r=this.children.slice();let l=r[n+2].removeInner(i,s+1);if(l!=uo){r[n+2]=l}else{r.splice(n,3);n-=3}}if(n.length)for(let r=0,i;r<t.length;r++)if(i=t[r]){for(let t=0;t<n.length;t++)if(n[t].eq(i,e)){if(n==this.local)n=this.local.slice();n.splice(t--,1)}}if(r==this.children&&n==this.local)return this;return n.length||r.length?new lo(n,r):uo}forChild(t,e){if(this==uo)return this;if(e.isLeaf)return lo.empty;let r,n;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){if(this.children[e]==t)r=this.children[e+2];break}let i=t+1,s=i+e.content.size;for(let t=0;t<this.local.length;t++){let e=this.local[t];if(e.from<s&&e.to>i&&e.type instanceof ro){let t=Math.max(i,e.from)-i,r=Math.min(s,e.to)-i;if(t<r)(n||(n=[])).push(e.copy(t,r))}}if(n){let t=new lo(n.sort(wo),so);return r?new fo([t,r]):t}return r||uo}eq(t){if(this==t)return true;if(!(t instanceof lo)||this.local.length!=t.local.length||this.children.length!=t.children.length)return false;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return false;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return false;return true}locals(t){return bo(this.localsInner(t))}localsInner(t){if(this==uo)return so;if(t.inlineContent||!this.local.some(ro.is))return this.local;let e=[];for(let t=0;t<this.local.length;t++){if(!(this.local[t].type instanceof ro))e.push(this.local[t])}return e}forEachSet(t){t(this)}}lo.empty=new lo([],[]);lo.removeOverlap=bo;const uo=lo.empty;class fo{constructor(t){this.members=t}map(t,e){const r=this.members.map((r=>r.map(t,e,oo)));return fo.from(r)}forChild(t,e){if(e.isLeaf)return lo.empty;let r=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(t,e);if(i==uo)continue;if(i instanceof fo)r=r.concat(i.members);else r.push(i)}return fo.from(r)}eq(t){if(!(t instanceof fo)||t.members.length!=this.members.length)return false;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return false;return true}locals(t){let e,r=true;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(t);if(!i.length)continue;if(!e){e=i}else{if(r){e=e.slice();r=false}for(let t=0;t<i.length;t++)e.push(i[t])}}return e?bo(r?e:e.sort(wo)):so}static from(t){switch(t.length){case 0:return uo;case 1:return t[0];default:return new fo(t.every((t=>t instanceof lo))?t:t.reduce(((t,e)=>t.concat(e instanceof lo?e:e.members)),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function ao(t,e,r,n,i,s,o){let l=t.slice();for(let t=0,e=s;t<r.maps.length;t++){let n=0;r.maps[t].forEach(((t,r,i,s)=>{let o=s-i-(r-t);for(let i=0;i<l.length;i+=3){let s=l[i+1];if(s<0||t>s+e-n)continue;let u=l[i]+e-n;if(r>=u){l[i+1]=t<=u?-2:-1}else if(t>=e&&o){l[i]+=o;l[i+1]+=o}}n+=o}));e=r.maps[t].map(e,-1)}let u=false;for(let e=0;e<l.length;e+=3)if(l[e+1]<0){if(l[e+1]==-2){u=true;l[e+1]=-1;continue}let f=r.map(t[e]+s),a=f-i;if(a<0||a>=n.content.size){u=true;continue}let h=r.map(t[e+1]+s,-1),c=h-i;let{index:d,offset:p}=n.content.findIndex(a);let m=n.maybeChild(d);if(m&&p==a&&p+m.nodeSize==c){let n=l[e+2].mapInner(r,m,f+1,t[e]+s+1,o);if(n!=uo){l[e]=a;l[e+1]=c;l[e+2]=n}else{l[e+1]=-2;u=true}}else{u=true}}if(u){let u=co(l,t,e,r,i,s,o);let f=go(u,n,0,o);e=f.local;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){l.splice(t,3);t-=3}for(let t=0,e=0;t<f.children.length;t+=3){let r=f.children[t];while(e<l.length&&l[e]<r)e+=3;l.splice(e,0,f.children[t],f.children[t+1],f.children[t+2])}}return new lo(e.sort(wo),l)}function ho(t,e){if(!e||!t.length)return t;let r=[];for(let n=0;n<t.length;n++){let i=t[n];r.push(new io(i.from+e,i.to+e,i.type))}return r}function co(t,e,r,n,i,s,o){function l(t,e){for(let s=0;s<t.local.length;s++){let l=t.local[s].map(n,i,e);if(l)r.push(l);else if(o.onRemove)o.onRemove(t.local[s].spec)}for(let r=0;r<t.children.length;r+=3)l(t.children[r+2],t.children[r]+e+1)}for(let r=0;r<t.length;r+=3)if(t[r+1]==-1)l(t[r+2],e[r]+s+1);return r}function po(t,e,r){if(e.isLeaf)return null;let n=r+e.nodeSize,i=null;for(let e=0,s;e<t.length;e++){if((s=t[e])&&s.from>r&&s.to<n){(i||(i=[])).push(s);t[e]=null}}return i}function mo(t){let e=[];for(let r=0;r<t.length;r++)if(t[r]!=null)e.push(t[r]);return e}function go(t,e,r,n){let i=[],s=false;e.forEach(((e,o)=>{let l=po(t,e,o+r);if(l){s=true;let t=go(l,e,r+o+1,n);if(t!=uo)i.push(o,o+e.nodeSize,t)}}));let o=ho(s?mo(t):t,-r).sort(wo);for(let t=0;t<o.length;t++)if(!o[t].type.valid(e,o[t])){if(n.onRemove)n.onRemove(o[t].spec);o.splice(t--,1)}return o.length||i.length?new lo(o,i):uo}function wo(t,e){return t.from-e.from||t.to-e.to}function bo(t){let e=t;for(let r=0;r<e.length-1;r++){let n=e[r];if(n.from!=n.to)for(let i=r+1;i<e.length;i++){let s=e[i];if(s.from==n.from){if(s.to!=n.to){if(e==t)e=t.slice();e[i]=s.copy(s.from,n.to);vo(e,i+1,s.copy(n.to,s.to))}continue}else{if(s.from<n.to){if(e==t)e=t.slice();e[r]=n.copy(n.from,s.from);vo(e,i,n.copy(s.from,n.to))}break}}}return e}function vo(t,e,r){while(e<t.length&&wo(r,t[e])>0)e++;t.splice(e,0,r)}function yo(t){let e=[];t.someProp("decorations",(r=>{let n=r(t.state);if(n&&n!=uo)e.push(n)}));if(t.cursorWrapper)e.push(lo.create(t.state.doc,[t.cursorWrapper.deco]));return fo.from(e)}const ko={childList:true,characterData:true,characterDataOldValue:true,attributes:true,attributeOldValue:true,subtree:true};const xo=Gr&&Zr<=11;class Mo{constructor(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0}set(t){this.anchorNode=t.anchorNode;this.anchorOffset=t.anchorOffset;this.focusNode=t.focusNode;this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class So{constructor(t,e){this.view=t;this.handleDOMChange=e;this.queue=[];this.flushingSoon=-1;this.observer=null;this.currentSelection=new Mo;this.onCharData=null;this.suppressingSelectionUpdates=false;this.lastChangedTextNode=null;this.observer=window.MutationObserver&&new window.MutationObserver((t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);if(Gr&&Zr<=11&&t.some((t=>t.type=="childList"&&t.removedNodes.length||t.type=="characterData"&&t.oldValue.length>t.target.nodeValue.length)))this.flushSoon();else this.flush()}));if(xo){this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue});this.flushSoon()}}this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){if(this.flushingSoon<0)this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1;this.flush()}),20)}forceFlush(){if(this.flushingSoon>-1){window.clearTimeout(this.flushingSoon);this.flushingSoon=-1;this.flush()}}start(){if(this.observer){this.observer.takeRecords();this.observer.observe(this.view.dom,ko)}if(this.onCharData)this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData);this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}if(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=true;setTimeout((()=>this.suppressingSelectionUpdates=false),50)}onSelectionChange(){if(!Oi(this.view))return;if(this.suppressingSelectionUpdates)return bi(this.view);if(Gr&&Zr<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Cr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return true;let e=new Set,r;for(let r=t.focusNode;r;r=Ar(r))e.add(r);for(let n=t.anchorNode;n;n=Ar(n))if(e.has(n)){r=n;break}let n=r&&this.view.docView.nearestDesc(r);if(n&&n.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r})){this.setCurSelection();return true}}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();if(e.length)this.queue=[];let r=t.domSelectionRange();let n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Oi(t)&&!this.ignoreSelectionChange(r);let i=-1,s=-1,o=false,l=[];if(t.editable){for(let t=0;t<e.length;t++){let r=this.registerMutation(e[t],l);if(r){i=i<0?r.from:Math.min(r.from,i);s=s<0?r.to:Math.max(r.to,s);if(r.typeOver)o=true}}}if(Yr&&l.length){let e=l.filter((t=>t.nodeName=="BR"));if(e.length==2){let[t,r]=e;if(t.parentNode&&t.parentNode.parentNode==r.parentNode)r.remove();else t.remove()}else{let{focusNode:r}=this.currentSelection;for(let n of e){let e=n.parentNode;if(e&&e.nodeName=="LI"&&(!r||$o(t,r)!=e))n.remove()}}}let u=null;if(i<0&&n&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&_r(r)&&(u=gi(t))&&u.eq(tr.near(t.state.doc.resolve(0),1))){t.input.lastFocus=0;bi(t);this.currentSelection.set(r);t.scrollToSelection()}else if(i>-1||n){if(i>-1){t.docView.markDirty(i,s);Ao(t)}this.handleDOMChange(i,s,o,l);if(t.docView&&t.docView.dirty)t.updateState(t.state);else if(!this.currentSelection.eq(r))bi(t);this.currentSelection.set(r)}}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let r=0;r<t.addedNodes.length;r++){let n=t.addedNodes[r];e.push(n);if(n.nodeType==3)this.lastChangedTextNode=n}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let n=t.previousSibling,i=t.nextSibling;if(Gr&&Zr<=11&&t.addedNodes.length){for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:r,nextSibling:s}=t.addedNodes[e];if(!r||Array.prototype.indexOf.call(t.addedNodes,r)<0)n=r;if(!s||Array.prototype.indexOf.call(t.addedNodes,s)<0)i=s}}let s=n&&n.parentNode==t.target?Tr(n)+1:0;let o=r.localPosFromDOM(t.target,s,-1);let l=i&&i.parentNode==t.target?Tr(i):t.target.childNodes.length;let u=r.localPosFromDOM(t.target,l,1);return{from:o,to:u}}else if(t.type=="attributes"){return{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}}else{this.lastChangedTextNode=t.target;return{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}}}let Eo=new WeakMap;let To=false;function Ao(t){if(Eo.has(t))return;Eo.set(t,null);if(["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1){t.requiresGeckoHackNode=Yr;if(To)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.");To=true}}function Oo(t,e){let r=e.startContainer,n=e.startOffset;let i=e.endContainer,s=e.endOffset;let o=t.domAtPos(t.state.selection.anchor);if(Cr(o.node,o.offset,i,s))[r,n,i,s]=[i,s,r,n];return{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:s}}function Ro(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Oo(t,r)}let r;function n(t){t.preventDefault();t.stopImmediatePropagation();r=t.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",n,true);document.execCommand("indent");t.dom.removeEventListener("beforeinput",n,true);return r?Oo(t,r):null}function $o(t,e){for(let r=e.parentNode;r&&r!=t.dom;r=r.parentNode){let e=t.docView.nearestDesc(r,true);if(e&&e.node.isBlock)return r}return null}function Co(t,e,r){let{node:n,fromOffset:i,toOffset:s,from:o,to:l}=t.docView.parseRange(e,r);let u=t.domSelectionRange();let f;let a=u.anchorNode;if(a&&t.dom.contains(a.nodeType==1?a:a.parentNode)){f=[{node:a,offset:u.anchorOffset}];if(!_r(u))f.push({node:u.focusNode,offset:u.focusOffset})}if(Qr&&t.input.lastKeyCode===8){for(let t=s;t>i;t--){let e=n.childNodes[t-1],r=e.pmViewDesc;if(e.nodeName=="BR"&&!r){s=t;break}if(!r||r.size)break}}let h=t.state.doc;let c=t.someProp("domParser")||vt.fromSchema(t.state.schema);let d=h.resolve(o);let p=null,m=c.parse(n,{topNode:d.parent,topMatch:d.parent.contentMatchAt(d.index()),topOpen:true,from:i,to:s,preserveWhitespace:d.parent.type.whitespace=="pre"?"full":true,findPositions:f,ruleFromNode:Lo,context:d});if(f&&f[0].pos!=null){let t=f[0].pos,e=f[1]&&f[1].pos;if(e==null)e=t;p={anchor:t+o,head:e+o}}return{doc:m,sel:p,from:o,to:l}}function Lo(t){let e=t.pmViewDesc;if(e){return e.parseRule()}else if(t.nodeName=="BR"&&t.parentNode){if(en&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let t=document.createElement("div");t.appendChild(document.createElement("li"));return{skip:t}}else if(t.parentNode.lastChild==t||en&&/^(tr|table)$/i.test(t.parentNode.nodeName)){return{ignore:true}}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder")){return{ignore:true}}return null}const No=/^(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 Po(t,e,r,n,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);t.input.compositionPendingChanges=0;if(e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null;let r=gi(t,e);if(r&&!t.state.selection.eq(r)){if(Qr&&on&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",(e=>e(t,Br(13,"Enter")))))return;let n=t.state.tr.setSelection(r);if(e=="pointer")n.setMeta("pointer",true);else if(e=="key")n.scrollIntoView();if(s)n.setMeta("composition",s);t.dispatch(n)}return}let o=t.state.doc.resolve(e);let l=o.sharedDepth(r);e=o.before(l+1);r=t.state.doc.resolve(r).after(l+1);let u=t.state.selection;let f=Co(t,e,r);let a=t.state.doc,h=a.slice(f.from,f.to);let c,d;if(t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime){c=t.state.selection.to;d="end"}else{c=t.state.selection.from;d="start"}t.input.lastKeyCode=null;let p=_o(h.content,f.doc.content,f.from,c,d);if(p)t.input.domChangeCount++;if((rn&&t.input.lastIOSEnter>Date.now()-225||on)&&i.some((t=>t.nodeType==1&&!No.test(t.nodeName)))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",(e=>e(t,Br(13,"Enter"))))){t.input.lastIOSEnter=0;return}if(!p){if(n&&u instanceof ir&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head)){p={start:u.from,endA:u.to,endB:u.to}}else{if(f.sel){let e=Do(t,t.state.doc,f.sel);if(e&&!e.eq(t.state.selection)){let r=t.state.tr.setSelection(e);if(s)r.setMeta("composition",s);t.dispatch(r)}}return}}if(t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof ir){if(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=f.from){p.start=t.state.selection.from}else if(p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to){p.endB+=t.state.selection.to-p.endA;p.endA=t.state.selection.to}}if(Gr&&Zr<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>f.from&&f.doc.textBetween(p.start-f.from-1,p.start-f.from+1)=="  "){p.start--;p.endA--;p.endB--}let m=f.doc.resolveNoCache(p.start-f.from);let g=f.doc.resolveNoCache(p.endB-f.from);let w=a.resolve(p.start);let b=m.sameParent(g)&&m.parent.inlineContent&&w.end()>=p.endA;if((rn&&t.input.lastIOSEnter>Date.now()-225&&(!b||i.some((t=>t.nodeName=="DIV"||t.nodeName=="P")))||!b&&m.pos<f.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(f.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",(e=>e(t,Br(13,"Enter"))))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&Ho(a,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",(e=>e(t,Br(8,"Backspace"))))){if(on&&Qr)t.domObserver.suppressSelectionUpdates();return}if(Qr&&p.endB==p.start)t.input.lastChromeDelete=Date.now();if(on&&!b&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==p.endA){p.endB-=2;g=f.doc.resolveNoCache(p.endB-f.from);setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,Br(13,"Enter"))}))}),20)}let v=p.start,y=p.endA;let k=e=>{let r=e||t.state.tr.replace(v,y,f.doc.slice(p.start-f.from,p.endB-f.from));if(f.sel){let e=Do(t,r.doc,f.sel);if(e&&!(Qr&&t.composing&&e.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(e.head==v||e.head==r.mapping.map(y)-1)||Gr&&e.empty&&e.head==v))r.setSelection(e)}if(s)r.setMeta("composition",s);return r.scrollIntoView()};let x;if(b){if(m.pos==g.pos){if(Gr&&Zr<=11&&m.parentOffset==0){t.domObserver.suppressSelectionUpdates();setTimeout((()=>bi(t)),20)}let e=k(t.state.tr.delete(v,y));let r=a.resolve(p.start).marksAcross(a.resolve(p.endA));if(r)e.ensureMarks(r);t.dispatch(e)}else if(p.endA==p.endB&&(x=Io(m.parent.content.cut(m.parentOffset,g.parentOffset),w.parent.content.cut(w.parentOffset,p.endA-w.start())))){let e=k(t.state.tr);if(x.type=="add")e.addMark(v,y,x.mark);else e.removeMark(v,y,x.mark);t.dispatch(e)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let e=m.parent.textBetween(m.parentOffset,g.parentOffset);let r=()=>k(t.state.tr.insertText(e,v,y));if(!t.someProp("handleTextInput",(n=>n(t,v,y,e,r))))t.dispatch(r())}}else{t.dispatch(k())}}function Do(t,e,r){if(Math.max(r.anchor,r.head)>e.content.size)return null;return Ai(t,e.resolve(r.anchor),e.resolve(r.head))}function Io(t,e){let r=t.firstChild.marks,n=e.firstChild.marks;let i=r,s=n,o,l,u;for(let t=0;t<n.length;t++)i=n[t].removeFromSet(i);for(let t=0;t<r.length;t++)s=r[t].removeFromSet(s);if(i.length==1&&s.length==0){l=i[0];o="add";u=t=>t.mark(l.addToSet(t.marks))}else if(i.length==0&&s.length==1){l=s[0];o="remove";u=t=>t.mark(l.removeFromSet(t.marks))}else{return null}let f=[];for(let t=0;t<e.childCount;t++)f.push(u(e.child(t)));if(v.from(f).eq(t))return{mark:l,type:o}}function Ho(t,e,r,n,i){if(r-e<=i.pos-n.pos||jo(n,true,false)<i.pos)return false;let s=t.resolve(e);if(!n.parent.isTextblock){let t=s.nodeAfter;return t!=null&&r==e+t.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return false;let o=t.resolve(jo(s,true,true));if(!o.parent.isTextblock||o.pos>r||jo(o,true,false)<r)return false;return n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function jo(t,e,r){let n=t.depth,i=e?t.end():t.pos;while(n>0&&(e||t.indexAfter(n)==t.node(n).childCount)){n--;i++;e=false}if(r){let e=t.node(n).maybeChild(t.indexAfter(n));while(e&&!e.isLeaf){e=e.firstChild;i++}}return i}function _o(t,e,r,n,i){let s=t.findDiffStart(e,r);if(s==null)return null;let{a:o,b:l}=t.findDiffEnd(e,r+t.size,r+e.size);if(i=="end"){let t=Math.max(0,s-Math.min(o,l));n-=o+t-s}if(o<s&&t.size<e.size){let t=n<=s&&n>=o?s-n:0;s-=t;if(s&&s<e.size&&Bo(e.textBetween(s-1,s+1)))s+=t?1:-1;l=s+(l-o);o=s}else if(l<s){let e=n<=s&&n>=l?s-n:0;s-=e;if(s&&s<t.size&&Bo(t.textBetween(s-1,s+1)))s+=e?1:-1;o=s+(o-l);l=s}return{start:s,endA:o,endB:l}}function Bo(t){if(t.length!=2)return false;let e=t.charCodeAt(0),r=t.charCodeAt(1);return e>=56320&&e<=57343&&r>=55296&&r<=56319}class zo{constructor(t,e){this._root=null;this.focused=false;this.trackWrites=null;this.mounted=false;this.markCursor=null;this.cursorWrapper=null;this.lastSelectedViewDesc=undefined;this.input=new ws;this.prevDirectPlugins=[];this.pluginViews=[];this.requiresGeckoHackNode=false;this.dragging=null;this._props=e;this.state=e.state;this.directPlugins=e.plugins||[];this.directPlugins.forEach(Vo);this.dispatch=this.dispatch.bind(this);this.dom=t&&t.mount||document.createElement("div");if(t){if(t.appendChild)t.appendChild(this.dom);else if(typeof t=="function")t(this.dom);else if(t.mount)this.mounted=true}this.editable=qo(this);Uo(this);this.nodeViews=Jo(this);this.docView=Zn(this.state.doc,Fo(this),yo(this),this.dom,this);this.domObserver=new So(this,((t,e,r,n)=>Po(this,t,e,r,n)));this.domObserver.start();bs(this);this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){if(t.handleDOMEvents!=this._props.handleDOMEvents)ks(this);let e=this._props;this._props=t;if(t.plugins){t.plugins.forEach(Vo);this.directPlugins=t.plugins}this.updateStateInner(t.state,e)}setProps(t){let e={};for(let t in this._props)e[t]=this._props[t];e.state=this.state;for(let r in t)e[r]=t[r];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var r;let n=this.state,i=false,s=false;if(t.storedMarks&&this.composing){zs(this);s=true}this.state=t;let o=n.plugins!=t.plugins||this._props.plugins!=e.plugins;if(o||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=Jo(this);if(Wo(t,this.nodeViews)){this.nodeViews=t;i=true}}if(o||e.handleDOMEvents!=this._props.handleDOMEvents){ks(this)}this.editable=qo(this);Uo(this);let l=yo(this),u=Fo(this);let f=n.plugins!=t.plugins&&!n.doc.eq(t.doc)?"reset":t.scrollToSelection>n.scrollToSelection?"to selection":"preserve";let a=i||!this.docView.matchesNode(t.doc,u,l);if(a||!t.selection.eq(n.selection))s=true;let h=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&dn(this);if(s){this.domObserver.stop();let e=a&&(Gr||Qr)&&!this.composing&&!n.selection.empty&&!t.selection.empty&&Ko(n.selection,t.selection);if(a){let r=Qr?this.trackWrites=this.domSelectionRange().focusNode:null;if(this.composing)this.input.compositionNode=Fs(this);if(i||!this.docView.update(t.doc,u,l,this)){this.docView.updateOuterDeco(u);this.docView.destroy();this.docView=Zn(t.doc,u,l,this.dom,this)}if(r&&!this.trackWrites)e=true}if(e||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&$i(this))){bi(this,e)}else{Ei(this,t.selection);this.domObserver.setCurSelection()}this.domObserver.start()}this.updatePluginViews(n);if(((r=this.dragging)===null||r===void 0?void 0:r.node)&&!n.doc.eq(t.doc))this.updateDraggedNode(this.dragging,n);if(f=="reset"){this.dom.scrollTop=0}else if(f=="to selection"){this.scrollToSelection()}else if(h){mn(h)}}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode));else if(this.someProp("handleScrollToSelection",(t=>t(this))));else if(this.state.selection instanceof or){let e=this.docView.domAfterPos(this.state.selection.from);if(e.nodeType==1)cn(this,e.getBoundingClientRect(),t)}else{cn(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;while(t=this.pluginViews.pop())if(t.destroy)t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins;this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];if(e.spec.view)this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];if(e.spec.view)this.pluginViews.push(e.spec.view(this))}}else{for(let e=0;e<this.pluginViews.length;e++){let r=this.pluginViews[e];if(r.update)r.update(this,t)}}}updateDraggedNode(t,e){let r=t.node,n=-1;if(this.state.doc.nodeAt(r.from)==r.node){n=r.from}else{let t=r.from+(this.state.doc.content.size-e.doc.content.size);let i=t>0&&this.state.doc.nodeAt(t);if(i==r.node)n=t}this.dragging=new Ys(t.slice,t.move,n<0?undefined:or.create(this.state.doc,n))}someProp(t,e){let r=this._props&&this._props[t],n;if(r!=null&&(n=e?e(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let i=this.directPlugins[r].props[t];if(i!=null&&(n=e?e(i):i))return n}let i=this.state.plugins;if(i)for(let r=0;r<i.length;r++){let s=i[r].props[t];if(s!=null&&(n=e?e(s):s))return n}}hasFocus(){if(Gr){let t=this.root.activeElement;if(t==this.dom)return true;if(!t||!this.dom.contains(t))return false;while(t&&this.dom!=t&&this.dom.contains(t)){if(t.contentEditable=="false")return false;t=t.parentElement}return true}return this.root.activeElement==this.dom}focus(){this.domObserver.stop();if(this.editable)bn(this.dom);bi(this);this.domObserver.start()}get root(){let t=this._root;if(t==null)for(let t=this.dom.parentNode;t;t=t.parentNode){if(t.nodeType==9||t.nodeType==11&&t.host){if(!t.getSelection)Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection();return this._root=t}}return t||document}updateRoot(){this._root=null}posAtCoords(t){return Tn(this,t)}coordsAtPos(t,e=1){return $n(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,r=-1){let n=this.docView.posFromDOM(t,e,r);if(n==null)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(t,e){return Bn(this,e||this.state,t)}pasteHTML(t,e){return Gs(this,"",t,false,e||new ClipboardEvent("paste"))}pasteText(t,e){return Gs(this,t,null,true,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return Zi(this,t)}destroy(){if(!this.docView)return;ys(this);this.destroyPluginViews();if(this.mounted){this.docView.update(this.state.doc,[],yo(this),this);this.dom.textContent=""}else if(this.dom.parentNode){this.dom.parentNode.removeChild(this.dom)}this.docView.destroy();this.docView=null;$r()}get isDestroyed(){return this.docView==null}dispatchEvent(t){return Ss(this,t)}domSelectionRange(){let t=this.domSelection();if(!t)return{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0};return en&&this.root.nodeType===11&&zr(this.dom.ownerDocument)==this.dom&&Ro(this,t)||t}domSelection(){return this.root.getSelection()}}zo.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;if(e)e.call(this,t);else this.updateState(this.state.apply(t))};function Fo(t){let e=Object.create(null);e.class="ProseMirror";e.contenteditable=String(t.editable);t.someProp("attributes",(r=>{if(typeof r=="function")r=r(t.state);if(r)for(let t in r){if(t=="class")e.class+=" "+r[t];else if(t=="style")e.style=(e.style?e.style+";":"")+r[t];else if(!e[t]&&t!="contenteditable"&&t!="nodeName")e[t]=String(r[t])}}));if(!e.translate)e.translate="no";return[io.node(0,t.state.doc.content.size,e)]}function Uo(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:io.widget(t.state.selection.from,e,{raw:true,marks:t.markCursor})}}else{t.cursorWrapper=null}}function qo(t){return!t.someProp("editable",(e=>e(t.state)===false))}function Ko(t,e){let r=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(r)!=e.$anchor.start(r)}function Jo(t){let e=Object.create(null);function r(t){for(let r in t)if(!Object.prototype.hasOwnProperty.call(e,r))e[r]=t[r]}t.someProp("nodeViews",r);t.someProp("markViews",r);return e}function Wo(t,e){let r=0,n=0;for(let n in t){if(t[n]!=e[n])return true;r++}for(let t in e)n++;return r!=n}function Vo(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 Go={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:"'"};var Zo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'};var Yo=typeof navigator!="undefined"&&/Mac/.test(navigator.platform);var Xo=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Qo=0;Qo<10;Qo++)Go[48+Qo]=Go[96+Qo]=String(Qo);for(var Qo=1;Qo<=24;Qo++)Go[Qo+111]="F"+Qo;for(var Qo=65;Qo<=90;Qo++){Go[Qo]=String.fromCharCode(Qo+32);Zo[Qo]=String.fromCharCode(Qo)}for(var tl in Go)if(!Zo.hasOwnProperty(tl))Zo[tl]=Go[tl];function el(t){var e=Yo&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Xo&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified";var r=!e&&t.key||(t.shiftKey?Zo:Go)[t.keyCode]||t.key||"Unidentified";if(r=="Esc")r="Escape";if(r=="Del")r="Delete";if(r=="Left")r="ArrowLeft";if(r=="Up")r="ArrowUp";if(r=="Right")r="ArrowRight";if(r=="Down")r="ArrowDown";return r}const rl=typeof navigator!="undefined"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);const nl=typeof navigator!="undefined"&&/Win/.test(navigator.platform);function il(t){let e=t.split(/-(?!$)/),r=e[e.length-1];if(r=="Space")r=" ";let n,i,s,o;for(let t=0;t<e.length-1;t++){let r=e[t];if(/^(cmd|meta|m)$/i.test(r))o=true;else if(/^a(lt)?$/i.test(r))n=true;else if(/^(c|ctrl|control)$/i.test(r))i=true;else if(/^s(hift)?$/i.test(r))s=true;else if(/^mod$/i.test(r)){if(rl)o=true;else i=true}else throw new Error("Unrecognized modifier name: "+r)}if(n)r="Alt-"+r;if(i)r="Ctrl-"+r;if(o)r="Meta-"+r;if(s)r="Shift-"+r;return r}function sl(t){let e=Object.create(null);for(let r in t)e[il(r)]=t[r];return e}function ol(t,e,r=true){if(e.altKey)t="Alt-"+t;if(e.ctrlKey)t="Ctrl-"+t;if(e.metaKey)t="Meta-"+t;if(r&&e.shiftKey)t="Shift-"+t;return t}function ll(t){return new xr({props:{handleKeyDown:ul(t)}})}function ul(t){let e=sl(t);return function(t,r){let n=el(r),i,s=e[ol(n,r)];if(s&&s(t.state,t.dispatch,t))return true;if(n.length==1&&n!=" "){if(r.shiftKey){let i=e[ol(n,r,false)];if(i&&i(t.state,t.dispatch,t))return true}if((r.altKey||r.metaKey||r.ctrlKey)&&!(nl&&r.ctrlKey&&r.altKey)&&(i=Go[r.keyCode])&&i!=n){let n=e[ol(i,r)];if(n&&n(t.state,t.dispatch,t))return true}}return false}}const fl=(t,e)=>{if(t.selection.empty)return false;if(e)e(t.tr.deleteSelection().scrollIntoView());return true};function al(t,e){let{$cursor:r}=t.selection;if(!r||(e?!e.endOfTextblock("backward",t):r.parentOffset>0))return null;return r}const hl=(t,e,r)=>{let n=al(t,r);if(!n)return false;let i=wl(n);if(!i){let r=n.blockRange(),i=r&&de(r);if(i==null)return false;if(e)e(t.tr.lift(r,i).scrollIntoView());return true}let s=i.nodeBefore;if(Dl(t,i,e,-1))return true;if(n.parent.content.size==0&&(ml(s,"end")||or.isSelectable(s))){for(let r=n.depth;;r--){let o=Pe(t.doc,n.before(r),n.after(r),E.empty);if(o&&o.slice.size<o.to-o.from){if(e){let r=t.tr.step(o);r.setSelection(ml(s,"end")?tr.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):or.create(r.doc,i.pos-s.nodeSize));e(r.scrollIntoView())}return true}if(r==1||n.node(r-1).childCount>1)break}}if(s.isAtom&&i.depth==n.depth-1){if(e)e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView());return true}return false};const cl=(t,e,r)=>{let n=al(t,r);if(!n)return false;let i=wl(n);return i?pl(t,i,e):false};const dl=(t,e,r)=>{let n=bl(t,r);if(!n)return false;let i=kl(n);return i?pl(t,i,e):false};function pl(t,e,r){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return false;let t=i.lastChild;if(!t)return false;i=t}let o=e.nodeAfter,l=o,u=e.pos+1;for(;!l.isTextblock;u++){if(l.type.spec.isolating)return false;let t=l.firstChild;if(!t)return false;l=t}let f=Pe(t.doc,s,u,E.empty);if(!f||f.from!=s||f instanceof oe&&f.slice.size>=u-s)return false;if(r){let e=t.tr.step(f);e.setSelection(ir.create(e.doc,s));r(e.scrollIntoView())}return true}function ml(t,e,r=false){for(let n=t;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return true;if(r&&n.childCount!=1)return false}return false}const gl=(t,e,r)=>{let{$head:n,empty:i}=t.selection,s=n;if(!i)return false;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",t):n.parentOffset>0)return false;s=wl(n)}let o=s&&s.nodeBefore;if(!o||!or.isSelectable(o))return false;if(e)e(t.tr.setSelection(or.create(t.doc,s.pos-o.nodeSize)).scrollIntoView());return true};function wl(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 bl(t,e){let{$cursor:r}=t.selection;if(!r||(e?!e.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size))return null;return r}const vl=(t,e,r)=>{let n=bl(t,r);if(!n)return false;let i=kl(n);if(!i)return false;let s=i.nodeAfter;if(Dl(t,i,e,1))return true;if(n.parent.content.size==0&&(ml(s,"start")||or.isSelectable(s))){let r=Pe(t.doc,n.before(),n.after(),E.empty);if(r&&r.slice.size<r.to-r.from){if(e){let n=t.tr.step(r);n.setSelection(ml(s,"start")?tr.findFrom(n.doc.resolve(n.mapping.map(i.pos)),1):or.create(n.doc,n.mapping.map(i.pos)));e(n.scrollIntoView())}return true}}if(s.isAtom&&i.depth==n.depth-1){if(e)e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView());return true}return false};const yl=(t,e,r)=>{let{$head:n,empty:i}=t.selection,s=n;if(!i)return false;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)return false;s=kl(n)}let o=s&&s.nodeAfter;if(!o||!or.isSelectable(o))return false;if(e)e(t.tr.setSelection(or.create(t.doc,s.pos)).scrollIntoView());return true};function kl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let r=t.node(e);if(t.index(e)+1<r.childCount)return t.doc.resolve(t.after(e+1));if(r.type.spec.isolating)break}return null}const xl=(t,e)=>{let r=t.selection,n=r instanceof or,i;if(n){if(r.node.isTextblock||!Ae(t.doc,r.from))return false;i=r.from}else{i=$e(t.doc,r.from,-1);if(i==null)return false}if(e){let r=t.tr.join(i);if(n)r.setSelection(or.create(r.doc,i-t.doc.resolve(i).nodeBefore.nodeSize));e(r.scrollIntoView())}return true};const Ml=(t,e)=>{let r=t.selection,n;if(r instanceof or){if(r.node.isTextblock||!Ae(t.doc,r.to))return false;n=r.to}else{n=$e(t.doc,r.to,1);if(n==null)return false}if(e)e(t.tr.join(n).scrollIntoView());return true};const Sl=(t,e)=>{let{$from:r,$to:n}=t.selection;let i=r.blockRange(n),s=i&&de(i);if(s==null)return false;if(e)e(t.tr.lift(i,s).scrollIntoView());return true};const El=(t,e)=>{let{$head:r,$anchor:n}=t.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return false;if(e)e(t.tr.insertText("\n").scrollIntoView());return true};function Tl(t){for(let e=0;e<t.edgeCount;e++){let{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}const Al=(t,e)=>{let{$head:r,$anchor:n}=t.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return false;let i=r.node(-1),s=r.indexAfter(-1),o=Tl(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return false;if(e){let n=r.after(),i=t.tr.replaceWith(n,n,o.createAndFill());i.setSelection(tr.near(i.doc.resolve(n),1));e(i.scrollIntoView())}return true};const Ol=(t,e)=>{let r=t.selection,{$from:n,$to:i}=r;if(r instanceof ur||n.parent.inlineContent||i.parent.inlineContent)return false;let s=Tl(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return false;if(e){let r=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos;let o=t.tr.insert(r,s.createAndFill());o.setSelection(ir.create(o.doc,r+1));e(o.scrollIntoView())}return true};const Rl=(t,e)=>{let{$cursor:r}=t.selection;if(!r||r.parent.content.size)return false;if(r.depth>1&&r.after()!=r.end(-1)){let n=r.before();if(Ee(t.doc,n)){if(e)e(t.tr.split(n).scrollIntoView());return true}}let n=r.blockRange(),i=n&&de(n);if(i==null)return false;if(e)e(t.tr.lift(n,i).scrollIntoView());return true};function $l(t){return(e,r)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof or&&e.selection.node.isBlock){if(!n.parentOffset||!Ee(e.doc,n.pos))return false;if(r)r(e.tr.split(n.pos).scrollIntoView());return true}if(!n.depth)return false;let s=[];let o,l,u=false,f=false;for(let e=n.depth;;e--){let r=n.node(e);if(r.isBlock){u=n.end(e)==n.pos+(n.depth-e);f=n.start(e)==n.pos-(n.depth-e);l=Tl(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));let r=t&&t(i.parent,u,n);s.unshift(r||(u&&l?{type:l}:null));o=e;break}else{if(e==1)return false;s.unshift(null)}}let a=e.tr;if(e.selection instanceof ir||e.selection instanceof ur)a.deleteSelection();let h=a.mapping.map(n.pos);let c=Ee(a.doc,h,s.length,s);if(!c){s[0]=l?{type:l}:null;c=Ee(a.doc,h,s.length,s)}if(!c)return false;a.split(h,s.length,s);if(!u&&f&&n.node(o).type!=l){let t=a.mapping.map(n.before(o)),e=a.doc.resolve(t);if(l&&n.node(o-1).canReplaceWith(e.index(),e.index()+1,l))a.setNodeMarkup(a.mapping.map(n.before(o)),l)}if(r)r(a.scrollIntoView());return true}}const Cl=$l();const Ll=(t,e)=>{let{$from:r,to:n}=t.selection,i;let s=r.sharedDepth(n);if(s==0)return false;i=r.before(s);if(e)e(t.tr.setSelection(or.create(t.doc,i)));return true};const Nl=(t,e)=>{if(e)e(t.tr.setSelection(new ur(t.doc)));return true};function Pl(t,e,r){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();if(!n||!i||!n.type.compatibleContent(i.type))return false;if(!n.content.size&&e.parent.canReplace(s-1,s)){if(r)r(t.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView());return true}if(!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ae(t.doc,e.pos)))return false;if(r)r(t.tr.join(e.pos).scrollIntoView());return true}function Dl(t,e,r,n){let i=e.nodeBefore,s=e.nodeAfter,o,l;let u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&Pl(t,e,r))return true;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(r){let n=e.pos+s.nodeSize,l=v.empty;for(let t=o.length-1;t>=0;t--)l=v.from(o[t].create(null,l));l=v.from(i.copy(l));let u=t.tr.step(new le(e.pos-1,n,e.pos,n,new E(l,1,0),o.length,true));let f=u.doc.resolve(n+2*o.length);if(f.nodeAfter&&f.nodeAfter.type==i.type&&Ae(u.doc,f.pos))u.join(f.pos);r(u.scrollIntoView())}return true}let a=s.type.spec.isolating||n>0&&u?null:tr.findFrom(e,1);let h=a&&a.$from.blockRange(a.$to),c=h&&de(h);if(c!=null&&c>=e.depth){if(r)r(t.tr.lift(h,c).scrollIntoView());return true}if(f&&ml(s,"start",true)&&ml(i,"end")){let n=i,o=[];for(;;){o.push(n);if(n.isTextblock)break;n=n.lastChild}let l=s,u=1;for(;!l.isTextblock;l=l.firstChild)u++;if(n.canReplace(n.childCount,n.childCount,l.content)){if(r){let n=v.empty;for(let t=o.length-1;t>=0;t--)n=v.from(o[t].copy(n));let i=t.tr.step(new le(e.pos-o.length,e.pos+s.nodeSize,e.pos+u,e.pos+s.nodeSize-u,new E(n,o.length,0),0,true));r(i.scrollIntoView())}return true}}return false}function Il(t){return function(e,r){let n=e.selection,i=t<0?n.$from:n.$to;let s=i.depth;while(i.node(s).isInline){if(!s)return false;s--}if(!i.node(s).isTextblock)return false;if(r)r(e.tr.setSelection(ir.create(e.doc,t<0?i.start(s):i.end(s))));return true}}const Hl=Il(-1);const jl=Il(1);function _l(t,e=null){return function(r,n){let{$from:i,$to:s}=r.selection;let o=i.blockRange(s),l=o&&me(o,t,e);if(!l)return false;if(n)n(r.tr.wrap(o,l).scrollIntoView());return true}}function Bl(t,e=null){return function(r,n){let i=false;for(let n=0;n<r.selection.ranges.length&&!i;n++){let{$from:{pos:s},$to:{pos:o}}=r.selection.ranges[n];r.doc.nodesBetween(s,o,((n,s)=>{if(i)return false;if(!n.isTextblock||n.hasMarkup(t,e))return;if(n.type==t){i=true}else{let e=r.doc.resolve(s),n=e.index();i=e.parent.canReplaceWith(n,n+1,t)}}))}if(!i)return false;if(n){let i=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:s},$to:{pos:o}}=r.selection.ranges[n];i.setBlockType(s,o,t,e)}n(i.scrollIntoView())}return true}}function zl(...t){return function(e,r,n){for(let i=0;i<t.length;i++)if(t[i](e,r,n))return true;return false}}let Fl=zl(fl,hl,gl);let Ul=zl(fl,vl,yl);const ql={Enter:zl(El,Ol,Rl,Cl),"Mod-Enter":Al,Backspace:Fl,"Mod-Backspace":Fl,"Shift-Backspace":Fl,Delete:Ul,"Mod-Delete":Ul,"Mod-a":Nl};const Kl={"Ctrl-h":ql["Backspace"],"Alt-Backspace":ql["Mod-Backspace"],"Ctrl-d":ql["Delete"],"Ctrl-Alt-Backspace":ql["Mod-Delete"],"Alt-Delete":ql["Mod-Delete"],"Alt-d":ql["Mod-Delete"],"Ctrl-a":Hl,"Ctrl-e":jl};for(let t in ql)Kl[t]=ql[t];typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os!="undefined"&&os.platform?os.platform()=="darwin":false;function Jl(t,e=null){return function(r,n){let{$from:i,$to:s}=r.selection;let o=i.blockRange(s);if(!o)return false;let l=n?r.tr:null;if(!Wl(l,o,t,e))return false;if(n)n(l.scrollIntoView());return true}}function Wl(t,e,r,n=null){let i=false,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(r)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return false;let t=o.resolve(e.start-2);s=new F(t,t,e.depth);if(e.endIndex<e.parent.childCount)e=new F(e.$from,o.resolve(e.$to.end(e.depth)),e.depth);i=true}let l=me(s,r,n,e);if(!l)return false;if(t)Vl(t,e,l,i,r);return true}function Vl(t,e,r,n,i){let s=v.empty;for(let t=r.length-1;t>=0;t--)s=v.from(r[t].type.create(r[t].attrs,s));t.step(new le(e.start-(n?2:0),e.end,e.start,e.end,new E(s,0,0),r.length,true));let o=0;for(let t=0;t<r.length;t++)if(r[t].type==i)o=t+1;let l=r.length-o;let u=e.start+r.length-(n?2:0),f=e.parent;for(let r=e.startIndex,n=e.endIndex,i=true;r<n;r++,i=false){if(!i&&Ee(t.doc,u,l)){t.split(u,l);u+=2*l}u+=f.child(r).nodeSize}return t}function Gl(t){return function(e,r){let{$from:n,$to:i}=e.selection;let s=n.blockRange(i,(e=>e.childCount>0&&e.firstChild.type==t));if(!s)return false;if(!r)return true;if(n.node(s.depth-1).type==t)return Zl(e,r,t,s);else return Yl(e,r,s)}}function Zl(t,e,r,n){let i=t.tr,s=n.end,o=n.$to.end(n.depth);if(s<o){i.step(new le(s-1,o,s,o,new E(v.from(r.create(null,n.parent.copy())),1,0),1,true));n=new F(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth)}const l=de(n);if(l==null)return false;i.lift(n,l);let u=i.doc.resolve(i.mapping.map(s,-1)-1);if(Ae(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type)i.join(u.pos);e(i.scrollIntoView());return true}function Yl(t,e,r){let n=t.tr,i=r.parent;for(let t=r.end,e=r.endIndex-1,s=r.startIndex;e>s;e--){t-=i.child(e).nodeSize;n.delete(t-1,t+1)}let s=n.doc.resolve(r.start),o=s.nodeAfter;if(n.mapping.map(r.end)!=r.start+s.nodeAfter.nodeSize)return false;let l=r.startIndex==0,u=r.endIndex==i.childCount;let f=s.node(-1),a=s.index(-1);if(!f.canReplace(a+(l?0:1),a+1,o.content.append(u?v.empty:v.from(i))))return false;let h=s.pos,c=h+o.nodeSize;n.step(new le(h-(l?1:0),c+(u?1:0),h+1,c-1,new E((l?v.empty:v.from(i.copy(v.empty))).append(u?v.empty:v.from(i.copy(v.empty))),l?0:1,u?0:1),l?0:1));e(n.scrollIntoView());return true}function Xl(t){return function(e,r){let{$from:n,$to:i}=e.selection;let s=n.blockRange(i,(e=>e.childCount>0&&e.firstChild.type==t));if(!s)return false;let o=s.startIndex;if(o==0)return false;let l=s.parent,u=l.child(o-1);if(u.type!=t)return false;if(r){let n=u.lastChild&&u.lastChild.type==l.type;let i=v.from(n?t.create():null);let o=new E(v.from(t.create(null,v.from(l.type.create(null,i)))),n?3:1,0);let f=s.start,a=s.end;r(e.tr.step(new le(f-(n?3:1),a,f,a,o,1,true)).scrollIntoView())}return true}}var Ql=Object.defineProperty;var tu=(t,e)=>{for(var r in e)Ql(t,r,{get:e[r],enumerable:true})};function eu(t){const{state:e,transaction:r}=t;let{selection:n}=r;let{doc:i}=r;let{storedMarks:s}=r;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 n},get doc(){return i},get tr(){n=r.selection;i=r.doc;s=r.storedMarks;return r}}}var ru=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:r}=this;const{view:n}=e;const{tr:i}=r;const s=this.buildProps(i);return Object.fromEntries(Object.entries(t).map((([t,e])=>{const r=(...t)=>{const r=e(...t)(s);if(!i.getMeta("preventDispatch")&&!this.hasCustomState){n.dispatch(i)}return r};return[t,r]})))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=true){const{rawCommands:r,editor:n,state:i}=this;const{view:s}=n;const o=[];const l=!!t;const u=t||i.tr;const f=()=>{if(!l&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState){s.dispatch(u)}return o.every((t=>t===true))};const a={...Object.fromEntries(Object.entries(r).map((([t,r])=>{const n=(...t)=>{const n=this.buildProps(u,e);const i=r(...t)(n);o.push(i);return a};return[t,n]}))),run:f};return a}createCan(t){const{rawCommands:e,state:r}=this;const n=false;const i=t||r.tr;const s=this.buildProps(i,n);const o=Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)({...s,dispatch:void 0})])));return{...o,chain:()=>this.createChain(i,n)}}buildProps(t,e=true){const{rawCommands:r,editor:n,state:i}=this;const{view:s}=n;const o={tr:t,editor:n,view:s,state:eu({state:i,transaction:t}),dispatch:e?()=>void 0:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map((([t,e])=>[t,(...t)=>e(...t)(o)])))}};return o}};var nu=class{constructor(){this.callbacks={}}on(t,e){if(!this.callbacks[t]){this.callbacks[t]=[]}this.callbacks[t].push(e);return this}emit(t,...e){const r=this.callbacks[t];if(r){r.forEach((t=>t.apply(this,e)))}return this}off(t,e){const r=this.callbacks[t];if(r){if(e){this.callbacks[t]=r.filter((t=>t!==e))}else{delete this.callbacks[t]}}return this}once(t,e){const r=(...n)=>{this.off(t,r);e.apply(this,n)};return this.on(t,r)}removeAllListeners(){this.callbacks={}}};function iu(t,e){const r=new Xe(t);e.forEach((t=>{t.steps.forEach((t=>{r.step(t)}))}));return r}var su=t=>{const e=t.childNodes;for(let r=e.length-1;r>=0;r-=1){const n=e[r];if(n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)){t.removeChild(n)}else if(n.nodeType===1){su(n)}}return t};function ou(t){if(typeof window==="undefined"){throw new Error("[tiptap error]: there is no window object available, so this function cannot be used")}const e=`<body>${t}</body>`;const r=(new window.DOMParser).parseFromString(e,"text/html").body;return su(r)}function lu(t,e,r){if(t instanceof q||t instanceof v){return t}r={slice:true,parseOptions:{},...r};const n=typeof t==="object"&&t!==null;const i=typeof t==="string";if(n){try{const n=Array.isArray(t)&&t.length>0;if(n){return v.fromArray(t.map((t=>e.nodeFromJSON(t))))}const i=e.nodeFromJSON(t);if(r.errorOnInvalidContent){i.check()}return i}catch(n){if(r.errorOnInvalidContent){throw new Error("[tiptap error]: Invalid JSON content",{cause:n})}console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",n);return lu("",e,r)}}if(i){if(r.errorOnInvalidContent){let n=false;let i="";const s=new mt({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:t=>{n=true;i=typeof t==="string"?t:t.outerHTML;return null}}]}})});if(r.slice){vt.fromSchema(s).parseSlice(ou(t),r.parseOptions)}else{vt.fromSchema(s).parse(ou(t),r.parseOptions)}if(r.errorOnInvalidContent&&n){throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}}const n=vt.fromSchema(e);if(r.slice){return n.parseSlice(ou(t),r.parseOptions).content}return n.parse(ou(t),r.parseOptions)}return lu("",e,r)}function uu(t,e,r={},n={}){return lu(t,e,{slice:false,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}function fu(t){for(let e=0;e<t.edgeCount;e+=1){const{type:r}=t.edge(e);if(r.isTextblock&&!r.hasRequiredAttrs()){return r}}return null}function au(t,e,r){const n=[];t.nodesBetween(e.from,e.to,((t,e)=>{if(r(t)){n.push({node:t,pos:e})}}));return n}function hu(t,e){for(let r=t.depth;r>0;r-=1){const n=t.node(r);if(e(n)){return{pos:r>0?t.before(r):0,start:t.start(r),depth:r,node:n}}}}function cu(t){return e=>hu(e.$from,t)}function du(t,e,r){if(t.config[e]===void 0&&t.parent){return du(t.parent,e,r)}if(typeof t.config[e]==="function"){const n=t.config[e].bind({...r,parent:t.parent?du(t.parent,e,r):null});return n}return t.config[e]}function pu(t){return t.map((t=>{const e={name:t.name,options:t.options,storage:t.storage};const r=du(t,"addExtensions",e);if(r){return[t,...pu(r())]}return t})).flat(10)}function mu(t,e){const r=Nt.fromSchema(e).serializeFragment(t);const n=document.implementation.createHTMLDocument();const i=n.createElement("div");i.appendChild(r);return i.innerHTML}function gu(t){return typeof t==="function"}function wu(t,e=void 0,...r){if(gu(t)){if(e){return t.bind(e)(...r)}return t(...r)}return t}function bu(t={}){return Object.keys(t).length===0&&t.constructor===Object}function vu(t){const e=t.filter((t=>t.type==="extension"));const r=t.filter((t=>t.type==="node"));const n=t.filter((t=>t.type==="mark"));return{baseExtensions:e,nodeExtensions:r,markExtensions:n}}function yu(t){const e=[];const{nodeExtensions:r,markExtensions:n}=vu(t);const i=[...r,...n];const s={default:null,validate:void 0,rendered:true,renderHTML:null,parseHTML:null,keepOnSplit:true,isRequired:false};t.forEach((t=>{const r={name:t.name,options:t.options,storage:t.storage,extensions:i};const n=du(t,"addGlobalAttributes",r);if(!n){return}const o=n();o.forEach((t=>{t.types.forEach((r=>{Object.entries(t.attributes).forEach((([t,n])=>{e.push({type:r,name:t,attribute:{...s,...n}})}))}))}))}));i.forEach((t=>{const r={name:t.name,options:t.options,storage:t.storage};const n=du(t,"addAttributes",r);if(!n){return}const i=n();Object.entries(i).forEach((([r,n])=>{const i={...s,...n};if(typeof(i==null?void 0:i.default)==="function"){i.default=i.default()}if((i==null?void 0:i.isRequired)&&(i==null?void 0:i.default)===void 0){delete i.default}e.push({type:t.name,name:r,attribute:i})}))}));return e}function ku(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const r={...t};Object.entries(e).forEach((([t,e])=>{const n=r[t];if(!n){r[t]=e;return}if(t==="class"){const n=e?String(e).split(" "):[];const i=r[t]?r[t].split(" "):[];const s=n.filter((t=>!i.includes(t)));r[t]=[...i,...s].join(" ")}else if(t==="style"){const n=e?e.split(";").map((t=>t.trim())).filter(Boolean):[];const i=r[t]?r[t].split(";").map((t=>t.trim())).filter(Boolean):[];const s=new Map;i.forEach((t=>{const[e,r]=t.split(":").map((t=>t.trim()));s.set(e,r)}));n.forEach((t=>{const[e,r]=t.split(":").map((t=>t.trim()));s.set(e,r)}));r[t]=Array.from(s.entries()).map((([t,e])=>`${t}: ${e}`)).join("; ")}else{r[t]=e}}));return r}),{})}function xu(t,e){return e.filter((e=>e.type===t.type.name)).filter((t=>t.attribute.rendered)).map((e=>{if(!e.attribute.renderHTML){return{[e.name]:t.attrs[e.name]}}return e.attribute.renderHTML(t.attrs)||{}})).reduce(((t,e)=>ku(t,e)),{})}function Mu(t){if(typeof t!=="string"){return t}if(t.match(/^[+-]?(?:\d*\.)?\d+$/)){return Number(t)}if(t==="true"){return true}if(t==="false"){return false}return t}function Su(t,e){if("style"in t){return t}return{...t,getAttrs:r=>{const n=t.getAttrs?t.getAttrs(r):t.attrs;if(n===false){return false}const i=e.reduce(((t,e)=>{const n=e.attribute.parseHTML?e.attribute.parseHTML(r):Mu(r.getAttribute(e.name));if(n===null||n===void 0){return t}return{...t,[e.name]:n}}),{});return{...n,...i}}}}function Eu(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>{if(t==="attrs"&&bu(e)){return false}return e!==null&&e!==void 0})))}function Tu(t,e){var r;const n=yu(t);const{nodeExtensions:i,markExtensions:s}=vu(t);const o=(r=i.find((t=>du(t,"topNode"))))==null?void 0:r.name;const l=Object.fromEntries(i.map((r=>{const i=n.filter((t=>t.type===r.name));const s={name:r.name,options:r.options,storage:r.storage,editor:e};const o=t.reduce(((t,e)=>{const n=du(e,"extendNodeSchema",s);return{...t,...n?n(r):{}}}),{});const l=Eu({...o,content:wu(du(r,"content",s)),marks:wu(du(r,"marks",s)),group:wu(du(r,"group",s)),inline:wu(du(r,"inline",s)),atom:wu(du(r,"atom",s)),selectable:wu(du(r,"selectable",s)),draggable:wu(du(r,"draggable",s)),code:wu(du(r,"code",s)),whitespace:wu(du(r,"whitespace",s)),linebreakReplacement:wu(du(r,"linebreakReplacement",s)),defining:wu(du(r,"defining",s)),isolating:wu(du(r,"isolating",s)),attrs:Object.fromEntries(i.map((t=>{var e,r;return[t.name,{default:(e=t==null?void 0:t.attribute)==null?void 0:e.default,validate:(r=t==null?void 0:t.attribute)==null?void 0:r.validate}]})))});const u=wu(du(r,"parseHTML",s));if(u){l.parseDOM=u.map((t=>Su(t,i)))}const f=du(r,"renderHTML",s);if(f){l.toDOM=t=>f({node:t,HTMLAttributes:xu(t,i)})}const a=du(r,"renderText",s);if(a){l.toText=a}return[r.name,l]})));const u=Object.fromEntries(s.map((r=>{const i=n.filter((t=>t.type===r.name));const s={name:r.name,options:r.options,storage:r.storage,editor:e};const o=t.reduce(((t,e)=>{const n=du(e,"extendMarkSchema",s);return{...t,...n?n(r):{}}}),{});const l=Eu({...o,inclusive:wu(du(r,"inclusive",s)),excludes:wu(du(r,"excludes",s)),group:wu(du(r,"group",s)),spanning:wu(du(r,"spanning",s)),code:wu(du(r,"code",s)),attrs:Object.fromEntries(i.map((t=>{var e,r;return[t.name,{default:(e=t==null?void 0:t.attribute)==null?void 0:e.default,validate:(r=t==null?void 0:t.attribute)==null?void 0:r.validate}]})))});const u=wu(du(r,"parseHTML",s));if(u){l.parseDOM=u.map((t=>Su(t,i)))}const f=du(r,"renderHTML",s);if(f){l.toDOM=t=>f({mark:t,HTMLAttributes:xu(t,i)})}return[r.name,l]})));return new mt({topNode:o,nodes:l,marks:u})}function Au(t){const e=t.filter(((e,r)=>t.indexOf(e)!==r));return Array.from(new Set(e))}function Ou(t){const e=100;return t.sort(((t,r)=>{const n=du(t,"priority")||e;const i=du(r,"priority")||e;if(n>i){return-1}if(n<i){return 1}return 0}))}function Ru(t){const e=Ou(pu(t));const r=Au(e.map((t=>t.name)));if(r.length){console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((t=>`'${t}'`)).join(", ")}]. This can lead to issues.`)}return e}function $u(t,e,r){const{from:n,to:i}=e;const{blockSeparator:s="\n\n",textSerializers:o={}}=r||{};let l="";t.nodesBetween(n,i,((t,r,u,f)=>{var a;if(t.isBlock&&r>n){l+=s}const h=o==null?void 0:o[t.type.name];if(h){if(u){l+=h({node:t,pos:r,parent:u,index:f,range:e})}return false}if(t.isText){l+=(a=t==null?void 0:t.text)==null?void 0:a.slice(Math.max(n,r)-r,i-r)}}));return l}function Cu(t,e){const r={from:0,to:t.content.size};return $u(t,r,e)}function Lu(t){return Object.fromEntries(Object.entries(t.nodes).filter((([,t])=>t.spec.toText)).map((([t,e])=>[t,e.spec.toText])))}function Nu(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}function Pu(t,e){const r=Nu(e,t.schema);const{from:n,to:i,empty:s}=t.selection;const o=[];if(s){if(t.storedMarks){o.push(...t.storedMarks)}o.push(...t.selection.$head.marks())}else{t.doc.nodesBetween(n,i,(t=>{o.push(...t.marks)}))}const l=o.find((t=>t.type.name===r.name));if(!l){return{}}return{...l.attrs}}function Du(t,e){if(typeof t==="string"){if(!e.nodes[t]){throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`)}return e.nodes[t]}return t}function Iu(t,e){const r=Du(e,t.schema);const{from:n,to:i}=t.selection;const s=[];t.doc.nodesBetween(n,i,(t=>{s.push(t)}));const o=s.reverse().find((t=>t.type.name===r.name));if(!o){return{}}return{...o.attrs}}function Hu(t,e){if(e.nodes[t]){return"node"}if(e.marks[t]){return"mark"}return null}function ju(t,e){const r=Hu(typeof e==="string"?e:e.name,t.schema);if(r==="node"){return Iu(t,e)}if(r==="mark"){return Pu(t,e)}return{}}function _u(t,e=JSON.stringify){const r={};return t.filter((t=>{const n=e(t);return Object.prototype.hasOwnProperty.call(r,n)?false:r[n]=true}))}function Bu(t){const e=_u(t);return e.length===1?e:e.filter(((t,r)=>{const n=e.filter(((t,e)=>e!==r));return!n.some((e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}))}function zu(t){const{mapping:e,steps:r}=t;const n=[];e.maps.forEach(((t,i)=>{const s=[];if(!t.ranges.length){const{from:t,to:e}=r[i];if(t===void 0||e===void 0){return}s.push({from:t,to:e})}else{t.forEach(((t,e)=>{s.push({from:t,to:e})}))}s.forEach((({from:t,to:r})=>{const s=e.slice(i).map(t,-1);const o=e.slice(i).map(r);const l=e.invert().map(s,-1);const u=e.invert().map(o);n.push({oldRange:{from:l,to:u},newRange:{from:s,to:o}})}))}));return Bu(n)}function Fu(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Uu(t,e,r={strict:true}){const n=Object.keys(e);if(!n.length){return true}return n.every((n=>{if(r.strict){return e[n]===t[n]}if(Fu(e[n])){return e[n].test(t[n])}return e[n]===t[n]}))}function qu(t,e,r={}){return t.find((t=>t.type===e&&Uu(Object.fromEntries(Object.keys(r).map((e=>[e,t.attrs[e]]))),r)))}function Ku(t,e,r={}){return!!qu(t,e,r)}function Ju(t,e,r){var n;if(!t||!e){return}let i=t.parent.childAfter(t.parentOffset);if(!i.node||!i.node.marks.some((t=>t.type===e))){i=t.parent.childBefore(t.parentOffset)}if(!i.node||!i.node.marks.some((t=>t.type===e))){return}r=r||((n=i.node.marks[0])==null?void 0:n.attrs);const s=qu([...i.node.marks],e,r);if(!s){return}let o=i.index;let l=t.start()+i.offset;let u=o+1;let f=l+i.node.nodeSize;while(o>0&&Ku([...t.parent.child(o-1).marks],e,r)){o-=1;l-=t.parent.child(o).nodeSize}while(u<t.parent.childCount&&Ku([...t.parent.child(u).marks],e,r)){f+=t.parent.child(u).nodeSize;u+=1}return{from:l,to:f}}function Wu(t,e,r){const n=[];if(t===e){r.resolve(t).marks().forEach((e=>{const i=r.resolve(t);const s=Ju(i,e.type);if(!s){return}n.push({mark:e,...s})}))}else{r.nodesBetween(t,e,((t,e)=>{if(!t||(t==null?void 0:t.nodeSize)===void 0){return}n.push(...t.marks.map((r=>({from:e,to:e+t.nodeSize,mark:r}))))}))}return n}var Vu=(t,e,r,n=20)=>{const i=t.doc.resolve(r);let s=n;let o=null;while(s>0&&o===null){const t=i.node(s);if((t==null?void 0:t.type.name)===e){o=t}else{s-=1}}return[o,s]};function Gu(t,e){return e.nodes[t]||e.marks[t]||null}function Zu(t,e,r){return Object.fromEntries(Object.entries(r).filter((([r])=>{const n=t.find((t=>t.type===e&&t.name===r));if(!n){return false}return n.attribute.keepOnSplit})))}var Yu=(t,e=500)=>{let r="";const n=t.parentOffset;t.parent.nodesBetween(Math.max(0,n-e),n,((t,e,i,s)=>{var o,l;const u=((l=(o=t.type.spec).toText)==null?void 0:l.call(o,{node:t,pos:e,parent:i,index:s}))||t.textContent||"%leaf%";r+=t.isAtom&&!t.isText?u:u.slice(0,Math.max(0,n-e))}));return r};function Xu(t,e,r={}){const{empty:n,ranges:i}=t.selection;const s=e?Nu(e,t.schema):null;if(n){return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>{if(!s){return true}return s.name===t.type.name})).find((t=>Uu(t.attrs,r,{strict:false})))}let o=0;const l=[];i.forEach((({$from:e,$to:r})=>{const n=e.pos;const i=r.pos;t.doc.nodesBetween(n,i,((t,e)=>{if(!t.isText&&!t.marks.length){return}const r=Math.max(n,e);const s=Math.min(i,e+t.nodeSize);const u=s-r;o+=u;l.push(...t.marks.map((t=>({mark:t,from:r,to:s}))))}))}));if(o===0){return false}const u=l.filter((t=>{if(!s){return true}return s.name===t.mark.type.name})).filter((t=>Uu(t.mark.attrs,r,{strict:false}))).reduce(((t,e)=>t+e.to-e.from),0);const f=l.filter((t=>{if(!s){return true}return t.mark.type!==s&&t.mark.type.excludes(s)})).reduce(((t,e)=>t+e.to-e.from),0);const a=u>0?u+f:u;return a>=o}function Qu(t,e,r={}){const{from:n,to:i,empty:s}=t.selection;const o=e?Du(e,t.schema):null;const l=[];t.doc.nodesBetween(n,i,((t,e)=>{if(t.isText){return}const r=Math.max(n,e);const s=Math.min(i,e+t.nodeSize);l.push({node:t,from:r,to:s})}));const u=i-n;const f=l.filter((t=>{if(!o){return true}return o.name===t.node.type.name})).filter((t=>Uu(t.node.attrs,r,{strict:false})));if(s){return!!f.length}const a=f.reduce(((t,e)=>t+e.to-e.from),0);return a>=u}function tf(t,e,r={}){if(!e){return Qu(t,null,r)||Xu(t,null,r)}const n=Hu(e,t.schema);if(n==="node"){return Qu(t,e,r)}if(n==="mark"){return Xu(t,e,r)}return false}var ef=(t,e)=>{const{$from:r,$to:n,$anchor:i}=t.selection;if(e){const r=cu((t=>t.type.name===e))(t.selection);if(!r){return false}const n=t.doc.resolve(r.pos+1);if(i.pos+1===n.end()){return true}return false}if(n.parentOffset<n.parent.nodeSize-2||r.pos!==n.pos){return false}return true};var rf=t=>{const{$from:e,$to:r}=t.selection;if(e.parentOffset>0||e.pos!==r.pos){return false}return true};function nf(t,e){if(Array.isArray(e)){return e.some((e=>{const r=typeof e==="string"?e:e.name;return r===t.name}))}return e}function sf(t,e){const{nodeExtensions:r}=vu(e);const n=r.find((e=>e.name===t));if(!n){return false}const i={name:n.name,options:n.options,storage:n.storage};const s=wu(du(n,"group",i));if(typeof s!=="string"){return false}return s.split(" ").includes("list")}function of(t,{checkChildren:e=true,ignoreWhitespace:r=false}={}){var n;if(r){if(t.type.name==="hardBreak"){return true}if(t.isText){return/^\s*$/m.test((n=t.text)!=null?n:"")}}if(t.isText){return!t.text}if(t.isAtom||t.isLeaf){return false}if(t.content.childCount===0){return true}if(e){let n=true;t.content.forEach((t=>{if(n===false){return}if(!of(t,{ignoreWhitespace:r,checkChildren:e})){n=false}}));return n}return false}function lf(t){return t instanceof or}function uf(t){return t instanceof ir}function ff(t=0,e=0,r=0){return Math.min(Math.max(t,e),r)}function af(t,e=null){if(!e){return null}const r=tr.atStart(t);const n=tr.atEnd(t);if(e==="start"||e===true){return r}if(e==="end"){return n}const i=r.from;const s=n.to;if(e==="all"){return ir.create(t,ff(0,i,s),ff(t.content.size,i,s))}return ir.create(t,ff(e,i,s),ff(e,i,s))}function hf(t,e,r){const n=t.steps.length-1;if(n<e){return}const i=t.steps[n];if(!(i instanceof oe||i instanceof le)){return}const s=t.mapping.maps[n];let o=0;s.forEach(((t,e,r,n)=>{if(o===0){o=n}}));t.setSelection(tr.near(t.doc.resolve(o),r))}var cf=class{constructor(t){var e;this.find=t.find;this.handler=t.handler;this.undoable=(e=t.undoable)!=null?e:true}};var df=(t,e)=>{if(Fu(e)){return e.exec(t)}const r=e(t);if(!r){return null}const n=[r.text];n.index=r.index;n.input=t;n.data=r.data;if(r.replaceWith){if(!r.text.includes(r.replaceWith)){console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".')}n.push(r.replaceWith)}return n};function pf(t){var e;const{editor:r,from:n,to:i,text:s,rules:o,plugin:l}=t;const{view:u}=r;if(u.composing){return false}const f=u.state.doc.resolve(n);if(f.parent.type.spec.code||!!((e=f.nodeBefore||f.nodeAfter)==null?void 0:e.marks.find((t=>t.type.spec.code)))){return false}let a=false;const h=Yu(f)+s;o.forEach((t=>{if(a){return}const e=df(h,t.find);if(!e){return}const o=u.state.tr;const f=eu({state:u.state,transaction:o});const c={from:n-(e[0].length-s.length),to:i};const{commands:d,chain:p,can:m}=new ru({editor:r,state:f});const g=t.handler({state:f,range:c,match:e,commands:d,chain:p,can:m});if(g===null||!o.steps.length){return}if(t.undoable){o.setMeta(l,{transform:o,from:n,to:i,text:s})}u.dispatch(o);a=true}));return a}function mf(t){const{editor:e,rules:r}=t;const n=new xr({state:{init(){return null},apply(t,i,s){const o=t.getMeta(n);if(o){return o}const l=t.getMeta("applyInputRules");const u=!!l;if(u){setTimeout((()=>{let{text:t}=l;if(typeof t==="string"){t=t}else{t=mu(v.from(t),s.schema)}const{from:i}=l;const o=i+t.length;pf({editor:e,from:i,to:o,text:t,rules:r,plugin:n})}))}return t.selectionSet||t.docChanged?null:i}},props:{handleTextInput(t,i,s,o){return pf({editor:e,from:i,to:s,text:o,rules:r,plugin:n})},handleDOMEvents:{compositionend:t=>{setTimeout((()=>{const{$cursor:i}=t.state.selection;if(i){pf({editor:e,from:i.pos,to:i.pos,text:"",rules:r,plugin:n})}}));return false}},handleKeyDown(t,i){if(i.key!=="Enter"){return false}const{$cursor:s}=t.state.selection;if(s){return pf({editor:e,from:s.pos,to:s.pos,text:"\n",rules:r,plugin:n})}return false}},isInputRules:true});return n}function gf(t){return Object.prototype.toString.call(t).slice(8,-1)}function wf(t){if(gf(t)!=="Object"){return false}return t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function bf(t,e){const r={...t};if(wf(t)&&wf(e)){Object.keys(e).forEach((n=>{if(wf(e[n])&&wf(t[n])){r[n]=bf(t[n],e[n])}else{r[n]=e[n]}}))}return r}var vf=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{...wu(du(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...wu(du(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>bf(this.options,t)});e.name=this.name;e.parent=this.parent;return e}extend(t={}){const e=new this.constructor({...this.config,...t});e.parent=this;this.child=e;e.name="name"in t?t.name:e.parent.name;return e}};var yf=class t extends vf{constructor(){super(...arguments);this.type="mark"}static create(e={}){const r=typeof e==="function"?e():e;return new t(r)}static handleExit({editor:t,mark:e}){const{tr:r}=t.state;const n=t.state.selection.$from;const i=n.pos===n.end();if(i){const i=n.marks();const s=!!i.find((t=>(t==null?void 0:t.type.name)===e.name));if(!s){return false}const o=i.find((t=>(t==null?void 0:t.type.name)===e.name));if(o){r.removeStoredMark(o)}r.insertText(" ",n.pos);t.view.dispatch(r);return true}return false}configure(t){return super.configure(t)}extend(t){const e=typeof t==="function"?t():t;return super.extend(e)}};function kf(t){return typeof t==="number"}var xf=class{constructor(t){this.find=t.find;this.handler=t.handler}};var Mf=(t,e,r)=>{if(Fu(e)){return[...t.matchAll(e)]}const n=e(t,r);if(!n){return[]}return n.map((e=>{const r=[e.text];r.index=e.index;r.input=t;r.data=e.data;if(e.replaceWith){if(!e.text.includes(e.replaceWith)){console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".')}r.push(e.replaceWith)}return r}))};function Sf(t){const{editor:e,state:r,from:n,to:i,rule:s,pasteEvent:o,dropEvent:l}=t;const{commands:u,chain:f,can:a}=new ru({editor:e,state:r});const h=[];r.doc.nodesBetween(n,i,((t,e)=>{var c,d,p,m,g;if(((d=(c=t.type)==null?void 0:c.spec)==null?void 0:d.code)||!(t.isText||t.isTextblock||t.isInline)){return}const w=(g=(m=(p=t.content)==null?void 0:p.size)!=null?m:t.nodeSize)!=null?g:0;const b=Math.max(n,e);const v=Math.min(i,e+w);if(b>=v){return}const y=t.isText?t.text||"":t.textBetween(b-e,v-e,void 0,"");const k=Mf(y,s.find,o);k.forEach((t=>{if(t.index===void 0){return}const e=b+t.index+1;const n=e+t[0].length;const i={from:r.tr.mapping.map(e),to:r.tr.mapping.map(n)};const c=s.handler({state:r,range:i,match:t,commands:u,chain:f,can:a,pasteEvent:o,dropEvent:l});h.push(c)}))}));const c=h.every((t=>t!==null));return c}var Ef=null;var Tf=t=>{var e;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});(e=r.clipboardData)==null?void 0:e.setData("text/html",t);return r};function Af(t){const{editor:e,rules:r}=t;let n=null;let i=false;let s=false;let o=typeof ClipboardEvent!=="undefined"?new ClipboardEvent("paste"):null;let l;try{l=typeof DragEvent!=="undefined"?new DragEvent("drop"):null}catch{l=null}const u=({state:t,from:r,to:n,rule:i,pasteEvt:s})=>{const u=t.tr;const f=eu({state:t,transaction:u});const a=Sf({editor:e,state:f,from:Math.max(r-1,0),to:n.b-1,rule:i,pasteEvent:s,dropEvent:l});if(!a||!u.steps.length){return}try{l=typeof DragEvent!=="undefined"?new DragEvent("drop"):null}catch{l=null}o=typeof ClipboardEvent!=="undefined"?new ClipboardEvent("paste"):null;return u};const f=r.map((t=>new xr({view(t){const r=r=>{var i;n=((i=t.dom.parentElement)==null?void 0:i.contains(r.target))?t.dom.parentElement:null;if(n){Ef=e}};const i=()=>{if(Ef){Ef=null}};window.addEventListener("dragstart",r);window.addEventListener("dragend",i);return{destroy(){window.removeEventListener("dragstart",r);window.removeEventListener("dragend",i)}}},props:{handleDOMEvents:{drop:(t,e)=>{s=n===t.dom.parentElement;l=e;if(!s){const t=Ef;if(t==null?void 0:t.isEditable){setTimeout((()=>{const e=t.state.selection;if(e){t.commands.deleteRange({from:e.from,to:e.to})}}),10)}}return false},paste:(t,e)=>{var r;const n=(r=e.clipboardData)==null?void 0:r.getData("text/html");o=e;i=!!(n==null?void 0:n.includes("data-pm-slice"));return false}}},appendTransaction:(e,r,n)=>{const l=e[0];const f=l.getMeta("uiEvent")==="paste"&&!i;const a=l.getMeta("uiEvent")==="drop"&&!s;const h=l.getMeta("applyPasteRules");const c=!!h;if(!f&&!a&&!c){return}if(c){let{text:e}=h;if(typeof e==="string"){e=e}else{e=mu(v.from(e),n.schema)}const{from:r}=h;const i=r+e.length;const s=Tf(e);return u({rule:t,state:n,from:r,to:{b:i},pasteEvt:s})}const d=r.doc.content.findDiffStart(n.doc.content);const p=r.doc.content.findDiffEnd(n.doc.content);if(!kf(d)||!p||d===p.b){return}return u({rule:t,state:n,from:d,to:p,pasteEvt:o})}})));return f}var Of=class{constructor(t,e){this.splittableMarks=[];this.editor=e;this.extensions=Ru(t);this.schema=Tu(this.extensions,e);this.setupExtensions()}get commands(){return this.extensions.reduce(((t,e)=>{const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Gu(e.name,this.schema)};const n=du(e,"addCommands",r);if(!n){return t}return{...t,...n()}}),{})}get plugins(){const{editor:t}=this;const e=Ou([...this.extensions].reverse());const r=e.flatMap((e=>{const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Gu(e.name,this.schema)};const n=[];const i=du(e,"addKeyboardShortcuts",r);let s={};if(e.type==="mark"&&du(e,"exitable",r)){s.ArrowRight=()=>yf.handleExit({editor:t,mark:e})}if(i){const e=Object.fromEntries(Object.entries(i()).map((([e,r])=>[e,()=>r({editor:t})])));s={...s,...e}}const o=ll(s);n.push(o);const l=du(e,"addInputRules",r);if(nf(e,t.options.enableInputRules)&&l){const e=l();if(e&&e.length){const r=mf({editor:t,rules:e});const i=Array.isArray(r)?r:[r];n.push(...i)}}const u=du(e,"addPasteRules",r);if(nf(e,t.options.enablePasteRules)&&u){const e=u();if(e&&e.length){const r=Af({editor:t,rules:e});n.push(...r)}}const f=du(e,"addProseMirrorPlugins",r);if(f){const t=f();n.push(...t)}return n}));return r}get attributes(){return yu(this.extensions)}get nodeViews(){const{editor:t}=this;const{nodeExtensions:e}=vu(this.extensions);return Object.fromEntries(e.filter((t=>!!du(t,"addNodeView"))).map((e=>{const r=this.attributes.filter((t=>t.type===e.name));const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Du(e.name,this.schema)};const i=du(e,"addNodeView",n);if(!i){return[]}const s=(n,s,o,l,u)=>{const f=xu(n,r);return i()({node:n,view:s,getPos:o,decorations:l,innerDecorations:u,editor:t,extension:e,HTMLAttributes:f})};return[e.name,s]})))}get markViews(){const{editor:t}=this;const{markExtensions:e}=vu(this.extensions);return Object.fromEntries(e.filter((t=>!!du(t,"addMarkView"))).map((e=>{const r=this.attributes.filter((t=>t.type===e.name));const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Nu(e.name,this.schema)};const i=du(e,"addMarkView",n);if(!i){return[]}const s=(n,s,o)=>{const l=xu(n,r);return i()({mark:n,view:s,inline:o,editor:t,extension:e,HTMLAttributes:l,updateAttributes:e=>{hh(n,t,e)}})};return[e.name,s]})))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map((t=>[t.name,t.storage])));t.forEach((t=>{var e;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Gu(t.name,this.schema)};if(t.type==="mark"){const n=(e=wu(du(t,"keepOnSplit",r)))!=null?e:true;if(n){this.splittableMarks.push(t.name)}}const n=du(t,"onBeforeCreate",r);const i=du(t,"onCreate",r);const s=du(t,"onUpdate",r);const o=du(t,"onSelectionUpdate",r);const l=du(t,"onTransaction",r);const u=du(t,"onFocus",r);const f=du(t,"onBlur",r);const a=du(t,"onDestroy",r);if(n){this.editor.on("beforeCreate",n)}if(i){this.editor.on("create",i)}if(s){this.editor.on("update",s)}if(o){this.editor.on("selectionUpdate",o)}if(l){this.editor.on("transaction",l)}if(u){this.editor.on("focus",u)}if(f){this.editor.on("blur",f)}if(a){this.editor.on("destroy",a)}}))}};Of.resolve=Ru;Of.sort=Ou;Of.flatten=pu;var Rf={};tu(Rf,{ClipboardTextSerializer:()=>Cf,Commands:()=>Wa,Delete:()=>Va,Drop:()=>Ga,Editable:()=>Za,FocusEvents:()=>Xa,Keymap:()=>Qa,Paste:()=>th,Tabindex:()=>eh,focusEventsPluginKey:()=>Ya});var $f=class t extends vf{constructor(){super(...arguments);this.type="extension"}static create(e={}){const r=typeof e==="function"?e():e;return new t(r)}configure(t){return super.configure(t)}extend(t){const e=typeof t==="function"?t():t;return super.extend(e)}};var Cf=$f.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new xr({key:new Er("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this;const{state:e,schema:r}=t;const{doc:n,selection:i}=e;const{ranges:s}=i;const o=Math.min(...s.map((t=>t.$from.pos)));const l=Math.max(...s.map((t=>t.$to.pos)));const u=Lu(r);const f={from:o,to:l};return $u(n,f,{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}});var Lf={};tu(Lf,{blur:()=>Nf,clearContent:()=>Pf,clearNodes:()=>Df,command:()=>If,createParagraphNear:()=>Hf,cut:()=>jf,deleteCurrentNode:()=>_f,deleteNode:()=>Bf,deleteRange:()=>zf,deleteSelection:()=>Ff,enter:()=>Uf,exitCode:()=>qf,extendMarkRange:()=>Kf,first:()=>Jf,focus:()=>Gf,forEach:()=>Zf,insertContent:()=>Yf,insertContentAt:()=>Qf,joinBackward:()=>ra,joinDown:()=>ea,joinForward:()=>na,joinItemBackward:()=>ia,joinItemForward:()=>sa,joinTextblockBackward:()=>oa,joinTextblockForward:()=>la,joinUp:()=>ta,keyboardShortcut:()=>aa,lift:()=>ha,liftEmptyBlock:()=>ca,liftListItem:()=>da,newlineInCode:()=>pa,resetAttributes:()=>ga,scrollIntoView:()=>wa,selectAll:()=>ba,selectNodeBackward:()=>va,selectNodeForward:()=>ya,selectParentNode:()=>ka,selectTextblockEnd:()=>xa,selectTextblockStart:()=>Ma,setContent:()=>Sa,setMark:()=>Ta,setMeta:()=>Aa,setNode:()=>Oa,setNodeSelection:()=>Ra,setTextSelection:()=>$a,sinkListItem:()=>Ca,splitBlock:()=>Na,splitListItem:()=>Pa,toggleList:()=>Ha,toggleMark:()=>ja,toggleNode:()=>_a,toggleWrap:()=>Ba,undoInputRule:()=>za,unsetAllMarks:()=>Fa,unsetMark:()=>Ua,updateAttributes:()=>qa,wrapIn:()=>Ka,wrapInList:()=>Ja});var Nf=()=>({editor:t,view:e})=>{requestAnimationFrame((()=>{var r;if(!t.isDestroyed){e.dom.blur();(r=window==null?void 0:window.getSelection())==null?void 0:r.removeAllRanges()}}));return true};var Pf=(t=true)=>({commands:e})=>e.setContent("",{emitUpdate:t});var Df=()=>({state:t,tr:e,dispatch:r})=>{const{selection:n}=e;const{ranges:i}=n;if(!r){return true}i.forEach((({$from:r,$to:n})=>{t.doc.nodesBetween(r.pos,n.pos,((t,r)=>{if(t.type.isText){return}const{doc:n,mapping:i}=e;const s=n.resolve(i.map(r));const o=n.resolve(i.map(r+t.nodeSize));const l=s.blockRange(o);if(!l){return}const u=de(l);if(t.type.isTextblock){const{defaultType:t}=s.parent.contentMatchAt(s.index());e.setNodeMarkup(l.start,t)}if(u||u===0){e.lift(l,u)}}))}));return true};var If=t=>e=>t(e);var Hf=()=>({state:t,dispatch:e})=>Ol(t,e);var jf=(t,e)=>({editor:r,tr:n})=>{const{state:i}=r;const s=i.doc.slice(t.from,t.to);n.deleteRange(t.from,t.to);const o=n.mapping.map(e);n.insert(o,s.content);n.setSelection(new ir(n.doc.resolve(Math.max(o-1,0))));return true};var _f=()=>({tr:t,dispatch:e})=>{const{selection:r}=t;const n=r.$anchor.node();if(n.content.size>0){return false}const i=t.selection.$anchor;for(let r=i.depth;r>0;r-=1){const s=i.node(r);if(s.type===n.type){if(e){const e=i.before(r);const n=i.after(r);t.delete(e,n).scrollIntoView()}return true}}return false};var Bf=t=>({tr:e,state:r,dispatch:n})=>{const i=Du(t,r.schema);const s=e.selection.$anchor;for(let t=s.depth;t>0;t-=1){const r=s.node(t);if(r.type===i){if(n){const r=s.before(t);const n=s.after(t);e.delete(r,n).scrollIntoView()}return true}}return false};var zf=t=>({tr:e,dispatch:r})=>{const{from:n,to:i}=t;if(r){e.delete(n,i)}return true};var Ff=()=>({state:t,dispatch:e})=>fl(t,e);var Uf=()=>({commands:t})=>t.keyboardShortcut("Enter");var qf=()=>({state:t,dispatch:e})=>Al(t,e);var Kf=(t,e={})=>({tr:r,state:n,dispatch:i})=>{const s=Nu(t,n.schema);const{doc:o,selection:l}=r;const{$from:u,from:f,to:a}=l;if(i){const t=Ju(u,s,e);if(t&&t.from<=f&&t.to>=a){const e=ir.create(o,t.from,t.to);r.setSelection(e)}}return true};var Jf=t=>e=>{const r=typeof t==="function"?t(e):t;for(let t=0;t<r.length;t+=1){if(r[t](e)){return true}}return false};function Wf(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Vf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Gf=(t=null,e={})=>({editor:r,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:true,...e};const o=()=>{if(Vf()||Wf()){n.dom.focus()}requestAnimationFrame((()=>{if(!r.isDestroyed){n.focus();if(e==null?void 0:e.scrollIntoView){r.commands.scrollIntoView()}}}))};if(n.hasFocus()&&t===null||t===false){return true}if(s&&t===null&&!uf(r.state.selection)){o();return true}const l=af(i.doc,t)||r.state.selection;const u=r.state.selection.eq(l);if(s){if(!u){i.setSelection(l)}if(u&&i.storedMarks){i.setStoredMarks(i.storedMarks)}o()}return true};var Zf=(t,e)=>r=>t.every(((t,n)=>e(t,{...r,index:n})));var Yf=(t,e)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},t,e);var Xf=t=>!("type"in t);var Qf=(t,e,r)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){r={parseOptions:s.options.parseOptions,updateSelection:true,applyInputRules:false,applyPasteRules:false,...r};let i;const l=t=>{s.emit("contentError",{editor:s,error:t,disableCollaboration:()=>{if("collaboration"in s.storage&&typeof s.storage.collaboration==="object"&&s.storage.collaboration){s.storage.collaboration.isDisabled=true}}})};const u={preserveWhitespace:"full",...r.parseOptions};if(!r.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError){try{lu(e,s.schema,{parseOptions:u,errorOnInvalidContent:true})}catch(t){l(t)}}try{i=lu(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=r.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(t){l(t);return false}let{from:f,to:a}=typeof t==="number"?{from:t,to:t}:{from:t.from,to:t.to};let h=true;let c=true;const d=Xf(i)?i:[i];d.forEach((t=>{t.check();h=h?t.isText&&t.marks.length===0:false;c=c?t.isBlock:false}));if(f===a&&c){const{parent:t}=n.doc.resolve(f);const e=t.isTextblock&&!t.type.spec.code&&!t.childCount;if(e){f-=1;a+=1}}let p;if(h){if(Array.isArray(e)){p=e.map((t=>t.text||"")).join("")}else if(e instanceof v){let t="";e.forEach((e=>{if(e.text){t+=e.text}}));p=t}else if(typeof e==="object"&&!!e&&!!e.text){p=e.text}else{p=e}n.insertText(p,f,a)}else{p=i;const t=n.doc.resolve(f);const e=t.node();const r=t.parentOffset===0;const s=e.isText||e.isTextblock;const o=e.content.size>0;if(r&&s&&o){f=Math.max(0,f-1)}n.replaceWith(f,a,p)}if(r.updateSelection){hf(n,n.steps.length-1,-1)}if(r.applyInputRules){n.setMeta("applyInputRules",{from:f,text:p})}if(r.applyPasteRules){n.setMeta("applyPasteRules",{from:f,text:p})}}return true};var ta=()=>({state:t,dispatch:e})=>xl(t,e);var ea=()=>({state:t,dispatch:e})=>Ml(t,e);var ra=()=>({state:t,dispatch:e})=>hl(t,e);var na=()=>({state:t,dispatch:e})=>vl(t,e);var ia=()=>({state:t,dispatch:e,tr:r})=>{try{const n=$e(t.doc,t.selection.$from.pos,-1);if(n===null||n===void 0){return false}r.join(n,2);if(e){e(r)}return true}catch{return false}};var sa=()=>({state:t,dispatch:e,tr:r})=>{try{const n=$e(t.doc,t.selection.$from.pos,1);if(n===null||n===void 0){return false}r.join(n,2);if(e){e(r)}return true}catch{return false}};var oa=()=>({state:t,dispatch:e})=>cl(t,e);var la=()=>({state:t,dispatch:e})=>dl(t,e);function ua(){return typeof navigator!=="undefined"?/Mac/.test(navigator.platform):false}function fa(t){const e=t.split(/-(?!$)/);let r=e[e.length-1];if(r==="Space"){r=" "}let n;let i;let s;let o;for(let t=0;t<e.length-1;t+=1){const r=e[t];if(/^(cmd|meta|m)$/i.test(r)){o=true}else if(/^a(lt)?$/i.test(r)){n=true}else if(/^(c|ctrl|control)$/i.test(r)){i=true}else if(/^s(hift)?$/i.test(r)){s=true}else if(/^mod$/i.test(r)){if(Vf()||ua()){o=true}else{i=true}}else{throw new Error(`Unrecognized modifier name: ${r}`)}}if(n){r=`Alt-${r}`}if(i){r=`Ctrl-${r}`}if(o){r=`Meta-${r}`}if(s){r=`Shift-${r}`}return r}var aa=t=>({editor:e,view:r,tr:n,dispatch:i})=>{const s=fa(t).split(/-(?!$)/);const o=s.find((t=>!["Alt","Ctrl","Meta","Shift"].includes(t)));const l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:true,cancelable:true});const u=e.captureTransaction((()=>{r.someProp("handleKeyDown",(t=>t(r,l)))}));u==null?void 0:u.steps.forEach((t=>{const e=t.map(n.mapping);if(e&&i){n.maybeStep(e)}}));return true};var ha=(t,e={})=>({state:r,dispatch:n})=>{const i=Du(t,r.schema);const s=Qu(r,i,e);if(!s){return false}return Sl(r,n)};var ca=()=>({state:t,dispatch:e})=>Rl(t,e);var da=t=>({state:e,dispatch:r})=>{const n=Du(t,e.schema);return Gl(n)(e,r)};var pa=()=>({state:t,dispatch:e})=>El(t,e);function ma(t,e){const r=typeof e==="string"?[e]:e;return Object.keys(t).reduce(((e,n)=>{if(!r.includes(n)){e[n]=t[n]}return e}),{})}var ga=(t,e)=>({tr:r,state:n,dispatch:i})=>{let s=null;let o=null;const l=Hu(typeof t==="string"?t:t.name,n.schema);if(!l){return false}if(l==="node"){s=Du(t,n.schema)}if(l==="mark"){o=Nu(t,n.schema)}if(i){r.selection.ranges.forEach((t=>{n.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,n)=>{if(s&&s===t.type){r.setNodeMarkup(n,void 0,ma(t.attrs,e))}if(o&&t.marks.length){t.marks.forEach((i=>{if(o===i.type){r.addMark(n,n+t.nodeSize,o.create(ma(i.attrs,e)))}}))}}))}))}return true};var wa=()=>({tr:t,dispatch:e})=>{if(e){t.scrollIntoView()}return true};var ba=()=>({tr:t,dispatch:e})=>{if(e){const e=new ur(t.doc);t.setSelection(e)}return true};var va=()=>({state:t,dispatch:e})=>gl(t,e);var ya=()=>({state:t,dispatch:e})=>yl(t,e);var ka=()=>({state:t,dispatch:e})=>Ll(t,e);var xa=()=>({state:t,dispatch:e})=>jl(t,e);var Ma=()=>({state:t,dispatch:e})=>Hl(t,e);var Sa=(t,{errorOnInvalidContent:e,emitUpdate:r=true,parseOptions:n={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:u}=s;if(n.preserveWhitespace!=="full"){const l=uu(t,i.schema,n,{errorOnInvalidContent:e!=null?e:i.options.enableContentCheck});if(o){s.replaceWith(0,u.content.size,l).setMeta("preventUpdate",!r)}return true}if(o){s.setMeta("preventUpdate",!r)}return l.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:e!=null?e:i.options.enableContentCheck})};function Ea(t,e,r){var n;const{selection:i}=e;let s=null;if(uf(i)){s=i.$cursor}if(s){const e=(n=t.storedMarks)!=null?n:s.marks();const i=s.parent.type.allowsMarkType(r);return i&&(!!r.isInSet(e)||!e.some((t=>t.type.excludes(r))))}const{ranges:o}=i;return o.some((({$from:e,$to:n})=>{let i=e.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(r):false;t.doc.nodesBetween(e.pos,n.pos,((t,e,n)=>{if(i){return false}if(t.isInline){const e=!n||n.type.allowsMarkType(r);const s=!!r.isInSet(t.marks)||!t.marks.some((t=>t.type.excludes(r)));i=e&&s}return!i}));return i}))}var Ta=(t,e={})=>({tr:r,state:n,dispatch:i})=>{const{selection:s}=r;const{empty:o,ranges:l}=s;const u=Nu(t,n.schema);if(i){if(o){const t=Pu(n,u);r.addStoredMark(u.create({...t,...e}))}else{l.forEach((t=>{const i=t.$from.pos;const s=t.$to.pos;n.doc.nodesBetween(i,s,((t,n)=>{const o=Math.max(n,i);const l=Math.min(n+t.nodeSize,s);const f=t.marks.find((t=>t.type===u));if(f){t.marks.forEach((t=>{if(u===t.type){r.addMark(o,l,u.create({...t.attrs,...e}))}}))}else{r.addMark(o,l,u.create(e))}}))}))}}return Ea(n,r,u)};var Aa=(t,e)=>({tr:r})=>{r.setMeta(t,e);return true};var Oa=(t,e={})=>({state:r,dispatch:n,chain:i})=>{const s=Du(t,r.schema);let o;if(r.selection.$anchor.sameParent(r.selection.$head)){o=r.selection.$anchor.parent.attrs}if(!s.isTextblock){console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.');return false}return i().command((({commands:t})=>{const n=Bl(s,{...o,...e})(r);if(n){return true}return t.clearNodes()})).command((({state:t})=>Bl(s,{...o,...e})(t,n))).run()};var Ra=t=>({tr:e,dispatch:r})=>{if(r){const{doc:r}=e;const n=ff(t,0,r.content.size);const i=or.create(r,n);e.setSelection(i)}return true};var $a=t=>({tr:e,dispatch:r})=>{if(r){const{doc:r}=e;const{from:n,to:i}=typeof t==="number"?{from:t,to:t}:t;const s=ir.atStart(r).from;const o=ir.atEnd(r).to;const l=ff(n,s,o);const u=ff(i,s,o);const f=ir.create(r,l,u);e.setSelection(f)}return true};var Ca=t=>({state:e,dispatch:r})=>{const n=Du(t,e.schema);return Xl(n)(e,r)};function La(t,e){const r=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(r){const n=r.filter((t=>e==null?void 0:e.includes(t.type.name)));t.tr.ensureMarks(n)}}var Na=({keepMarks:t=true}={})=>({tr:e,state:r,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e;const{$from:l,$to:u}=s;const f=i.extensionManager.attributes;const a=Zu(f,l.node().type.name,l.node().attrs);if(s instanceof or&&s.node.isBlock){if(!l.parentOffset||!Ee(o,l.pos)){return false}if(n){if(t){La(r,i.extensionManager.splittableMarks)}e.split(l.pos).scrollIntoView()}return true}if(!l.parent.isBlock){return false}const h=u.parentOffset===u.parent.content.size;const c=l.depth===0?void 0:fu(l.node(-1).contentMatchAt(l.indexAfter(-1)));let d=h&&c?[{type:c,attrs:a}]:void 0;let p=Ee(e.doc,e.mapping.map(l.pos),1,d);if(!d&&!p&&Ee(e.doc,e.mapping.map(l.pos),1,c?[{type:c}]:void 0)){p=true;d=c?[{type:c,attrs:a}]:void 0}if(n){if(p){if(s instanceof ir){e.deleteSelection()}e.split(e.mapping.map(l.pos),1,d);if(c&&!h&&!l.parentOffset&&l.parent.type!==c){const t=e.mapping.map(l.before());const r=e.doc.resolve(t);if(l.node(-1).canReplaceWith(r.index(),r.index()+1,c)){e.setNodeMarkup(e.mapping.map(l.before()),c)}}}if(t){La(r,i.extensionManager.splittableMarks)}e.scrollIntoView()}return p};var Pa=(t,e={})=>({tr:r,state:n,dispatch:i,editor:s})=>{var o;const l=Du(t,n.schema);const{$from:u,$to:f}=n.selection;const a=n.selection.node;if(a&&a.isBlock||u.depth<2||!u.sameParent(f)){return false}const h=u.node(-1);if(h.type!==l){return false}const c=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==l||u.index(-2)!==u.node(-2).childCount-1){return false}if(i){let t=v.empty;const n=u.index(-1)?1:u.index(-2)?2:3;for(let e=u.depth-n;e>=u.depth-3;e-=1){t=v.from(u.node(e).copy(t))}const i=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3;const s={...Zu(c,u.node().type.name,u.node().attrs),...e};const f=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(s))||void 0;t=t.append(v.from(l.createAndFill(null,f)||void 0));const a=u.before(u.depth-(n-1));r.replace(a,u.after(-i),new E(t,4-n,0));let h=-1;r.doc.nodesBetween(a,r.doc.content.size,((t,e)=>{if(h>-1){return false}if(t.isTextblock&&t.content.size===0){h=e+1}}));if(h>-1){r.setSelection(ir.near(r.doc.resolve(h)))}r.scrollIntoView()}return true}const d=f.pos===u.end()?h.contentMatchAt(0).defaultType:null;const p={...Zu(c,h.type.name,h.attrs),...e};const m={...Zu(c,u.node().type.name,u.node().attrs),...e};r.delete(u.pos,f.pos);const g=d?[{type:l,attrs:p},{type:d,attrs:m}]:[{type:l,attrs:p}];if(!Ee(r.doc,u.pos,2)){return false}if(i){const{selection:t,storedMarks:e}=n;const{splittableMarks:o}=s.extensionManager;const l=e||t.$to.parentOffset&&t.$from.marks();r.split(u.pos,2,g).scrollIntoView();if(!l||!i){return true}const f=l.filter((t=>o.includes(t.type.name)));r.ensureMarks(f)}return true};var Da=(t,e)=>{const r=cu((t=>t.type===e))(t.selection);if(!r){return true}const n=t.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(n===void 0){return true}const i=t.doc.nodeAt(n);const s=r.node.type===(i==null?void 0:i.type)&&Ae(t.doc,r.pos);if(!s){return true}t.join(r.pos);return true};var Ia=(t,e)=>{const r=cu((t=>t.type===e))(t.selection);if(!r){return true}const n=t.doc.resolve(r.start).after(r.depth);if(n===void 0){return true}const i=t.doc.nodeAt(n);const s=r.node.type===(i==null?void 0:i.type)&&Ae(t.doc,n);if(!s){return true}t.join(n);return true};var Ha=(t,e,r,n={})=>({editor:i,tr:s,state:o,dispatch:l,chain:u,commands:f,can:a})=>{const{extensions:h,splittableMarks:c}=i.extensionManager;const d=Du(t,o.schema);const p=Du(e,o.schema);const{selection:m,storedMarks:g}=o;const{$from:w,$to:b}=m;const v=w.blockRange(b);const y=g||m.$to.parentOffset&&m.$from.marks();if(!v){return false}const k=cu((t=>sf(t.type.name,h)))(m);if(v.depth>=1&&k&&v.depth-k.depth<=1){if(k.node.type===d){return f.liftListItem(p)}if(sf(k.node.type.name,h)&&d.validContent(k.node.content)&&l){return u().command((()=>{s.setNodeMarkup(k.pos,d);return true})).command((()=>Da(s,d))).command((()=>Ia(s,d))).run()}}if(!r||!y||!l){return u().command((()=>{const t=a().wrapInList(d,n);if(t){return true}return f.clearNodes()})).wrapInList(d,n).command((()=>Da(s,d))).command((()=>Ia(s,d))).run()}return u().command((()=>{const t=a().wrapInList(d,n);const e=y.filter((t=>c.includes(t.type.name)));s.ensureMarks(e);if(t){return true}return f.clearNodes()})).wrapInList(d,n).command((()=>Da(s,d))).command((()=>Ia(s,d))).run()};var ja=(t,e={},r={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=false}=r;const o=Nu(t,n.schema);const l=Xu(n,o,e);if(l){return i.unsetMark(o,{extendEmptyMarkRange:s})}return i.setMark(o,e)};var _a=(t,e,r={})=>({state:n,commands:i})=>{const s=Du(t,n.schema);const o=Du(e,n.schema);const l=Qu(n,s,r);let u;if(n.selection.$anchor.sameParent(n.selection.$head)){u=n.selection.$anchor.parent.attrs}if(l){return i.setNode(o,u)}return i.setNode(s,{...u,...r})};var Ba=(t,e={})=>({state:r,commands:n})=>{const i=Du(t,r.schema);const s=Qu(r,i,e);if(s){return n.lift(i)}return n.wrapIn(i,e)};var za=()=>({state:t,dispatch:e})=>{const r=t.plugins;for(let n=0;n<r.length;n+=1){const i=r[n];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const e=t.tr;const r=s.transform;for(let t=r.steps.length-1;t>=0;t-=1){e.step(r.steps[t].invert(r.docs[t]))}if(s.text){const r=e.doc.resolve(s.from).marks();e.replaceWith(s.from,s.to,t.schema.text(s.text,r))}else{e.delete(s.from,s.to)}}return true}}return false};var Fa=()=>({tr:t,dispatch:e})=>{const{selection:r}=t;const{empty:n,ranges:i}=r;if(n){return true}if(e){i.forEach((e=>{t.removeMark(e.$from.pos,e.$to.pos)}))}return true};var Ua=(t,e={})=>({tr:r,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=false}=e;const{selection:l}=r;const u=Nu(t,n.schema);const{$from:f,empty:a,ranges:h}=l;if(!i){return true}if(a&&o){let{from:t,to:e}=l;const n=(s=f.marks().find((t=>t.type===u)))==null?void 0:s.attrs;const i=Ju(f,u,n);if(i){t=i.from;e=i.to}r.removeMark(t,e,u)}else{h.forEach((t=>{r.removeMark(t.$from.pos,t.$to.pos,u)}))}r.removeStoredMark(u);return true};var qa=(t,e={})=>({tr:r,state:n,dispatch:i})=>{let s=null;let o=null;const l=Hu(typeof t==="string"?t:t.name,n.schema);if(!l){return false}if(l==="node"){s=Du(t,n.schema)}if(l==="mark"){o=Nu(t,n.schema)}if(i){r.selection.ranges.forEach((t=>{const i=t.$from.pos;const l=t.$to.pos;let u;let f;let a;let h;if(r.selection.empty){n.doc.nodesBetween(i,l,((t,e)=>{if(s&&s===t.type){a=Math.max(e,i);h=Math.min(e+t.nodeSize,l);u=e;f=t}}))}else{n.doc.nodesBetween(i,l,((t,n)=>{if(n<i&&s&&s===t.type){a=Math.max(n,i);h=Math.min(n+t.nodeSize,l);u=n;f=t}if(n>=i&&n<=l){if(s&&s===t.type){r.setNodeMarkup(n,void 0,{...t.attrs,...e})}if(o&&t.marks.length){t.marks.forEach((s=>{if(o===s.type){const u=Math.max(n,i);const f=Math.min(n+t.nodeSize,l);r.addMark(u,f,o.create({...s.attrs,...e}))}}))}}}))}if(f){if(u!==void 0){r.setNodeMarkup(u,void 0,{...f.attrs,...e})}if(o&&f.marks.length){f.marks.forEach((t=>{if(o===t.type){r.addMark(a,h,o.create({...t.attrs,...e}))}}))}}}))}return true};var Ka=(t,e={})=>({state:r,dispatch:n})=>{const i=Du(t,r.schema);return _l(i,e)(r,n)};var Ja=(t,e={})=>({state:r,dispatch:n})=>{const i=Du(t,r.schema);return Jl(i,e)(r,n)};var Wa=$f.create({name:"commands",addCommands(){return{...Lf}}});var Va=$f.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var r,n,i;const s=()=>{var r,n,i,s;if((s=(i=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.filterTransaction)==null?void 0:i.call(n,t))!=null?s:t.getMeta("y-sync$")){return}const o=iu(t.before,[t,...e]);const l=zu(o);l.forEach((e=>{if(o.mapping.mapResult(e.oldRange.from).deletedAfter&&o.mapping.mapResult(e.oldRange.to).deletedBefore){o.before.nodesBetween(e.oldRange.from,e.oldRange.to,((r,n)=>{const i=n+r.nodeSize-2;const s=e.oldRange.from<=n&&i<=e.oldRange.to;this.editor.emit("delete",{type:"node",node:r,from:n,to:i,newFrom:o.mapping.map(n),newTo:o.mapping.map(i),deletedRange:e.oldRange,newRange:e.newRange,partial:!s,editor:this.editor,transaction:t,combinedTransform:o})}))}}));const u=o.mapping;o.steps.forEach(((e,r)=>{var n,i;if(e instanceof ne){const s=u.slice(r).map(e.from,-1);const l=u.slice(r).map(e.to);const f=u.invert().map(s,-1);const a=u.invert().map(l);const h=(n=o.doc.nodeAt(s-1))==null?void 0:n.marks.some((t=>t.eq(e.mark)));const c=(i=o.doc.nodeAt(l))==null?void 0:i.marks.some((t=>t.eq(e.mark)));this.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:f,to:a},newRange:{from:s,to:l},partial:Boolean(c||h),editor:this.editor,transaction:t,combinedTransform:o})}}))};if((i=(n=(r=this.editor.options.coreExtensionOptions)==null?void 0:r.delete)==null?void 0:n.async)!=null?i:true){setTimeout(s,0)}else{s()}}});var Ga=$f.create({name:"drop",addProseMirrorPlugins(){return[new xr({key:new Er("tiptapDrop"),props:{handleDrop:(t,e,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:r,moved:n})}}})]}});var Za=$f.create({name:"editable",addProseMirrorPlugins(){return[new xr({key:new Er("editable"),props:{editable:()=>this.editor.options.editable}})]}});var Ya=new Er("focusEvents");var Xa=$f.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new xr({key:Ya,props:{handleDOMEvents:{focus:(e,r)=>{t.isFocused=true;const n=t.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",false);e.dispatch(n);return false},blur:(e,r)=>{t.isFocused=false;const n=t.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",false);e.dispatch(n);return false}}}})]}});var Qa=$f.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.command((({tr:e})=>{const{selection:r,doc:n}=e;const{empty:i,$anchor:s}=r;const{pos:o,parent:l}=s;const u=s.parent.isTextblock&&o>0?e.doc.resolve(o-1):s;const f=u.parent.type.spec.isolating;const a=s.pos-s.parentOffset;const h=f&&u.parent.childCount===1?a===s.pos:tr.atStart(n).from===o;if(!i||!l.type.isTextblock||l.textContent.length||!h||h&&s.parent.type.name==="paragraph"){return false}return t.clearNodes()})),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()]));const e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()]));const r=()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()]));const n={Enter:r,"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()};const i={...n};const s={...n,"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()};if(Vf()||ua()){return s}return i},addProseMirrorPlugins(){return[new xr({key:new Er("clearDocument"),appendTransaction:(t,e,r)=>{if(t.some((t=>t.getMeta("composition")))){return}const n=t.some((t=>t.docChanged))&&!e.doc.eq(r.doc);const i=t.some((t=>t.getMeta("preventClearDocument")));if(!n||i){return}const{empty:s,from:o,to:l}=e.selection;const u=tr.atStart(e.doc).from;const f=tr.atEnd(e.doc).to;const a=o===u&&l===f;if(s||!a){return}const h=of(r.doc);if(!h){return}const c=r.tr;const d=eu({state:r,transaction:c});const{commands:p}=new ru({editor:this.editor,state:d});p.clearNodes();if(!c.steps.length){return}return c}})]}});var th=$f.create({name:"paste",addProseMirrorPlugins(){return[new xr({key:new Er("tiptapPaste"),props:{handlePaste:(t,e,r)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:r})}}})]}});var eh=$f.create({name:"tabindex",addProseMirrorPlugins(){return[new xr({key:new Er("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var rh=class t{constructor(t,e,r=false,n=null){this.currentNode=null;this.actualDepth=null;this.isBlock=r;this.resolvedPos=t;this.editor=e;this.currentNode=n}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 t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from;let 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}e=this.from+1;r=this.to-1}this.editor.commands.insertContentAt({from:e,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){if(this.isBlock){return this.pos}return this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){if(this.isBlock){return this.pos+this.size}return 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);const r=this.resolvedPos.doc.resolve(e);return new t(r,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));if(e.depth!==this.depth){e=this.resolvedPos.doc.resolve(this.from-3)}return new t(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));if(e.depth!==this.depth){e=this.resolvedPos.doc.resolve(this.to+3)}return new t(e,this.editor)}get children(){const e=[];this.node.content.forEach(((r,n)=>{const i=r.isBlock&&!r.isTextblock;const s=r.isAtom&&!r.isText;const o=this.pos+n+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2){return}const l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth){return}const u=new t(l,this.editor,i,i?r:null);if(i){u.actualDepth=this.depth+1}e.push(new t(l,this.editor,i,i?r:null))}));return e}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let r=null;let n=this.parent;while(n&&!r){if(n.node.type.name===t){if(Object.keys(e).length>0);else{r=n}}n=n.parent}return r}querySelector(t,e={}){return this.querySelectorAll(t,e,true)[0]||null}querySelectorAll(t,e={},r=false){let n=[];if(!this.children||this.children.length===0){return n}const i=Object.keys(e);this.children.forEach((s=>{if(r&&n.length>0){return}if(s.node.type.name===t){const t=i.every((t=>e[t]===s.node.attrs[t]));if(t){n.push(s)}}if(r&&n.length>0){return}n=n.concat(s.querySelectorAll(t,e,r))}));return n}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t});this.editor.view.dispatch(e)}};var nh=`.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}`;function ih(t,e,r){const n=document.querySelector(`style[data-tiptap-style${r?`-${r}`:""}]`);if(n!==null){return n}const i=document.createElement("style");if(e){i.setAttribute("nonce",e)}i.setAttribute(`data-tiptap-style${r?`-${r}`:""}`,"");i.innerHTML=t;document.getElementsByTagName("head")[0].appendChild(i);return i}var sh=class extends nu{constructor(t={}){super();this.css=null;this.editorView=null;this.isFocused=false;this.isInitialized=false;this.extensionStorage={};this.instanceId=Math.random().toString(36).slice(2,9);this.options={element:typeof document!=="undefined"?document.createElement("div"):null,content:"",injectCSS:true,injectNonce:void 0,extensions:[],autofocus:false,editable:true,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:true,enablePasteRules:true,enableCoreExtensions:true,enableContentCheck:false,emitContentError:false,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null};this.isCapturingTransaction=false;this.capturedTransaction=null;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:t,slice:e,moved:r})=>this.options.onDrop(t,e,r)));this.on("paste",(({event:t,slice:e})=>this.options.onPaste(t,e)));this.on("delete",this.options.onDelete);const e=this.createDoc();const r=af(e,this.options.autofocus);this.editorState=yr.create({doc:e,schema:this.schema,selection:r||void 0});if(this.options.element){this.mount(this.options.element)}}mount(t){if(typeof document==="undefined"){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});if(this.css&&!document.head.contains(this.css)){document.head.appendChild(this.css)}window.setTimeout((()=>{if(this.isDestroyed){return}this.commands.focus(this.options.autofocus);this.emit("create",{editor:this});this.isInitialized=true}),0)}unmount(){if(this.editorView){const t=this.editorView.dom;if(t==null?void 0:t.editor){delete t.editor}this.editorView.destroy()}this.editorView=null;this.isInitialized=false;if(this.css){try{if(typeof this.css.remove==="function"){this.css.remove()}else if(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(){if(this.options.injectCSS&&typeof document!=="undefined"){this.css=ih(nh,this.options.injectNonce)}}setOptions(t={}){this.options={...this.options,...t};if(!this.editorView||!this.state||this.isDestroyed){return}if(this.options.editorProps){this.view.setProps(this.options.editorProps)}this.view.updateState(this.state)}setEditable(t,e=true){this.setOptions({editable:t});if(e){this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){if(this.editorView){return this.editorView}return new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:false,dragging:null,editable:true,isDestroyed:false},{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(){if(this.editorView){this.editorState=this.view.state}return this.editorState}registerPlugin(t,e){const r=gu(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t];const n=this.state.reconfigure({plugins:r});this.view.updateState(n);return n}unregisterPlugin(t){if(this.isDestroyed){return void 0}const e=this.state.plugins;let r=e;[].concat(t).forEach((t=>{const e=typeof t==="string"?`${t}$`:t.key;r=r.filter((t=>!t.key.startsWith(e)))}));if(e.length===r.length){return void 0}const n=this.state.reconfigure({plugins:r});this.view.updateState(n);return n}createExtensionManager(){var t,e;const r=this.options.enableCoreExtensions?[Za,Cf.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Wa,Xa,Qa,eh,Ga,th,Va].filter((t=>{if(typeof this.options.enableCoreExtensions==="object"){return this.options.enableCoreExtensions[t.name]!==false}return true})):[];const n=[...r,...this.options.extensions].filter((t=>["extension","node","mark"].includes(t==null?void 0:t.type)));this.extensionManager=new Of(n,this)}createCommandManager(){this.commandManager=new ru({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=uu(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:()=>{if("collaboration"in this.storage&&typeof this.storage.collaboration==="object"&&this.storage.collaboration){this.storage.collaboration.isDisabled=true}this.options.extensions=this.options.extensions.filter((t=>t.name!=="collaboration"));this.createExtensionManager()}});t=uu(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:false})}return t}createView(t){var e;this.editorView=new zo(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r);this.prependClass();this.injectCSS();const n=this.view.dom;n.editor=this}createNodeViews(){if(this.view.isDestroyed){return}this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=true;t();this.isCapturingTransaction=false;const e=this.capturedTransaction;this.capturedTransaction=null;return e}dispatchTransaction(t){if(this.view.isDestroyed){return}if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach((t=>{var e;return(e=this.capturedTransaction)==null?void 0:e.step(t)}));return}const{state:e,transactions:r}=this.state.applyTransaction(t);const n=!this.state.selection.eq(e.selection);const i=r.includes(t);const s=this.state;this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e});if(!i){return}this.view.updateState(e);this.emit("transaction",{editor:this,transaction:t,appendedTransactions:r.slice(1)});if(n){this.emit("selectionUpdate",{editor:this,transaction:t})}const o=r.findLast((t=>t.getMeta("focus")||t.getMeta("blur")));const l=o==null?void 0:o.getMeta("focus");const u=o==null?void 0:o.getMeta("blur");if(l){this.emit("focus",{editor:this,event:l.event,transaction:o})}if(u){this.emit("blur",{editor:this,event:u.event,transaction:o})}if(t.getMeta("preventUpdate")||!r.some((t=>t.docChanged))||s.doc.eq(e.doc)){return}this.emit("update",{editor:this,transaction:t,appendedTransactions:r.slice(1)})}getAttributes(t){return ju(this.state,t)}isActive(t,e){const r=typeof t==="string"?t:null;const n=typeof t==="string"?e:t;return tf(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return mu(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:r={}}=t||{};return Cu(this.state.doc,{blockSeparator:e,textSerializers:{...Lu(this.schema),...r}})}get isEmpty(){return of(this.state.doc)}destroy(){this.emit("destroy");this.unmount();this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:true}$node(t,e){var r;return((r=this.$doc)==null?void 0:r.querySelector(t,e))||null}$nodes(t,e){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new rh(e,this)}get $doc(){return this.$pos(0)}};function oh(t){return new cf({find:t.find,handler:({state:e,range:r,match:n})=>{const i=wu(t.getAttributes,void 0,n);if(i===false||i===null){return null}const{tr:s}=e;const o=n[n.length-1];const l=n[0];if(o){const n=l.search(/\S/);const u=r.from+l.indexOf(o);const f=u+o.length;const a=Wu(r.from,r.to,e.doc).filter((e=>{const r=e.mark.type.excluded;return r.find((r=>r===t.type&&r!==e.mark.type))})).filter((t=>t.to>u));if(a.length){return null}if(f<r.to){s.delete(f,r.to)}if(u>r.from){s.delete(r.from+n,u)}const h=r.from+n+o.length;s.addMark(r.from+n,h,t.type.create(i||{}));s.removeStoredMark(t.type)}},undoable:t.undoable})}function lh(t){return new cf({find:t.find,handler:({state:e,range:r,match:n})=>{const i=wu(t.getAttributes,void 0,n)||{};const{tr:s}=e;const o=r.from;let l=r.to;const u=t.type.create(i);if(n[1]){const t=n[0].lastIndexOf(n[1]);let e=o+t;if(e>l){e=l}else{l=e+n[1].length}const r=n[0][n[0].length-1];s.insertText(r,o+n[0].length-1);s.replaceWith(e,l,u)}else if(n[0]){const e=t.type.isInline?o:o-1;s.insert(e,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function uh(t){return new cf({find:t.find,handler:({state:e,range:r,match:n})=>{const i=e.doc.resolve(r.from);const s=wu(t.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type)){return null}e.tr.delete(r.from,r.to).setBlockType(r.from,r.from,t.type,s)},undoable:t.undoable})}function fh(t){return new cf({find:t.find,handler:({state:e,range:r,match:n,chain:i})=>{const s=wu(t.getAttributes,void 0,n)||{};const o=e.tr.delete(r.from,r.to);const l=o.doc.resolve(r.from);const u=l.blockRange();const f=u&&me(u,t.type,s);if(!f){return null}o.wrap(u,f);if(t.keepMarks&&t.editor){const{selection:r,storedMarks:n}=e;const{splittableMarks:i}=t.editor.extensionManager;const s=n||r.$to.parentOffset&&r.$from.marks();if(s){const t=s.filter((t=>i.includes(t.type.name)));o.ensureMarks(t)}}if(t.keepAttributes){const e=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(e,s).run()}const a=o.doc.resolve(r.from-1).nodeBefore;if(a&&a.type===t.type&&Ae(o.doc,r.from-1)&&(!t.joinPredicate||t.joinPredicate(n,a))){o.join(r.from-1)}},undoable:t.undoable})}function ah(t,e){const{selection:r}=t;const{$from:n}=r;if(r instanceof or){const t=n.index();const r=n.parent;return r.canReplaceWith(t,t+1,e)}let i=n.depth;while(i>=0){const t=n.index(i);const r=n.node(i);const s=r.contentMatchAt(t);if(s.matchType(e)){return true}i-=1}return false}function hh(t,e,r={}){const{state:n}=e;const{doc:i,tr:s}=n;const o=t;i.descendants(((e,n)=>{const i=s.mapping.map(n);const l=s.mapping.map(n)+e.nodeSize;let u=null;e.marks.forEach((t=>{if(t!==o){return false}u=t}));if(!u){return}let f=false;Object.keys(r).forEach((t=>{if(r[t]!==u.attrs[t]){f=true}}));if(f){const e=t.type.create({...t.attrs,...r});s.removeMark(i,l,t.type);s.addMark(i,l,e)}}));if(s.docChanged){e.view.dispatch(s)}}var ch=class t extends vf{constructor(){super(...arguments);this.type="node"}static create(e={}){const r=typeof e==="function"?e():e;return new t(r)}configure(t){return super.configure(t)}extend(t){const e=typeof t==="function"?t():t;return super.extend(e)}};function dh(t){return new xf({find:t.find,handler:({state:e,range:r,match:n,pasteEvent:i})=>{const s=wu(t.getAttributes,void 0,n,i);if(s===false||s===null){return null}const{tr:o}=e;const l=n[n.length-1];const u=n[0];let f=r.to;if(l){const n=u.search(/\S/);const i=r.from+u.indexOf(l);const a=i+l.length;const h=Wu(r.from,r.to,e.doc).filter((e=>{const r=e.mark.type.excluded;return r.find((r=>r===t.type&&r!==e.mark.type))})).filter((t=>t.to>i));if(h.length){return null}if(a<r.to){o.delete(a,r.to)}if(i>r.from){o.delete(r.from+n,i)}f=r.from+n+l.length;o.addMark(r.from+n,f,t.type.create(s||{}));o.removeStoredMark(t.type)}}})}var ph=(t,e)=>{if(t==="slot"){return 0}if(t instanceof Function){return t(e)}const{children:r,...n}=e!=null?e:{};if(t==="svg"){throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead")}return[t,n,r]};var mh=/^\s*>\s$/;var gh=ch.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:true,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ph("blockquote",{...ku(this.options.HTMLAttributes,t),children:ph("slot",{})})},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[fh({find:mh,type:this.type})]}});var wh=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;var bh=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;var vh=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;var yh=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;var kh=yf.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 ph("strong",{...ku(this.options.HTMLAttributes,t),children:ph("slot",{})})},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[oh({find:wh,type:this.type}),oh({find:vh,type:this.type})]},addPasteRules(){return[dh({find:bh,type:this.type}),dh({find:yh,type:this.type})]}});var xh=/(^|[^`])`([^`]+)`(?!`)$/;var Mh=/(^|[^`])`([^`]+)`(?!`)/g;var Sh=yf.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:true,exitable:true,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ku(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[oh({find:xh,type:this.type})]},addPasteRules(){return[dh({find:Mh,type:this.type})]}});var Eh=4;var Th=/^```([a-z]+)?[\s\n]$/;var Ah=/^~~~([a-z]+)?[\s\n]$/;var Oh=ch.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:true,exitOnArrowDown:true,defaultLanguage:null,enableTabIndentation:false,tabSize:Eh,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:true,defining:true,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:r}=this.options;if(!r){return null}const n=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]];const i=n.filter((t=>t.startsWith(r))).map((t=>t.replace(r,"")));const s=i[0];if(!s){return null}return s},rendered:false}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ku(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection;const r=e.pos===1;if(!t||e.parent.type.name!==this.name){return false}if(r||!e.parent.textContent.length){return this.editor.commands.clearNodes()}return false},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation){return false}const r=(e=this.options.tabSize)!=null?e:Eh;const{state:n}=t;const{selection:i}=n;const{$from:s,empty:o}=i;if(s.parent.type!==this.type){return false}const l=" ".repeat(r);if(o){return t.commands.insertContent(l)}return t.commands.command((({tr:t})=>{const{from:e,to:r}=i;const s=n.doc.textBetween(e,r,"\n","\n");const o=s.split("\n");const u=o.map((t=>l+t)).join("\n");t.replaceWith(e,r,n.schema.text(u));return true}))},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation){return false}const r=(e=this.options.tabSize)!=null?e:Eh;const{state:n}=t;const{selection:i}=n;const{$from:s,empty:o}=i;if(s.parent.type!==this.type){return false}if(o){return t.commands.command((({tr:t})=>{var e;const{pos:i}=s;const o=s.start();const l=s.end();const u=n.doc.textBetween(o,l,"\n","\n");const f=u.split("\n");let a=0;let h=0;const c=i-o;for(let t=0;t<f.length;t+=1){if(h+f[t].length>=c){a=t;break}h+=f[t].length+1}const d=f[a];const p=((e=d.match(/^ */))==null?void 0:e[0])||"";const m=Math.min(p.length,r);if(m===0){return true}let g=o;for(let t=0;t<a;t+=1){g+=f[t].length+1}t.delete(g,g+m);const w=i-g;if(w<=m){t.setSelection(ir.create(t.doc,g))}return true}))}return t.commands.command((({tr:t})=>{const{from:e,to:s}=i;const o=n.doc.textBetween(e,s,"\n","\n");const l=o.split("\n");const u=l.map((t=>{var e;const n=((e=t.match(/^ */))==null?void 0:e[0])||"";const i=Math.min(n.length,r);return t.slice(i)})).join("\n");t.replaceWith(e,s,n.schema.text(u));return true}))},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter){return false}const{state:e}=t;const{selection:r}=e;const{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type){return false}const s=n.parentOffset===n.parent.nodeSize-2;const o=n.parent.textContent.endsWith("\n\n");if(!s||!o){return false}return t.chain().command((({tr:t})=>{t.delete(n.pos-2,n.pos);return true})).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown){return false}const{state:e}=t;const{selection:r,doc:n}=e;const{$from:i,empty:s}=r;if(!s||i.parent.type!==this.type){return false}const o=i.parentOffset===i.parent.nodeSize-2;if(!o){return false}const l=i.after();if(l===void 0){return false}const u=n.nodeAt(l);if(u){return t.commands.command((({tr:t})=>{t.setSelection(tr.near(n.resolve(l)));return true}))}return t.commands.exitCode()}}},addInputRules(){return[uh({find:Th,type:this.type,getAttributes:t=>({language:t[1]})}),uh({find:Ah,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new xr({key:new Er("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData){return false}if(this.editor.isActive(this.type.name)){return false}const r=e.clipboardData.getData("text/plain");const n=e.clipboardData.getData("vscode-editor-data");const i=n?JSON.parse(n):void 0;const s=i==null?void 0:i.mode;if(!r||!s){return false}const{tr:o,schema:l}=t.state;const u=l.text(r.replace(/\r\n?/g,"\n"));o.replaceSelectionWith(this.type.create({language:s},u));if(o.selection.$from.parent.type!==this.type){o.setSelection(ir.near(o.doc.resolve(Math.max(0,o.selection.from-2))))}o.setMeta("paste",true);t.dispatch(o);return true}}})]}});var Rh=ch.create({name:"doc",topNode:true,content:"block+"});var $h=ch.create({name:"hardBreak",addOptions(){return{keepMarks:true,HTMLAttributes:{}}},inline:true,group:"inline",selectable:false,linebreakReplacement:true,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ku(this.options.HTMLAttributes,t)]},renderText(){return"\n"},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:r,editor:n})=>t.first([()=>t.exitCode(),()=>t.command((()=>{const{selection:t,storedMarks:i}=r;if(t.$from.parent.type.spec.isolating){return false}const{keepMarks:s}=this.options;const{splittableMarks:o}=n.extensionManager;const l=i||t.$to.parentOffset&&t.$from.marks();return e().insertContent({type:this.name}).command((({tr:t,dispatch:e})=>{if(e&&l&&s){const e=l.filter((t=>o.includes(t.type.name)));t.ensureMarks(e)}return true})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Ch=ch.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:true,addAttributes(){return{level:{default:1,rendered:false}}},parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){const r=this.options.levels.includes(t.attrs.level);const n=r?t.attrs.level:this.options.levels[0];return[`h${n}`,ku(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>{if(!this.options.levels.includes(t.level)){return false}return e.setNode(this.name,t)},toggleHeading:t=>({commands:e})=>{if(!this.options.levels.includes(t.level)){return false}return e.toggleNode(this.name,"paragraph",t)}}},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=>uh({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}})))}});var Lh=ch.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ku(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!ah(e,e.schema.nodes[this.name])){return false}const{selection:r}=e;const{$to:n}=r;const i=t();if(lf(r)){i.insertContentAt(n.pos,{type:this.name})}else{i.insertContent({type:this.name})}return i.command((({state:t,tr:e,dispatch:r})=>{if(r){const{$to:r}=e.selection;const n=r.end();if(r.nodeAfter){if(r.nodeAfter.isTextblock){e.setSelection(ir.create(e.doc,r.pos+1))}else if(r.nodeAfter.isBlock){e.setSelection(or.create(e.doc,r.pos))}else{e.setSelection(ir.create(e.doc,r.pos))}}else{const i=t.schema.nodes[this.options.nextNodeType]||r.parent.type.contentMatch.defaultType;const s=i==null?void 0:i.create();if(s){e.insert(n,s);e.setSelection(ir.create(e.doc,n+1))}}e.scrollIntoView()}return true})).run()}}},addInputRules(){return[lh({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Nh=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;var Ph=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;var Dh=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;var Ih=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;var Hh=yf.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",ku(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[oh({find:Nh,type:this.type}),oh({find:Dh,type:this.type})]},addPasteRules(){return[dh({find:Ph,type:this.type}),dh({find:Ih,type:this.type})]}});const jh="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";const _h="ελ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";const Bh="numeric";const zh="ascii";const Fh="alpha";const Uh="asciinumeric";const qh="alphanumeric";const Kh="domain";const Jh="emoji";const Wh="scheme";const Vh="slashscheme";const Gh="whitespace";function Zh(t,e){if(!(t in e)){e[t]=[]}return e[t]}function Yh(t,e,r){if(e[Bh]){e[Uh]=true;e[qh]=true}if(e[zh]){e[Uh]=true;e[Fh]=true}if(e[Uh]){e[qh]=true}if(e[Fh]){e[qh]=true}if(e[qh]){e[Kh]=true}if(e[Jh]){e[Kh]=true}for(const n in e){const e=Zh(n,r);if(e.indexOf(t)<0){e.push(t)}}}function Xh(t,e){const r={};for(const n in e){if(e[n].indexOf(t)>=0){r[n]=true}}return r}function Qh(t=null){this.j={};this.jr=[];this.jd=null;this.t=t}Qh.groups={};Qh.prototype={accepts(){return!!this.t},go(t){const e=this;const r=e.j[t];if(r){return r}for(let r=0;r<e.jr.length;r++){const n=e.jr[r][0];const i=e.jr[r][1];if(i&&n.test(t)){return i}}return e.jd},has(t,e=false){return e?t in this.j:!!this.go(t)},ta(t,e,r,n){for(let i=0;i<t.length;i++){this.tt(t[i],e,r,n)}},tr(t,e,r,n){n=n||Qh.groups;let i;if(e&&e.j){i=e}else{i=new Qh(e);if(r&&n){Yh(e,r,n)}}this.jr.push([t,i]);return i},ts(t,e,r,n){let i=this;const s=t.length;if(!s){return i}for(let e=0;e<s-1;e++){i=i.tt(t[e])}return i.tt(t[s-1],e,r,n)},tt(t,e,r,n){n=n||Qh.groups;const i=this;if(e&&e.j){i.j[t]=e;return e}const s=e;let o,l=i.go(t);if(l){o=new Qh;Object.assign(o.j,l.j);o.jr.push.apply(o.jr,l.jr);o.jd=l.jd;o.t=l.t}else{o=new Qh}if(s){if(n){if(o.t&&typeof o.t==="string"){const t=Object.assign(Xh(o.t,n),r);Yh(s,t,n)}else if(r){Yh(s,r,n)}}o.t=s}i.j[t]=o;return o}};const tc=(t,e,r,n,i)=>t.ta(e,r,n,i);const ec=(t,e,r,n,i)=>t.tr(e,r,n,i);const rc=(t,e,r,n,i)=>t.ts(e,r,n,i);const nc=(t,e,r,n,i)=>t.tt(e,r,n,i);const ic="WORD";const sc="UWORD";const oc="ASCIINUMERICAL";const lc="ALPHANUMERICAL";const uc="LOCALHOST";const fc="TLD";const ac="UTLD";const hc="SCHEME";const cc="SLASH_SCHEME";const dc="NUM";const pc="WS";const mc="NL";const gc="OPENBRACE";const wc="CLOSEBRACE";const bc="OPENBRACKET";const vc="CLOSEBRACKET";const yc="OPENPAREN";const kc="CLOSEPAREN";const xc="OPENANGLEBRACKET";const Mc="CLOSEANGLEBRACKET";const Sc="FULLWIDTHLEFTPAREN";const Ec="FULLWIDTHRIGHTPAREN";const Tc="LEFTCORNERBRACKET";const Ac="RIGHTCORNERBRACKET";const Oc="LEFTWHITECORNERBRACKET";const Rc="RIGHTWHITECORNERBRACKET";const $c="FULLWIDTHLESSTHAN";const Cc="FULLWIDTHGREATERTHAN";const Lc="AMPERSAND";const Nc="APOSTROPHE";const Pc="ASTERISK";const Dc="AT";const Ic="BACKSLASH";const Hc="BACKTICK";const jc="CARET";const _c="COLON";const Bc="COMMA";const zc="DOLLAR";const Fc="DOT";const Uc="EQUALS";const qc="EXCLAMATION";const Kc="HYPHEN";const Jc="PERCENT";const Wc="PIPE";const Vc="PLUS";const Gc="POUND";const Zc="QUERY";const Yc="QUOTE";const Xc="FULLWIDTHMIDDLEDOT";const Qc="SEMI";const td="SLASH";const ed="TILDE";const rd="UNDERSCORE";const nd="EMOJI";const id="SYM";var sd=Object.freeze({__proto__:null,ALPHANUMERICAL:lc,AMPERSAND:Lc,APOSTROPHE:Nc,ASCIINUMERICAL:oc,ASTERISK:Pc,AT:Dc,BACKSLASH:Ic,BACKTICK:Hc,CARET:jc,CLOSEANGLEBRACKET:Mc,CLOSEBRACE:wc,CLOSEBRACKET:vc,CLOSEPAREN:kc,COLON:_c,COMMA:Bc,DOLLAR:zc,DOT:Fc,EMOJI:nd,EQUALS:Uc,EXCLAMATION:qc,FULLWIDTHGREATERTHAN:Cc,FULLWIDTHLEFTPAREN:Sc,FULLWIDTHLESSTHAN:$c,FULLWIDTHMIDDLEDOT:Xc,FULLWIDTHRIGHTPAREN:Ec,HYPHEN:Kc,LEFTCORNERBRACKET:Tc,LEFTWHITECORNERBRACKET:Oc,LOCALHOST:uc,NL:mc,NUM:dc,OPENANGLEBRACKET:xc,OPENBRACE:gc,OPENBRACKET:bc,OPENPAREN:yc,PERCENT:Jc,PIPE:Wc,PLUS:Vc,POUND:Gc,QUERY:Zc,QUOTE:Yc,RIGHTCORNERBRACKET:Ac,RIGHTWHITECORNERBRACKET:Rc,SCHEME:hc,SEMI:Qc,SLASH:td,SLASH_SCHEME:cc,SYM:id,TILDE:ed,TLD:fc,UNDERSCORE:rd,UTLD:ac,UWORD:sc,WORD:ic,WS:pc});const od=/[a-z]/;const ld=/\p{L}/u;const ud=/\p{Emoji}/u;const fd=/\d/;const ad=/\s/;const hd="\r";const cd="\n";const dd="️";const pd="‍";const md="";let gd=null,wd=null;function bd(t=[]){const e={};Qh.groups=e;const r=new Qh;if(gd==null){gd=xd(jh)}if(wd==null){wd=xd(_h)}nc(r,"'",Nc);nc(r,"{",gc);nc(r,"}",wc);nc(r,"[",bc);nc(r,"]",vc);nc(r,"(",yc);nc(r,")",kc);nc(r,"<",xc);nc(r,">",Mc);nc(r,"(",Sc);nc(r,")",Ec);nc(r,"「",Tc);nc(r,"」",Ac);nc(r,"『",Oc);nc(r,"』",Rc);nc(r,"<",$c);nc(r,">",Cc);nc(r,"&",Lc);nc(r,"*",Pc);nc(r,"@",Dc);nc(r,"`",Hc);nc(r,"^",jc);nc(r,":",_c);nc(r,",",Bc);nc(r,"$",zc);nc(r,".",Fc);nc(r,"=",Uc);nc(r,"!",qc);nc(r,"-",Kc);nc(r,"%",Jc);nc(r,"|",Wc);nc(r,"+",Vc);nc(r,"#",Gc);nc(r,"?",Zc);nc(r,'"',Yc);nc(r,"/",td);nc(r,";",Qc);nc(r,"~",ed);nc(r,"_",rd);nc(r,"\\",Ic);nc(r,"・",Xc);const n=ec(r,fd,dc,{[Bh]:true});ec(n,fd,n);const i=ec(n,od,oc,{[Uh]:true});const s=ec(n,ld,lc,{[qh]:true});const o=ec(r,od,ic,{[zh]:true});ec(o,fd,i);ec(o,od,o);ec(i,fd,i);ec(i,od,i);const l=ec(r,ld,sc,{[Fh]:true});ec(l,od);ec(l,fd,s);ec(l,ld,l);ec(s,fd,s);ec(s,od);ec(s,ld,s);const u=nc(r,cd,mc,{[Gh]:true});const f=nc(r,hd,pc,{[Gh]:true});const a=ec(r,ad,pc,{[Gh]:true});nc(r,md,a);nc(f,cd,u);nc(f,md,a);ec(f,ad,a);nc(a,hd);nc(a,cd);ec(a,ad,a);nc(a,md,a);const h=ec(r,ud,nd,{[Jh]:true});nc(h,"#");ec(h,ud,h);nc(h,dd,h);const c=nc(h,pd);nc(c,"#");ec(c,ud,h);const d=[[od,o],[fd,i]];const p=[[od,null],[ld,l],[fd,s]];for(let t=0;t<gd.length;t++){kd(r,gd[t],fc,ic,d)}for(let t=0;t<wd.length;t++){kd(r,wd[t],ac,sc,p)}Yh(fc,{tld:true,ascii:true},e);Yh(ac,{utld:true,alpha:true},e);kd(r,"file",hc,ic,d);kd(r,"mailto",hc,ic,d);kd(r,"http",cc,ic,d);kd(r,"https",cc,ic,d);kd(r,"ftp",cc,ic,d);kd(r,"ftps",cc,ic,d);Yh(hc,{scheme:true,ascii:true},e);Yh(cc,{slashscheme:true,ascii:true},e);t=t.sort(((t,e)=>t[0]>e[0]?1:-1));for(let e=0;e<t.length;e++){const n=t[e][0];const i=t[e][1];const s=i?{[Wh]:true}:{[Vh]:true};if(n.indexOf("-")>=0){s[Kh]=true}else if(!od.test(n)){s[Bh]=true}else if(fd.test(n)){s[Uh]=true}else{s[zh]=true}rc(r,n,n,s)}rc(r,"localhost",uc,{ascii:true});r.jd=new Qh(id);return{start:r,tokens:Object.assign({groups:e},sd)}}function vd(t,e){const r=yd(e.replace(/[A-Z]/g,(t=>t.toLowerCase())));const n=r.length;const i=[];let s=0;let o=0;while(o<n){let l=t;let u=null;let f=0;let a=null;let h=-1;let c=-1;while(o<n&&(u=l.go(r[o]))){l=u;if(l.accepts()){h=0;c=0;a=l}else if(h>=0){h+=r[o].length;c++}f+=r[o].length;s+=r[o].length;o++}s-=h;o-=c;f-=h;i.push({t:a.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function yd(t){const e=[];const r=t.length;let n=0;while(n<r){let i=t.charCodeAt(n);let s;let o=i<55296||i>56319||n+1===r||(s=t.charCodeAt(n+1))<56320||s>57343?t[n]:t.slice(n,n+2);e.push(o);n+=o.length}return e}function kd(t,e,r,n,i){let s;const o=e.length;for(let r=0;r<o-1;r++){const o=e[r];if(t.j[o]){s=t.j[o]}else{s=new Qh(n);s.jr=i.slice();t.j[o]=s}t=s}s=new Qh(r);s.jr=i.slice();t.j[e[o-1]]=s;return s}function xd(t){const e=[];const r=[];let n=0;let i="0123456789";while(n<t.length){let s=0;while(i.indexOf(t[n+s])>=0){s++}if(s>0){e.push(r.join(""));for(let e=parseInt(t.substring(n,n+s),10);e>0;e--){r.pop()}n+=s}else{r.push(t[n]);n++}}return e}const Md={defaultProtocol:"http",events:null,format:Ed,formatHref:Ed,nl2br:false,tagName:"a",target:null,rel:null,validate:true,truncate:Infinity,className:null,attributes:null,ignoreTags:[],render:null};function Sd(t,e=null){let r=Object.assign({},Md);if(t){r=Object.assign(r,t instanceof Sd?t.o:t)}const n=r.ignoreTags;const i=[];for(let t=0;t<n.length;t++){i.push(n[t].toUpperCase())}this.o=r;if(e){this.defaultRender=e}this.ignoreTags=i}Sd.prototype={o:Md,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,r){const n=e!=null;let i=this.o[t];if(!i){return i}if(typeof i==="object"){i=r.t in i?i[r.t]:Md[t];if(typeof i==="function"&&n){i=i(e,r)}}else if(typeof i==="function"&&n){i=i(e,r.t,r)}return i},getObj(t,e,r){let n=this.o[t];if(typeof n==="function"&&e!=null){n=n(e,r.t,r)}return n},render(t){const e=t.render(this);const r=this.get("render",null,t)||this.defaultRender;return r(e,t.t,t)}};function Ed(t){return t}function Td(t,e){this.t="token";this.v=t;this.tk=e}Td.prototype={isLink:false,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString();const r=t.get("truncate",e,this);const n=t.get("format",e,this);return r&&n.length>r?n.substring(0,r)+"…":n},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=Md.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;const r=this.toHref(t.get("defaultProtocol"));const n=t.get("formatHref",r,this);const i=t.get("tagName",r,e);const s=this.toFormattedString(t);const o={};const l=t.get("className",r,e);const u=t.get("target",r,e);const f=t.get("rel",r,e);const a=t.getObj("attributes",r,e);const h=t.getObj("events",r,e);o.href=n;if(l){o.class=l}if(u){o.target=u}if(f){o.rel=f}if(a){Object.assign(o,a)}return{tagName:i,attributes:o,content:s,eventListeners:h}}};function Ad(t,e){class r extends Td{constructor(e,r){super(e,r);this.t=t}}for(const t in e){r.prototype[t]=e[t]}r.t=t;return r}const Od=Ad("email",{isLink:true,toHref(){return"mailto:"+this.toString()}});const Rd=Ad("text");const $d=Ad("nl");const Cd=Ad("url",{isLink:true,toHref(t=Md.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==uc&&t[1].t===_c}});const Ld=t=>new Qh(t);function Nd({groups:t}){const e=t.domain.concat([Lc,Pc,Dc,Ic,Hc,jc,zc,Uc,Kc,dc,Jc,Wc,Vc,Gc,td,id,ed,rd]);const r=[Nc,_c,Bc,Fc,qc,Jc,Zc,Yc,Qc,xc,Mc,gc,wc,vc,bc,yc,kc,Sc,Ec,Tc,Ac,Oc,Rc,$c,Cc];const n=[Lc,Nc,Pc,Ic,Hc,jc,zc,Uc,Kc,gc,wc,Jc,Wc,Vc,Gc,Zc,td,id,ed,rd];const i=Ld();const s=nc(i,ed);tc(s,n,s);tc(s,t.domain,s);const o=Ld(),l=Ld(),u=Ld();tc(i,t.domain,o);tc(i,t.scheme,l);tc(i,t.slashscheme,u);tc(o,n,s);tc(o,t.domain,o);const f=nc(o,Dc);nc(s,Dc,f);nc(l,Dc,f);nc(u,Dc,f);const a=nc(s,Fc);tc(a,n,s);tc(a,t.domain,s);const h=Ld();tc(f,t.domain,h);tc(h,t.domain,h);const c=nc(h,Fc);tc(c,t.domain,h);const d=Ld(Od);tc(c,t.tld,d);tc(c,t.utld,d);nc(f,uc,d);const p=nc(h,Kc);nc(p,Kc,p);tc(p,t.domain,h);tc(d,t.domain,h);nc(d,Fc,c);nc(d,Kc,p);const m=nc(d,_c);tc(m,t.numeric,Od);const g=nc(o,Kc);const w=nc(o,Fc);nc(g,Kc,g);tc(g,t.domain,o);tc(w,n,s);tc(w,t.domain,o);const b=Ld(Cd);tc(w,t.tld,b);tc(w,t.utld,b);tc(b,t.domain,o);tc(b,n,s);nc(b,Fc,w);nc(b,Kc,g);nc(b,Dc,f);const v=nc(b,_c);const y=Ld(Cd);tc(v,t.numeric,y);const k=Ld(Cd);const x=Ld();tc(k,e,k);tc(k,r,x);tc(x,e,k);tc(x,r,x);nc(b,td,k);nc(y,td,k);const M=nc(l,_c);const S=nc(u,_c);const E=nc(S,td);const T=nc(E,td);tc(l,t.domain,o);nc(l,Fc,w);nc(l,Kc,g);tc(u,t.domain,o);nc(u,Fc,w);nc(u,Kc,g);tc(M,t.domain,k);nc(M,td,k);nc(M,Zc,k);tc(T,t.domain,k);tc(T,e,k);nc(T,td,k);const A=[[gc,wc],[bc,vc],[yc,kc],[xc,Mc],[Sc,Ec],[Tc,Ac],[Oc,Rc],[$c,Cc]];for(let t=0;t<A.length;t++){const[n,i]=A[t];const s=nc(k,n);nc(x,n,s);nc(s,i,k);const o=Ld(Cd);tc(s,e,o);const l=Ld();tc(s,r);tc(o,e,o);tc(o,r,l);tc(l,e,o);tc(l,r,l);nc(o,i,k);nc(l,i,k)}nc(i,uc,b);nc(i,mc,$d);return{start:i,tokens:sd}}function Pd(t,e,r){let n=r.length;let i=0;let s=[];let o=[];while(i<n){let l=t;let u=null;let f=null;let a=0;let h=null;let c=-1;while(i<n&&!(u=l.go(r[i].t))){o.push(r[i++])}while(i<n&&(f=u||l.go(r[i].t))){u=null;l=f;if(l.accepts()){c=0;h=l}else if(c>=0){c++}i++;a++}if(c<0){i-=a;if(i<n){o.push(r[i]);i++}}else{if(o.length>0){s.push(Dd(Rd,e,o));o=[]}i-=c;a-=c;const t=h.t;const n=r.slice(i-a,i);s.push(Dd(t,e,n))}}if(o.length>0){s.push(Dd(Rd,e,o))}return s}function Dd(t,e,r){const n=r[0].s;const i=r[r.length-1].e;const s=e.slice(n,i);return new t(s,r)}const Id=typeof console!=="undefined"&&console&&console.warn||(()=>{});const Hd="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.";const jd={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:false};function _d(){Qh.groups={};jd.scanner=null;jd.parser=null;jd.tokenQueue=[];jd.pluginQueue=[];jd.customSchemes=[];jd.initialized=false;return jd}function Bd(t,e=false){if(jd.initialized){Id(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Hd}`)}if(!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t)){throw new Error(`linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat`)}jd.customSchemes.push([t,e])}function zd(){jd.scanner=bd(jd.customSchemes);for(let t=0;t<jd.tokenQueue.length;t++){jd.tokenQueue[t][1]({scanner:jd.scanner})}jd.parser=Nd(jd.scanner.tokens);for(let t=0;t<jd.pluginQueue.length;t++){jd.pluginQueue[t][1]({scanner:jd.scanner,parser:jd.parser})}jd.initialized=true;return jd}function Fd(t){if(!jd.initialized){zd()}return Pd(jd.parser.start,t,vd(jd.scanner.start,t))}Fd.scan=vd;function Ud(t,e=null,r=null){if(e&&typeof e==="object"){if(r){throw Error(`linkifyjs: Invalid link type ${e}; must be a string`)}r=e;e=null}const n=new Sd(r);const i=Fd(t);const s=[];for(let t=0;t<i.length;t++){const r=i[t];if(r.isLink&&(!e||r.t===e)&&n.check(r)){s.push(r.toFormattedObject(n))}}return s}var qd="[\0-   ᠎ -\u2029  ]";var Kd=new RegExp(qd);var Jd=new RegExp(`${qd}$`);var Wd=new RegExp(qd,"g");function Vd(t){if(t.length===1){return t[0].isLink}if(t.length===3&&t[1].isLink){return["()","[]"].includes(t[0].value+t[2].value)}return false}function Gd(t){return new xr({key:new Er("autolink"),appendTransaction:(e,r,n)=>{const i=e.some((t=>t.docChanged))&&!r.doc.eq(n.doc);const s=e.some((t=>t.getMeta("preventAutolink")));if(!i||s){return}const{tr:o}=n;const l=iu(r.doc,[...e]);const u=zu(l);u.forEach((({newRange:e})=>{const r=au(n.doc,e,(t=>t.isTextblock));let i;let s;if(r.length>1){i=r[0];s=n.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0," ")}else if(r.length){const t=n.doc.textBetween(e.from,e.to," "," ");if(!Jd.test(t)){return}i=r[0];s=n.doc.textBetween(i.pos,e.to,void 0," ")}if(i&&s){const e=s.split(Kd).filter(Boolean);if(e.length<=0){return false}const r=e[e.length-1];const l=i.pos+s.lastIndexOf(r);if(!r){return false}const u=Fd(r).map((e=>e.toObject(t.defaultProtocol)));if(!Vd(u)){return false}u.filter((t=>t.isLink)).map((t=>({...t,from:l+t.start+1,to:l+t.end+1}))).filter((t=>{if(!n.schema.marks.code){return true}return!n.doc.rangeHasMark(t.from,t.to,n.schema.marks.code)})).filter((e=>t.validate(e.value))).filter((e=>t.shouldAutoLink(e.value))).forEach((e=>{if(Wu(e.from,e.to,n.doc).some((e=>e.mark.type===t.type))){return}o.addMark(e.from,e.to,t.type.create({href:e.href}))}))}}));if(!o.steps.length){return}return o}})}function Zd(t){return new xr({key:new Er("handleClickLink"),props:{handleClick:(e,r,n)=>{var i,s;if(n.button!==0){return false}if(!e.editable){return false}let o=null;if(n.target instanceof HTMLAnchorElement){o=n.target}else{let t=n.target;const e=[];while(t.nodeName!=="DIV"){e.push(t);t=t.parentNode}o=e.find((t=>t.nodeName==="A"))}if(!o){return false}const l=ju(e.state,t.type.name);const u=(i=o==null?void 0:o.href)!=null?i:l.href;const f=(s=o==null?void 0:o.target)!=null?s:l.target;if(t.enableClickSelection){t.editor.commands.extendMarkRange(t.type.name)}if(o&&u){window.open(u,f);return true}return false}}})}function Yd(t){return new xr({key:new Er("handlePasteLink"),props:{handlePaste:(e,r,n)=>{const{state:i}=e;const{selection:s}=i;const{empty:o}=s;if(o){return false}let l="";n.content.forEach((t=>{l+=t.textContent}));const u=Ud(l,{defaultProtocol:t.defaultProtocol}).find((t=>t.isLink&&t.value===l));if(!l||!u){return false}return t.editor.commands.setMark(t.type,{href:u.href})}}})}function Xd(t,e){const r=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];if(e){e.forEach((t=>{const e=typeof t==="string"?t:t.scheme;if(e){r.push(e)}}))}return!t||t.replace(Wd,"").match(new RegExp(`^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Qd=yf.create({name:"link",priority:1e3,keepOnSplit:false,exitable:true,onCreate(){if(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"){Bd(t);return}Bd(t.scheme,t.optionalSlashes)}))},onDestroy(){_d()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:true,enableClickSelection:false,linkOnPaste:true,autolink:true,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Xd(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");if(!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Xd(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})){return false}return null}}]},renderHTML({HTMLAttributes:t}){if(!this.options.isAllowedUri(t.href,{defaultValidate:t=>!!Xd(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})){return["a",ku(this.options.HTMLAttributes,{...t,href:""}),0]}return["a",ku(this.options.HTMLAttributes,t),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:r}=t;if(!this.options.isAllowedUri(r,{defaultValidate:t=>!!Xd(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})){return false}return e().setMark(this.name,t).setMeta("preventAutolink",true).run()},toggleLink:t=>({chain:e})=>{const{href:r}=t||{};if(r&&!this.options.isAllowedUri(r,{defaultValidate:t=>!!Xd(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})){return false}return e().toggleMark(this.name,t,{extendEmptyMarkRange:true}).setMeta("preventAutolink",true).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:true}).setMeta("preventAutolink",true).run()}},addPasteRules(){return[dh({find:t=>{const e=[];if(t){const{protocols:r,defaultProtocol:n}=this.options;const i=Ud(t).filter((t=>t.isLink&&this.options.isAllowedUri(t.value,{defaultValidate:t=>!!Xd(t,r),protocols:r,defaultProtocol:n})));if(i.length){i.forEach((t=>e.push({text:t.value,data:{href:t.href},index:t.start})))}}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[];const{protocols:e,defaultProtocol:r}=this.options;if(this.options.autolink){t.push(Gd({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:t=>this.options.isAllowedUri(t,{defaultValidate:t=>!!Xd(t,e),protocols:e,defaultProtocol:r}),shouldAutoLink:this.options.shouldAutoLink}))}if(this.options.openOnClick===true){t.push(Zd({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection}))}if(this.options.linkOnPaste){t.push(Yd({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type}))}return t}});var tp=Qd;var ep=Object.defineProperty;var rp=(t,e)=>{for(var r in e)ep(t,r,{get:e[r],enumerable:true})};var np="listItem";var ip="textStyle";var sp=/^\s*([-+*])\s$/;var op=ch.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:false,keepAttributes:false}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ku(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>{if(this.options.keepAttributes){return e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(np,this.editor.getAttributes(ip)).run()}return t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fh({find:sp,type:this.type});if(this.options.keepMarks||this.options.keepAttributes){t=fh({find:sp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ip),editor:this.editor})}return[t]}});var lp=ch.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:true,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ku(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var up={};rp(up,{findListItemPos:()=>fp,getNextListDepth:()=>ap,handleBackspace:()=>pp,handleDelete:()=>wp,hasListBefore:()=>hp,hasListItemAfter:()=>bp,hasListItemBefore:()=>cp,listItemHasSubList:()=>dp,nextListIsDeeper:()=>mp,nextListIsHigher:()=>gp});var fp=(t,e)=>{const{$from:r}=e.selection;const n=Du(t,e.schema);let i=null;let s=r.depth;let o=r.pos;let l=null;while(s>0&&l===null){i=r.node(s);if(i.type===n){l=s}else{s-=1;o-=1}}if(l===null){return null}return{$pos:e.doc.resolve(o),depth:l}};var ap=(t,e)=>{const r=fp(t,e);if(!r){return false}const[,n]=Vu(e,t,r.$pos.pos+4);return n};var hp=(t,e,r)=>{const{$anchor:n}=t.selection;const i=Math.max(0,n.pos-2);const s=t.doc.resolve(i).node();if(!s||!r.includes(s.type.name)){return false}return true};var cp=(t,e)=>{var r;const{$anchor:n}=e.selection;const i=e.doc.resolve(n.pos-2);if(i.index()===0){return false}if(((r=i.nodeBefore)==null?void 0:r.type.name)!==t){return false}return true};var dp=(t,e,r)=>{if(!r){return false}const n=Du(t,e.schema);let i=false;r.descendants((t=>{if(t.type===n){i=true}}));return i};var pp=(t,e,r)=>{if(t.commands.undoInputRule()){return true}if(t.state.selection.from!==t.state.selection.to){return false}if(!Qu(t.state,e)&&hp(t.state,e,r)){const{$anchor:r}=t.state.selection;const n=t.state.doc.resolve(r.before()-1);const i=[];n.node().descendants(((t,r)=>{if(t.type.name===e){i.push({node:t,pos:r})}}));const s=i.at(-1);if(!s){return false}const o=t.state.doc.resolve(n.start()+s.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},o.end()).joinForward().run()}if(!Qu(t.state,e)){return false}if(!rf(t.state)){return false}const n=fp(e,t.state);if(!n){return false}const i=t.state.doc.resolve(n.$pos.pos-2);const s=i.node(n.depth);const o=dp(e,t.state,s);if(cp(e,t.state)&&!o){return t.commands.joinItemBackward()}return t.chain().liftListItem(e).run()};var mp=(t,e)=>{const r=ap(t,e);const n=fp(t,e);if(!n||!r){return false}if(r>n.depth){return true}return false};var gp=(t,e)=>{const r=ap(t,e);const n=fp(t,e);if(!n||!r){return false}if(r<n.depth){return true}return false};var wp=(t,e)=>{if(!Qu(t.state,e)){return false}if(!ef(t.state,e)){return false}const{selection:r}=t.state;const{$from:n,$to:i}=r;if(!r.empty&&n.sameParent(i)){return false}if(mp(e,t.state)){return t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run()}if(gp(e,t.state)){return t.chain().joinForward().joinBackward().run()}return t.commands.joinItemForward()};var bp=(t,e)=>{var r;const{$anchor:n}=e.selection;const i=e.doc.resolve(n.pos-n.parentOffset-2);if(i.index()===i.parent.childCount-1){return false}if(((r=i.nodeAfter)==null?void 0:r.type.name)!==t){return false}return true};var vp=$f.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=false;this.options.listTypes.forEach((({itemName:r})=>{if(t.state.schema.nodes[r]===void 0){return}if(wp(t,r)){e=true}}));return e},"Mod-Delete":({editor:t})=>{let e=false;this.options.listTypes.forEach((({itemName:r})=>{if(t.state.schema.nodes[r]===void 0){return}if(wp(t,r)){e=true}}));return e},Backspace:({editor:t})=>{let e=false;this.options.listTypes.forEach((({itemName:r,wrapperNames:n})=>{if(t.state.schema.nodes[r]===void 0){return}if(pp(t,r,n)){e=true}}));return e},"Mod-Backspace":({editor:t})=>{let e=false;this.options.listTypes.forEach((({itemName:r,wrapperNames:n})=>{if(t.state.schema.nodes[r]===void 0){return}if(pp(t,r,n)){e=true}}));return e}}}});var yp="listItem";var kp="textStyle";var xp=/^(\d+)\.\s$/;var Mp=ch.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:false,keepAttributes:false}},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,...r}=t;return e===1?["ol",ku(this.options.HTMLAttributes,r),0]:["ol",ku(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>{if(this.options.keepAttributes){return e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(yp,this.editor.getAttributes(kp)).run()}return t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=fh({find:xp,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});if(this.options.keepMarks||this.options.keepAttributes){t=fh({find:xp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(kp)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})}return[t]}});var Sp=/^\s*(\[([( |x])?\])\s$/;var Ep=ch.create({name:"taskItem",addOptions(){return{nested:false,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:true,addAttributes(){return{checked:{default:false,keepOnSplit:false,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",ku(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};if(!this.options.nested){return t}return{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}},addNodeView(){return({node:t,HTMLAttributes:e,getPos:r,editor:n})=>{const i=document.createElement("li");const s=document.createElement("label");const o=document.createElement("span");const l=document.createElement("input");const u=document.createElement("div");const f=t=>{var e,r;l.ariaLabel=((r=(e=this.options.a11y)==null?void 0:e.checkboxLabel)==null?void 0:r.call(e,t,l.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};f(t);s.contentEditable="false";l.type="checkbox";l.addEventListener("mousedown",(t=>t.preventDefault()));l.addEventListener("change",(e=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:i}=e.target;if(n.isEditable&&typeof r==="function"){n.chain().focus(void 0,{scrollIntoView:false}).command((({tr:t})=>{const e=r();if(typeof e!=="number"){return false}const n=t.doc.nodeAt(e);t.setNodeMarkup(e,void 0,{...n==null?void 0:n.attrs,checked:i});return true})).run()}if(!n.isEditable&&this.options.onReadOnlyChecked){if(!this.options.onReadOnlyChecked(t,i)){l.checked=!l.checked}}}));Object.entries(this.options.HTMLAttributes).forEach((([t,e])=>{i.setAttribute(t,e)}));i.dataset.checked=t.attrs.checked;l.checked=t.attrs.checked;s.append(l,o);i.append(s,u);Object.entries(e).forEach((([t,e])=>{i.setAttribute(t,e)}));return{dom:i,contentDOM:u,update:t=>{if(t.type!==this.type){return false}i.dataset.checked=t.attrs.checked;l.checked=t.attrs.checked;f(t);return true}}}},addInputRules(){return[fh({find:Sp,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}});var Tp=ch.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",ku(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});$f.create({name:"listKit",addExtensions(){const t=[];if(this.options.bulletList!==false){t.push(op.configure(this.options.bulletList))}if(this.options.listItem!==false){t.push(lp.configure(this.options.listItem))}if(this.options.listKeymap!==false){t.push(vp.configure(this.options.listKeymap))}if(this.options.orderedList!==false){t.push(Mp.configure(this.options.orderedList))}if(this.options.taskItem!==false){t.push(Ep.configure(this.options.taskItem))}if(this.options.taskList!==false){t.push(Tp.configure(this.options.taskList))}return t}});var Ap=ch.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ku(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var Op=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;var Rp=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;var $p=yf.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:false,getAttrs:t=>t.includes("line-through")?{}:false}]},renderHTML({HTMLAttributes:t}){return["s",ku(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[oh({find:Op,type:this.type})]},addPasteRules(){return[dh({find:Rp,type:this.type})]}});var Cp=ch.create({name:"text",group:"inline"});var Lp=yf.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:false,getAttrs:t=>t.includes("underline")?{}:false}]},renderHTML({HTMLAttributes:t}){return["u",ku(this.options.HTMLAttributes,t),0]},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 Np(t={}){return new xr({view(e){return new Pp(e,t)}})}class Pp{constructor(t,e){var r;this.editorView=t;this.cursorPos=null;this.element=null;this.timeout=-1;this.width=(r=e.width)!==null&&r!==void 0?r:1;this.color=e.color===false?undefined:e.color||"black";this.class=e.class;this.handlers=["dragover","dragend","drop","dragleave"].map((e=>{let r=t=>{this[e](t)};t.dom.addEventListener(e,r);return{name:e,handler:r}}))}destroy(){this.handlers.forEach((({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e)))}update(t,e){if(this.cursorPos!=null&&e.doc!=t.state.doc){if(this.cursorPos>t.state.doc.content.size)this.setCursor(null);else this.updateOverlay()}}setCursor(t){if(t==this.cursorPos)return;this.cursorPos=t;if(t==null){this.element.parentNode.removeChild(this.element);this.element=null}else{this.updateOverlay()}}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos);let e=!t.parent.inlineContent,r;let n=this.editorView.dom,i=n.getBoundingClientRect();let s=i.width/n.offsetWidth,o=i.height/n.offsetHeight;if(e){let e=t.nodeBefore,n=t.nodeAfter;if(e||n){let t=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(t){let i=t.getBoundingClientRect();let s=e?i.bottom:i.top;if(e&&n)s=(s+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2;let l=this.width/2*o;r={left:i.left,right:i.right,top:s-l,bottom:s+l}}}}if(!r){let t=this.editorView.coordsAtPos(this.cursorPos);let e=this.width/2*s;r={left:t.left-e,right:t.left+e,top:t.top,bottom:t.bottom}}let l=this.editorView.dom.offsetParent;if(!this.element){this.element=l.appendChild(document.createElement("div"));if(this.class)this.element.className=this.class;this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;";if(this.color){this.element.style.backgroundColor=this.color}}this.element.classList.toggle("prosemirror-dropcursor-block",e);this.element.classList.toggle("prosemirror-dropcursor-inline",!e);let u,f;if(!l||l==document.body&&getComputedStyle(l).position=="static"){u=-pageXOffset;f=-pageYOffset}else{let t=l.getBoundingClientRect();let e=t.width/l.offsetWidth,r=t.height/l.offsetHeight;u=t.left-l.scrollLeft*e;f=t.top-l.scrollTop*r}this.element.style.left=(r.left-u)/s+"px";this.element.style.top=(r.top-f)/o+"px";this.element.style.width=(r.right-r.left)/s+"px";this.element.style.height=(r.bottom-r.top)/o+"px"}scheduleRemoval(t){clearTimeout(this.timeout);this.timeout=setTimeout((()=>this.setCursor(null)),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY});let r=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside);let n=r&&r.type.spec.disableDropCursor;let i=typeof n=="function"?n(this.editorView,e,t):n;if(e&&!i){let t=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Ne(this.editorView.state.doc,t,this.editorView.dragging.slice);if(e!=null)t=e}this.setCursor(t);this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){if(!this.editorView.dom.contains(t.relatedTarget))this.setCursor(null)}}class Dp extends tr{constructor(t){super(t,t)}map(t,e){let r=t.resolve(e.map(this.head));return Dp.valid(r)?new Dp(r):tr.near(r)}content(){return E.empty}eq(t){return t instanceof Dp&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Dp(t.resolve(e.pos))}getBookmark(){return new Ip(this.anchor)}static valid(t){let e=t.parent;if(e.isTextblock||!Hp(t)||!jp(t))return false;let r=e.type.spec.allowGapCursor;if(r!=null)return r;let n=e.contentMatchAt(t.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(t,e,r=false){t:for(;;){if(!r&&Dp.valid(t))return t;let n=t.pos,i=null;for(let r=t.depth;;r--){let s=t.node(r);if(e>0?t.indexAfter(r)<s.childCount:t.index(r)>0){i=s.child(e>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0){return null}n+=e;let o=t.doc.resolve(n);if(Dp.valid(o))return o}for(;;){let s=e>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!or.isSelectable(i)){t=t.doc.resolve(n+i.nodeSize*e);r=false;continue t}break}i=s;n+=e;let o=t.doc.resolve(n);if(Dp.valid(o))return o}return null}}}Dp.prototype.visible=false;Dp.findFrom=Dp.findGapCursorFrom;tr.jsonID("gapcursor",Dp);class Ip{constructor(t){this.pos=t}map(t){return new Ip(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return Dp.valid(e)?new Dp(e):tr.near(e)}}function Hp(t){for(let e=t.depth;e>=0;e--){let r=t.index(e),n=t.node(e);if(r==0){if(n.type.spec.isolating)return true;continue}for(let t=n.child(r-1);;t=t.lastChild){if(t.childCount==0&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return true;if(t.inlineContent)return false}}return true}function jp(t){for(let e=t.depth;e>=0;e--){let r=t.indexAfter(e),n=t.node(e);if(r==n.childCount){if(n.type.spec.isolating)return true;continue}for(let t=n.child(r);;t=t.firstChild){if(t.childCount==0&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return true;if(t.inlineContent)return false}}return true}function _p(){return new xr({props:{decorations:qp,createSelectionBetween(t,e,r){return e.pos==r.pos&&Dp.valid(r)?new Dp(r):null},handleClick:Fp,handleKeyDown:Bp,handleDOMEvents:{beforeinput:Up}}})}const Bp=ul({ArrowLeft:zp("horiz",-1),ArrowRight:zp("horiz",1),ArrowUp:zp("vert",-1),ArrowDown:zp("vert",1)});function zp(t,e){const r=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(t,n,i){let s=t.selection;let o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof ir){if(!i.endOfTextblock(r)||o.depth==0)return false;l=false;o=t.doc.resolve(e>0?o.after():o.before())}let u=Dp.findGapCursorFrom(o,e,l);if(!u)return false;if(n)n(t.tr.setSelection(new Dp(u)));return true}}function Fp(t,e,r){if(!t||!t.editable)return false;let n=t.state.doc.resolve(e);if(!Dp.valid(n))return false;let i=t.posAtCoords({left:r.clientX,top:r.clientY});if(i&&i.inside>-1&&or.isSelectable(t.state.doc.nodeAt(i.inside)))return false;t.dispatch(t.state.tr.setSelection(new Dp(n)));return true}function Up(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Dp))return false;let{$from:r}=t.state.selection;let n=r.parent.contentMatchAt(r.index()).findWrapping(t.state.schema.nodes.text);if(!n)return false;let i=v.empty;for(let t=n.length-1;t>=0;t--)i=v.from(n[t].createAndFill(null,i));let s=t.state.tr.replace(r.pos,r.pos,new E(i,0,0));s.setSelection(ir.near(s.doc.resolve(r.pos+1)));t.dispatch(s);return false}function qp(t){if(!(t.selection instanceof Dp))return null;let e=document.createElement("div");e.className="ProseMirror-gapcursor";return lo.create(t.doc,[io.widget(t.selection.head,e,{key:"gapcursor"})])}var Kp=200;var Jp=function t(){};Jp.prototype.append=function t(e){if(!e.length){return this}e=Jp.from(e);return!this.length&&e||e.length<Kp&&this.leafAppend(e)||this.length<Kp&&e.leafPrepend(this)||this.appendInner(e)};Jp.prototype.prepend=function t(e){if(!e.length){return this}return Jp.from(e).append(this)};Jp.prototype.appendInner=function t(e){return new Vp(this,e)};Jp.prototype.slice=function t(e,r){if(e===void 0)e=0;if(r===void 0)r=this.length;if(e>=r){return Jp.empty}return this.sliceInner(Math.max(0,e),Math.min(this.length,r))};Jp.prototype.get=function t(e){if(e<0||e>=this.length){return undefined}return this.getInner(e)};Jp.prototype.forEach=function t(e,r,n){if(r===void 0)r=0;if(n===void 0)n=this.length;if(r<=n){this.forEachInner(e,r,n,0)}else{this.forEachInvertedInner(e,r,n,0)}};Jp.prototype.map=function t(e,r,n){if(r===void 0)r=0;if(n===void 0)n=this.length;var i=[];this.forEach((function(t,r){return i.push(e(t,r))}),r,n);return i};Jp.from=function t(e){if(e instanceof Jp){return e}return e&&e.length?new Wp(e):Jp.empty};var Wp=function(t){function e(e){t.call(this);this.values=e}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;var r={length:{configurable:true},depth:{configurable:true}};e.prototype.flatten=function t(){return this.values};e.prototype.sliceInner=function t(r,n){if(r==0&&n==this.length){return this}return new e(this.values.slice(r,n))};e.prototype.getInner=function t(e){return this.values[e]};e.prototype.forEachInner=function t(e,r,n,i){for(var s=r;s<n;s++){if(e(this.values[s],i+s)===false){return false}}};e.prototype.forEachInvertedInner=function t(e,r,n,i){for(var s=r-1;s>=n;s--){if(e(this.values[s],i+s)===false){return false}}};e.prototype.leafAppend=function t(r){if(this.length+r.length<=Kp){return new e(this.values.concat(r.flatten()))}};e.prototype.leafPrepend=function t(r){if(this.length+r.length<=Kp){return new e(r.flatten().concat(this.values))}};r.length.get=function(){return this.values.length};r.depth.get=function(){return 0};Object.defineProperties(e.prototype,r);return e}(Jp);Jp.empty=new Wp([]);var Vp=function(t){function e(e,r){t.call(this);this.left=e;this.right=r;this.length=e.length+r.length;this.depth=Math.max(e.depth,r.depth)+1}if(t)e.__proto__=t;e.prototype=Object.create(t&&t.prototype);e.prototype.constructor=e;e.prototype.flatten=function t(){return this.left.flatten().concat(this.right.flatten())};e.prototype.getInner=function t(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)};e.prototype.forEachInner=function t(e,r,n,i){var s=this.left.length;if(r<s&&this.left.forEachInner(e,r,Math.min(n,s),i)===false){return false}if(n>s&&this.right.forEachInner(e,Math.max(r-s,0),Math.min(this.length,n)-s,i+s)===false){return false}};e.prototype.forEachInvertedInner=function t(e,r,n,i){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(e,r-s,Math.max(n,s)-s,i+s)===false){return false}if(n<s&&this.left.forEachInvertedInner(e,Math.min(r,s),n,i)===false){return false}};e.prototype.sliceInner=function t(e,r){if(e==0&&r==this.length){return this}var n=this.left.length;if(r<=n){return this.left.slice(e,r)}if(e>=n){return this.right.slice(e-n,r-n)}return this.left.slice(e,n).append(this.right.slice(0,r-n))};e.prototype.leafAppend=function t(r){var n=this.right.leafAppend(r);if(n){return new e(this.left,n)}};e.prototype.leafPrepend=function t(r){var n=this.left.leafPrepend(r);if(n){return new e(n,this.right)}};e.prototype.appendInner=function t(r){if(this.left.depth>=Math.max(this.right.depth,r.depth)+1){return new e(this.left,new e(this.right,r))}return new e(this,r)};return e}(Jp);const Gp=500;class Zp{constructor(t,e){this.items=t;this.eventCount=e}popEvent(t,e){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--){let t=this.items.get(r-1);if(t.selection){--r;break}}let n,i;if(e){n=this.remapping(r,this.items.length);i=n.maps.length}let s=t.tr;let o,l;let u=[],f=[];this.items.forEach(((t,e)=>{if(!t.step){if(!n){n=this.remapping(r,e+1);i=n.maps.length}i--;f.push(t);return}if(n){f.push(new Xp(t.map));let e=t.step.map(n.slice(i)),r;if(e&&s.maybeStep(e).doc){r=s.mapping.maps[s.mapping.maps.length-1];u.push(new Xp(r,undefined,undefined,u.length+f.length))}i--;if(r)n.appendMap(r,i)}else{s.maybeStep(t.step)}if(t.selection){o=n?t.selection.map(n.slice(i)):t.selection;l=new Zp(this.items.slice(0,r).append(f.reverse().concat(u)),this.eventCount-1);return false}}),this.items.length,0);return{remaining:l,transform:s,selection:o}}addTransform(t,e,r,n){let i=[],s=this.eventCount;let o=this.items,l=!n&&o.length?o.get(o.length-1):null;for(let r=0;r<t.steps.length;r++){let u=t.steps[r].invert(t.docs[r]);let f=new Xp(t.mapping.maps[r],u,e),a;if(a=l&&l.merge(f)){f=a;if(r)i.pop();else o=o.slice(0,o.length-1)}i.push(f);if(e){s++;e=undefined}if(!n)l=f}let u=s-r.depth;if(u>tm){o=Yp(o,u);s-=u}return new Zp(o.append(i),s)}remapping(t,e){let r=new Yt;this.items.forEach(((e,n)=>{let i=e.mirrorOffset!=null&&n-e.mirrorOffset>=t?r.maps.length-e.mirrorOffset:undefined;r.appendMap(e.map,i)}),t,e);return r}addMaps(t){if(this.eventCount==0)return this;return new Zp(this.items.append(t.map((t=>new Xp(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-e);let i=t.mapping;let s=t.steps.length;let o=this.eventCount;this.items.forEach((t=>{if(t.selection)o--}),n);let l=e;this.items.forEach((e=>{let n=i.getMirror(--l);if(n==null)return;s=Math.min(s,n);let u=i.maps[n];if(e.step){let s=t.steps[n].invert(t.docs[n]);let f=e.selection&&e.selection.map(i.slice(l+1,n));if(f)o++;r.push(new Xp(u,s,f))}else{r.push(new Xp(u))}}),n);let u=[];for(let t=e;t<s;t++)u.push(new Xp(i.maps[t]));let f=this.items.slice(0,n).append(u).append(r);let a=new Zp(f,o);if(a.emptyItemCount()>Gp)a=a.compress(this.items.length-r.length);return a}emptyItemCount(){let t=0;this.items.forEach((e=>{if(!e.step)t++}));return t}compress(t=this.items.length){let e=this.remapping(0,t),r=e.maps.length;let n=[],i=0;this.items.forEach(((s,o)=>{if(o>=t){n.push(s);if(s.selection)i++}else if(s.step){let t=s.step.map(e.slice(r)),o=t&&t.getMap();r--;if(o)e.appendMap(o,r);if(t){let l=s.selection&&s.selection.map(e.slice(r));if(l)i++;let u=new Xp(o.invert(),t,l),f,a=n.length-1;if(f=n.length&&n[a].merge(u))n[a]=f;else n.push(u)}}else if(s.map){r--}}),this.items.length,0);return new Zp(Jp.from(n.reverse()),i)}}Zp.empty=new Zp(Jp.empty,0);function Yp(t,e){let r;t.forEach(((t,n)=>{if(t.selection&&e--==0){r=n;return false}}));return t.slice(r)}class Xp{constructor(t,e,r,n){this.map=t;this.step=e;this.selection=r;this.mirrorOffset=n}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Xp(e.getMap().invert(),e,this.selection)}}}class Qp{constructor(t,e,r,n,i){this.done=t;this.undone=e;this.prevRanges=r;this.prevTime=n;this.prevComposition=i}}const tm=20;function em(t,e,r,n){let i=r.getMeta(fm),s;if(i)return i.historyState;if(r.getMeta(am))t=new Qp(t.done,t.undone,null,0,-1);let o=r.getMeta("appendedTransaction");if(r.steps.length==0){return t}else if(o&&o.getMeta(fm)){if(o.getMeta(fm).redo)return new Qp(t.done.addTransform(r,undefined,n,um(e)),t.undone,nm(r.mapping.maps),t.prevTime,t.prevComposition);else return new Qp(t.done,t.undone.addTransform(r,undefined,n,um(e)),null,t.prevTime,t.prevComposition)}else if(r.getMeta("addToHistory")!==false&&!(o&&o.getMeta("addToHistory")===false)){let i=r.getMeta("composition");let s=t.prevTime==0||!o&&t.prevComposition!=i&&(t.prevTime<(r.time||0)-n.newGroupDelay||!rm(r,t.prevRanges));let l=o?im(t.prevRanges,r.mapping):nm(r.mapping.maps);return new Qp(t.done.addTransform(r,s?e.selection.getBookmark():undefined,n,um(e)),Zp.empty,l,r.time,i==null?t.prevComposition:i)}else if(s=r.getMeta("rebased")){return new Qp(t.done.rebased(r,s),t.undone.rebased(r,s),im(t.prevRanges,r.mapping),t.prevTime,t.prevComposition)}else{return new Qp(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),im(t.prevRanges,r.mapping),t.prevTime,t.prevComposition)}}function rm(t,e){if(!e)return false;if(!t.docChanged)return true;let r=false;t.mapping.maps[0].forEach(((t,n)=>{for(let i=0;i<e.length;i+=2)if(t<=e[i+1]&&n>=e[i])r=true}));return r}function nm(t){let e=[];for(let r=t.length-1;r>=0&&e.length==0;r--)t[r].forEach(((t,r,n,i)=>e.push(n,i)));return e}function im(t,e){if(!t)return null;let r=[];for(let n=0;n<t.length;n+=2){let i=e.map(t[n],1),s=e.map(t[n+1],-1);if(i<=s)r.push(i,s)}return r}function sm(t,e,r){let n=um(e);let i=fm.get(e).spec.config;let s=(r?t.undone:t.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc);let l=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,n);let u=new Qp(r?l:s.remaining,r?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(fm,{redo:r,historyState:u})}let om=false,lm=null;function um(t){let e=t.plugins;if(lm!=e){om=false;lm=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){om=true;break}}return om}const fm=new Er("history");const am=new Er("closeHistory");function hm(t={}){t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500};return new xr({key:fm,state:{init(){return new Qp(Zp.empty,Zp.empty,null,0,-1)},apply(e,r,n){return em(r,n,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(t,e){let r=e.inputType;let n=r=="historyUndo"?dm:r=="historyRedo"?pm:null;if(!n)return false;e.preventDefault();return n(t.state,t.dispatch)}}}})}function cm(t,e){return(r,n)=>{let i=fm.getState(r);if(!i||(t?i.undone:i.done).eventCount==0)return false;if(n){let s=sm(i,r,t);if(s)n(e?s.scrollIntoView():s)}return true}}const dm=cm(false,true);const pm=cm(true,true);$f.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter((t=>t!=="")).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;const r=(t==null?void 0:t.mode)||this.options.mode;if(r==="textSize"){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize};this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;const r=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(r)}},addProseMirrorPlugins(){let t=false;return[new xr({key:new Er("characterCount"),appendTransaction:(e,r,n)=>{if(t){return}const i=this.options.limit;if(i===null||i===void 0||i===0){t=true;return}const s=this.storage.characters({node:n.doc});if(s>i){const e=s-i;const r=0;const o=e;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const l=n.tr.deleteRange(r,o);t=true;return l}t=true},filterTransaction:(t,e)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0){return true}const n=this.storage.characters({node:e.doc});const i=this.storage.characters({node:t.doc});if(i<=r){return true}if(n>r&&i>r&&i<=n){return true}if(n>r&&i>r&&i>n){return false}const s=t.getMeta("paste");if(!s){return false}const o=t.selection.$head.pos;const l=i-r;const u=o-l;const f=o;t.deleteRange(u,f);const a=this.storage.characters({node:t.doc});if(a>r){return false}return true}})]}});var mm=$f.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Np(this.options)]}});$f.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new xr({key:new Er("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:r,isFocused:n}=this.editor;const{anchor:i}=e;const s=[];if(!r||!n){return lo.create(t,[])}let o=0;if(this.options.mode==="deepest"){t.descendants(((t,e)=>{if(t.isText){return}const r=i>=e&&i<=e+t.nodeSize-1;if(!r){return false}o+=1}))}let l=0;t.descendants(((t,e)=>{if(t.isText){return false}const r=i>=e&&i<=e+t.nodeSize-1;if(!r){return false}l+=1;const n=this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1;if(n){return this.options.mode==="deepest"}s.push(io.node(e,e+t.nodeSize,{class:this.options.className}))}));return lo.create(t,s)}}})]}});var gm=$f.create({name:"gapCursor",addProseMirrorPlugins(){return[_p()]},extendNodeSchema(t){var e;const r={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=wu(du(t,"allowGapCursor",r)))!=null?e:null}}});$f.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:true,showOnlyCurrent:true,includeChildren:false}},addProseMirrorPlugins(){return[new xr({key:new Er("placeholder"),props:{decorations:({doc:t,selection:e})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable;const{anchor:n}=e;const i=[];if(!r){return null}const s=this.editor.isEmpty;t.descendants(((t,e)=>{const r=n>=e&&n<=e+t.nodeSize;const o=!t.isLeaf&&of(t);if((r||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];if(s){n.push(this.options.emptyEditorClass)}const o=io.node(e,e+t.nodeSize,{class:n.join(" "),"data-placeholder":typeof this.options.placeholder==="function"?this.options.placeholder({editor:this.editor,node:t,pos:e,hasAnchor:r}):this.options.placeholder});i.push(o)}return this.options.includeChildren}));return lo.create(t,i)}}})]}});$f.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new xr({key:new Er("selection"),props:{decorations(r){if(r.selection.empty||t.isFocused||!t.isEditable||lf(r.selection)||t.view.dragging){return null}return lo.create(r.doc,[io.inline(r.selection.from,r.selection.to,{class:e.className})])}}})]}});function wm({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var bm=$f.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const t=new Er(this.name);const e=Object.entries(this.editor.schema.nodes).map((([,t])=>t)).filter((t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name)));return[new xr({key:t,appendTransaction:(e,r,n)=>{const{doc:i,tr:s,schema:o}=n;const l=t.getState(n);const u=i.content.size;const f=o.nodes[this.options.node];if(!l){return}return s.insert(u,f.create())},state:{init:(t,r)=>{const n=r.tr.doc.lastChild;return!wm({node:n,types:e})},apply:(t,r)=>{if(!t.docChanged){return r}const n=t.doc.lastChild;return!wm({node:n,types:e})}}})]}});var vm=$f.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>dm(t,e),redo:()=>({state:t,dispatch:e})=>pm(t,e)}},addProseMirrorPlugins(){return[hm(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()}}});var ym=$f.create({name:"starterKit",addExtensions(){var t,e,r,n;const i=[];if(this.options.bold!==false){i.push(kh.configure(this.options.bold))}if(this.options.blockquote!==false){i.push(gh.configure(this.options.blockquote))}if(this.options.bulletList!==false){i.push(op.configure(this.options.bulletList))}if(this.options.code!==false){i.push(Sh.configure(this.options.code))}if(this.options.codeBlock!==false){i.push(Oh.configure(this.options.codeBlock))}if(this.options.document!==false){i.push(Rh.configure(this.options.document))}if(this.options.dropcursor!==false){i.push(mm.configure(this.options.dropcursor))}if(this.options.gapcursor!==false){i.push(gm.configure(this.options.gapcursor))}if(this.options.hardBreak!==false){i.push($h.configure(this.options.hardBreak))}if(this.options.heading!==false){i.push(Ch.configure(this.options.heading))}if(this.options.undoRedo!==false){i.push(vm.configure(this.options.undoRedo))}if(this.options.horizontalRule!==false){i.push(Lh.configure(this.options.horizontalRule))}if(this.options.italic!==false){i.push(Hh.configure(this.options.italic))}if(this.options.listItem!==false){i.push(lp.configure(this.options.listItem))}if(this.options.listKeymap!==false){i.push(vp.configure((t=this.options)==null?void 0:t.listKeymap))}if(this.options.link!==false){i.push(Qd.configure((e=this.options)==null?void 0:e.link))}if(this.options.orderedList!==false){i.push(Mp.configure(this.options.orderedList))}if(this.options.paragraph!==false){i.push(Ap.configure(this.options.paragraph))}if(this.options.strike!==false){i.push($p.configure(this.options.strike))}if(this.options.text!==false){i.push(Cp.configure(this.options.text))}if(this.options.underline!==false){i.push(Lp.configure((r=this.options)==null?void 0:r.underline))}if(this.options.trailingNode!==false){i.push(bm.configure((n=this.options)==null?void 0:n.trailingNode))}return i}});var km=ym;var xm=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;var Mm=ch.create({name:"image",addOptions(){return{inline:false,allowBase64:false,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:true,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ku(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[lh({find:xm,type:this.type,getAttributes:t=>{const[,,e,r,n]=t;return{src:r,alt:e,title:n}}})]}});var Sm=Mm;const Em=t=>Sm.extend({addNodeView(){return({HTMLAttributes:e})=>{const r=document.createElement("pos-image");const n=new URL(e.src,t);r.setAttribute("src",n.toString());let i=["alt","title"];for(const t of i){if(e[t]){r.setAttribute(t,e[t])}}return{dom:r,ignoreMutation:()=>true}}}});const Tm=t=>tp.extend({addMarkView(){return({HTMLAttributes:e})=>{const r=document.createElement("pos-rich-link");const n=new URL(e.href,t);r.setAttribute("uri",n.toString());return{dom:r,contentDOM:r,ignoreMutation:()=>true}}}});class Am{constructor(t,e,r){this.modified=false;this.editingJustChanged=false;this.modifications=new l;this.editor=new sh({element:t,extensions:[km.configure({link:false}),Em(r),Tm(r)],content:e.value,editable:false});this.editor.on("update",(()=>{if(this.editingJustChanged){this.editingJustChanged=false;return}this.modified=true;this.modifications.next({content:this.editor.getHTML()})}))}onUpdate(t){this.editor.on("update",t)}isEditable(){return this.editor.isEditable}startEditing(){this.editingJustChanged=true;this.editor.setEditable(true);this.editor.commands.focus()}stopEditing(){this.editingJustChanged=true;this.editor.setEditable(false)}isModified(){return this.modified}getContent(){return this.editor.getHTML()}observeChanges(t=1e3){return this.modifications.pipe(u(t),h((()=>this.modified=false)))}}function Om(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r){if(r.hasOwnProperty(n))t[n]=r[n]}}return t}function Rm(t,e){return Array(e+1).join(t)}function $m(t){return t.replace(/^\n*/,"")}function Cm(t){var e=t.length;while(e>0&&t[e-1]==="\n")e--;return t.substring(0,e)}var Lm=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Nm(t){return Bm(t,Lm)}var Pm=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Dm(t){return Bm(t,Pm)}function Im(t){return zm(t,Pm)}var Hm=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function jm(t){return Bm(t,Hm)}function _m(t){return zm(t,Hm)}function Bm(t,e){return e.indexOf(t.nodeName)>=0}function zm(t,e){return t.getElementsByTagName&&e.some((function(e){return t.getElementsByTagName(e).length}))}var Fm={};Fm.paragraph={filter:"p",replacement:function(t){return"\n\n"+t+"\n\n"}};Fm.lineBreak={filter:"br",replacement:function(t,e,r){return r.br+"\n"}};Fm.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,r){var n=Number(e.nodeName.charAt(1));if(r.headingStyle==="setext"&&n<3){var i=Rm(n===1?"=":"-",t.length);return"\n\n"+t+"\n"+i+"\n\n"}else{return"\n\n"+Rm("#",n)+" "+t+"\n\n"}}};Fm.blockquote={filter:"blockquote",replacement:function(t){t=t.replace(/^\n+|\n+$/g,"");t=t.replace(/^/gm,"> ");return"\n\n"+t+"\n\n"}};Fm.list={filter:["ul","ol"],replacement:function(t,e){var r=e.parentNode;if(r.nodeName==="LI"&&r.lastElementChild===e){return"\n"+t}else{return"\n\n"+t+"\n\n"}}};Fm.listItem={filter:"li",replacement:function(t,e,r){var n=r.bulletListMarker+" ";var i=e.parentNode;if(i.nodeName==="OL"){var s=i.getAttribute("start");var o=Array.prototype.indexOf.call(i.children,e);n=(s?Number(s)+o:o+1)+". "}t=t.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n"+" ".repeat(n.length));return n+t+(e.nextSibling&&!/\n$/.test(t)?"\n":"")}};Fm.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){return"\n\n "+e.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}};Fm.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){var n=e.firstChild.getAttribute("class")||"";var i=(n.match(/language-(\S+)/)||[null,""])[1];var s=e.firstChild.textContent;var o=r.fence.charAt(0);var l=3;var u=new RegExp("^"+o+"{3,}","gm");var f;while(f=u.exec(s)){if(f[0].length>=l){l=f[0].length+1}}var a=Rm(o,l);return"\n\n"+a+i+"\n"+s.replace(/\n$/,"")+"\n"+a+"\n\n"}};Fm.horizontalRule={filter:"hr",replacement:function(t,e,r){return"\n\n"+r.hr+"\n\n"}};Fm.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var r=e.getAttribute("href");if(r)r=r.replace(/([()])/g,"\\$1");var n=Um(e.getAttribute("title"));if(n)n=' "'+n.replace(/"/g,'\\"')+'"';return"["+t+"]("+r+n+")"}};Fm.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,r){var n=e.getAttribute("href");var i=Um(e.getAttribute("title"));if(i)i=' "'+i+'"';var s;var o;switch(r.linkReferenceStyle){case"collapsed":s="["+t+"][]";o="["+t+"]: "+n+i;break;case"shortcut":s="["+t+"]";o="["+t+"]: "+n+i;break;default:var l=this.references.length+1;s="["+t+"]["+l+"]";o="["+l+"]: "+n+i}this.references.push(o);return s},references:[],append:function(t){var e="";if(this.references.length){e="\n\n"+this.references.join("\n")+"\n\n";this.references=[]}return e}};Fm.emphasis={filter:["em","i"],replacement:function(t,e,r){if(!t.trim())return"";return r.emDelimiter+t+r.emDelimiter}};Fm.strong={filter:["strong","b"],replacement:function(t,e,r){if(!t.trim())return"";return r.strongDelimiter+t+r.strongDelimiter}};Fm.code={filter:function(t){var e=t.previousSibling||t.nextSibling;var r=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!r},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"";var r="`";var n=t.match(/`+/gm)||[];while(n.indexOf(r)!==-1)r=r+"`";return r+e+t+e+r}};Fm.image={filter:"img",replacement:function(t,e){var r=Um(e.getAttribute("alt"));var n=e.getAttribute("src")||"";var i=Um(e.getAttribute("title"));var s=i?' "'+i+'"':"";return n?"!["+r+"]"+"("+n+s+")":""}};function Um(t){return t?t.replace(/(\n+\s*)+/g,"\n"):""}function qm(t){this.options=t;this._keep=[];this._remove=[];this.blankRule={replacement:t.blankReplacement};this.keepReplacement=t.keepReplacement;this.defaultRule={replacement:t.defaultReplacement};this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}qm.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;if(e=Km(this.array,t,this.options))return e;if(e=Km(this._keep,t,this.options))return e;if(e=Km(this._remove,t,this.options))return e;return this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function Km(t,e,r){for(var n=0;n<t.length;n++){var i=t[n];if(Jm(i,e,r))return i}return void 0}function Jm(t,e,r){var n=t.filter;if(typeof n==="string"){if(n===e.nodeName.toLowerCase())return true}else if(Array.isArray(n)){if(n.indexOf(e.nodeName.toLowerCase())>-1)return true}else if(typeof n==="function"){if(n.call(t,e,r))return true}else{throw new TypeError("`filter` needs to be a string, array, or function")}}function Wm(t){var e=t.element;var r=t.isBlock;var n=t.isVoid;var i=t.isPre||function(t){return t.nodeName==="PRE"};if(!e.firstChild||i(e))return;var s=null;var o=false;var l=null;var u=Gm(l,e,i);while(u!==e){if(u.nodeType===3||u.nodeType===4){var f=u.data.replace(/[ \r\n\t]+/g," ");if((!s||/ $/.test(s.data))&&!o&&f[0]===" "){f=f.substr(1)}if(!f){u=Vm(u);continue}u.data=f;s=u}else if(u.nodeType===1){if(r(u)||u.nodeName==="BR"){if(s){s.data=s.data.replace(/ $/,"")}s=null;o=false}else if(n(u)||i(u)){s=null;o=true}else if(s){o=false}}else{u=Vm(u);continue}var a=Gm(l,u,i);l=u;u=a}if(s){s.data=s.data.replace(/ $/,"");if(!s.data){Vm(s)}}}function Vm(t){var e=t.nextSibling||t.parentNode;t.parentNode.removeChild(t);return e}function Gm(t,e,r){if(t&&t.parentNode===e||r(e)){return e.nextSibling||e.parentNode}return e.firstChild||e.nextSibling||e.parentNode}var Zm=typeof window!=="undefined"?window:{};function Ym(){var t=Zm.DOMParser;var e=false;try{if((new t).parseFromString("","text/html")){e=true}}catch(t){}return e}function Xm(){var t=function(){};{if(Qm()){t.prototype.parseFromString=function(t){var e=new window.ActiveXObject("htmlfile");e.designMode="on";e.open();e.write(t);e.close();return e}}else{t.prototype.parseFromString=function(t){var e=document.implementation.createHTMLDocument("");e.open();e.write(t);e.close();return e}}}return t}function Qm(){var t=false;try{document.implementation.createHTMLDocument("").open()}catch(e){if(Zm.ActiveXObject)t=true}return t}var tg=Ym()?Zm.DOMParser:Xm();function eg(t,e){var r;if(typeof t==="string"){var n=ng().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");r=n.getElementById("turndown-root")}else{r=t.cloneNode(true)}Wm({element:r,isBlock:Nm,isVoid:Dm,isPre:e.preformattedCode?ig:null});return r}var rg;function ng(){rg=rg||new tg;return rg}function ig(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function sg(t,e){t.isBlock=Nm(t);t.isCode=t.nodeName==="CODE"||t.parentNode.isCode;t.isBlank=og(t);t.flankingWhitespace=lg(t,e);return t}function og(t){return!Dm(t)&&!jm(t)&&/^\s*$/i.test(t.textContent)&&!Im(t)&&!_m(t)}function lg(t,e){if(t.isBlock||e.preformattedCode&&t.isCode){return{leading:"",trailing:""}}var r=ug(t.textContent);if(r.leadingAscii&&fg("left",t,e)){r.leading=r.leadingNonAscii}if(r.trailingAscii&&fg("right",t,e)){r.trailing=r.trailingNonAscii}return{leading:r.leading,trailing:r.trailing}}function ug(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function fg(t,e,r){var n;var i;var s;if(t==="left"){n=e.previousSibling;i=/ $/}else{n=e.nextSibling;i=/^ /}if(n){if(n.nodeType===3){s=i.test(n.nodeValue)}else if(r.preformattedCode&&n.nodeName==="CODE"){s=false}else if(n.nodeType===1&&!Nm(n)){s=i.test(n.textContent)}}return s}var ag=Array.prototype.reduce;var hg=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function cg(t){if(!(this instanceof cg))return new cg(t);var e={rules:Fm,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:false,blankReplacement:function(t,e){return e.isBlock?"\n\n":""},keepReplacement:function(t,e){return e.isBlock?"\n\n"+e.outerHTML+"\n\n":e.outerHTML},defaultReplacement:function(t,e){return e.isBlock?"\n\n"+t+"\n\n":t}};this.options=Om({},e,t);this.rules=new qm(this.options)}cg.prototype={turndown:function(t){if(!wg(t)){throw new TypeError(t+" is not a string, or an element/document/fragment node.")}if(t==="")return"";var e=dg.call(this,new eg(t,this.options));return pg.call(this,e)},use:function(t){if(Array.isArray(t)){for(var e=0;e<t.length;e++)this.use(t[e])}else if(typeof t==="function"){t(this)}else{throw new TypeError("plugin must be a Function or an Array of Functions")}return this},addRule:function(t,e){this.rules.add(t,e);return this},keep:function(t){this.rules.keep(t);return this},remove:function(t){this.rules.remove(t);return this},escape:function(t){return hg.reduce((function(t,e){return t.replace(e[0],e[1])}),t)}};function dg(t){var e=this;return ag.call(t.childNodes,(function(t,r){r=new sg(r,e.options);var n="";if(r.nodeType===3){n=r.isCode?r.nodeValue:e.escape(r.nodeValue)}else if(r.nodeType===1){n=mg.call(e,r)}return gg(t,n)}),"")}function pg(t){var e=this;this.rules.forEach((function(r){if(typeof r.append==="function"){t=gg(t,r.append(e.options))}}));return t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function mg(t){var e=this.rules.forNode(t);var r=dg.call(this,t);var n=t.flankingWhitespace;if(n.leading||n.trailing)r=r.trim();return n.leading+e.replacement(r,t,this.options)+n.trailing}function gg(t,e){var r=Cm(t);var n=$m(e);var i=Math.max(t.length-r.length,e.length-n.length);var s="\n\n".substring(0,i);return r+s+n}function wg(t){return t!=null&&(typeof t==="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}const bg=new cg({headingStyle:"atx",bulletListMarker:"-",codeBlockStyle:"fenced"});function vg(t){return bg.turndown(t)}var yg={exports:{}};(function(t,e){(function(e,r){{t.exports=r()}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:c,(function(){var t={};var e=t;var r={exports:t};var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},u=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of s(e))!o.call(t,u)&&u!==r&&n(t,u,{get:()=>e[u],enumerable:!(l=i(e,u))||l.enumerable});return t};var f=t=>u(n({},"__esModule",{value:!0}),t);var a={};l(a,{Hooks:()=>Dt,Lexer:()=>Ct,Marked:()=>It,Parser:()=>Pt,Renderer:()=>Lt,TextRenderer:()=>Nt,Tokenizer:()=>$t,defaults:()=>c,getDefaults:()=>h,lexer:()=>Jt,marked:()=>jt,options:()=>_t,parse:()=>qt,parseInline:()=>Ut,parser:()=>Kt,setOptions:()=>Bt,use:()=>zt,walkTokens:()=>Ft});r.exports=f(a);function h(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var c=h();function d(t){c=t}var p={exec:()=>null};function m(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(t,e)=>{let i=typeof e=="string"?e:e.source;return i=i.replace(g.caret,"$1"),r=r.replace(t,i),n},getRegex:()=>new RegExp(r,e)};return n}var g={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},w=/^(?:[ \t]*(?:\n|$))+/,b=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,v=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,y=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,k=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,x=/(?:[*+-]|\d{1,9}[.)])/,M=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,S=m(M).replace(/bull/g,x).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),E=m(M).replace(/bull/g,x).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),T=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,A=/^[^\n]+/,O=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,R=m(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",O).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$=m(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,x).getRegex(),C="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",L=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,N=m("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",L).replace("tag",C).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),P=m(T).replace("hr",y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",C).getRegex(),D=m(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",P).getRegex(),I={blockquote:D,code:b,def:R,fences:v,heading:k,hr:y,html:N,lheading:S,list:$,newline:w,paragraph:P,table:p,text:A},H=m("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",C).getRegex(),j={...I,lheading:E,table:H,paragraph:m(T).replace("hr",y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",H).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",C).getRegex()},_={...I,html:m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",L).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:p,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:m(T).replace("hr",y).replace("heading",` *#{1,6} *[^\n]`).replace("lheading",S).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},B=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,z=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,F=/^( {2,}|\\)\n(?!\s*$)/,U=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,K=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,W=m(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,K).getRegex(),V=/(?!~)[\p{P}\p{S}]/u,G=/(?!~)[\s\p{P}\p{S}]/u,Z=/(?:[^\s\p{P}\p{S}]|~)/u,Y=/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,X=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Q=m(X,"u").replace(/punct/g,q).getRegex(),tt=m(X,"u").replace(/punct/g,V).getRegex(),et="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",rt=m(et,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,K).replace(/punct/g,q).getRegex(),nt=m(et,"gu").replace(/notPunctSpace/g,Z).replace(/punctSpace/g,G).replace(/punct/g,V).getRegex(),it=m("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,K).replace(/punct/g,q).getRegex(),st=m(/\\(punct)/,"gu").replace(/punct/g,q).getRegex(),ot=m(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),lt=m(L).replace("(?:--\x3e|$)","--\x3e").getRegex(),ut=m("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",lt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ft=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,at=m(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ft).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ht=m(/^!?\[(label)\]\[(ref)\]/).replace("label",ft).replace("ref",O).getRegex(),ct=m(/^!?\[(ref)\](?:\[\])?/).replace("ref",O).getRegex(),dt=m("reflink|nolink(?!\\()","g").replace("reflink",ht).replace("nolink",ct).getRegex(),pt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,mt={_backpedal:p,anyPunctuation:st,autolink:ot,blockSkip:Y,br:F,code:z,del:p,emStrongLDelim:Q,emStrongRDelimAst:rt,emStrongRDelimUnd:it,escape:B,link:at,nolink:ct,punctuation:W,reflink:ht,reflinkSearch:dt,tag:ut,text:U,url:p},gt={...mt,link:m(/^!?\[(label)\]\((.*?)\)/).replace("label",ft).getRegex(),reflink:m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ft).getRegex()},wt={...mt,emStrongRDelimAst:nt,emStrongLDelim:tt,url:m(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",pt).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:m(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",pt).getRegex()},bt={...wt,br:m(F).replace("{2,}","*").getRegex(),text:m(wt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},vt={normal:I,gfm:j,pedantic:_},yt={normal:mt,gfm:wt,breaks:bt,pedantic:gt};var kt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xt=t=>kt[t];function Mt(t,e){if(e){if(g.escapeTest.test(t))return t.replace(g.escapeReplace,xt)}else if(g.escapeTestNoEncode.test(t))return t.replace(g.escapeReplaceNoEncode,xt);return t}function St(t){try{t=encodeURI(t).replace(g.percentDecode,"%")}catch{return null}return t}function Et(t,e){let r=t.replace(g.findPipe,((t,e,r)=>{let n=!1,i=e;for(;--i>=0&&r[i]==="\\";)n=!n;return n?"|":" |"})),n=r.split(g.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(g.slashPipe,"|");return n}function Tt(t,e,r){let n=t.length;if(n===0)return"";let i=0;for(;i<n;){let s=t.charAt(n-i-1);if(s===e&&!r)i++;else if(s!==e&&r)i++;else break}return t.slice(0,n-i)}function At(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function Ot(t,e,r,n,i){let s=e.href,o=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;let u={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:s,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,u}function Rt(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`\n`).map((t=>{let e=t.match(r.other.beginningSpace);if(e===null)return t;let[n]=e;return n.length>=i.length?t.slice(i.length):t})).join(`\n`)}var $t=class{options;rules;lexer;constructor(t){this.options=t||c}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Tt(t,`\n`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let t=e[0],r=Rt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let e=Tt(t,"#");(this.options.pedantic||!e||this.rules.other.endingSpaceChar.test(e))&&(t=e.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Tt(e[0],`\n`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let t=Tt(e[0],`\n`).split(`\n`),r="",n="",i=[];for(;t.length>0;){let e=!1,s=[],o;for(o=0;o<t.length;o++)if(this.rules.other.blockquoteStart.test(t[o]))s.push(t[o]),e=!0;else if(!e)s.push(t[o]);else break;t=t.slice(o);let l=s.join(`\n`),u=l.replace(this.rules.other.blockquoteSetextReplace,`\n $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}\n${l}`:l,n=n?`${n}\n${u}`:u;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=f,t.length===0)break;let a=i.at(-1);if(a?.type==="code")break;if(a?.type==="blockquote"){let e=a,s=e.raw+`\n`+t.join(`\n`),o=this.blockquote(s);i[i.length-1]=o,r=r.substring(0,r.length-e.raw.length)+o.raw,n=n.substring(0,n.length-e.text.length)+o.text;break}else if(a?.type==="list"){let e=a,s=e.raw+`\n`+t.join(`\n`),o=this.list(s);i[i.length-1]=o,r=r.substring(0,r.length-a.raw.length)+o.raw,n=n.substring(0,n.length-e.raw.length)+o.raw,t=s.substring(i.at(-1).raw.length).split(`\n`);continue}}return{type:"blockquote",raw:r,tokens:i,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim(),n=r.length>1,i={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");let s=this.rules.other.listItemRegex(r),o=!1;for(;t;){let r=!1,n="",l="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;n=e[0],t=t.substring(n.length);let u=e[2].split(`\n`,1)[0].replace(this.rules.other.listReplaceTabs,(t=>" ".repeat(3*t.length))),f=t.split(`\n`,1)[0],a=!u.trim(),h=0;if(this.options.pedantic?(h=2,l=u.trimStart()):a?h=e[1].length+1:(h=e[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,l=u.slice(h),h+=e[1].length),a&&this.rules.other.blankLine.test(f)&&(n+=f+`\n`,t=t.substring(f.length+1),r=!0),!r){let e=this.rules.other.nextBulletRegex(h),r=this.rules.other.hrRegex(h),i=this.rules.other.fencesBeginRegex(h),s=this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h);for(;t;){let c=t.split(`\n`,1)[0],d;if(f=c,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),d=f):d=f.replace(this.rules.other.tabCharGlobal," "),i.test(f)||s.test(f)||o.test(f)||e.test(f)||r.test(f))break;if(d.search(this.rules.other.nonSpaceChar)>=h||!f.trim())l+=`\n`+d.slice(h);else{if(a||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(u)||s.test(u)||r.test(u))break;l+=`\n`+f}!a&&!f.trim()&&(a=!0),n+=c+`\n`,t=t.substring(c.length+1),u=d.slice(h)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(n)&&(o=!0));let c=null,d;this.options.gfm&&(c=this.rules.other.listIsTask.exec(l),c&&(d=c[0]!=="[ ] ",l=l.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:n,task:!!c,checked:d,loose:!1,text:l,tokens:[]}),i.raw+=n}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let t=0;t<i.items.length;t++)if(this.lexer.state.top=!1,i.items[t].tokens=this.lexer.blockTokens(i.items[t].text,[]),!i.loose){let e=i.items[t].tokens.filter((t=>t.type==="space")),r=e.length>0&&e.some((t=>this.rules.other.anyLine.test(t.raw)));i.loose=r}if(i.loose)for(let t=0;t<i.items.length;t++)i.items[t].loose=!0;return i}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:n}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=Et(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`\n`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(let t of n)this.rules.other.tableAlignRight.test(t)?s.align.push("right"):this.rules.other.tableAlignCenter.test(t)?s.align.push("center"):this.rules.other.tableAlignLeft.test(t)?s.align.push("left"):s.align.push(null);for(let t=0;t<r.length;t++)s.header.push({text:r[t],tokens:this.lexer.inline(r[t]),header:!0,align:s.align[t]});for(let t of i)s.rows.push(Et(t,s.header.length).map(((t,e)=>({text:t,tokens:this.lexer.inline(t),header:!1,align:s.align[e]}))));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let t=e[1].charAt(e[1].length-1)===`\n`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let e=Tt(t.slice(0,-1),"\\");if((t.length-e.length)%2===0)return}else{let t=At(e[2],"()");if(t===-2)return;if(t>-1){let r=(e[0].indexOf("!")===0?5:4)+e[1].length+t;e[2]=e[2].substring(0,t),e[0]=e[0].substring(0,r).trim(),e[3]=""}}let r=e[2],n="";if(this.options.pedantic){let t=this.rules.other.pedanticHrefTitle.exec(r);t&&(r=t[1],n=t[3])}else n=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),Ot(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let t=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[t.toLowerCase()];if(!n){let t=r[0].charAt(0);return{type:"text",raw:t,text:t}}return Ot(r,n,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let r=[...n[0]].length-1,i,s,o=r,l=0,u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+r);(n=u.exec(e))!=null;){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i)continue;if(s=[...i].length,n[3]||n[4]){o+=s;continue}else if((n[5]||n[6])&&r%3&&!((r+s)%3)){l+=s;continue}if(o-=s,o>0)continue;s=Math.min(s,s+o+l);let e=[...n[0]][0].length,u=t.slice(0,r+n.index+e+s);if(Math.min(r,s)%2){let t=u.slice(1,-1);return{type:"em",raw:u,text:t,tokens:this.lexer.inlineTokens(t)}}let f=u.slice(2,-2);return{type:"strong",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let t,r;if(e[2]==="@")t=e[0],r="mailto:"+t;else{let n;do{n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??""}while(n!==e[0]);t=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}};var Ct=class t{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||c,this.options.tokenizer=this.options.tokenizer||new $t,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let e={other:g,block:vt.normal,inline:yt.normal};this.options.pedantic?(e.block=vt.pedantic,e.inline=yt.pedantic):this.options.gfm&&(e.block=vt.gfm,this.options.breaks?e.inline=yt.breaks:e.inline=yt.gfm),this.tokenizer.rules=e}static get rules(){return{block:vt,inline:yt}}static lex(e,r){return new t(r).lex(e)}static lexInline(e,r){return new t(r).inlineTokens(e)}lex(t){t=t.replace(g.carriageReturn,`\n`),this.blockTokens(t,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],r=!1){for(this.options.pedantic&&(t=t.replace(g.tabCharGlobal," ").replace(g.spaceLine,""));t;){let n;if(this.options.extensions?.block?.some((r=>(n=r.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1)))continue;if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length);let r=e.at(-1);n.raw.length===1&&r!==void 0?r.raw+=`\n`:e.push(n);continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length);let r=e.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(`\n`)?"":`\n`)+n.raw,r.text+=`\n`+n.text,this.inlineQueue.at(-1).src=r.text):e.push(n);continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length);let r=e.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(`\n`)?"":`\n`)+n.raw,r.text+=`\n`+n.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},e.push(n));continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length),e.push(n);continue}let i=t;if(this.options.extensions?.startBlock){let e=1/0,r=t.slice(1),n;this.options.extensions.startBlock.forEach((t=>{n=t.call({lexer:this},r),typeof n=="number"&&n>=0&&(e=Math.min(e,n))})),e<1/0&&e>=0&&(i=t.substring(0,e+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i))){let s=e.at(-1);r&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`\n`)?"":`\n`)+n.raw,s.text+=`\n`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):e.push(n),r=i.length!==t.length,t=t.substring(n.raw.length);continue}if(n=this.tokenizer.text(t)){t=t.substring(n.raw.length);let r=e.at(-1);r?.type==="text"?(r.raw+=(r.raw.endsWith(`\n`)?"":`\n`)+n.raw,r.text+=`\n`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):e.push(n);continue}if(t){let e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}else throw new Error(e)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let r=t,n=null;if(this.tokens.links){let t=Object.keys(this.tokens.links);if(t.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)t.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,n.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(n=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let i=!1,s="";for(;t;){i||(s=""),i=!1;let n;if(this.options.extensions?.inline?.some((r=>(n=r.call({lexer:this},t,e))?(t=t.substring(n.raw.length),e.push(n),!0):!1)))continue;if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length);let r=e.at(-1);n.type==="text"&&r?.type==="text"?(r.raw+=n.raw,r.text+=n.text):e.push(n);continue}if(n=this.tokenizer.emStrong(t,r,s)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),e.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),e.push(n);continue}let o=t;if(this.options.extensions?.startInline){let e=1/0,r=t.slice(1),n;this.options.extensions.startInline.forEach((t=>{n=t.call({lexer:this},r),typeof n=="number"&&n>=0&&(e=Math.min(e,n))})),e<1/0&&e>=0&&(o=t.substring(0,e+1))}if(n=this.tokenizer.inlineText(o)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(s=n.raw.slice(-1)),i=!0;let r=e.at(-1);r?.type==="text"?(r.raw+=n.raw,r.text+=n.text):e.push(n);continue}if(t){let e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}else throw new Error(e)}}return e}};var Lt=class{options;parser;constructor(t){this.options=t||c}space(t){return""}code({text:t,lang:e,escaped:r}){let n=(e||"").match(g.notSpaceStart)?.[0],i=t.replace(g.endingNewline,"")+`\n`;return n?'<pre><code class="language-'+Mt(n)+'">'+(r?i:Mt(i,!0))+`</code></pre>\n`:"<pre><code>"+(r?i:Mt(i,!0))+`</code></pre>\n`}blockquote({tokens:t}){return`<blockquote>\n${this.parser.parse(t)}</blockquote>\n`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>\n`}hr(t){return`<hr>\n`}list(t){let e=t.ordered,r=t.start,n="";for(let e=0;e<t.items.length;e++){let r=t.items[e];n+=this.listitem(r)}let i=e?"ol":"ul",s=e&&r!==1?' start="'+r+'"':"";return"<"+i+s+`>\n`+n+"</"+i+`>\n`}listitem(t){let e="";if(t.task){let r=this.checkbox({checked:!!t.checked});t.loose?t.tokens[0]?.type==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+Mt(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>\n`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>\n`}table(t){let e="",r="";for(let e=0;e<t.header.length;e++)r+=this.tablecell(t.header[e]);e+=this.tablerow({text:r});let n="";for(let e=0;e<t.rows.length;e++){let i=t.rows[e];r="";for(let t=0;t<i.length;t++)r+=this.tablecell(i[t]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>\n<thead>\n`+e+`</thead>\n`+n+`</table>\n`}tablerow({text:t}){return`<tr>\n${t}</tr>\n`}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>\n`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Mt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){let n=this.parser.parseInline(r),i=St(t);if(i===null)return n;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+Mt(e)+'"'),s+=">"+n+"</a>",s}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let i=St(t);if(i===null)return Mt(r);t=i;let s=`<img src="${t}" alt="${r}"`;return e&&(s+=` title="${Mt(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Mt(t.text)}};var Nt=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}};var Pt=class t{options;renderer;textRenderer;constructor(t){this.options=t||c,this.options.renderer=this.options.renderer||new Lt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Nt}static parse(e,r){return new t(r).parse(e)}static parseInline(e,r){return new t(r).parseInline(e)}parse(t,e=!0){let r="";for(let n=0;n<t.length;n++){let i=t[n];if(this.options.extensions?.renderers?.[i.type]){let t=i,e=this.options.extensions.renderers[t.type].call({parser:this},t);if(e!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(t.type)){r+=e||"";continue}}let s=i;switch(s.type){case"space":{r+=this.renderer.space(s);continue}case"hr":{r+=this.renderer.hr(s);continue}case"heading":{r+=this.renderer.heading(s);continue}case"code":{r+=this.renderer.code(s);continue}case"table":{r+=this.renderer.table(s);continue}case"blockquote":{r+=this.renderer.blockquote(s);continue}case"list":{r+=this.renderer.list(s);continue}case"html":{r+=this.renderer.html(s);continue}case"def":{r+=this.renderer.def(s);continue}case"paragraph":{r+=this.renderer.paragraph(s);continue}case"text":{let i=s,o=this.renderer.text(i);for(;n+1<t.length&&t[n+1].type==="text";)i=t[++n],o+=`\n`+this.renderer.text(i);e?r+=this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o,escaped:!0}]}):r+=o;continue}default:{let t='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(t),"";throw new Error(t)}}}return r}parseInline(t,e=this.renderer){let r="";for(let n=0;n<t.length;n++){let i=t[n];if(this.options.extensions?.renderers?.[i.type]){let t=this.options.extensions.renderers[i.type].call({parser:this},i);if(t!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=t||"";continue}}let s=i;switch(s.type){case"escape":{r+=e.text(s);break}case"html":{r+=e.html(s);break}case"link":{r+=e.link(s);break}case"image":{r+=e.image(s);break}case"strong":{r+=e.strong(s);break}case"em":{r+=e.em(s);break}case"codespan":{r+=e.codespan(s);break}case"br":{r+=e.br(s);break}case"del":{r+=e.del(s);break}case"text":{r+=e.text(s);break}default:{let t='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(t),"";throw new Error(t)}}}return r}};var Dt=class{options;block;constructor(t){this.options=t||c}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?Ct.lex:Ct.lexInline}provideParser(){return this.block?Pt.parse:Pt.parseInline}};var It=class{defaults=h();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Pt;Renderer=Lt;TextRenderer=Nt;Lexer=Ct;Tokenizer=$t;Hooks=Dt;constructor(...t){this.use(...t)}walkTokens(t,e){let r=[];for(let n of t)switch(r=r.concat(e.call(this,n)),n.type){case"table":{let t=n;for(let n of t.header)r=r.concat(this.walkTokens(n.tokens,e));for(let n of t.rows)for(let t of n)r=r.concat(this.walkTokens(t.tokens,e));break}case"list":{let t=n;r=r.concat(this.walkTokens(t.items,e));break}default:{let t=n;this.defaults.extensions?.childTokens?.[t.type]?this.defaults.extensions.childTokens[t.type].forEach((n=>{let i=t[n].flat(1/0);r=r.concat(this.walkTokens(i,e))})):t.tokens&&(r=r.concat(this.walkTokens(t.tokens,e)))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach((t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach((t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){let r=e.renderers[t.name];r?e.renderers[t.name]=function(...e){let n=t.renderer.apply(this,e);return n===!1&&(n=r.apply(this,e)),n}:e.renderers[t.name]=t.renderer}if("tokenizer"in t){if(!t.level||t.level!=="block"&&t.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[t.level];r?r.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&(t.level==="block"?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:t.level==="inline"&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)})),r.extensions=e),t.renderer){let e=this.defaults.renderer||new Lt(this.defaults);for(let r in t.renderer){if(!(r in e))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let n=r,i=t.renderer[n],s=e[n];e[n]=(...t)=>{let r=i.apply(e,t);return r===!1&&(r=s.apply(e,t)),r||""}}r.renderer=e}if(t.tokenizer){let e=this.defaults.tokenizer||new $t(this.defaults);for(let r in t.tokenizer){if(!(r in e))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let n=r,i=t.tokenizer[n],s=e[n];e[n]=(...t)=>{let r=i.apply(e,t);return r===!1&&(r=s.apply(e,t)),r}}r.tokenizer=e}if(t.hooks){let e=this.defaults.hooks||new Dt;for(let r in t.hooks){if(!(r in e))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let n=r,i=t.hooks[n],s=e[n];Dt.passThroughHooks.has(r)?e[n]=t=>{if(this.defaults.async&&Dt.passThroughHooksRespectAsync.has(r))return(async()=>{let r=await i.call(e,t);return s.call(e,r)})();let n=i.call(e,t);return s.call(e,n)}:e[n]=(...t)=>{if(this.defaults.async)return(async()=>{let r=await i.apply(e,t);return r===!1&&(r=await s.apply(e,t)),r})();let r=i.apply(e,t);return r===!1&&(r=s.apply(e,t)),r}}r.hooks=e}if(t.walkTokens){let e=this.defaults.walkTokens,n=t.walkTokens;r.walkTokens=function(t){let r=[];return r.push(n.call(this,t)),e&&(r=r.concat(e.call(this,t))),r}}this.defaults={...this.defaults,...r}})),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ct.lex(t,e??this.defaults)}parser(t,e){return Pt.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},i={...this.defaults,...n},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let r=i.hooks?await i.hooks.preprocess(e):e,n=await(i.hooks?await i.hooks.provideLexer():t?Ct.lex:Ct.lexInline)(r,i),s=i.hooks?await i.hooks.processAllTokens(n):n;i.walkTokens&&await Promise.all(this.walkTokens(s,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():t?Pt.parse:Pt.parseInline)(s,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let r=(i.hooks?i.hooks.provideLexer():t?Ct.lex:Ct.lexInline)(e,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let n=(i.hooks?i.hooks.provideParser():t?Pt.parse:Pt.parseInline)(r,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(t){return s(t)}}}onError(t,e){return r=>{if(r.message+=`\nPlease report this to https://github.com/markedjs/marked.`,t){let t="<p>An error occurred:</p><pre>"+Mt(r.message+"",!0)+"</pre>";return e?Promise.resolve(t):t}if(e)return Promise.reject(r);throw r}}};var Ht=new It;function jt(t,e){return Ht.parse(t,e)}jt.options=jt.setOptions=function(t){return Ht.setOptions(t),jt.defaults=Ht.defaults,d(jt.defaults),jt};jt.getDefaults=h;jt.defaults=c;jt.use=function(...t){return Ht.use(...t),jt.defaults=Ht.defaults,d(jt.defaults),jt};jt.walkTokens=function(t,e){return Ht.walkTokens(t,e)};jt.parseInline=Ht.parseInline;jt.Parser=Pt;jt.parser=Pt.parse;jt.Renderer=Lt;jt.TextRenderer=Nt;jt.Lexer=Ct;jt.lexer=Ct.lex;jt.Tokenizer=$t;jt.Hooks=Dt;jt.parse=jt;var _t=jt.options,Bt=jt.setOptions,zt=jt.use,Ft=jt.walkTokens,Ut=jt.parseInline,qt=jt,Kt=Pt.parse,Jt=Ct.lex;if(e!=t)r.exports=t;return r.exports}))})(yg);async function kg(t){return await yg.exports.marked(t)}const xg=":host {\n article {\n padding: 0;\n &:focus-within {\n outline: var(--pos-input-focus-outline);\n }\n\n .tiptap {\n border: none;\n outline: none;\n }\n\n line-height: 1.5;\n pos-image {\n --max-width: 100%;\n }\n\n header {\n position: sticky;\n background-color: var(--pos-background-color);\n border-bottom: var(--size-px) solid var(--pos-border-color);\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n overflow: hidden;\n z-index: var(--layer-1);\n top: 0;\n padding: var(--size-1);\n flex-direction: row;\n justify-content: flex-end;\n button {\n background: var(--pos-primary-color);\n color: var(--pos-primary-text-color);\n outline: none;\n border: none;\n border-radius: var(--radius-xs);\n display: inline-flex;\n gap: var(--size-1);\n justify-content: center;\n align-items: center;\n height: var(--size-8);\n flex-shrink: 1;\n\n &:focus {\n outline: var(--pos-input-focus-outline);\n }\n\n &:hover {\n filter: brightness(110%);\n box-shadow: var(--shadow-md);\n }\n }\n .status {\n display: flex;\n align-content: center;\n align-items: center;\n gap: var(--size-1);\n font-size: var(--scale-00);\n\n &.pending {\n animation: pending-fade 1s ease forwards;\n }\n\n &.success {\n animation: success-flash 2s ease forwards;\n }\n\n &.error {\n animation: error-flash 2s ease infinite;\n }\n }\n }\n\n .content {\n padding: var(--size-4);\n\n pre {\n code {\n display: block;\n padding: var(--size-4);\n overflow-x: auto;\n background-color: var(--color-black);\n font-family: monospace;\n color: var(--color-white);\n line-height: 1.6;\n border-radius: var(--radius-lg);\n }\n }\n\n blockquote {\n border-left: var(--size-1) solid var(--pos-primary-color);\n margin-left: var(--size-4);\n padding-left: var(--size-4);\n }\n }\n }\n}\n\n@keyframes pending-fade {\n 0% {\n opacity: 0;\n color: var(--pos-subtle-text-color);\n }\n 100% {\n opacity: 1;\n color: var(--pos-primary-color);\n }\n}\n\n@keyframes success-flash {\n 0% {\n opacity: 0;\n color: var(--pos-subtle-text-color);\n }\n 50% {\n opacity: 1;\n color: var(--color-green-500);\n }\n 100% {\n opacity: 1;\n color: var(--pos-subtle-text-color);\n }\n}\n\n@keyframes error-flash {\n 0% {\n opacity: 0;\n }\n 50% {\n opacity: 1;\n color: var(--color-red-500);\n }\n 100% {\n opacity: 0;\n }\n}\n";const Mg=xg;const Sg="article {\n padding: var(--size-2);\n display: flex;\n flex-direction: column;\n gap: var(--size-2);\n outline: var(--pos-border-solid);\n border-radius: var(--radius-sm);\n box-shadow: var(--shadow-md);\n background-color: var(--pos-card-background);\n\n header {\n display: flex;\n flex-direction: column;\n gap: var(--size-2);\n h1 {\n margin: 0;\n }\n }\n}\n";const Eg=Sg;const Tg=class{constructor(r){t(this,r);this.documentModified=e(this,"pod-os:document-modified",7);this.savingFailed=false;this.editable=false;this.isModified=false;this.isEditing=false;this.disconnected$=new l}async componentWillLoad(){const t=await this.file.blob().text();const e=await kg(t);this.sanitizedHtml=m(e)}componentDidLoad(){this.editor=new Am(this.editorEl,this.sanitizedHtml,this.file.url);this.editor.onUpdate((()=>{this.isModified=this.editor.isModified()}));this.editor.observeChanges().pipe(f(this.disconnected$),a((t=>vg(t.content))),h((t=>{this.isModified=false;this.documentModified.emit({file:this.file,newContent:t})}))).subscribe()}disconnectedCallback(){this.disconnected$.next();this.disconnected$.unsubscribe()}startEditing(){this.editor.startEditing();this.isEditing=true}stopEditing(){this.editor.stopEditing();this.isEditing=false}render(){return r("article",{key:"21cbe982b1ead2ba403706407e05d97903e0073b"},this.editable?r("header",null,this.isEditing?this.getStatus():null,this.isEditing?r("button",{onClick:()=>this.stopEditing()},r("sl-icon",{name:"eye"}),"View"):r("button",{onClick:()=>this.startEditing()},r("sl-icon",{name:"pencil-square"}),"Edit")):null,r("div",{key:"22f18aeef51e66cee8e7300fd82def756d8ae522",class:"content",ref:t=>this.editorEl=t}))}getStatus(){if(this.isModified){return r(Ag,{status:"pending",message:"pending changes",icon:"clock-history"})}if(this.savingFailed){return r(Ag,{status:"error",message:"saving failed",icon:"x-octagon"})}return r(Ag,{status:"success",message:"all saved",icon:"check2-circle"})}};function Ag({status:t,icon:e,message:n}){return r("span",{class:{status:true,[t]:true},role:"status","aria-live":"polite","aria-labelledby":"status-message"},r("sl-icon",{name:e,"aria-hidden":"true"}),r("span",{id:"status-message"},n))}Tg.style=Mg+Eg;export{Tg as pos_markdown_document};
3
- //# sourceMappingURL=p-581ed3ee.entry.js.map