@lemoncat7/dsh-ssh 1.10.4 → 1.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/docs/dsh-020-compatibility.md +11 -0
- package/docs/releases/1.10.5.md +6 -0
- package/lib/client.js +1 -1
- package/lib/client.js.map +2 -2
- package/package.json +30 -29
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-ssh
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 当前版本 **1.10.5**,已验证宿主 **DSH 0.2.0-rc.2**(宿主仍为 RC)。Node.js **^22.19.0 或 >=24.0.0**。详见 [兼容说明](docs/dsh-020-compatibility.md) 和 [发布说明](docs/releases/1.10.5.md)。
|
|
4
4
|
|
|
5
5
|
面向 DeepSeek Harness 的远端工作插件。它把 SSH 会话管理、浏览器终端、FTP/FTPS/SFTP 文件传输、代理、端口转发和 AI 会话授权放在同一个 DSH 工作区里。
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## 兼容性
|
|
10
10
|
|
|
11
|
-
当前正式版 `1.10.
|
|
11
|
+
当前正式版 `1.10.5` 适配并验证 DeepSeek Harness `0.2.0-rc.2`,需要 Node.js `^22.19.0` 或 `>=24.0.0`。旧版 DSH `0.1.5` 请保留 `1.9.2`。详见 [1.10.5 更新说明](docs/releases/1.10.5.md)。
|
|
12
12
|
|
|
13
13
|
## 1.7.0 界面语言
|
|
14
14
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# DSH 0.2.0-rc.2 兼容说明
|
|
2
|
+
|
|
3
|
+
本次发布版本:1.10.5,适配 DSH 0.2.0-rc.2。此前 1.10.4 安装包不因此获得新宿主兼容声明。
|
|
4
|
+
|
|
5
|
+
- 已验证宿主:DSH 0.2.0-rc.2;Node.js ^22.19.0 或 >=24.0.0。
|
|
6
|
+
- 宿主版本依赖已更新;知识库和主题补充了可供安装器识别的 DSH peerDependencies,不再仅依赖 README 描述。
|
|
7
|
+
- 七个插件合计 1,213 项测试通过,1 项原有跳过;隔离宿主验证召回、回写、伙伴次轮权限、配置保存及重启持久化,浏览器错误为 0。
|
|
8
|
+
- 工作区已检查桌面、390px 手机和 1024px 平板宽度;Desktop Origin 检查不等同于完整 Windows/macOS 客户端端到端测试。
|
|
9
|
+
- 未触发真实渠道消息、付费模型生成或远程 SSH 操作;不保证所有外部服务兼容。
|
|
10
|
+
- 新兼容构建面向 DSH 0.2.0,不应直接覆盖旧宿主安装。升级时保留旧宿主镜像、配置和数据卷,回退须使用配套备份。
|
|
11
|
+
- 不修改 DSH 核心源码;原有功能和数据保留。
|
package/lib/client.js
CHANGED
|
@@ -183,7 +183,7 @@ ${n}
|
|
|
183
183
|
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,s;let i=t.split(`
|
|
184
184
|
`),[o,a]=h5(i);if(o.length===0)return;let l=UC(o,o[0].indent,n);if(l.length!==0)return{type:"list",ordered:!0,start:((r=o[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(s=o[0])===null||s===void 0?void 0:s.type,items:l,raw:i.slice(0,a).join(`
|
|
185
185
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(f5,this.editor.getAttributes(NC)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new ze({props:{handlePaste:(t,e)=>{var n,r;let s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(s?.trim())return!1;let i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;let o=u5(i);if(!o)return!1;try{let a=t.state.schema.nodeFromJSON(o),l=t.state.tr.replaceSelectionWith(a);return t.dispatch(l),!0}catch{return!1}}}})]},addInputRules(){let t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1],e=Ks({find:FC,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ks({find:FC,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(NC)}),joinPredicate:t,editor:this.editor})),[e]}}),m5=/^\s*(\[([( |x])?\])\s$/,g5="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",b5=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},Od=nt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let 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,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Oe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{let n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){let r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;let r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return Rg(t,e,r)},addExtensions(){return this.options.nested?[HC(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");o.style.cssText=g5;let c=d=>{let u=b5(d,d.attrs.checked,this.options.a11y);a.setAttribute("aria-label",u),o.textContent=u};c(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:u}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{let p=n();if(typeof p!="number")return!1;let m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{s.setAttribute(d,u)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([d,u])=>{s.setAttribute(d,u)});let h=new Set(Object.keys(e));return{dom:s,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d);let u=r.extensionManager.attributes,f=qs(d,u),p=new Set(Object.keys(f)),m=this.options.HTMLAttributes;return h.forEach(g=>{p.has(g)||(g in m?s.setAttribute(g,m[g]):s.removeAttribute(g))}),Object.entries(f).forEach(([g,b])=>{b==null?g in m?s.setAttribute(g,m[g]):s.removeAttribute(g):s.setAttribute(g,b)}),h=p,!0}}}},addInputRules(){return[Ks({find:m5,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Ld=nt.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",Oe(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
186
|
-
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;let n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){let r=i=>{let o=Dg(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);if(o){let a={type:"taskList",raw:o.raw,items:o.items},l=i.slice(o.raw.length);return l.trim()?[a,...n.blockTokens(l)]:[a]}return n.blockTokens(i)},s=Dg(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),lY=tt.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(lb.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(db.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(pb.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(fb.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Od.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Ld.configure(this.options.taskList)),t}});var zd=" ",mb="\xA0",qC=nt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Oe(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{let n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);let r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===zd||n[0].text===zd||n[0].raw===mb||n[0].text===mb)&&r.length===1&&r[0].type==="text"&&(r[0].text===zd||r[0].text===mb)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";let r=Array.isArray(t.content)?t.content:[];if(r.length===0){var s,i;let o=Array.isArray(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.content)?n.previousNode.content:[];return(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&o.length===0?zd:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var v5=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,y5=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,KC=In.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Oe(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Yn({find:v5,type:this.type})]},addPasteRules(){return[On({find:y5,type:this.type})]}});var GC=nt.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});var JC=In.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Oe(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;let s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function XC(t={}){return new ze({view(e){return new gb(e,t)}})}var gb=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,u=e.nodeAfter;if(d||u){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=d?p.bottom:p.top;d&&u&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),u=this.width/2*o;r={left:d.left-u,right:d.left+u,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,h;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,h=-pageYOffset;else{let d=l.getBoundingClientRect(),u=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*u,h=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-h)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(!n||i)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=wh(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};var on=class t extends we{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):we.near(r)}content(){return le.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}getBookmark(){return new bb(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!w5(e)||!x5(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(t.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!xe.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(t.valid(a))return a}return null}}};on.prototype.visible=!1;on.findFrom=on.findGapCursorFrom;we.jsonID("gapcursor",on);var bb=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return on.valid(n)?new on(n):we.near(n)}};function YC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function w5(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||YC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function x5(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||YC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function QC(){return new ze({props:{decorations:C5,createSelectionBetween(t,e,n){return e.pos==n.pos&&on.valid(n)?new on(n):null},handleClick:_5,handleKeyDown:k5,handleDOMEvents:{beforeinput:S5}}})}var k5=_l({ArrowLeft:Nd("horiz",-1),ArrowRight:Nd("horiz",1),ArrowUp:Nd("vert",-1),ArrowDown:Nd("vert",1)});function Nd(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof ge){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=on.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new on(c))),!0):!1}}function _5(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!on.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&xe.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new on(r))),!0)}function S5(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof on))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=Q.empty;for(let o=r.length-1;o>=0;o--)s=Q.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new le(s,0,0));return i.setSelection(ge.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function C5(t){if(!(t.selection instanceof on))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ye.create(t.doc,[It.widget(t.selection.head,e,{key:"gapcursor"})])}var Fd=200,Kt=function(){};Kt.prototype.append=function(e){return e.length?(e=Kt.from(e),!this.length&&e||e.length<Fd&&this.leafAppend(e)||this.length<Fd&&e.leafPrepend(this)||this.appendInner(e)):this};Kt.prototype.prepend=function(e){return e.length?Kt.from(e).append(this):this};Kt.prototype.appendInner=function(e){return new T5(this,e)};Kt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Kt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Kt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Kt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Kt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};Kt.from=function(e){return e instanceof Kt?e:e&&e.length?new ZC(e):Kt.empty};var ZC=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Fd)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Fd)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Kt);Kt.empty=new ZC([]);var T5=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Kt),vb=Kt;var E5=500,Gi=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],h=[];return this.items.forEach((d,u)=>{if(!d.step){s||(s=this.remapping(r,u+1),i=s.maps.length),i--,h.push(d);return}if(s){h.push(new Dr(d.map));let f=d.step.map(s.slice(i)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Dr(p,void 0,void 0,c.length+h.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new t(this.items.slice(0,r).append(h.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let h=0;h<e.steps.length;h++){let d=e.steps[h].invert(e.docs[h]),u=new Dr(e.mapping.maps[h],d,n),f;(f=l&&l.merge(u))&&(u=f,h?i.pop():a=a.slice(0,a.length-1)),i.push(u),n&&(o++,n=void 0),s||(l=u)}let c=o-r.depth;return c>P5&&(a=A5(a,c),o-=c),new t(a.append(i),o)}remapping(e,n){let r=new ol;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new Dr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(u=>{u.selection&&a--},s);let l=n;this.items.forEach(u=>{let f=i.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=i.maps[f];if(u.step){let m=e.steps[f].invert(e.docs[f]),g=u.selection&&u.selection.map(i.slice(l+1,f));g&&a++,r.push(new Dr(p,m,g))}else r.push(new Dr(p))},s);let c=[];for(let u=n;u<o;u++)c.push(new Dr(i.maps[u]));let h=this.items.slice(0,s).append(c).append(r),d=new t(h,a);return d.emptyItemCount()>E5&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let h=o.selection&&o.selection.map(n.slice(r));h&&i++;let d=new Dr(c.invert(),l,h),u,f=s.length-1;(u=s.length&&s[f].merge(d))?s[f]=u:s.push(d)}}else o.map&&r--},this.items.length,0),new t(vb.from(s.reverse()),i)}};Gi.empty=new Gi(vb.empty,0);function A5(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}var Dr=class t{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},Rr=class{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}},P5=20;function M5(t,e,n,r){let s=n.getMeta(Ki),i;if(s)return s.historyState;n.getMeta(I5)&&(t=new Rr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ki))return o.getMeta(Ki).redo?new Rr(t.done.addTransform(n,void 0,r,Bd(e)),t.undone,eT(n.mapping.maps),t.prevTime,t.prevComposition):new Rr(t.done,t.undone.addTransform(n,void 0,r,Bd(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!D5(n,t.prevRanges)),c=o?yb(t.prevRanges,n.mapping):eT(n.mapping.maps);return new Rr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Bd(e)),Gi.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Rr(t.done.rebased(n,i),t.undone.rebased(n,i),yb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Rr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),yb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function D5(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function eT(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function yb(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function R5(t,e,n){let r=Bd(e),s=Ki.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new Rr(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(Ki,{redo:n,historyState:l})}var wb=!1,tT=null;function Bd(t){let e=t.plugins;if(tT!=e){wb=!1,tT=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){wb=!0;break}}return wb}var Ki=new Qe("history"),I5=new Qe("closeHistory");function nT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ze({key:Ki,state:{init(){return new Rr(Gi.empty,Gi.empty,null,0,-1)},apply(e,n,r){return M5(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?xb:r=="historyRedo"?kb:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function Hd(t,e){return(n,r)=>{let s=Ki.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=R5(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}var xb=Hd(!1,!0),kb=Hd(!0,!0),OY=Hd(!1,!1),LY=Hd(!0,!1);var UY=tt.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{let e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){let n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{let e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ze({key:new Qe("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}let o=this.storage.characters({node:r.doc});if(o>s){let a=o-s,l=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);let h=r.tr.deleteRange(l,c);return t=!0,h}t=!0},filterTransaction:(e,n)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;let s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos,a=o-(i-r),l=o;return e.deleteRange(a,l),!(this.storage.characters({node:e.doc})>r)}})]}}),iT=tt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[XC(this.options)]}}),qY=tt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ze({key:new Qe("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return Ye.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(!l.isText){if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1}});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(It.node(c,c+l.nodeSize,{class:this.options.className}))}),Ye.create(t,i)}}})]}}),oT=tt.create({name:"gapCursor",addProseMirrorPlugins(){return[QC()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ue(fe(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),aT="placeholder",rT=new Qe("tiptap__placeholder");function lT(t){let{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=t,h=[l];return o&&h.push(c),It.node(s,s+i.nodeSize,{class:h.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:a}):n})}function cT(t,e){return typeof t=="function"?t(e):t}function hT({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:i,to:o}){let{anchor:a}=s,l=[],c=t.isEmpty;return r.nodesBetween(i,o,(h,d)=>{let u=a>=d&&a<=d+h.nodeSize,f=!h.isLeaf&&Zo(h);return h.type.isTextblock&&(u||!e.showOnlyCurrent)&&f&&l.push(lT({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:u,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:cT(e.emptyNodeClass,{editor:t,node:h,pos:d,hasAnchor:u})},node:h,pos:d})),e.includeChildren}),l}function dT({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;let{anchor:i}=s,o=[],a=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){let l=r.resolve(i),c=l.depth>0?l.node(1):l.nodeAfter,h=l.depth>0?l.before(1):i;if(c&&c.type.isTextblock&&Zo(c)){let d=i>=h&&i<=h+c.nodeSize;o.push(lT({editor:t,isEmptyDoc:a,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:cT(e.emptyNodeClass,{editor:t,node:c,pos:h,hasAnchor:d})},node:c,pos:h}))}}else o.push(...hT({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:0,to:r.content.size}));return Ye.create(r,o)}function Fl(t,e){let n=t.resolve(e);if(n.depth===0){var r;let i=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!i)return{from:e,to:e};let o=n.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}let s=n.before(1);return{from:s,to:s+n.node(1).nodeSize}}function Bl(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function O5(t,e,n){let r=[];return t.forEach((s,i)=>{let o=i,a=o+s.nodeSize,l=o+1,c=a+1;l<n&&c>e&&r.push({from:o,to:a})}),r}function L5(t){if(t.length===0)return[];let e=[...t].sort((r,s)=>r.from-s.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){let s=n[n.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):n.push({...i})}return n}function z5(t,e){let n=O5(t,e.from,e.to);return n.push(Bl(t,Fl(t,e.from))),e.to>e.from?n.push(Bl(t,Fl(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Bl(t,Fl(t,Math.min(e.from+1,t.content.size)))),n}function N5(t,e,n){let r=[];if(t.docChanged){let s=Qo(t);for(let i of s)r.push(...z5(n.doc,i.newRange))}return t.selectionSet&&(r.push(Bl(n.doc,Fl(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Bl(n.doc,Fl(n.doc,n.selection.anchor)))),L5(r)}function F5(t,e,n){let r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function B5({decorations:t,ranges:e,editor:n,options:r,dataAttribute:s,doc:i,selection:o}){let a=t;for(let l of e){let{from:c,to:h}=F5(l.from,l.to,i),d=a.find(c,h).filter(f=>f.from>=c&&f.to<=h);d.length&&(a=a.remove(d));let u=hT({editor:n,options:r,dataAttribute:s,doc:i,selection:o,from:c,to:h});u.length&&(a=a.add(i,u))}return a}function H5({editor:t,options:e,dataAttribute:n}){return{init(r,s){let i=dT({editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection});return i??Ye.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:B5({decorations:s.map(r.mapping,r.doc),ranges:N5(r,i,o),editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function $5(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function j5({editor:t,options:e}){let n=e.dataAttribute?`data-${$5(e.dataAttribute)}`:`data-${aT}`,r=e.showOnlyCurrent&&!e.includeChildren;return new ze({key:rT,...r?{}:{state:H5({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:s,selection:i})=>dT({editor:t,options:e,dataAttribute:n,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?Ye.empty:(i=rT.getState(s))!==null&&i!==void 0?i:Ye.empty}}})}var KY=tt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:aT,placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[j5({editor:this.editor,options:this.options})]}});function _b(t,e){return!t.selection.empty&&!Gh(t.selection)&&e.isEditable}function V5(t,e){return _b(t,e)&&!e.isFocused&&!e.view.dragging}function W5(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function U5(t){t.focus()}var GY=tt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return[new ze({key:new Qe("selection"),props:{decorations(n){return V5(n,t)?Ye.create(n.doc,[It.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return _b(n.state,t)&&W5(),!1},focus(n){return _b(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&U5(n)}),!1}}}})]}});function sT({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var uT=tt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;let e=new Qe(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new ze({key:e,appendTransaction:(s,i,o)=>{let{doc:a,tr:l,schema:c}=o,h=e.getState(o),d=a.content.size,u=c.nodes[n];if(!s.some(f=>f.getMeta("skipTrailingNode"))&&h)return l.insert(d,u.create())},state:{init:(s,i)=>{let o=i.tr.doc.lastChild;return!sT({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;let o=s.doc.lastChild;return!sT({node:o,types:r})}}})]}}),pT=tt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>xb(t,e),redo:()=>({state:t,dispatch:e})=>kb(t,e)}},addProseMirrorPlugins(){return[nT(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var q5=tt.create({name:"starterKit",addExtensions(){let t=[];if(this.options.bold!==!1&&t.push(oC.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(iC.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(lb.configure(this.options.bulletList)),this.options.code!==!1&&t.push(aC.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(lC.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(cC.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(iT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(oT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(hC.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(dC.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(pT.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(uC.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(pC.configure(this.options.italic)),this.options.listItem!==!1&&t.push(db.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(pb.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(RC.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(fb.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(qC.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(KC.configure(this.options.strike)),this.options.text!==!1&&t.push(GC.configure(this.options.text)),this.options.underline!==!1){var r;t.push(JC.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;t.push(uT.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return t}}),fT=q5;function Eb(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Yi=Eb();function xT(t){Yi=t}var Ji={exec:()=>null};function Ke(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(gn.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var K5=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),gn={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,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\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"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},G5=/^(?:[ \t]*(?:\n|$))+/,J5=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,X5=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Y5=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ab=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,kT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_T=Ke(kT).replace(/bull/g,Ab).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(),Q5=Ke(kT).replace(/bull/g,Ab).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(),Pb=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Z5=/^[^\n]+/,Mb=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,e3=Ke(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mb).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),t3=Ke(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ab).getRegex(),Ud="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",Db=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,n3=Ke("^ {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[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Db).replace("tag",Ud).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ST=Ke(Pb).replace("hr",Vl).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ud).getRegex(),r3=Ke(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ST).getRegex(),Rb={blockquote:r3,code:J5,def:e3,fences:X5,heading:Y5,hr:Vl,html:n3,lheading:_T,list:t3,newline:G5,paragraph:ST,table:Ji,text:Z5},mT=Ke("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ud).getRegex(),s3={...Rb,lheading:Q5,table:mT,paragraph:Ke(Pb).replace("hr",Vl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",mT).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ud).getRegex()},i3={...Rb,html:Ke(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Db).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:Ji,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ke(Pb).replace("hr",Vl).replace("heading",` *#{1,6} *[^
|
|
186
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;let n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){let r=i=>{let o=Dg(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);if(o){let a={type:"taskList",raw:o.raw,items:o.items},l=i.slice(o.raw.length);return l.trim()?[a,...n.blockTokens(l)]:[a]}return n.blockTokens(i)},s=Dg(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),lY=tt.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(lb.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(db.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(pb.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(fb.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Od.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Ld.configure(this.options.taskList)),t}});var zd=" ",mb="\xA0",qC=nt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Oe(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{let n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);let r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===zd||n[0].text===zd||n[0].raw===mb||n[0].text===mb)&&r.length===1&&r[0].type==="text"&&(r[0].text===zd||r[0].text===mb)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";let r=Array.isArray(t.content)?t.content:[];if(r.length===0){var s,i;let o=Array.isArray(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.content)?n.previousNode.content:[];return(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&o.length===0?zd:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var v5=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,y5=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,KC=In.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Oe(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Yn({find:v5,type:this.type})]},addPasteRules(){return[On({find:y5,type:this.type})]}});var GC=nt.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});var JC=In.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Oe(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;let s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function XC(t={}){return new ze({view(e){return new gb(e,t)}})}var gb=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,u=e.nodeAfter;if(d||u){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=d?p.bottom:p.top;d&&u&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),u=this.width/2*o;r={left:d.left-u,right:d.left+u,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,h;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,h=-pageYOffset;else{let d=l.getBoundingClientRect(),u=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*u,h=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-h)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(!n||i)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=wh(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};var on=class t extends we{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):we.near(r)}content(){return le.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}getBookmark(){return new bb(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!w5(e)||!x5(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(t.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!xe.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(t.valid(a))return a}return null}}};on.prototype.visible=!1;on.findFrom=on.findGapCursorFrom;we.jsonID("gapcursor",on);var bb=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return on.valid(n)?new on(n):we.near(n)}};function YC(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function w5(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||YC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function x5(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||YC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function QC(){return new ze({props:{decorations:C5,createSelectionBetween(t,e,n){return e.pos==n.pos&&on.valid(n)?new on(n):null},handleClick:_5,handleKeyDown:k5,handleDOMEvents:{beforeinput:S5}}})}var k5=_l({ArrowLeft:Nd("horiz",-1),ArrowRight:Nd("horiz",1),ArrowUp:Nd("vert",-1),ArrowDown:Nd("vert",1)});function Nd(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof ge){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=on.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new on(c))),!0):!1}}function _5(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!on.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&xe.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new on(r))),!0)}function S5(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof on))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=Q.empty;for(let o=r.length-1;o>=0;o--)s=Q.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new le(s,0,0));return i.setSelection(ge.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function C5(t){if(!(t.selection instanceof on))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ye.create(t.doc,[It.widget(t.selection.head,e,{key:"gapcursor"})])}var Fd=200,Kt=function(){};Kt.prototype.append=function(e){return e.length?(e=Kt.from(e),!this.length&&e||e.length<Fd&&this.leafAppend(e)||this.length<Fd&&e.leafPrepend(this)||this.appendInner(e)):this};Kt.prototype.prepend=function(e){return e.length?Kt.from(e).append(this):this};Kt.prototype.appendInner=function(e){return new T5(this,e)};Kt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Kt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Kt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Kt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Kt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};Kt.from=function(e){return e instanceof Kt?e:e&&e.length?new ZC(e):Kt.empty};var ZC=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Fd)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Fd)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Kt);Kt.empty=new ZC([]);var T5=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Kt),vb=Kt;var E5=500,Gi=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],h=[];return this.items.forEach((d,u)=>{if(!d.step){s||(s=this.remapping(r,u+1),i=s.maps.length),i--,h.push(d);return}if(s){h.push(new Dr(d.map));let f=d.step.map(s.slice(i)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Dr(p,void 0,void 0,c.length+h.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new t(this.items.slice(0,r).append(h.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let h=0;h<e.steps.length;h++){let d=e.steps[h].invert(e.docs[h]),u=new Dr(e.mapping.maps[h],d,n),f;(f=l&&l.merge(u))&&(u=f,h?i.pop():a=a.slice(0,a.length-1)),i.push(u),n&&(o++,n=void 0),s||(l=u)}let c=o-r.depth;return c>P5&&(a=A5(a,c),o-=c),new t(a.append(i),o)}remapping(e,n){let r=new ol;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new Dr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],s=this.items.length-n,i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(u=>{u.selection&&a--},s);let l=n;this.items.forEach(u=>{let f=i.getMirror(--l);if(f==null)return;o=Math.min(o,f);let p=i.maps[f];if(u.step){let m=e.steps[f].invert(e.docs[f]),g=u.selection&&u.selection.map(i.slice(l+1,f));g&&a++,r.push(new Dr(p,m,g))}else r.push(new Dr(p))},s);let c=[];for(let u=n;u<o;u++)c.push(new Dr(i.maps[u]));let h=this.items.slice(0,s).append(c).append(r),d=new t(h,a);return d.emptyItemCount()>E5&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let h=o.selection&&o.selection.map(n.slice(r));h&&i++;let d=new Dr(c.invert(),l,h),u,f=s.length-1;(u=s.length&&s[f].merge(d))?s[f]=u:s.push(d)}}else o.map&&r--},this.items.length,0),new t(vb.from(s.reverse()),i)}};Gi.empty=new Gi(vb.empty,0);function A5(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}var Dr=class t{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},Rr=class{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}},P5=20;function M5(t,e,n,r){let s=n.getMeta(Ki),i;if(s)return s.historyState;n.getMeta(I5)&&(t=new Rr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ki))return o.getMeta(Ki).redo?new Rr(t.done.addTransform(n,void 0,r,Bd(e)),t.undone,eT(n.mapping.maps),t.prevTime,t.prevComposition):new Rr(t.done,t.undone.addTransform(n,void 0,r,Bd(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!D5(n,t.prevRanges)),c=o?yb(t.prevRanges,n.mapping):eT(n.mapping.maps);return new Rr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Bd(e)),Gi.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Rr(t.done.rebased(n,i),t.undone.rebased(n,i),yb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Rr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),yb(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function D5(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function eT(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function yb(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function R5(t,e,n){let r=Bd(e),s=Ki.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new Rr(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(Ki,{redo:n,historyState:l})}var wb=!1,tT=null;function Bd(t){let e=t.plugins;if(tT!=e){wb=!1,tT=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){wb=!0;break}}return wb}var Ki=new Qe("history"),I5=new Qe("closeHistory");function nT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ze({key:Ki,state:{init(){return new Rr(Gi.empty,Gi.empty,null,0,-1)},apply(e,n,r){return M5(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?xb:r=="historyRedo"?kb:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function Hd(t,e){return(n,r)=>{let s=Ki.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=R5(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}var xb=Hd(!1,!0),kb=Hd(!0,!0),OY=Hd(!1,!1),LY=Hd(!0,!1);var UY=tt.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{let e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){let n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{let e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new ze({key:new Qe("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}let o=this.storage.characters({node:r.doc});if(o>s){let a=o-s,l=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);let h=r.tr.deleteRange(l,c);return t=!0,h}t=!0},filterTransaction:(e,n)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;let s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos,a=o-(i-r),l=o;return e.deleteRange(a,l),!(this.storage.characters({node:e.doc})>r)}})]}}),iT=tt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[XC(this.options)]}}),qY=tt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ze({key:new Qe("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return Ye.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(!l.isText){if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1}});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(It.node(c,c+l.nodeSize,{class:this.options.className}))}),Ye.create(t,i)}}})]}}),oT=tt.create({name:"gapCursor",addProseMirrorPlugins(){return[QC()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ue(fe(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),aT="placeholder",rT=new Qe("tiptap__placeholder");function lT(t){let{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=t,h=[l];return o&&h.push(c),It.node(s,s+i.nodeSize,{class:h.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:a}):n})}function cT(t,e){return typeof t=="function"?t(e):t}function hT({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:i,to:o}){let{anchor:a}=s,l=[],c=t.isEmpty;return r.nodesBetween(i,o,(h,d)=>{let u=a>=d&&a<=d+h.nodeSize,f=!h.isLeaf&&Zo(h);return h.type.isTextblock&&(u||!e.showOnlyCurrent)&&f&&l.push(lT({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:u,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:cT(e.emptyNodeClass,{editor:t,node:h,pos:d,hasAnchor:u})},node:h,pos:d})),e.includeChildren}),l}function dT({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;let{anchor:i}=s,o=[],a=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){let l=r.resolve(i),c=l.depth>0?l.node(1):l.nodeAfter,h=l.depth>0?l.before(1):i;if(c&&c.type.isTextblock&&Zo(c)){let d=i>=h&&i<=h+c.nodeSize;o.push(lT({editor:t,isEmptyDoc:a,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:cT(e.emptyNodeClass,{editor:t,node:c,pos:h,hasAnchor:d})},node:c,pos:h}))}}else o.push(...hT({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:0,to:r.content.size}));return Ye.create(r,o)}function Fl(t,e){let n=t.resolve(e);if(n.depth===0){var r;let i=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!i)return{from:e,to:e};let o=n.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}let s=n.before(1);return{from:s,to:s+n.node(1).nodeSize}}function Bl(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function O5(t,e,n){let r=[];return t.forEach((s,i)=>{let o=i,a=o+s.nodeSize,l=o+1,c=a+1;l<n&&c>e&&r.push({from:o,to:a})}),r}function L5(t){if(t.length===0)return[];let e=[...t].sort((r,s)=>r.from-s.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){let s=n[n.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):n.push({...i})}return n}function z5(t,e){let n=O5(t,e.from,e.to);return n.push(Bl(t,Fl(t,e.from))),e.to>e.from?n.push(Bl(t,Fl(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Bl(t,Fl(t,Math.min(e.from+1,t.content.size)))),n}function N5(t,e,n){let r=[];if(t.docChanged){let s=Qo(t);for(let i of s)r.push(...z5(n.doc,i.newRange))}return t.selectionSet&&(r.push(Bl(n.doc,Fl(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Bl(n.doc,Fl(n.doc,n.selection.anchor)))),L5(r)}function F5(t,e,n){let r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function B5({decorations:t,ranges:e,editor:n,options:r,dataAttribute:s,doc:i,selection:o}){let a=t;for(let l of e){let{from:c,to:h}=F5(l.from,l.to,i),d=a.find(c,h).filter(f=>f.from>=c&&f.to<=h);d.length&&(a=a.remove(d));let u=hT({editor:n,options:r,dataAttribute:s,doc:i,selection:o,from:c,to:h});u.length&&(a=a.add(i,u))}return a}function H5({editor:t,options:e,dataAttribute:n}){return{init(r,s){let i=dT({editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection});return i??Ye.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:B5({decorations:s.map(r.mapping,r.doc),ranges:N5(r,i,o),editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function $5(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function j5({editor:t,options:e}){let n=e.dataAttribute?`data-${$5(e.dataAttribute)}`:`data-${aT}`,r=e.showOnlyCurrent&&!e.includeChildren;return new ze({key:rT,...r?{}:{state:H5({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:s,selection:i})=>dT({editor:t,options:e,dataAttribute:n,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?Ye.empty:(i=rT.getState(s))!==null&&i!==void 0?i:Ye.empty}}})}var KY=tt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:aT,placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[j5({editor:this.editor,options:this.options})]}});function _b(t,e){return!t.selection.empty&&!Gh(t.selection)&&e.isEditable}function V5(t,e){return _b(t,e)&&!e.isFocused&&!e.view.dragging}function W5(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function U5(t){t.focus()}var GY=tt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return[new ze({key:new Qe("selection"),props:{decorations(n){return V5(n,t)?Ye.create(n.doc,[It.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return _b(n.state,t)&&W5(),!1},focus(n){return _b(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&U5(n)}),!1}}}})]}});function sT({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var uT=tt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;let e=new Qe(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new ze({key:e,appendTransaction:(s,i,o)=>{let{doc:a,tr:l,schema:c}=o,h=e.getState(o),d=a.content.size,u=c.nodes[n];if(!s.some(f=>f.getMeta("skipTrailingNode"))&&h)return l.insert(d,u.create())},state:{init:(s,i)=>{let o=i.tr.doc.lastChild;return!sT({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;let o=s.doc.lastChild;return!sT({node:o,types:r})}}})]}}),pT=tt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>xb(t,e),redo:()=>({state:t,dispatch:e})=>kb(t,e)}},addProseMirrorPlugins(){return[nT(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var q5=tt.create({name:"starterKit",addExtensions(){let t=[];if(this.options.bold!==!1&&t.push(oC.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(iC.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(lb.configure(this.options.bulletList)),this.options.code!==!1&&t.push(aC.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(lC.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(cC.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(iT.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(oT.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(hC.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(dC.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(pT.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(uC.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(pC.configure(this.options.italic)),this.options.listItem!==!1&&t.push(db.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(pb.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(RC.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(fb.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(qC.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(KC.configure(this.options.strike)),this.options.text!==!1&&t.push(GC.configure(this.options.text)),this.options.underline!==!1){var r;t.push(JC.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;t.push(uT.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return t}}),fT=q5;function Eb(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Yi=Eb();function xT(t){Yi=t}var Ji={exec:()=>null};function Ke(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(gn.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var K5=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),gn={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,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\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"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},G5=/^(?:[ \t]*(?:\n|$))+/,J5=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,X5=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Y5=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ab=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,kT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_T=Ke(kT).replace(/bull/g,Ab).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(),Q5=Ke(kT).replace(/bull/g,Ab).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(),Pb=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Z5=/^[^\n]+/,Mb=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,e3=Ke(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mb).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),t3=Ke(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ab).getRegex(),Ud="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",Db=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,n3=Ke("^ {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[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Db).replace("tag",Ud).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ST=Ke(Pb).replace("hr",Vl).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ud).getRegex(),r3=Ke(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ST).getRegex(),Rb={blockquote:r3,code:J5,def:e3,fences:X5,heading:Y5,hr:Vl,html:n3,lheading:_T,list:t3,newline:G5,paragraph:ST,table:Ji,text:Z5},mT=Ke("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ud).getRegex(),s3={...Rb,lheading:Q5,table:mT,paragraph:Ke(Pb).replace("hr",Vl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",mT).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ud).getRegex()},i3={...Rb,html:Ke(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Db).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:Ji,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ke(Pb).replace("hr",Vl).replace("heading",` *#{1,6} *[^
|
|
187
187
|
]`).replace("lheading",_T).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},o3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,a3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,CT=/^( {2,}|\\)\n(?!\s*$)/,l3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,sa=/[\p{P}\p{S}]/u,qd=/[\s\p{P}\p{S}]/u,Ib=/[^\s\p{P}\p{S}]/u,c3=Ke(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qd).getRegex(),TT=/(?!~)[\p{P}\p{S}]/u,h3=/(?!~)[\s\p{P}\p{S}]/u,d3=/(?:[^\s\p{P}\p{S}]|~)/u,u3=Ke(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",K5?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ET=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,p3=Ke(ET,"u").replace(/punct/g,sa).getRegex(),f3=Ke(ET,"u").replace(/punct/g,TT).getRegex(),AT="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",m3=Ke(AT,"gu").replace(/notPunctSpace/g,Ib).replace(/punctSpace/g,qd).replace(/punct/g,sa).getRegex(),g3=Ke(AT,"gu").replace(/notPunctSpace/g,d3).replace(/punctSpace/g,h3).replace(/punct/g,TT).getRegex(),b3=Ke("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ib).replace(/punctSpace/g,qd).replace(/punct/g,sa).getRegex(),v3=Ke(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,sa).getRegex(),y3="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",w3=Ke(y3,"gu").replace(/notPunctSpace/g,Ib).replace(/punctSpace/g,qd).replace(/punct/g,sa).getRegex(),x3=Ke(/\\(punct)/,"gu").replace(/punct/g,sa).getRegex(),k3=Ke(/^<(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(),_3=Ke(Db).replace("(?:-->|$)","-->").getRegex(),S3=Ke("^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",_3).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,C3=Ke(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",jd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),PT=Ke(/^!?\[(label)\]\[(ref)\]/).replace("label",jd).replace("ref",Mb).getRegex(),MT=Ke(/^!?\[(ref)\](?:\[\])?/).replace("ref",Mb).getRegex(),T3=Ke("reflink|nolink(?!\\()","g").replace("reflink",PT).replace("nolink",MT).getRegex(),gT=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ob={_backpedal:Ji,anyPunctuation:x3,autolink:k3,blockSkip:u3,br:CT,code:a3,del:Ji,delLDelim:Ji,delRDelim:Ji,emStrongLDelim:p3,emStrongRDelimAst:m3,emStrongRDelimUnd:b3,escape:o3,link:C3,nolink:MT,punctuation:c3,reflink:PT,reflinkSearch:T3,tag:S3,text:l3,url:Ji},E3={...Ob,link:Ke(/^!?\[(label)\]\((.*?)\)/).replace("label",jd).getRegex(),reflink:Ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",jd).getRegex()},Sb={...Ob,emStrongRDelimAst:g3,emStrongLDelim:f3,delLDelim:v3,delRDelim:w3,url:Ke(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",gT).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:Ke(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",gT).getRegex()},A3={...Sb,br:Ke(CT).replace("{2,}","*").getRegex(),text:Ke(Sb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$d={normal:Rb,gfm:s3,pedantic:i3},Hl={normal:Ob,gfm:Sb,breaks:A3,pedantic:E3},P3={"&":"&","<":"<",">":">",'"':""","'":"'"},bT=t=>P3[t];function Ir(t,e){if(e){if(gn.escapeTest.test(t))return t.replace(gn.escapeReplace,bT)}else if(gn.escapeTestNoEncode.test(t))return t.replace(gn.escapeReplaceNoEncode,bT);return t}function vT(t){try{t=encodeURI(t).replace(gn.percentDecode,"%")}catch{return null}return t}function yT(t,e){let n=t.replace(gn.findPipe,(i,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(gn.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(gn.slashPipe,"|");return r}function $l(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r;){let i=t.charAt(r-s-1);if(i===e&&!n)s++;else if(i!==e&&n)s++;else break}return t.slice(0,r-s)}function M3(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function D3(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function wT(t,e,n,r,s){let i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function R3(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
188
188
|
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
189
189
|
`)}var Vd=class{options;rules;lexer;constructor(t){this.options=t||Yi}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 n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:$l(n,`
|