xiaodao-editor 0.1.13 → 0.1.14

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.
@@ -8,7 +8,7 @@
8
8
  `)}]}});continue}if(u.kind==="table"){n.push({indent:0,block:va(u.lines)});continue}const h=[];let p=!1;for(const m of u.lines){if(m.trim().length===0){p=!0;continue}const k=m.length-m.trimStart().length,x=wa(m.trim());if(!x){p=!1;continue}h.push({indent:k,block:x,blankBefore:p}),p=!1}for(const m of h){const k=n[n.length-1];if(k&&!m.blankBefore&&k.indent===m.indent&&k.block.type===m.block.type&&(m.block.type==="quote"||m.block.type==="paragraph")){const x=k.block.content??[],D=m.block.content??[];n[n.length-1]={indent:k.indent,block:{type:k.block.type,...k.block.attrs?{attrs:k.block.attrs}:{},content:[...x,{type:"text",text:`
9
9
  `},...D]}}}else n.push({indent:m.indent,block:m.block})}}const r=new Map,l=new Map,s=[],i=[],c=new Set(["paragraph","heading","bulletList","orderedList","todoList"]),a=10,d=(u,h,p)=>{if(r.set(h,p),l.set(h,u),u===null){s.push(h);return}const m=r.get(u);if(!m){s.push(h),l.set(h,null);return}r.set(u,{...m,children:[...m.children,h]})};for(const u of n){const h=fo(),p=c.has(u.block.type);let m=Math.floor(u.indent/2);for(m<0&&(m=0),m>a&&(m=a);i.length>0&&i[i.length-1].indent>=m;)i.pop();const k=i.length>0?i[i.length-1].id:null,x={...u.block.attrs??{}},D={id:h,type:u.block.type,attrs:x,content:u.block.content??[],children:[]};d(k,h,D),p&&i.push({indent:m,id:h})}const f=10;for(const[u,h]of r){let p=0,m=l.get(u);const k=new Set;for(;m!=null&&!k.has(m);)k.add(m),p++,m=l.get(m);if(p=Math.min(f,p),(typeof h.attrs.indent=="number"?h.attrs.indent:0)===p)continue;const{indent:D,...U}=h.attrs,F=p>0?{...U,indent:p}:U;r.set(u,{...h,attrs:F})}return{id:"doc_"+Math.random().toString(36).slice(2,10),root:s,blocks:r,parent:l}}const mi=Symbol("block-editor-mobile"),$r=Symbol("block-editor-fixed-toolbar-bridge"),Do=Symbol("block-editor-fixed-toolbar-bottom"),Pr=Symbol("block-editor"),pi=Symbol("block-editor-editable"),hi=Symbol("block-editor-image-upload");function fn(){const e=t.inject(Pr);if(!e)throw new Error("useEditor(): must be called within a <BlockEditor> component tree");return e}function _a(){return t.inject(hi,null)}function Yn(){return t.inject(pi)??t.ref(!0)}function xa(e,n){const o=Jl(n);if(!o)return!1;const r=e.registries.keymap.resolve(o);if(!r)return!1;const l=e.commands[r.command];return l?l(r.args)===!0:!1}const Ma=e=>`[data-block-id="${CSS.escape(e)}"]`;function $o(e,n){const o=Ma(n),r=e.querySelector(`${o}[contenteditable], ${o} [contenteditable]`);return r||e.querySelector(o)}function Na(e){const n=window.getSelection();if(!n||n.rangeCount===0)return 0;const o=n.getRangeAt(0),r=o.cloneRange();return r.selectNodeContents(e),r.setEnd(o.endContainer,o.endOffset),r.toString().length}function gi(e,n){const o=window.getSelection();if(!o||o.rangeCount===0)return null;const r=o.getRangeAt(0).endContainer,l=or(r,e);if(!l)return null;const s=l.dataset.blockId;if(!s)return null;const i=Na(l),c=n.blocks.get(s);if(!c)return null;const a=Ae(c.content).length,d=Math.min(i,a);if(!o.isCollapsed&&o.anchorNode===o.focusNode&&or(o.anchorNode,e)===l){const u=Math.min(o.anchorOffset,a);return{kind:"text",anchor:{blockId:s,offset:u},focus:{blockId:s,offset:d}}}return st(s,d)}function or(e,n){let o=e;for(;o&&o!==n;){if(o.nodeType===Node.ELEMENT_NODE){const r=o;if(r.dataset&&r.dataset.blockId)return r}o=o.parentNode}return null}function Sa(e,n,o){const r=document.createRange();r.selectNodeContents(e);try{r.setEnd(n,o)}catch{return 0}return r.toString().length}function bi(e,n,o){const r=ki(e,n),l=ki(e,o);if(!r||!l)return null;try{const s=document.createRange();return s.setStart(r.node,r.offset),s.setEnd(l.node,l.offset),s}catch{return null}}function ki(e,n){let o=0;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=null;for(;r.nextNode();){const s=r.currentNode;l=s;const i=(s.nodeValue??"").length;if(o+i>=n)return{node:s,offset:Math.max(0,n-o)};o+=i}return l?{node:l,offset:(l.nodeValue??"").length}:{node:e,offset:0}}function rr(e,n,o,r){let l=null;const s=document;if(typeof s.caretRangeFromPoint=="function")l=s.caretRangeFromPoint(e,n);else if(typeof s.caretPositionFromPoint=="function"){const i=s.caretPositionFromPoint(e,n);i&&(l=document.createRange(),l.setStart(i.offsetNode,i.offset),l.collapse(!0))}if(l){const i=or(l.startContainer,o);if(i){const c=i.dataset.blockId;if(c){const a=r.blocks.get(c);if(a){const d=Ae(a.content).length,f=Math.min(Sa(i,l.startContainer,l.startOffset),d);return{blockEl:i,blockId:c,offset:f}}}}}return Aa(e,n,o,r)}function Aa(e,n,o,r){const l=document.elementFromPoint(e,n),s=l?or(l,o):null;if(!s)return null;const i=s.dataset.blockId;if(!i)return null;const c=r.blocks.get(i);if(!c)return null;const a=s.matches("[contenteditable]")?s:s.querySelector("[contenteditable]");if(!a)return null;const d=Ae(c.content).length;let f=null,u=0;const h=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);let p;for(;p=h.nextNode();){const m=p,k=(m.nodeValue??"").length;if(k===0)continue;const x=document.createRange();x.setStart(m,0),x.setEnd(m,k);const D=x.getBoundingClientRect();if(D.width<=0&&D.height<=0)continue;const U=Math.max(D.left,Math.min(e,D.right)),F=Math.max(D.top,Math.min(n,D.bottom)),ee=Math.hypot(e-U,n-F),$=D.width>0?Math.round((e-D.left)/D.width*k):0,V=u+Math.max(0,Math.min(k,$));(!f||ee<f.dist)&&(f={offset:V,dist:ee}),u+=k}return f?{blockEl:s,blockId:i,offset:Math.min(f.offset,d)}:{blockEl:s,blockId:i,offset:0}}function Hr(e,n){const o=document.createRange(),r=window.getSelection();if(!r)return;let l=0,s=!1;const i=c=>{var a;if(!s)if(c.nodeType===Node.TEXT_NODE){const d=((a=c.textContent)==null?void 0:a.length)??0;l+d>=n&&(o.setStart(c,Math.max(0,n-l)),o.collapse(!0),s=!0),l+=d}else for(const d of c.childNodes)i(d)};i(e),s||(o.selectNodeContents(e),o.collapse(!1)),r.removeAllRanges(),r.addRange(o)}function yi(e,n){if(ho(n)){const r=$o(e,n.blockId);if(!r)return;r.focus(),Hr(r,n.offset);return}if(qn(n)&&n.anchor.blockId===n.focus.blockId){const r=$o(e,n.focus.blockId);if(!r)return;if(r.focus(),n.anchor.offset===n.focus.offset)Hr(r,n.focus.offset);else{const l=Math.min(n.anchor.offset,n.focus.offset),s=Math.max(n.anchor.offset,n.focus.offset),i=bi(r,l,s),c=window.getSelection();i&&c?(c.removeAllRanges(),c.addRange(i)):Hr(r,n.focus.offset)}return}const o=window.getSelection();o&&o.rangeCount>0&&o.removeAllRanges()}function Ht(e){return e.kind==="text"&&!(e.anchor.blockId===e.focus.blockId&&e.anchor.offset===e.focus.offset)&&e.anchor.blockId!==e.focus.blockId}function Vr(e,n,o){if(o.anchor.blockId===o.focus.blockId)return[];const r=In(n),l=r.indexOf(o.anchor.blockId),s=r.indexOf(o.focus.blockId);if(l===-1||s===-1)return[];const[i,c]=l<=s?[o.anchor.blockId,o.focus.blockId,l<s]:[o.focus.blockId,o.anchor.blockId,l>s],a=r.indexOf(i),d=r.indexOf(c);if(a===-1||d===-1)return[];const f=[];for(let u=a;u<=d;u++){const h=r[u],p=n.blocks.get(h);if(!p)continue;const m=$o(e,h);if(!m)continue;const k=Ae(p.content).length;let x=0,D=k;if(u===a){const F=i===o.anchor.blockId?o.anchor.offset:o.focus.offset;x=Math.min(F,k)}if(u===d){const F=c===o.anchor.blockId?o.anchor.offset:o.focus.offset;D=Math.min(F,k)}const U=bi(m,x,Math.max(x,D));if(U)for(const F of U.getClientRects())F.width>0&&F.height>0&&f.push(F)}return f}function Ia(e){var s;const{registry:n,blockId:o,text:r,editor:l}=e;for(const i of n.all){const c=i.pattern.exec(r);if(!c)continue;const a=(s=i.args)==null?void 0:s.call(i,c),d=a&&typeof a=="object"?a:{},f={...d};f.id==="__currentBlock__"&&(f.id=o);const u=typeof d.__stripPrefix=="number"?d.__stripPrefix:0,h=l.commands[i.command];if(h){l.history.beginGroup();try{if(u>0){const p=r.slice(u),m=l.commands.setText;m&&m({id:o,content:Wn(p)})}h(f)}finally{l.history.endGroup()}return!0}}return!1}function Ba(e){return e.includes("/")?e.startsWith("/")||/^\s*\/\S*/.test(e):!1}const Ra=["http:","https:","mailto:","tel:"],La=["javascript:","vbscript:","data:","file:"];function Pn(e){const n=e.trim();if(!n)return null;const o=n.toLowerCase();for(const s of La)if(o.startsWith(s))return null;const r=n.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);if(r){const s=r[1].toLowerCase()+":";return Ra.includes(s)?n:null}const l=n[0];return l==="/"||l==="."||l==="#"||n.startsWith("//")||Ur(n)?n:null}function Ur(e){const n=e.trim();return!n||n.length<4?!1:/^https?:\/\//i.test(n)||/^mailto:/i.test(n)?!0:/\s/.test(n)?!1:!!/^[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s]*)?$/.test(n)}function to(e){const n=e.trim();return n?/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n)?n:n.startsWith("@")||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?n.startsWith("mailto:")?n:`mailto:${n.replace(/^@/,"")}`:Ur(n)&&!n.startsWith("/")?`https://${n}`:n:""}const Po=/(^|\s)((?:https?:\/\/|www\.)[^\s<]+|[\w-]+(?:\.[\w-]+)+\.[a-zA-Z]{2,}(?::\d+)?(?:\/[^\s<]*)?)/g;function lr(e){var r,l;let n=!1;const o=[];for(const s of e){if(s.type!=="text"){o.push(s);continue}const i=(r=s.marks)==null?void 0:r.some(p=>p.type==="link"),c=(l=s.marks)==null?void 0:l.some(p=>p.type==="code");if(i||c){o.push(s);continue}const a=s.text,d=s.marks??[];if(Po.lastIndex=0,!Po.exec(a)){o.push(s);continue}n=!0;let u=0;Po.lastIndex=0;let h;for(;(h=Po.exec(a))!==null;){const p=h[0],m=h[2],k=h.index+p.length-m.length,x=k+m.length;if(k>u){const F=a.slice(u,k);F.length>0&&o.push({type:"text",text:F,marks:d.length>0?[...d]:void 0})}const D=to(m),U=Pn(D);if(U){const F={type:"link",attrs:{href:U}};o.push({type:"text",text:m,marks:[...d,F]})}else o.push({type:"text",text:m,marks:d.length>0?[...d]:void 0});u=x}if(u<a.length){const p=a.slice(u);p.length>0&&o.push({type:"text",text:p,marks:d.length>0?[...d]:void 0})}Po.lastIndex=0}return n?o:e}const Oa={bold:["b","strong"],italic:["i","em"],underline:["u"],strikethrough:["s","strike","del"],code:["code"],link:["a"]},wi={};for(const[e,n]of Object.entries(Oa))for(const o of n)wi[o]=e;const Da="b,strong,i,em,u,s,strike,del,code,a[href],span.be-color-gray,span.be-color-brown,span.be-color-orange,span.be-color-yellow,span.be-color-green,span.be-color-blue,span.be-color-purple,span.be-color-pink,span.be-color-red,span.be-bg-gray,span.be-bg-brown,span.be-bg-orange,span.be-bg-yellow,span.be-bg-green,span.be-bg-blue,span.be-bg-purple,span.be-bg-pink,span.be-bg-red";function $a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pa(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ei(e){return e.some(n=>n.type==="text"&&n.marks&&n.marks.length>0)}function Zn(e){return e.length===0?"":e.map(n=>{var f,u,h;if(n.type!=="text")return"";let o=$a(n.text);const r=n.marks??[],l=r.find(p=>p.type==="color"),s=(f=l==null?void 0:l.attrs)==null?void 0:f.color;typeof s=="string"&&(o=`<span class="be-color-${s}">${o}</span>`);const i=r.find(p=>p.type==="bgColor"),c=(u=i==null?void 0:i.attrs)==null?void 0:u.bgColor;typeof c=="string"&&(o=`<span class="be-bg-${c}">${o}</span>`),r.some(p=>p.type==="strikethrough")&&(o=`<s>${o}</s>`),r.some(p=>p.type==="underline")&&(o=`<u>${o}</u>`),r.some(p=>p.type==="italic")&&(o=`<i>${o}</i>`),r.some(p=>p.type==="bold")&&(o=`<b>${o}</b>`),r.some(p=>p.type==="code")&&(o=`<code>${o}</code>`);const a=r.find(p=>p.type==="link"),d=(h=a==null?void 0:a.attrs)==null?void 0:h.href;if(typeof d=="string"){const p=Pn(d);p&&(o=`<a href="${Pa(p)}" target="_blank" rel="noopener noreferrer">${o}</a>`)}return o}).join("")}function Ha(e){const n=[],o=e.className;if(typeof o=="string"){const r=o.match(/be-color-(\w+)/);r&&n.push({type:"color",attrs:{color:r[1]}});const l=o.match(/be-bg-(\w+)/);l&&n.push({type:"bgColor",attrs:{bgColor:l[1]}})}return n}function mn(e){const n=[];function o(r,l){if(r.nodeType===Node.TEXT_NODE){const d=r.textContent??"";d.length>0&&n.push({type:"text",text:d,marks:l.length>0?[...l]:void 0});return}if(r.nodeType!==Node.ELEMENT_NODE)return;const s=r,i=s.tagName.toLowerCase();if(i==="br")return;const c=wi[i];let a=l;if(c==="link"){const d=s.getAttribute("href")??"",f=Pn(d);f?a=[...l,{type:"link",attrs:{href:f}}]:a=l}else if(c)a=[...l,{type:c}];else if(i==="span"){const d=Ha(s);d.length>0&&(a=[...l,...d])}for(const d of s.childNodes)o(d,a)}return o(e,[]),za(n)}function Va(e,n){if(e.type!==n.type)return!1;const o=e.attrs?Object.keys(e.attrs):[],r=n.attrs?Object.keys(n.attrs):[];return o.length!==r.length?!1:o.every(l=>e.attrs[l]===n.attrs[l])}function Ua(e,n){return!e&&!n?!0:!e||!n||e.length!==n.length?!1:e.every(o=>n.some(r=>Va(o,r)))}function za(e){const n=[];for(const o of e){const r=n[n.length-1];r&&Ua(r.marks,o.marks)?n[n.length-1]={type:"text",text:r.text+o.text,marks:r.marks}:n.push({...o})}return n}function Fa(e){return e.attrs?Object.entries(e.attrs).sort((n,o)=>n[0].localeCompare(o[0])).map(([n,o])=>`${n}=${String(o)}`).join(";"):""}function vi(e){return e.map(n=>n.type==="text"?`${n.text}\0${(n.marks??[]).map(o=>`${o.type}:${Fa(o)}`).sort().join(",")}`:"").join("")}const zr=["paragraph","heading","heading1","heading2","heading3","heading4","heading5","heading6","bulletList","orderedList","todoList","quote","codeBlock"],Ho=["todoList"],Vo=["orderedList"],Fr=["left","center","right"],Kr=["top","middle","bottom"],Wr=["gray","brown","orange","yellow","green","blue","purple","pink","red"],Gr=["bold","italic","underline","strikethrough","color","bgColor","link"],Ka=["bold","italic","underline","strikethrough","code","link","color","bgColor"];function no(){return{content:[],rowspan:1,colspan:1,covered:!1}}function go(e,n){const o=n==="codeBlock",r=n==="quote",l=[];for(const s of e){if(s.type!=="text"){l.push({...s});continue}if(o){l.push({type:"text",text:s.text});continue}let i=s.marks?s.marks.filter(c=>Ka.includes(c.type)):void 0;i&&i.some(c=>c.type==="code")&&(i=i.filter(c=>c.type==="code"||!Gr.includes(c.type))),r&&i&&(i=i.filter(c=>c.type!=="italic")),i&&(i=i.filter(c=>{var d;if(c.type!=="link")return!0;const a=(d=c.attrs)==null?void 0:d.href;return typeof a!="string"?!1:Pn(a)!==null})),i&&i.length===0&&(i=void 0),l.push(i?{...s,marks:i}:{type:"text",text:s.text})}return l}function yn(e){return{content:e.content.map(n=>({...n})),rowspan:e.rowspan,colspan:e.colspan,covered:e.covered,cellType:e.cellType,align:e.align,verticalAlign:e.verticalAlign,bgColor:e.bgColor,checked:e.checked,startNumber:e.startNumber}}function Hn(e,n,o,r,l){var f,u,h;let s=Math.max(0,Math.min(n,r)),i=Math.min(e.rows-1,Math.max(n,r)),c=Math.max(0,Math.min(o,l)),a=Math.min(e.cols-1,Math.max(o,l)),d=!0;for(;d;){d=!1;for(let p=s;p<=i;p++)for(let m=c;m<=a;m++){const k=(f=e.cells[p])==null?void 0:f[m];if(!k)continue;let x=p,D=m;if(k.covered){let $=!1;for(let V=p;V>=0&&!$;V--)for(let re=m;re>=0&&!$;re--){const G=(u=e.cells[V])==null?void 0:u[re];!G||G.covered||V+Math.max(1,G.rowspan)>p&&re+Math.max(1,G.colspan)>m&&(x=V,D=re,$=!0)}if(!$)continue}const U=(h=e.cells[x])==null?void 0:h[D];if(!U||U.covered)continue;const F=x+Math.max(1,U.rowspan)-1,ee=D+Math.max(1,U.colspan)-1;s>x&&(s=x,d=!0),i<F&&(i=F,d=!0),c>D&&(c=D,d=!0),a<ee&&(a=ee,d=!0)}}return{r1:s,c1:c,r2:i,c2:a}}function Ci(e,n,o,r,l){var d;const s=Math.max(0,Math.min(n,r)),i=Math.min(e.rows-1,Math.max(n,r)),c=Math.max(0,Math.min(o,l)),a=Math.min(e.cols-1,Math.max(o,l));for(let f=s;f<=i;f++)for(let u=c;u<=a;u++){const h=(d=e.cells[f])==null?void 0:d[u];if(!(!h||h.covered)&&(h.rowspan>1||h.colspan>1))return!0}return!1}function Wa(e,n,o,r,l){var f;const s=Math.max(0,Math.min(n,r)),i=Math.min(e.rows-1,Math.max(n,r)),c=Math.max(0,Math.min(o,l)),a=Math.min(e.cols-1,Math.max(o,l));let d=0;for(let u=s;u<=i;u++)for(let h=c;h<=a;h++){const p=(f=e.cells[u])==null?void 0:f[h];p&&!p.covered&&(d+=1)}return d}function bo(e){return{content:e.content,rowspan:e.rowspan,colspan:e.colspan,covered:e.covered,cellType:e.cellType,align:e.align,verticalAlign:e.verticalAlign,bgColor:e.bgColor,checked:e.checked,startNumber:e.startNumber}}function Ga(e,n){const o=[];for(let r=0;r<e;r++){const l=[];for(let s=0;s<n;s++)l.push(no());o.push(l)}return o}function Uo(e){const n=e.rows,o=e.cols,r=typeof n=="number"&&Number.isInteger(n)&&n>=1?n:1,l=typeof o=="number"&&Number.isInteger(o)&&o>=1?o:1;let s=[];const i=e.colWidths;if(Array.isArray(i))for(const f of i)s.push(typeof f=="number"&&Number.isFinite(f)&&f>=0?f:0);for(;s.length<l;)s.push(0);s.length>l&&(s=s.slice(0,l));const c=typeof e.headerRow=="boolean"?e.headerRow:!1;let a=[];const d=e.cells;if(Array.isArray(d))for(let f=0;f<r;f++){const u=d[f],h=[];if(Array.isArray(u))for(let p=0;p<l;p++){const m=u[p];h.push(qa(m))}else for(let p=0;p<l;p++)h.push(no());a.push(h)}for(;a.length<r;){const f=[];for(let u=0;u<l;u++)f.push(no());a.push(f)}return a.length>r&&(a=a.slice(0,r)),a=Vn(a,r,l),{rows:r,cols:l,cells:a,colWidths:s,headerRow:c}}function qa(e){if(!e||typeof e!="object")return no();const n=e,o=Array.isArray(n.content)?n.content:[],r=typeof n.cellType=="string"?n.cellType:void 0,l=r&&zr.includes(r)?r:void 0,s=go(o,l),i=typeof n.rowspan=="number"&&Number.isInteger(n.rowspan)&&n.rowspan>=1?n.rowspan:1,c=typeof n.colspan=="number"&&Number.isInteger(n.colspan)&&n.colspan>=1?n.colspan:1,a=typeof n.covered=="boolean"?n.covered:!1,d=typeof n.align=="string"?n.align:void 0,f=d&&Fr.includes(d)?d:void 0,u=typeof n.verticalAlign=="string"?n.verticalAlign:void 0,h=u&&Kr.includes(u)?u:void 0,p=typeof n.bgColor=="string"?n.bgColor:void 0,m=p&&Wr.includes(p)?p:void 0,k=typeof n.checked=="boolean"?n.checked:!1,x=l&&Ho.includes(l)?k:void 0,D=typeof n.startNumber=="number"&&Number.isInteger(n.startNumber)&&n.startNumber>=1?n.startNumber:void 0,U=l&&Vo.includes(l)?D:void 0;return{content:s,rowspan:i,colspan:c,covered:a,cellType:l,align:f,verticalAlign:h,bgColor:m,checked:x,startNumber:U}}function Vn(e,n,o){const r=e.map(l=>l.map(yn));for(let l=0;l<n;l++)for(let s=0;s<o;s++){const i=r[l][s];if(i.covered)continue;const c=Math.max(1,Math.min(i.rowspan,n-l)),a=Math.max(1,Math.min(i.colspan,o-s));if(i.rowspan=c,i.colspan=a,!(c===1&&a===1))for(let d=l;d<l+c;d++)for(let f=s;f<s+a;f++)d===l&&f===s||(r[d][f]={content:[],rowspan:1,colspan:1,covered:!0})}return r.map(l=>l.map(bo))}function Ti(e,n){var u,h;const{rows:o,cols:r,cells:l,colWidths:s,headerRow:i}=e,c=Math.max(0,Math.min(n,o)),a=l.map(p=>p.map(yn)),d=[];for(let p=0;p<r;p++){if(c>0){const m=(u=a[c-1])==null?void 0:u[p];if(m&&!m.covered&&c-1+m.rowspan>c){d.push({content:[],rowspan:1,colspan:1,covered:!0});continue}}d.push(no())}if(a.splice(c,0,d),c>0)for(let p=0;p<r;p++){const m=(h=a[c-1])==null?void 0:h[p];m&&!m.covered&&c-1+m.rowspan>c&&(m.rowspan=m.rowspan+1)}const f=Vn(a,o+1,r);return{rows:o+1,cols:r,cells:f,colWidths:[...s],headerRow:i}}function Ya(e,n){var f;const{rows:o,cols:r,colWidths:l,headerRow:s}=e;if(o<=1)return e;const i=Math.max(0,Math.min(n,o-1)),c=e.cells.map(u=>u.map(yn));for(let u=0;u<r;u++)for(let h=0;h<i;h++){const p=(f=c[h])==null?void 0:f[u];if(!p||p.covered)continue;h+p.rowspan>i&&(p.rowspan=Math.max(1,p.rowspan-1))}c.splice(i,1);let a=s;s&&i===0&&(a=!1);const d=Vn(c,o-1,r);return{rows:o-1,cols:r,cells:d,colWidths:[...l],headerRow:a}}function Za(e,n){const{rows:o,cols:r,cells:l,colWidths:s,headerRow:i}=e,c=Math.max(0,Math.min(n,r)),a=l.map(p=>p.map(yn));for(let p=0;p<o;p++){let m=!1;if(c>0){const k=a[p][c-1];k&&!k.covered&&c-1+k.colspan>c&&(k.colspan=k.colspan+1,m=!0)}a[p].splice(c,0,m?{content:[],rowspan:1,colspan:1,covered:!0}:no())}const d=[...s],f=d.filter(p=>p>0),u=f.length>0?Math.round(f.reduce((p,m)=>p+m,0)/f.length):120;d.splice(c,0,u);const h=Vn(a,o,r+1);return{rows:o,cols:r+1,cells:h,colWidths:d,headerRow:i}}function Xa(e,n){const{rows:o,cols:r,cells:l,headerRow:s}=e;if(r<=1)return e;const i=Math.max(0,Math.min(n,r-1)),c=l.map(f=>f.map(yn));for(let f=0;f<o;f++){for(let u=0;u<i;u++){const h=c[f][u];if(!h||h.covered)continue;u+h.colspan>i&&(h.colspan=Math.max(1,h.colspan-1))}c[f].splice(i,1)}const a=[...e.colWidths];a.splice(i,1);const d=Vn(c,o,r-1);return{rows:o,cols:r-1,cells:d,colWidths:a,headerRow:s}}function zo(e,n,o,r){var c;if(n<0||n>=e.rows||o<0||o>=e.cols)return e;const l=(c=e.cells[n])==null?void 0:c[o];if(!l||l.covered)return e;const s=go(r,l.cellType),i=e.cells.map((a,d)=>a.map((f,u)=>d===n&&u===o?bo({...yn(f),content:s}):f));return{...e,cells:i}}function Fo(e,n,o,r){var i;if(n<0||n>=e.rows||o<0||o>=e.cols)return e;const l=(i=e.cells[n])==null?void 0:i[o];if(!l||l.covered)return e;const s=e.cells.map((c,a)=>c.map((d,f)=>{if(a!==n||f!==o)return d;const u=yn(d);return r.cellType!==void 0&&(u.cellType=r.cellType==="paragraph"?void 0:zr.includes(r.cellType)?r.cellType:void 0,u.content=go(u.content,u.cellType),(!u.cellType||!Ho.includes(u.cellType))&&(u.checked=void 0),(!u.cellType||!Vo.includes(u.cellType))&&(u.startNumber=void 0)),r.align!==void 0&&(u.align=r.align==="left"?void 0:Fr.includes(r.align)?r.align:void 0),r.verticalAlign!==void 0&&(u.verticalAlign=r.verticalAlign==="middle"?void 0:Kr.includes(r.verticalAlign)?r.verticalAlign:void 0),r.bgColor!==void 0&&(u.bgColor=r.bgColor==="default"?void 0:Wr.includes(r.bgColor)?r.bgColor:void 0),r.checked!==void 0&&(u.checked=u.cellType&&Ho.includes(u.cellType)?r.checked:void 0),r.startNumber!==void 0&&(r.startNumber===null?u.startNumber=void 0:u.startNumber=u.cellType&&Vo.includes(u.cellType)&&typeof r.startNumber=="number"&&Number.isInteger(r.startNumber)&&r.startNumber>=1?r.startNumber:void 0),bo(u)}));return{...e,cells:s}}function oo(e,n,o){const r=new Set(n.map(s=>`${s.row}-${s.col}`)),l=e.cells.map((s,i)=>s.map((c,a)=>{if(!r.has(`${i}-${a}`)||c.covered)return c;const d=yn(c);return o.cellType!==void 0&&(d.cellType=o.cellType==="paragraph"?void 0:zr.includes(o.cellType)?o.cellType:void 0,d.content=go(d.content,d.cellType),(!d.cellType||!Ho.includes(d.cellType))&&(d.checked=void 0),(!d.cellType||!Vo.includes(d.cellType))&&(d.startNumber=void 0)),o.align!==void 0&&(d.align=o.align==="left"?void 0:Fr.includes(o.align)?o.align:void 0),o.verticalAlign!==void 0&&(d.verticalAlign=o.verticalAlign==="middle"?void 0:Kr.includes(o.verticalAlign)?o.verticalAlign:void 0),o.bgColor!==void 0&&(d.bgColor=o.bgColor==="default"?void 0:Wr.includes(o.bgColor)?o.bgColor:void 0),o.checked!==void 0&&(d.checked=d.cellType&&Ho.includes(d.cellType)?o.checked:void 0),o.startNumber!==void 0&&(o.startNumber===null?d.startNumber=void 0:d.startNumber=d.cellType&&Vo.includes(d.cellType)&&typeof o.startNumber=="number"&&Number.isInteger(o.startNumber)&&o.startNumber>=1?o.startNumber:void 0),bo(d)}));return{...e,cells:l}}function _i(e,n,o,r){const l=new Set(n.map(i=>`${i.row}-${i.col}`)),s=e.cells.map((i,c)=>i.map((a,d)=>{if(!l.has(`${c}-${d}`)||a.covered||a.cellType==="codeBlock"||a.cellType==="quote"&&o==="italic")return a;const f=yn(a);return f.content=f.content.map(u=>{if(u.type!=="text")return u;const h=u.marks?[...u.marks]:[],p=h.some(k=>k.type==="code");if(o==="code"&&r!==null){const k=h.filter(x=>x.type==="code"||!Gr.includes(x.type));return k.some(x=>x.type==="code")||k.push({type:"code"}),{...u,marks:k.length>0?k:void 0}}if(r!==null&&Gr.includes(o)&&p)return u;const m=h.filter(k=>k.type!==o);return r!==null&&m.push(r?{type:o,attrs:r}:{type:o}),{...u,marks:m.length>0?m:void 0}}),bo(f)}));return{...e,cells:s}}function ja(e,n,o){var s,i;new Set(n.map(c=>`${c.row}-${c.col}`));const r=n.filter(c=>{var d;const a=(d=e.cells[c.row])==null?void 0:d[c.col];return!(!a||a.covered||a.cellType==="codeBlock"||a.cellType==="quote"&&o==="italic")});if(r.length===0)return e;let l=!0;for(const c of r){const a=(s=e.cells[c.row])==null?void 0:s[c.col];if(!(!a||a.covered)&&a.content.length!==0){for(const d of a.content){if(d.type!=="text")continue;if(!(((i=d.marks)==null?void 0:i.some(u=>u.type===o))??!1)){l=!1;break}}if(!l)break}}return _i(e,r,o,l?null:{})}function Qa(e,n,o,r,l){var $,V,re;const s=Math.max(0,Math.min(n,r)),i=Math.min(e.rows-1,Math.max(n,r)),c=Math.max(0,Math.min(o,l)),a=Math.min(e.cols-1,Math.max(o,l));if(s===i&&c===a)return e;const d=e.cells.map(G=>G.map(yn));for(let G=s;G<=i;G++)for(let ne=c;ne<=a;ne++)d[G][ne]={content:[],rowspan:1,colspan:1,covered:!1};let f=s,u=c;for(;f>=0&&((V=($=e.cells[f])==null?void 0:$[u])!=null&&V.covered);){if(u>0){u-=1;continue}f-=1,u=e.cols-1}const h=f>=0?(re=e.cells[f])==null?void 0:re[u]:void 0,p=h?h.content.map(G=>({...G})):[],m=h==null?void 0:h.cellType,k=h==null?void 0:h.align,x=h==null?void 0:h.verticalAlign,D=h==null?void 0:h.bgColor,U=h==null?void 0:h.checked,F=h==null?void 0:h.startNumber;d[s][c]={content:go(p,m),rowspan:i-s+1,colspan:a-c+1,covered:!1,cellType:m,align:k,verticalAlign:x,bgColor:D,checked:U,startNumber:F};const ee=Vn(d,e.rows,e.cols);return{...e,cells:ee}}function xi(e,n,o){var a;if(n<0||n>=e.rows||o<0||o>=e.cols)return e;const r=(a=e.cells[n])==null?void 0:a[o];if(!r||r.covered)return e;const l=n+r.rowspan-1,s=o+r.colspan-1,i=e.cells.map(d=>d.map(yn));for(let d=n;d<=l;d++)for(let f=o;f<=s;f++)i[d][f]={content:d===n&&f===o?[...r.content]:[],rowspan:1,colspan:1,covered:!1};const c=Vn(i,e.rows,e.cols);return{...e,cells:c}}function Ja(e,n,o,r,l){var f;const s=Math.max(0,Math.min(n,r)),i=Math.min(e.rows-1,Math.max(n,r)),c=Math.max(0,Math.min(o,l)),a=Math.min(e.cols-1,Math.max(o,l));let d=e;for(let u=i;u>=s;u--)for(let h=a;h>=c;h--){const p=(f=d.cells[u])==null?void 0:f[h];!p||p.covered||p.rowspan===1&&p.colspan===1||(d=xi(d,u,h))}return d}function ed(e){return{...e,headerRow:!e.headerRow}}function Mi(e,n,o){if(n<0||n>=e.cols)return e;const r=Math.max(0,Math.round(o)),l=[...e.colWidths];for(;l.length<e.cols;)l.push(0);return l[n]=r,{...e,colWidths:l}}function ir(e){let n="";for(const o of e.content)o.type==="text"&&(n+=o.text);return n}function Ni(e){return e.replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>")}function td(e){var s,i;const n=[];e.colWidths;const o=[],r=[];for(let c=0;c<e.cols;c++){const a=(s=e.cells[0])==null?void 0:s[c],d=a&&!a.covered?ir(a):"";o.push(Ni(d)),r.push(e.headerRow?"---":"-")}const l=e.headerRow?1:0;e.headerRow?(n.push(`| ${o.join(" | ")} |`),n.push(`| ${r.join(" | ")} |`)):(n.push(`| ${o.join(" | ")} |`),n.push(`| ${r.join(" | ")} |`));for(let c=l;c<e.rows;c++){const a=[];for(let d=0;d<e.cols;d++){const f=(i=e.cells[c])==null?void 0:i[d],u=f&&!f.covered?ir(f):"";a.push(Ni(u))}n.push(`| ${a.join(" | ")} |`)}return n.join(`
10
10
  `)}function nd(e){var l,s;const n=["<table>"],o=[];for(let i=0;i<e.cols;i++){const c=e.colWidths[i]??0;o.push(c>0?`<col style="width:${c}px">`:"<col>")}o.length>0&&n.push(`<colgroup>${o.join("")}</colgroup>`);const r=e.headerRow?1:0;if(e.headerRow){n.push("<thead><tr>");for(let i=0;i<e.cols;i++){const c=(l=e.cells[0])==null?void 0:l[i];if(!c||c.covered)continue;const a=c.rowspan>1?` rowspan="${c.rowspan}"`:"",d=c.colspan>1?` colspan="${c.colspan}"`:"";n.push(`<th${a}${d}>${Si(ir(c))}</th>`)}n.push("</tr></thead>")}n.push("<tbody>");for(let i=r;i<e.rows;i++){n.push("<tr>");for(let c=0;c<e.cols;c++){const a=(s=e.cells[i])==null?void 0:s[c];if(!a||a.covered)continue;const d=a.rowspan>1?` rowspan="${a.rowspan}"`:"",f=a.colspan>1?` colspan="${a.colspan}"`:"";n.push(`<td${d}${f}>${Si(ir(a))}</td>`)}n.push("</tr>")}return n.push("</tbody></table>"),n.join("")}function Si(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function od(e){var f;const n=Array.from(e.querySelectorAll("tr"));if(n.length===0)return null;let o=0;const r=[];for(const u of n){const h=Array.from(u.children).filter(m=>m.tagName==="TH"||m.tagName==="TD");let p=0;for(const m of h)p+=m.colSpan||1;p>o&&(o=p),r.push(h)}o=Math.max(1,o);const l=n.length,s=[];for(let u=0;u<l;u++){const h=[];for(let p=0;p<o;p++)h.push(no());s.push(h)}for(let u=0;u<l;u++){const h=r[u]??[];let p=0;for(const m of h){for(;p<o&&s[u][p].covered;)p++;if(p>=o)break;const k=Math.max(1,Math.min(m.rowSpan||1,l-u)),x=Math.max(1,Math.min(m.colSpan||1,o-p)),D=go(mn(m));s[u][p]={content:D,rowspan:k,colspan:x,covered:!1};for(let U=u;U<u+k;U++)for(let F=p;F<p+x;F++)U===u&&F===p||U<l&&F<o&&(s[U][F]={content:[],rowspan:1,colspan:1,covered:!0});p+=x}}const i=e.querySelectorAll("thead tr").length>0||((f=r[0])==null?void 0:f.every(u=>u.tagName==="TH"))===!0,c=[];for(let u=0;u<o;u++)c.push(0);const a=s.map(u=>u.map(bo)),d=Vn(a,l,o);return{rows:l,cols:o,cells:d,colWidths:c,headerRow:i}}function rd(e){if(!e||typeof e!="object")return!1;const n=e;return!(typeof n.rows!="number"||!Number.isInteger(n.rows)||n.rows<1||typeof n.cols!="number"||!Number.isInteger(n.cols)||n.cols<1)}function ro(e){return Uo(e)}function qr(e,n,o){var l,s;const r=(l=e.cells[n])==null?void 0:l[o];if(!r||r.covered)return 1;if(typeof r.startNumber=="number")return r.startNumber;for(let i=n-1;i>=0;i--){const c=(s=e.cells[i])==null?void 0:s[o];if(!(!c||c.covered)){if(c.cellType!=="orderedList")break;return qr(e,i,o)+1}}return 1}const Ai=new Set(["p","h1","h2","h3","h4","h5","h6","li","pre","blockquote","hr","tr","table-row","table"]),ld=/^(?:-{3,}|\*{3,}|_{3,})\s*$/,Yr={h1:1,h2:2,h3:3,h4:4,h5:5,h6:6},Ii=new Set(["meta","style","script","head","title","link","object","embed"]);function id(e){const n=(e.getAttribute("src")??"").trim();return!n||/^cid:/i.test(n)||/^(javascript|vbscript|data:text\/)/i.test(n)||n.length>1e7?null:{src:n,alt:(e.getAttribute("alt")??"").trim(),title:(e.getAttribute("title")??"").trim()}}function sr(e){return Ai.has(e)||e in Yr}function sd(e,n){if(e){const o=cd(e);if(o.length>0)return o}if(e){const o=ud(e);if(o.length>0)return o}return n?dd(n):[]}function cd(e){const n=e.match(/<!--\s*blockeditor:(.+?)\s*-->/);if(!n)return[];try{const o=JSON.parse(n[1]),r=o.type,l=o.attrs,s=o.text;if(!r)return[];const i=[];return s&&s.length>0?i.push({type:r,attrs:l??{},content:Wn(s)}):i.push({type:r,attrs:l??{},content:[]}),i}catch{return[]}}function Zr(e){let n=0;for(const o of e)o.type==="text"&&(n+=o.text.length);return n}function ad(e){if(e.length===0)return e;const n=[...e];for(;n.length>0;){const o=n[0];if(o.type!=="text")break;const r=o.text.replace(/^[\s\r\n]+/,"");if(r===o.text)break;if(r.length===0)n.shift();else{n[0]={...o,text:r};break}}for(;n.length>0;){const o=n[n.length-1];if(o.type!=="text")break;const r=o.text.replace(/[\s\r\n]+$/,"");if(r===o.text)break;if(r.length===0)n.pop();else{n[n.length-1]={...o,text:r};break}}return n}function Bi(e){for(let n=0;n<e.length;n++){const o=e[n];o.type==="codeBlock"||o.type==="image"||o.type==="table"||o.type==="divider"||(e[n]={...o,content:ad(o.content)})}}function dd(e){const n=e.split(/\r?\n/),o=[];for(const r of n)ld.test(r)?o.push({type:"divider",attrs:{},content:[]}):o.push({type:"paragraph",attrs:{},content:Wn(r)});return Bi(o),Ri(o),o}function Ri(e){const n=new Set(["image","table","divider","codeBlock"]),o=[];let r=!1;for(const l of e)!n.has(l.type)&&Zr(l.content)===0?(r||o.push(l),r=!0):(o.push(l),r=!1);for(;o.length>1&&!n.has(o[0].type)&&Zr(o[0].content)===0;)o.shift();for(;o.length>1&&!n.has(o[o.length-1].type)&&Zr(o[o.length-1].content)===0;)o.pop();e.length=0;for(const l of o)e.push(l)}function ud(e){const n=new DOMParser().parseFromString(e,"text/html"),o=[];let r=n.body;for(;r.nodeType===Node.ELEMENT_NODE;){const l=r,s=Array.from(l.childNodes),i=s.filter(u=>u.nodeType===Node.ELEMENT_NODE&&!Ii.has(u.tagName.toLowerCase())),c=i.some(u=>sr(u.tagName.toLowerCase())||u.tagName.toLowerCase()==="br"),a=s.some(u=>u.nodeType===Node.TEXT_NODE&&(u.textContent??"").length>0),d=i.some(u=>!sr(u.tagName.toLowerCase())&&u.tagName.toLowerCase()!=="div");if(c||a||d||i.length!==1)break;const f=i[0];if(f&&(f.tagName.toLowerCase()==="div"||f.tagName.toLowerCase()==="span"))r=f;else break}if(Ko(r.childNodes,n,o),Bi(o),Ri(o),o.length===0){const l=n.body.textContent??"";l.length>0&&o.push({type:"paragraph",attrs:{},content:Wn(l)})}return o}function Ko(e,n,o){var i;let r=[],l=0;function s(c=!1){if(r.length===0&&!c){l=0;return}const a=n.createElement("div");for(const f of r)a.appendChild(f.cloneNode(!0));const d=mn(a);o.push({type:"paragraph",attrs:{},content:d}),r=[],l=0}for(const c of e){if(c.nodeType===Node.COMMENT_NODE)continue;if(c.nodeType===Node.TEXT_NODE){const f=c.textContent??"";if(f.length>0&&f.trim().length===0)continue;r.push(c),l=0;continue}if(c.nodeType!==Node.ELEMENT_NODE)continue;const a=c,d=a.tagName.toLowerCase();if(!Ii.has(d)){if(d==="br"){l+=1;const f=r.length>0;s(!1),f||(l>=2||o.length>0)&&o.push({type:"paragraph",attrs:{},content:[]});continue}if(d==="pre"){s();const f=(a.textContent??"").replace(/^\n+|\n+$/g,"");o.push({type:"codeBlock",attrs:{language:"plain"},content:Wn(f)}),l=0;continue}if(d==="hr"){s(),o.push({type:"divider",attrs:{},content:[]}),l=0;continue}if(d in Yr){s(),o.push({type:"heading",attrs:{level:Yr[d]},content:mn(a)}),l=0;continue}if(d==="blockquote"){s(),Ko(a.childNodes,n,o),l=0;continue}if(d==="li"){s();const f=a.parentElement,u=(f==null?void 0:f.tagName.toLowerCase())??"",h=mn(a);u==="ol"?o.push({type:"orderedList",attrs:{},content:h}):u==="ul"?o.push({type:"bulletList",attrs:{},content:h}):o.push({type:"paragraph",attrs:{},content:h}),l=0;continue}if(Ai.has(d)){s();const f=Array.from(a.children).some(h=>sr(h.tagName.toLowerCase())),u=!!a.querySelector("img");f||u?Ko(a.childNodes,n,o):a.querySelector("br")?fd(a,n,o):o.push({type:"paragraph",attrs:{},content:mn(a)}),l=0;continue}if(d==="div"||d==="span"){const f=Array.from(a.children).some(h=>{const p=h.tagName.toLowerCase();return sr(p)||p==="div"}),u=!!a.querySelector("img");if(f||u)s(),Ko(a.childNodes,n,o),l=0;else{d==="div"&&r.length>0&&r.push(n.createTextNode(`
11
- `));for(const h of Array.from(a.childNodes))r.push(h);l=0}continue}if(d==="img"){const f=id(a);f&&(s(),o.push({type:"image",attrs:{src:f.src,alt:f.alt,title:f.title},content:[]}),l=0);continue}if(d==="table"){const f=od(a);f&&(s(),o.push({type:"table",attrs:f,content:[]}),l=0);continue}if((i=a.querySelector)!=null&&i.call(a,"img")){s(),Ko(a.childNodes,n,o),l=0;continue}r.push(c),l=0}}s()}function fd(e,n,o){const r=[[]];for(const l of e.childNodes)l.nodeType===Node.ELEMENT_NODE&&l.tagName.toLowerCase()==="br"?r.push([]):r[r.length-1].push(l);for(const l of r){const s=n.createElement("div");for(const c of l)s.appendChild(c.cloneNode(!0));const i=mn(s);o.push({type:"paragraph",attrs:{},content:i})}}const lo=new Map,cr=new Set;function Li(e,n){for(const o of cr)o(e,n)}function Xn(e){return lo.get(e)??null}function wn(e,n){if(n===null){if(lo.has(e)){const o=lo.get(e);if(o!=null&&o.tempPreviewUrl&&URL.revokeObjectURL(o.tempPreviewUrl),o!=null&&o.controller)try{o.controller.abort()}catch{}lo.delete(e),Li(e,null)}}else lo.set(e,n),Li(e,n)}function Oi(e){return cr.add(e),()=>{cr.delete(e)}}const md=Oi;function pd(){for(const[,e]of lo)if(e!=null&&e.tempPreviewUrl&&URL.revokeObjectURL(e.tempPreviewUrl),e!=null&&e.controller)try{e.controller.abort()}catch{}lo.clear();for(const e of cr)e("",null)}const hd=pd,ar=new Set;function gd(){for(const e of ar)try{URL.revokeObjectURL(e)}catch{}ar.clear()}function Xr(e){const n=URL.createObjectURL(e);return ar.add(n),n}function bd(e){for(const n of e)wn(n,null)}function kd(e){bd(e)}let jr=null;function yd(e){jr=e}const wd=yd;function Di(e,n,o,r){if(!jr){r.onError("Upload handler not registered");return}jr(e,n,o,r)}function Ed(e,n){return new Promise((o,r)=>{const l=Date.now(),s=500+Math.min(2500,Math.round(e.size/2e3));let i=!1;const c=()=>{if(i)return;const a=Date.now()-l,d=Math.min(1,a/s),f=1-Math.pow(1-d,2);if(n==null||n(f),d<1)requestAnimationFrame(c);else{const u=Xr(e);if(typeof document>"u"){o({url:u});return}const h=document.createElement("img");let p=!1;const m=(k,x)=>{p||(p=!0,o({url:u,width:k,height:x}))};h.onload=()=>m(h.naturalWidth||void 0,h.naturalHeight||void 0),h.onerror=()=>m(),h.src=u,setTimeout(()=>m(),5e3)}};requestAnimationFrame(c),e.type.startsWith("image/")||(i=!0,setTimeout(()=>r(new Error("Not an image file")),30))})}function vd(e,n){return new Promise(o=>{const r=Xr(n),l=new AbortController;wn(e,{status:"pending",progress:0,file:n,tempPreviewUrl:r,controller:l});let s,i;if(typeof document<"u"){const c=document.createElement("img");let a=!1;const d=()=>{a||(a=!0,s=c.naturalWidth||void 0,i=c.naturalHeight||void 0)};c.onload=d,c.onerror=d,c.src=r,setTimeout(d,4e3)}try{Di(n.name,n,l,{onProgress:c=>{const a=Xn(e);if(!a)return;const d=Math.max(0,Math.min(1,Number.isFinite(c)?c:0));wn(e,{...a,progress:d})},onSuccess:c=>{const a=Xn(e);if(a!=null&&a.tempPreviewUrl&&a.tempPreviewUrl!==c.url){try{URL.revokeObjectURL(a.tempPreviewUrl)}catch{}ar.delete(a.tempPreviewUrl)}wn(e,null),o({ok:!0,value:{url:c.url,width:c.width??s,height:c.height??i,alt:c.alt,title:c.title,fileId:c.fileId}})},onError:c=>{const a=Xn(e);wn(e,{status:"error",progress:0,error:c,file:(a==null?void 0:a.file)??n,tempPreviewUrl:a==null?void 0:a.tempPreviewUrl}),o({ok:!1,error:c})}})}catch(c){const a=c instanceof Error?c.message:String(c);wn(e,{status:"error",progress:0,error:a,file:n,tempPreviewUrl:r}),o({ok:!1,error:a})}})}async function Qr(e,n){if(!e)return null;try{if(e.startsWith("data:"))return Cd(e,n);const o=await fetch(e);if(!o.ok)return null;const r=await o.blob(),l=$i(r.type,e),s=n?Pi(n,l):`image-${Date.now()}${l}`;return new File([r],s,{type:r.type||"image/png"})}catch{return null}}function Cd(e,n){const o=e.match(/^data:([^;,]+)?(;base64)?,(.*)$/);if(!o)return null;const[,r,l,s]=o,i=r||"image/png",c=!!l;let a;if(c){const h=atob(s);a=new Uint8Array(h.length);for(let p=0;p<h.length;p++)a[p]=h.charCodeAt(p)}else{const h=decodeURIComponent(s);a=new TextEncoder().encode(h)}const d=$i(i,e),f=n?Pi(n,d):`image-${Date.now()}${d}`,u=new Blob([a],{type:i});return new File([u],f,{type:i})}function $i(e,n){if(e.includes("png"))return".png";if(e.includes("jpeg")||e.includes("jpg"))return".jpg";if(e.includes("gif"))return".gif";if(e.includes("webp"))return".webp";if(e.includes("svg"))return".svg";if(e.includes("bmp"))return".bmp";const o=n.match(/\.(png|jpe?g|gif|webp|svg|bmp)$/i);return o?`.${o[1].toLowerCase()}`:".png"}function Pi(e,n){return e.toLowerCase().endsWith(n.toLowerCase())?e:e+n}const Td=["data-block-id","data-empty","data-placeholder","contenteditable"],Un=t.defineComponent({__name:"BlockContent",props:{block:{},placeholder:{}},emits:["slashTrigger","inputChanged","linkClick","focusIn"],setup(e,{emit:n}){const o=e,r=n,l=fn(),s=Yn(),i=t.ref(null),c=t.shallowRef(!1);function a(){return Ae(o.block.content).length===0}const d=t.ref(a());t.onMounted(()=>{const S=i.value;if(!S)return;const K=Ae(o.block.content);Ei(o.block.content)?S.innerHTML=Zn(o.block.content):S.textContent=K,d.value=K.length===0});function f(S){const K=window.getSelection();if(!K||K.rangeCount===0)return null;const _=K.getRangeAt(0);if(!S.contains(_.commonAncestorContainer))return null;const O=document.createRange();O.selectNodeContents(S),O.setEnd(_.startContainer,_.startOffset);const M=O.toString().length;O.setEnd(_.endContainer,_.endOffset);const E=O.toString().length;return{from:Math.min(M,E),to:Math.max(M,E)}}function u(S,K){const _=document.createTreeWalker(S,NodeFilter.SHOW_TEXT);let O=Math.max(0,K),M=null;for(;_.nextNode();){const E=_.currentNode;M=E;const N=(E.nodeValue??"").length;if(O<=N)return{node:E,offset:O};O-=N}return M?{node:M,offset:(M.nodeValue??"").length}:{node:S,offset:0}}function h(S,K,_){const O=window.getSelection();if(!O)return;const M=u(S,K),E=u(S,Math.max(K,_));try{const N=document.createRange();K<=_?(N.setStart(M.node,M.offset),N.setEnd(E.node,E.offset)):(N.setStart(E.node,E.offset),N.setEnd(M.node,M.offset)),O.removeAllRanges(),O.addRange(N)}catch{try{const N=document.createRange();N.setStart(E.node,E.offset),N.collapse(!0),O.removeAllRanges(),O.addRange(N)}catch{}}}t.watch(()=>o.block,S=>{if(c.value)return;const K=i.value;if(!K)return;const _=f(K),O=_&&_.from!==_.to,M=document.activeElement===K,E=Ae(S.content),N=E.length===0;let A=!1;if(N)K.childNodes.length>0&&(K.textContent="",A=!0);else{const W=Ei(S.content),me=!!K.querySelector(Da);if(!W&&!me)K.textContent!==E&&(K.textContent=E,A=!0);else{const le=vi(mn(K)),he=vi(S.content);le!==he&&(K.innerHTML=Zn(S.content),A=!0)}}d.value=N,A&&_&&(M||O)&&h(K,_.from,_.to)});function p(S){S.key==="Enter"&&!S.shiftKey&&!S.isComposing&&S.preventDefault()}function m(S){var A,W;if(!s.value)return;const K=i.value;if(!K)return;const _=mn(K),O=Ae(_);if(d.value=O.length===0,r("inputChanged",o.block.id,O),c.value||Ia({editor:l,registry:l.registries.inputRules,blockId:o.block.id,text:O}))return;if(Ba(O)){const me=O.match(/\/([^/]*)$/),le=O.lastIndexOf("/"),he=me&&me[1]!==void 0?me[1]:le>=0?O.slice(le+1):"";r("slashTrigger",K,o.block.id,he)}let E=_;l.registries.schema.get(o.block.type).inlineMarks&&S.data&&/\s/.test(S.data)&&(E=lr(_)),(W=(A=l.commands).setText)==null||W.call(A,{id:o.block.id,content:E})}function k(S){c.value=!0}function x(S){var N,A;if(c.value=!1,!s.value)return;const K=i.value;if(!K)return;const _=mn(K),O=Ae(_);d.value=O.length===0,r("inputChanged",o.block.id,O);const E=l.registries.schema.get(o.block.type).inlineMarks?lr(_):_;(A=(N=l.commands).setText)==null||A.call(N,{id:o.block.id,content:E})}function D(){const S=i.value;if(!S)return null;const K=window.getSelection();if(!K||K.rangeCount===0)return null;const _=K.getRangeAt(0);if(!S.contains(_.commonAncestorContainer))return null;const O=Ae(o.block.content),M=document.createRange();M.selectNodeContents(S),M.setEnd(_.startContainer,_.startOffset);const E=Math.min(M.toString().length,O.length);M.setEnd(_.endContainer,_.endOffset);const N=Math.min(M.toString().length,O.length);return[Math.min(E,N),Math.max(E,N)]}function U(S){var W,me;const K=D();if(!K)return;const[_,O]=K;if(_===O)return;const[,M]=Wt(o.block.content,_),[E]=Wt(M,O-_),N=Ae(E),A=Zn(E);S.preventDefault(),(W=S.clipboardData)==null||W.setData("text/plain",N),(me=S.clipboardData)==null||me.setData("text/html",A)}function F(S){var le,he,ae,ie;if(!s.value){S.preventDefault();return}const K=D();if(!K)return;const[_,O]=K;if(_===O)return;const[M,E]=Wt(o.block.content,_),[N,A]=Wt(E,O-_),W=Ae(N),me=Zn(N);S.preventDefault(),(le=S.clipboardData)==null||le.setData("text/plain",W),(he=S.clipboardData)==null||he.setData("text/html",me),(ie=(ae=l.commands).setText)==null||ie.call(ae,{id:o.block.id,content:[...M,...A],selectionAfter:st(o.block.id,_)})}const ee=_a();function $(S){const K=[],_=new Set;if(S.items&&S.items.length>0)for(let O=0;O<S.items.length;O++){const M=S.items[O];if(M.kind!=="file")continue;const E=M.getAsFile();if(!E||!E.type.startsWith("image/"))continue;const N=`${E.name||""}:${E.size}:${E.type}`;_.has(N)||(_.add(N),K.push(E))}if(S.files&&S.files.length>0)for(let O=0;O<S.files.length;O++){const M=S.files[O];if(!M.type.startsWith("image/"))continue;const E=`${M.name||""}:${M.size}:${M.type}`;_.has(E)||(_.add(E),K.push(M))}return K}async function V(S){var Mt,Zt,Gt,Rt,tt,yt,vt,Ze,Ve,Ct,fe,Tt,Xe,Re,qt,rt,Et,P,w,z,we,ve,nt,lt,on,cn,He,vn,Xt,bn,Cn,Tn;if(!s.value){S.preventDefault();return}const K=S.clipboardData;if(!K)return;if(ee){const Me=$(K);if(Me.length>0){S.preventDefault();let Ie=o.block.id;for(let Ge=0;Ge<Me.length;Ge++){const ct=Me[Ge],Ke=await ee(ct,{relativeToBlockId:Ie,convertIfEmpty:Ge===0,position:"after"});Ke&&(Ie=Ke)}return}}const _=K.getData("text/html"),O=K.getData("text/plain"),M=sd(_||null,O||null);if(M.length===0)return;const E=M.some(Me=>Me.type==="image"),N=D(),A=Ae(o.block.content).length,W=N?N[0]:A,me=N?N[1]:A,[le]=Wt(o.block.content,W),[,he]=Wt(o.block.content,me),ae=l.registries.schema.get(o.block.type),ie=Me=>ae.inlineMarks?Me:Me.map(Ie=>({type:"text",text:Ie.text}));if(!E){if(M.length===1){const Ge=ie(M[0].content);if(ae.inlineMarks&&W<me&&Ge.length===1&&Ge[0].type==="text"&&!Ge[0].marks){const At=Ge[0].text;if(Ur(At)){const an=to(At),Lt=Pn(an);if(Lt){(Zt=(Mt=l.commands).setLink)==null||Zt.call(Mt,{id:o.block.id,href:Lt,from:W,to:me});return}}}const ct=[...le,...Ge,...he],Ke=ae.inlineMarks?lr(ct):ct,_t=Ae(le).length,ft=Ae(Ge).length,ht=_t+ft;(Rt=(Gt=l.commands).setText)==null||Rt.call(Gt,{id:o.block.id,content:Ke,selectionAfter:st(o.block.id,ht)});return}const Me=[...le,...ie(M[0].content)];(yt=(tt=l.commands).setText)==null||yt.call(tt,{id:o.block.id,content:Me});let Ie=o.block.id;for(let Ge=1;Ge<M.length;Ge++){const ct=M[Ge],Ke=Ge===M.length-1,_t=ie(ct.content),ft=Ke?[..._t,...he]:_t,ht=l.registries.schema.coerceAttrsFor(ct.type,ct.attrs);(Ze=(vt=l.commands).insertBlock)==null||Ze.call(vt,{after:Ie,type:ct.type,attrs:ht,content:ft});const At=l.getState();if(At.selection.kind==="caret"&&(Ie=At.selection.blockId),Ke){const an=Ae(_t).length,Lt=he.length>0?an:Ae(ft).length;(Ct=(Ve=l.commands).setSelection)==null||Ct.call(Ve,{selection:st(Ie,Lt)})}}return}if(!ee){const Me=M.filter(Ie=>Ie.type!=="image");if(Me.length===0)return;if(M.splice(0,M.length,...Me),M.length===1){const Ie=ie(M[0].content),Ge=[...le,...Ie,...he];(Tt=(fe=l.commands).setText)==null||Tt.call(fe,{id:o.block.id,content:Ge,selectionAfter:st(o.block.id,Ae(le).length+Ae(Ie).length)})}return}let Se=-1;for(let Me=M.length-1;Me>=0;Me--)if(M[Me].type!=="image"){Se=Me;break}let Te=o.block.id;const We=M[0];if(We.type!=="image"){const Ie=Se===0?[...le,...ie(We.content),...he]:[...le,...ie(We.content)];(Re=(Xe=l.commands).setText)==null||Re.call(Xe,{id:o.block.id,content:Ie}),Te=o.block.id}else{const Me=le.length===0&&he.length===0,Ie=We.attrs.src,Ge=We.attrs.alt??"";if(Me){const ct=await Qr(Ie,Ge||void 0);if(ct){const Ke=await ee(ct,{relativeToBlockId:Te,position:"after",convertIfEmpty:!0});Ke&&(Te=Ke)}else{const Ke=l.registries.schema.coerceAttrsFor(We.type,We.attrs);(rt=(qt=l.commands).replaceBlock)==null||rt.call(qt,{id:o.block.id,type:We.type,attrs:Ke}),Te=o.block.id}}else{(P=(Et=l.commands).setText)==null||P.call(Et,{id:o.block.id,content:le});const ct=await Qr(Ie,Ge||void 0);if(ct){const Ke=await ee(ct,{relativeToBlockId:Te,position:"after",convertIfEmpty:!1});Ke&&(Te=Ke)}else{const Ke=l.registries.schema.coerceAttrsFor(We.type,We.attrs);(z=(w=l.commands).insertBlock)==null||z.call(w,{after:Te,type:We.type,attrs:Ke,content:[]});const _t=l.getState();_t.selection.kind==="caret"&&(Te=_t.selection.blockId)}}}for(let Me=1;Me<M.length;Me++){const Ie=M[Me],Ge=Me===Se;if(Ie.type==="image"){const ct=Ie.attrs.src,Ke=Ie.attrs.alt??"",_t=await Qr(ct,Ke||void 0);if(_t){const ft=await ee(_t,{relativeToBlockId:Te,position:"after",convertIfEmpty:!1});ft&&(Te=ft)}else{const ft=l.registries.schema.coerceAttrsFor(Ie.type,Ie.attrs);(ve=(we=l.commands).insertBlock)==null||ve.call(we,{after:Te,type:Ie.type,attrs:ft,content:[]});const ht=l.getState();ht.selection.kind==="caret"&&(Te=ht.selection.blockId)}}else{const ct=ie(Ie.content),Ke=Ge?[...ct,...he]:ct,_t=l.registries.schema.coerceAttrsFor(Ie.type,Ie.attrs);(lt=(nt=l.commands).insertBlock)==null||lt.call(nt,{after:Te,type:Ie.type,attrs:_t,content:Ke});const ft=l.getState();if(ft.selection.kind==="caret"&&(Te=ft.selection.blockId),Ge){const ht=Ae(ct).length,At=he.length>0?ht:Ae(Ke).length;(cn=(on=l.commands).setSelection)==null||cn.call(on,{selection:st(Te,At)})}}}if(Se===-1&&he.length>0){(vn=(He=l.commands).insertBlock)==null||vn.call(He,{after:Te,type:"paragraph",attrs:{},content:he});const Me=l.getState();Me.selection.kind==="caret"&&(Te=Me.selection.blockId,(bn=(Xt=l.commands).setSelection)==null||bn.call(Xt,{selection:st(Te,Ae(he).length)}))}else Se===-1&&(le.length>0||he.length>0)&&((Tn=(Cn=l.commands).insertBlock)==null||Tn.call(Cn,{after:Te,type:"paragraph",attrs:{},content:[]}))}function re(){r("focusIn",o.block.id)}function G(){}function ne(S){return document.createTreeWalker(S,NodeFilter.SHOW_TEXT).nextNode()}function Z(S){var N;const K=S.target;if(!K)return;const _=K.closest("a");if(!_||!((N=i.value)!=null&&N.contains(_)))return;S.preventDefault();const O=window.getSelection();let M=0;if(O&&O.rangeCount>0&&!!_.contains(O.getRangeAt(0).commonAncestorContainer)){const A=O.getRangeAt(0),W=document.createRange();W.selectNodeContents(i.value),W.setEnd(A.startContainer,A.startOffset),M=W.toString().length}else{const A=ne(_);if(A){const W=document.createRange();W.selectNodeContents(i.value),W.setEnd(A,0),M=W.toString().length}}r("linkClick",o.block.id,M)}return(S,K)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:i,class:"block-content","data-block-id":e.block.id,"data-empty":d.value,"data-placeholder":e.placeholder,contenteditable:t.unref(s),spellcheck:"false",onInput:m,onCompositionstart:k,onCompositionend:x,onFocus:re,onBlur:G,onKeydown:p,onClick:Z,onPaste:t.withModifiers(V,["prevent"]),onCopy:U,onCut:F},null,40,Td))}});function Hi(e){return e==="zh-CN"||e===null||e===void 0||e===""?"zh-CN":"en-US"}function Vi(e){return e==="dark"?"dark":"light"}const _d={"zh-CN":{"editor.placeholder":"输入文字,或按 '/' 获取命令…","handle.plus.title":"点击添加块","handle.plus.ariaLabel":"Insert block below","handle.grip.title":"拖拽移动 / 点击设置","handle.grip.ariaLabel":"Drag to move block, click to open settings","ui.scrollUp":"向上滚动","ui.scrollDown":"向下滚动","ui.scrollLeft":"向左","ui.scrollRight":"向右","plus.category.basic":"基本区块","plus.category.list":"列表","plus.category.other":"其他","plus.noMatch":"未找到匹配的命令","plus.searchPlaceholder":"搜索命令…","slash.paragraph.title":"正文","slash.paragraph.description":"普通文本段落。","slash.heading1.title":"一级标题","slash.heading1.description":"用于文章的主标题。","slash.heading2.title":"二级标题","slash.heading2.description":"用于主要章节的标题。","slash.heading3.title":"三级标题","slash.heading3.description":"用于子章节的标题。","slash.heading4.title":"四级标题","slash.heading4.description":"用于更细分层的标题。","slash.heading5.title":"五级标题","slash.heading5.description":"用于较小层级的标题。","slash.heading6.title":"六级标题","slash.heading6.description":"用于最小层级的标题。","slash.bulletList.title":"项目符号列表","slash.bulletList.description":"创建一个无序列表。","slash.orderedList.title":"编号列表","slash.orderedList.description":"创建一个带编号的有序列表。","slash.todoList.title":"待办列表","slash.todoList.description":"用复选框追踪待办任务。","slash.quote.title":"引用","slash.quote.description":"引用一段话。","slash.codeBlock.title":"代码块","slash.codeBlock.description":"插入一段代码块。","codeBlock.title":"代码块","slash.divider.title":"分隔符","slash.divider.description":"插入一条水平分隔线。","slash.image.title":"图片","slash.image.description":"插入一张图片(从本地上传或选择文件)。","slash.table3x3.title":"表格(3×3)","slash.table3x3.description":"插入一个 3 行 3 列的表格。","slash.table2x2.title":"表格(2×2)","slash.table2x2.description":"插入一个 2 行 2 列的表格。","slash.table4x4.title":"表格(4×4)","slash.table4x4.description":"插入一个 4 行 4 列的表格。","bsm.section.turnInto":"转换为","bsm.section.alignIndent":"对齐与缩进","bsm.section.align":"对齐","bsm.section.indent":"缩进","bsm.section.action":"操作","bsm.section.textColor":"文字颜色","bsm.section.bgColor":"背景颜色","bsm.indent.decrease":"减少缩进","bsm.indent.increase":"增加缩进","turnInto.paragraph":"正文","turnInto.h1":"一级标题","turnInto.h2":"二级标题","turnInto.h3":"三级标题","turnInto.h4":"四级标题","turnInto.h5":"五级标题","turnInto.h6":"六级标题","turnInto.bullet":"项目符号","turnInto.ordered":"编号列表","turnInto.todo":"待办","turnInto.quote":"引用","turnInto.code":"代码块","align.left":"左对齐","align.center":"居中","align.right":"右对齐","align.justify":"两端对齐","verticalAlign.top":"顶端对齐","verticalAlign.middle":"垂直居中","verticalAlign.bottom":"底端对齐","hoverToolbar.verticalAlignBtnTitle":"垂直对齐","action.duplicate":"复制","action.copy":"拷贝","action.cut":"剪切","action.moveUp":"上移","action.moveDown":"下移","action.delete":"删除","ol.continue":"继续之前的编号","ol.startNew":"开始新列表(从1开始)","ol.modify":"修改编号值…","numberPicker.title":"修改编号值","numberPicker.inputLabel":"编号值","numberPicker.confirm":"确定","codeLang.title":"设置代码类型","codeLang.inputLabel":"代码类型","codeLang.placeholder":"请输入代码类型","codeLang.confirm":"确定","codeLang.custom":"自定义…","codeLang.cancel":"取消","codeLang.plain":"纯文本","hoverToolbar.label":"格式化","hoverToolbar.typeBtnTitle":"切换块类型","hoverToolbar.alignBtnTitle":"对齐方式","hoverToolbar.colorBtnTitle":"颜色","hoverToolbar.textColor":"文字颜色","hoverToolbar.bgColor":"背景颜色","hoverToolbar.copySelection":"复制选中文本","hoverToolbar.deleteBlock":"删除块","mark.bold":"加粗","mark.italic":"斜体","mark.underline":"下划线","mark.strikethrough":"删除线","mark.inlineCode":"行内代码","mark.link":"链接","link.popoverLabel":"链接","link.open":"打开链接","link.copy":"复制链接","link.edit":"编辑链接","link.remove":"移除链接","link.save":"保存","link.cancel":"取消","link.urlPlaceholder":"输入链接地址…","link.textPlaceholder":"链接文本…","link.emptyUrl":"(空链接)","link.invalidUrl":"请输入有效的链接地址","hoverToolbar.linkBtnTitle":"链接","color.default":"默认","color.gray":"灰色","color.brown":"棕色","color.orange":"橙色","color.yellow":"黄色","color.green":"绿色","color.blue":"蓝色","color.purple":"紫色","color.pink":"粉色","color.red":"红色","color.none":"无","image.uploading":"正在上传图片…","image.uploadFailed":"上传失败","image.loadFailed":"图片加载失败","image.retry":"重试","image.replace":"替换图片","image.remove":"删除图片","image.resize":"拖拽调整尺寸","image.emptyTitle":"点击上传图片","image.emptySub":"或拖入图片文件到此处","image.captionPlaceholder":"添加图片说明…","turnInto.image":"图片","table.title":"表格","table.cellPlaceholder":"输入内容…","table.resizeCol":"拖拽调整列宽","table.rowActions":"行操作","table.colActions":"列操作","table.selectRow":"选择此行","table.selectCol":"选择此列","table.selectAll":"选择整个表格","table.insertRowAbove":"在上方插入行","table.insertRowBelow":"在下方插入行","table.insertColLeft":"在左侧插入列","table.insertColRight":"在右侧插入列","table.removeRow":"删除此行","table.removeCol":"删除此列","table.deleteRow":"删除行","table.deleteCol":"删除列","table.toggleHeader":"切换表头行","table.mergeCells":"合并单元格","table.splitCell":"拆分单元格","table.deleteTable":"删除表格","turnInto.table":"表格","toc.title":"目录","toc.empty":"暂无标题","slash.tableOfContents.title":"目录","slash.tableOfContents.description":"插入文档目录。"},"en-US":{"editor.placeholder":"Type '/' for commands...","handle.plus.title":"Insert block below","handle.plus.ariaLabel":"Insert block below","handle.grip.title":"Drag to move / click for settings","handle.grip.ariaLabel":"Drag to move block, click to open settings","ui.scrollUp":"Scroll up","ui.scrollDown":"Scroll down","ui.scrollLeft":"Scroll left","ui.scrollRight":"Scroll right","plus.category.basic":"Basic blocks","plus.category.list":"Lists","plus.category.other":"Other","plus.noMatch":"No matching commands","plus.searchPlaceholder":"Search commands...","slash.paragraph.title":"Paragraph","slash.paragraph.description":"Plain text paragraph.","slash.heading1.title":"Heading 1","slash.heading1.description":"Main title for the document.","slash.heading2.title":"Heading 2","slash.heading2.description":"Title for major sections.","slash.heading3.title":"Heading 3","slash.heading3.description":"Title for sub-sections.","slash.heading4.title":"Heading 4","slash.heading4.description":"Title for finer hierarchy levels.","slash.heading5.title":"Heading 5","slash.heading5.description":"Title for smaller hierarchy levels.","slash.heading6.title":"Heading 6","slash.heading6.description":"Title for the smallest hierarchy level.","slash.bulletList.title":"Bullet list","slash.bulletList.description":"Create an unordered list.","slash.orderedList.title":"Numbered list","slash.orderedList.description":"Create a numbered ordered list.","slash.todoList.title":"To-do list","slash.todoList.description":"Track tasks with checkboxes.","slash.quote.title":"Quote","slash.quote.description":"Quote a passage of text.","slash.codeBlock.title":"Code block","slash.codeBlock.description":"Insert a code block.","codeBlock.title":"Code block","slash.divider.title":"Divider","slash.divider.description":"Insert a horizontal divider line.","slash.image.title":"Image","slash.image.description":"Insert an image (upload or choose a file).","slash.table3x3.title":"Table (3×3)","slash.table3x3.description":"Insert a 3-row 3-column table.","slash.table2x2.title":"Table (2×2)","slash.table2x2.description":"Insert a 2-row 2-column table.","slash.table4x4.title":"Table (4×4)","slash.table4x4.description":"Insert a 4-row 4-column table.","bsm.section.turnInto":"Turn into","bsm.section.alignIndent":"Align & Indent","bsm.section.align":"Align","bsm.section.indent":"Indent","bsm.section.action":"Actions","bsm.section.textColor":"Text color","bsm.section.bgColor":"Background color","bsm.indent.decrease":"Decrease indent","bsm.indent.increase":"Increase indent","turnInto.paragraph":"Paragraph","turnInto.h1":"Heading 1","turnInto.h2":"Heading 2","turnInto.h3":"Heading 3","turnInto.h4":"Heading 4","turnInto.h5":"Heading 5","turnInto.h6":"Heading 6","turnInto.bullet":"Bullet list","turnInto.ordered":"Numbered list","turnInto.todo":"To-do","turnInto.quote":"Quote","turnInto.code":"Code block","align.left":"Align left","align.center":"Center","align.right":"Align right","align.justify":"Justify","verticalAlign.top":"Align top","verticalAlign.middle":"Vertical center","verticalAlign.bottom":"Align bottom","hoverToolbar.verticalAlignBtnTitle":"Vertical align","action.duplicate":"Duplicate","action.copy":"Copy","action.cut":"Cut","action.moveUp":"Move up","action.moveDown":"Move down","action.delete":"Delete","ol.continue":"Continue previous numbering","ol.startNew":"Start a new list (from 1)","ol.modify":"Modify starting number...","numberPicker.title":"Modify number value","numberPicker.inputLabel":"Number value","numberPicker.confirm":"Confirm","codeLang.title":"Set code language","codeLang.inputLabel":"Code language","codeLang.placeholder":"Enter code language","codeLang.confirm":"Confirm","codeLang.custom":"Custom…","codeLang.cancel":"Cancel","codeLang.plain":"Plain text","hoverToolbar.label":"Formatting","hoverToolbar.typeBtnTitle":"Switch block type","hoverToolbar.alignBtnTitle":"Alignment","hoverToolbar.colorBtnTitle":"Color","hoverToolbar.textColor":"Text color","hoverToolbar.bgColor":"Background color","hoverToolbar.copySelection":"Copy selection","hoverToolbar.deleteBlock":"Delete block","mark.bold":"Bold","mark.italic":"Italic","mark.underline":"Underline","mark.strikethrough":"Strikethrough","mark.inlineCode":"Inline code","mark.link":"Link","link.popoverLabel":"Link","link.open":"Open link","link.copy":"Copy link","link.edit":"Edit link","link.remove":"Remove link","link.save":"Save","link.cancel":"Cancel","link.urlPlaceholder":"Enter URL...","link.textPlaceholder":"Link text...","link.emptyUrl":"(empty link)","link.invalidUrl":"Please enter a valid URL","hoverToolbar.linkBtnTitle":"Link","hoverToolbar.linkPrompt":"Enter URL:","color.default":"Default","color.gray":"Gray","color.brown":"Brown","color.orange":"Orange","color.yellow":"Yellow","color.green":"Green","color.blue":"Blue","color.purple":"Purple","color.pink":"Pink","color.red":"Red","color.none":"None","image.uploading":"Uploading image...","image.uploadFailed":"Upload failed","image.loadFailed":"Failed to load image","image.retry":"Retry","image.replace":"Replace image","image.remove":"Remove image","image.resize":"Drag to resize","image.emptyTitle":"Click to upload an image","image.emptySub":"or drag an image file here","image.captionPlaceholder":"Add a caption...","turnInto.image":"Image","table.title":"Table","table.cellPlaceholder":"Type here...","table.resizeCol":"Drag to resize column","table.rowActions":"Row actions","table.colActions":"Column actions","table.selectRow":"Select row","table.selectCol":"Select column","table.selectAll":"Select entire table","table.insertRowAbove":"Insert row above","table.insertRowBelow":"Insert row below","table.insertColLeft":"Insert column left","table.insertColRight":"Insert column right","table.removeRow":"Delete row","table.removeCol":"Delete column","table.deleteRow":"Delete row","table.deleteCol":"Delete column","table.toggleHeader":"Toggle header row","table.mergeCells":"Merge cells","table.splitCell":"Split cell","table.deleteTable":"Delete table","turnInto.table":"Table","toc.title":"Table of Contents","toc.empty":"No headings","slash.tableOfContents.title":"Table of Contents","slash.tableOfContents.description":"Insert a table of contents."}},Ui=Symbol("be-locale"),zi=Symbol("be-theme");function xd(e,n){t.provide(Ui,e),t.provide(zi,n)}function en(){const e=t.inject(Ui,t.ref("zh-CN")),n=t.inject(zi,t.ref("light"));return{get locale(){return e.value},get theme(){return n.value},t(o){const l=_d[e.value][o];return typeof l=="string"?l:o}}}const Md=["title","aria-label","onKeydown"],Nd=["title","aria-label","onKeydown"],Sd=4,Ad=300,Id=t.defineComponent({__name:"BlockHandle",props:{blockId:{},visible:{type:Boolean}},emits:["openPlusMenu","openSettingsMenu","gripPointerDown","gripPointerUp"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:s}=en(),i=Yn(),c=t.ref(null),a=t.ref(null),d=t.ref(null),f=t.ref(!1),u=t.ref(!1),h=t.ref(null);let p=null;const m=t.computed(()=>h.value===null?void 0:{top:`${h.value}px`});function k(){var O;const S=(O=c.value)==null?void 0:O.parentElement;if(!S)return null;const K=S.querySelector(".block-host-content");if(!K)return null;const _=K.firstElementChild;return _ instanceof HTMLElement?_:K}function x(){var M;const S=(M=c.value)==null?void 0:M.parentElement,K=k();if(!S||!K)return;const _=S.getBoundingClientRect(),O=K.getBoundingClientRect();h.value=O.top-_.top+O.height/2}function D(){const S=k();S&&(U(),p=new ResizeObserver(()=>x()),p.observe(S))}function U(){p==null||p.disconnect(),p=null}t.watch(()=>r.visible,S=>{S?t.nextTick().then(()=>{x(),D()}):U()}),t.onMounted(x),t.onBeforeUnmount(U);function F(){i.value&&a.value&&l("openPlusMenu",a.value)}let ee=0,$=0,V=0,re=!1;function G(S){i.value&&(V=Date.now(),ee=S.clientX,$=S.clientY,re=!0,u.value=!1,l("gripPointerDown",r.blockId,ee,$,{thresholdPx:Sd}))}function ne(S){u.value=S}function Z(){i.value&&(u.value||re&&Date.now()-V>Ad||(re=!1,d.value&&l("openSettingsMenu",d.value)))}return n({isOpen:f,insertBtn:a,gripBtn:d,setLocalDragging:ne}),(S,K)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handleEl",ref:c,class:t.normalizeClass(["block-handle",{visible:e.visible,dragging:u.value}]),style:t.normalizeStyle(m.value)},[t.createElementVNode("div",{ref_key:"insertBtn",ref:a,class:"handle-btn handle-insert",role:"button",tabindex:"0",title:t.unref(s)("handle.plus.title"),"aria-label":t.unref(s)("handle.plus.ariaLabel"),onMousedown:t.withModifiers(F,["prevent","stop"]),onKeydown:[t.withKeys(t.withModifiers(F,["prevent","stop"]),["enter"]),t.withKeys(t.withModifiers(F,["prevent","stop"]),["space"])]},[...K[0]||(K[0]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[t.createElementVNode("path",{d:"M8 3.5V12.5M3.5 8H12.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],40,Md),t.createElementVNode("div",{ref_key:"gripBtn",ref:d,class:"handle-btn handle-grip",role:"button",tabindex:"0",title:t.unref(s)("handle.grip.title"),"aria-label":t.unref(s)("handle.grip.ariaLabel"),onMousedown:t.withModifiers(G,["prevent","stop"]),onClick:t.withModifiers(Z,["stop"]),onKeydown:[t.withKeys(t.withModifiers(Z,["prevent","stop"]),["enter"]),t.withKeys(t.withModifiers(Z,["prevent","stop"]),["space"])]},[...K[1]||(K[1]=[t.createStaticVNode('<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><circle cx="5" cy="4" r="1.3" fill="currentColor"></circle><circle cx="11" cy="4" r="1.3" fill="currentColor"></circle><circle cx="5" cy="8" r="1.3" fill="currentColor"></circle><circle cx="11" cy="8" r="1.3" fill="currentColor"></circle><circle cx="5" cy="12" r="1.3" fill="currentColor"></circle><circle cx="11" cy="12" r="1.3" fill="currentColor"></circle></svg>',1)])],40,Nd)],6))}}),Bd=["data-block-id","data-block-type"],Rd={class:"block-host-content"},Fi=t.defineComponent({__name:"BlockHost",props:{block:{},placeholder:{},hoveredBlockId:{},focusedBlockId:{},hasTextSelection:{type:Boolean},draggingBlockId:{},dropTargetBlockId:{},dropPosition:{},menuOpenBlockId:{}},emits:["openSettingsMenu","openPlusMenu","slashTrigger","inputChanged","hoverChange","gripPointerDown","gripPointerUp","linkClick","focusIn"],setup(e,{expose:n,emit:o}){const r=e,l=o,s=fn(),i=Yn(),c=t.ref(null),a=t.ref(null),d=t.computed(()=>!i.value||r.hasTextSelection?!1:r.hoveredBlockId===r.block.id||r.hoveredBlockId===null&&r.focusedBlockId===r.block.id),f=t.computed(()=>r.draggingBlockId===r.block.id),u=t.computed(()=>r.menuOpenBlockId===r.block.id),h=t.computed(()=>r.dropTargetBlockId===r.block.id),p=t.computed(()=>r.dropPosition??"after");function m(Z,S,K,_){l("gripPointerDown",Z,S,K,_)}function k(Z){l("gripPointerUp",Z)}function x(Z){var S,K;(K=(S=a.value)==null?void 0:S.setLocalDragging)==null||K.call(S,Z)}function D(){l("hoverChange",r.block.id)}function U(){l("hoverChange",null)}function F(Z){l("openPlusMenu",r.block.id,Z)}function ee(Z){l("openSettingsMenu",r.block.id,Z)}function $(Z,S,K){l("slashTrigger",Z,r.block.id,K)}function V(Z,S){l("inputChanged",Z,S)}function re(Z,S){l("linkClick",Z,S)}function G(Z){l("focusIn",Z)}const ne=t.computed(()=>{const Z=s.registries.renderers.get(r.block.type);return Z!=null&&Z.component?Z.component:Un});return n({setHandleDragging:x}),(Z,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"hostEl",ref:c,class:t.normalizeClass(["block-host",{"block-dragging":f.value,"block-menu-active":u.value,"block-drop-target":h.value,"block-drop-before":h.value&&p.value==="before","block-drop-after":h.value&&p.value==="after","block-drop-into":h.value&&p.value==="into","block-host-readonly":!t.unref(i),"block-focused":e.focusedBlockId===e.block.id}]),"data-block-id":e.block.id,"data-block-type":e.block.type,onMouseenter:D,onMouseleave:U},[t.unref(i)?(t.openBlock(),t.createBlock(Id,{key:0,ref_key:"handleRef",ref:a,"block-id":e.block.id,visible:d.value,onOpenPlusMenu:F,onOpenSettingsMenu:ee,onGripPointerDown:m,onGripPointerUp:k},null,8,["block-id","visible"])):t.createCommentVNode("",!0),t.createElementVNode("div",Rd,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(ne.value),{block:e.block,placeholder:e.placeholder,onSlashTrigger:$,onInputChanged:V,onLinkClick:re,onFocusIn:G},null,40,["block","placeholder"]))])],42,Bd))}}),Ki=t.defineComponent({__name:"BlockList",props:{items:{},blocksMap:{},firstBlockPlaceholder:{},isNested:{type:Boolean},hoveredBlockId:{},focusedBlockId:{},hasTextSelection:{type:Boolean},draggingBlockId:{},dropTargetBlockId:{},dropPosition:{},menuOpenBlockId:{}},emits:["openSettingsMenu","openPlusMenu","slashTrigger","inputChanged","hoverChange","gripPointerDown","gripPointerUp","linkClick","focusIn"],setup(e,{expose:n,emit:o}){const r=e,l=o,s=new Map;function i($,V){V?s.set($,V):s.delete($)}function c($,V){var re,G;(G=(re=s.get($))==null?void 0:re.setHandleDragging)==null||G.call(re,V)}function a($){const V=[];for(const re of $.children){const G=r.blocksMap.get(re);G&&V.push({id:re,block:G})}return V}const d=t.computed(()=>!r.isNested&&!r.dropTargetBlockId&&r.dropPosition==="first"&&!!r.draggingBlockId),f=t.computed(()=>!r.isNested&&!r.dropTargetBlockId&&r.dropPosition==="last"&&!!r.draggingBlockId);function u($,V){l("openSettingsMenu",$,V)}function h($,V){l("openPlusMenu",$,V)}function p($,V,re){l("slashTrigger",$,V,re)}function m($,V){l("inputChanged",$,V)}function k($){l("hoverChange",$)}function x(){r.isNested||l("hoverChange",null)}function D($,V,re,G){l("gripPointerDown",$,V,re,G)}function U($){l("gripPointerUp",$)}function F($,V){l("linkClick",$,V)}function ee($){l("focusIn",$)}return n({setBlockHandleDragging:c}),($,V)=>{const re=t.resolveComponent("BlockList",!0);return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["block-list",{"block-children":e.isNested,"drop-indicator-first":d.value,"drop-indicator-last":f.value}]),onMouseleave:x},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.items,(G,ne)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:G.id},[t.createVNode(Fi,{ref_for:!0,ref:Z=>i(G.id,Z),block:G.block,placeholder:!e.isNested&&ne===0?e.firstBlockPlaceholder:void 0,"hovered-block-id":e.hoveredBlockId,"focused-block-id":e.focusedBlockId,"has-text-selection":e.hasTextSelection,"dragging-block-id":e.draggingBlockId,"drop-target-block-id":e.dropTargetBlockId,"drop-position":e.dropPosition,"menu-open-block-id":e.menuOpenBlockId,onOpenSettingsMenu:u,onOpenPlusMenu:h,onSlashTrigger:p,onInputChanged:m,onHoverChange:k,onGripPointerDown:D,onGripPointerUp:U,onLinkClick:F,onFocusIn:ee},null,8,["block","placeholder","hovered-block-id","focused-block-id","has-text-selection","dragging-block-id","drop-target-block-id","drop-position","menu-open-block-id"]),G.block.children.length>0?(t.openBlock(),t.createBlock(re,{key:"__nested_"+G.id,"is-nested":"",items:a(G.block),"hovered-block-id":e.hoveredBlockId,"focused-block-id":e.focusedBlockId,"has-text-selection":e.hasTextSelection,"dragging-block-id":e.draggingBlockId,"drop-target-block-id":e.dropTargetBlockId,"drop-position":e.dropPosition,"menu-open-block-id":e.menuOpenBlockId,"blocks-map":e.blocksMap,onOpenSettingsMenu:V[0]||(V[0]=(Z,S)=>l("openSettingsMenu",Z,S)),onOpenPlusMenu:V[1]||(V[1]=(Z,S)=>l("openPlusMenu",Z,S)),onSlashTrigger:V[2]||(V[2]=(Z,S,K)=>l("slashTrigger",Z,S,K)),onInputChanged:V[3]||(V[3]=(Z,S)=>l("inputChanged",Z,S)),onHoverChange:V[4]||(V[4]=Z=>l("hoverChange",Z)),onGripPointerDown:V[5]||(V[5]=(Z,S,K,_)=>l("gripPointerDown",Z,S,K,_)),onGripPointerUp:V[6]||(V[6]=Z=>l("gripPointerUp",Z)),onLinkClick:V[7]||(V[7]=(Z,S)=>l("linkClick",Z,S)),onFocusIn:V[8]||(V[8]=Z=>l("focusIn",Z))},null,8,["items","hovered-block-id","focused-block-id","has-text-selection","dragging-block-id","drop-target-block-id","drop-position","menu-open-block-id","blocks-map"])):t.createCommentVNode("",!0)],64))),128))],34)}}});function Wi(e,n,o,r=6,l="auto",s=0,i=0){const c=n instanceof HTMLElement?n.getBoundingClientRect():n,a=document.documentElement.clientHeight,d=Ld(),f=Math.max(0,a-c.bottom-r-s),u=Math.max(0,c.top-r-i),h=f>=o.height+r,p=u>=o.height+r,m=l==="down"?!1:l==="up"?!0:!h&&(p||u>f);let k,x,D;const U=c.bottom+r,F=c.top-r;m?(k=Math.max(r+i,F-o.height),x=F,D=Math.max(120,u)):(k=U,x=k+o.height,D=Math.max(120,f));const ee=d-o.width-r,$=Math.max(r,Math.min(ee,c.left));return{top:k,left:$,above:m,availableHeight:D,bottom:x,topBaseline:U}}function Gi(e,n,o,r=8){const l=document.documentElement.clientHeight,s=document.documentElement.clientWidth,i=n.left+(n.width-o.width)/2,c=Math.max(r,Math.min(s-o.width-r,i)),a=l-n.bottom-r,d=n.top-r,f=a>=o.height,u=d>=o.height,h=!f&&(u||d>a),p=n.bottom+r,m=n.top-r,k=h?Math.max(r,m-o.height):p,x=h?m:k+o.height,D=h?Math.max(120,d):Math.max(120,a);return{top:k,left:c,above:h,availableHeight:D,bottom:x,topBaseline:p}}function qi(e,n,o,r=8){const l=document.documentElement.clientHeight,s=document.documentElement.clientWidth,i=n.left+(n.width-o.width)/2,c=Math.max(r,Math.min(s-o.width-r,i)),a=n.top-r,d=l-n.bottom-r,f=a>=o.height,u=d>=o.height,h=f||!u&&a>d||a>=d,p=n.bottom+r,m=n.top-r,k=h?Math.max(r,m-o.height):p,x=h?m:k+o.height,D=h?Math.max(120,a):Math.max(120,d);return{top:k,left:c,above:h,availableHeight:D,bottom:x,topBaseline:p}}function Ld(){return document.documentElement.clientWidth}function dr(e,n){let o=0;function r(d){const f=e.value;if(!f)return;d.preventDefault();const u=d.deltaMode===WheelEvent.DOM_DELTA_LINE?d.deltaY*22:d.deltaY;f.scrollTop+=u,n()}function l(d){d.touches.length===1&&(o=d.touches[0].clientY)}function s(d){if(d.touches.length!==1)return;const f=e.value;if(!f)return;const u=d.touches[0].clientY;f.scrollTop-=u-o,o=u,d.preventDefault(),n()}function i(d){d&&(d.addEventListener("wheel",r,{passive:!1}),d.addEventListener("touchstart",l,{passive:!0}),d.addEventListener("touchmove",s,{passive:!1}))}function c(d){d&&(d.removeEventListener("wheel",r),d.removeEventListener("touchstart",l),d.removeEventListener("touchmove",s))}let a=null;t.watch(e,(d,f,u)=>{c(a),a=d,i(d),u(()=>{c(d),a===d&&(a=null)})},{immediate:!0}),t.onBeforeUnmount(()=>{c(a),a=null})}function Yi(e,n,o,r){function l(u){const h=e.value;if(!h||!u)return!1;if(u instanceof Node&&h.contains(u))return!0;if(r){const p=r(),m=Array.isArray(p)?p:[p];for(const k of m)if(k&&u instanceof Node&&k.contains(u))return!0}return!1}function s(u){n()&&(l(u.target)||o())}function i(u){n()&&(l(u.target)||o())}function c(){n()&&o()}function a(u){u&&u.addEventListener("mouseleave",c)}function d(u){u&&u.removeEventListener("mouseleave",c)}let f=null;t.watch(e,(u,h,p)=>{d(f),f=u,a(u),p(()=>{d(u),f===u&&(f=null)})},{immediate:!0}),t.onMounted(()=>{window.addEventListener("mousedown",s,!0),window.addEventListener("touchstart",s,!0),window.addEventListener("wheel",i,!0)}),t.onBeforeUnmount(()=>{window.removeEventListener("mousedown",s,!0),window.removeEventListener("touchstart",s,!0),window.removeEventListener("wheel",i,!0),d(f),f=null})}const Od=["innerHTML"],pn=t.defineComponent({__name:"SafeHtml",props:{html:{default:""}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("span",{innerHTML:e.html},null,8,Od))}}),Dd=["aria-label"],$d={key:0,class:"slash-menu-empty"},Pd={key:0,class:"slash-menu-group-label"},Hd=["aria-selected","onMousedown","onMouseenter"],Vd={class:"slash-menu-text"},Ud={class:"slash-menu-title"},zd={key:0,class:"slash-menu-desc"},Fd=["aria-label"],Jr=300,Kd=80,Zi=24,Wd=t.defineComponent({__name:"PlusMenu",props:{visible:{type:Boolean},anchorEl:{},blockId:{},query:{},rootEl:{},mode:{default:"slash"}},emits:["close","commit"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:s}=en(),i=t.computed(()=>({basic:s("plus.category.basic"),list:s("plus.category.list"),other:s("plus.category.other")})),c=fn(),a=t.inject(Do,t.ref(!1)),d=t.ref(null),f=t.ref(null),u=t.ref(0),h=t.ref({top:0,left:0,availableHeight:360,above:!1,bottom:0,topBaseline:0}),p=t.ref(!1),m=t.ref(!1),k=t.ref(!1),x=t.ref(!1);let D=null;t.watch(()=>r.visible,M=>{M?(D&&(clearTimeout(D),D=null),x.value=!0):D=setTimeout(()=>{x.value=!1,D=null},300)},{immediate:!0});function U(M){return typeof M=="string"?M:"•"}const F=t.computed(()=>{const M=r.query.trim().toLowerCase(),E=c.registries.slash.all;return M?E.filter(N=>(s(N.title)+" "+(N.keywords??[]).join(" ")).toLowerCase().includes(M)):E}),ee=t.computed(()=>{const M=[],E=new Map;for(const A of F.value){const W=A.category??"other";E.has(W)||E.set(W,[]),E.get(W).push(A)}const N=["basic","list","other"];for(const A of N){const W=E.get(A);W&&W.length>0&&M.push({category:A,label:i.value[A]??A,items:W})}for(const[A,W]of E)N.includes(A)||M.push({category:A,label:i.value[A]??A,items:W});return M});function $(M){return F.value.findIndex(E=>E.id===M)}t.watch([F,()=>r.visible],()=>{u.value=0,t.nextTick(()=>{f.value&&(f.value.scrollTop=0),V()})});function V(){const M=f.value;M&&(m.value=M.scrollTop>1,k.value=M.scrollTop+M.clientHeight<M.scrollHeight-1)}function re(){const M=f.value;M&&(M.scrollTop-=M.clientHeight*.8)}function G(){const M=f.value;M&&(M.scrollTop+=M.clientHeight*.8)}dr(f,V),t.watch(()=>r.visible,M=>{M&&(p.value=!1,h.value={top:0,left:0,availableHeight:360,above:!1,bottom:0,topBaseline:0})}),t.watch([()=>r.visible,()=>r.anchorEl,d,F,m,k],async()=>{if(!r.visible||!r.anchorEl||!r.rootEl)return;await t.nextTick();const M=d.value;if(!M)return;const E=M.getBoundingClientRect(),N=!!r.anchorEl.closest(".fixed-toolbar"),A=N?a.value?"up":"down":"auto",W=N?10:0,me=Wi(r.rootEl,r.anchorEl,{width:Jr,height:E.height},6,A,W,W);h.value=me,p.value=!0,t.nextTick(V)},{flush:"post"});const ne=t.computed(()=>{if(!r.rootEl)return{display:"none"};if(!p.value)return{visibility:"hidden",top:"0px",left:"0px",width:`${Jr}px`,"--scroll-max-height":"100vh"};const M=h.value.above,E=h.value.left,N=(m.value?Zi:0)+(k.value?Zi:0),A=h.value.availableHeight-N,W={left:`${E}px`,width:`${Jr}px`,maxHeight:`${h.value.availableHeight}px`,"--scroll-max-height":`${Math.max(Kd,A)}px`};if(M){const me=document.documentElement.clientHeight;W.bottom=`${Math.max(0,me-h.value.bottom)}px`,W.top="auto"}else W.top=`${h.value.top}px`,W.bottom="auto";return W});function Z(M){if(F.value.length===0)return;const E=F.value.length;u.value=((u.value+M)%E+E)%E,S()}function S(){var N;const M=(N=f.value)==null?void 0:N.querySelectorAll(".slash-menu-item"),E=M==null?void 0:M[u.value];E&&E.scrollIntoView({block:"nearest"}),t.nextTick(V)}function K(M){switch(M.key){case"ArrowDown":return M.preventDefault(),Z(1),!0;case"ArrowUp":return M.preventDefault(),Z(-1),!0;case"PageDown":return M.preventDefault(),Z(5),!0;case"PageUp":return M.preventDefault(),Z(-5),!0;case"Home":return M.preventDefault(),u.value=0,S(),!0;case"End":return M.preventDefault(),u.value=Math.max(0,F.value.length-1),S(),!0;case"Enter":return M.preventDefault(),_(),!0;case"Escape":return M.preventDefault(),l("close"),!0;default:return!1}}function _(){const M=F.value[u.value];M&&l("commit",M,r.mode),l("close")}function O(M){const E=F.value.indexOf(M);E>=0&&(u.value=E),_()}return n({onKeyDown:K}),Yi(d,()=>r.visible,()=>l("close"),()=>r.anchorEl),t.onMounted(()=>{window.addEventListener("resize",V)}),t.onBeforeUnmount(()=>{window.removeEventListener("resize",V)}),(M,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[x.value&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:d,class:t.normalizeClass(["plus-menu slash-menu",{"menu-closing":!e.visible}]),style:t.normalizeStyle(ne.value),role:"listbox"},[m.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(s)("ui.scrollUp"),onMousedown:t.withModifiers(re,["prevent"])},[...E[0]||(E[0]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Dd)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:f,class:"slash-menu-scroll",onScroll:V},[F.value.length===0?(t.openBlock(),t.createElementBlock("div",$d,t.toDisplayString(t.unref(s)("plus.noMatch")),1)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(ee.value,N=>(t.openBlock(),t.createElementBlock("div",{key:N.category,class:"slash-menu-group"},[N.label?(t.openBlock(),t.createElementBlock("div",Pd,t.toDisplayString(N.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.items,A=>(t.openBlock(),t.createElementBlock("div",{key:A.id,class:t.normalizeClass(["slash-menu-item",{active:$(A.id)===u.value}]),"aria-selected":$(A.id)===u.value,role:"option",onMousedown:t.withModifiers(W=>O(A),["prevent"]),onMouseenter:W=>u.value=$(A.id)},[t.createVNode(pn,{class:"slash-menu-icon",html:U(A.icon)},null,8,["html"]),t.createElementVNode("div",Vd,[t.createElementVNode("div",Ud,t.toDisplayString(t.unref(s)(A.title)),1),A.description?(t.openBlock(),t.createElementBlock("div",zd,t.toDisplayString(t.unref(s)(A.description)),1)):t.createCommentVNode("",!0)])],42,Hd))),128))]))),128))],544),k.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(s)("ui.scrollDown"),onMousedown:t.withModifiers(G,["prevent"])},[...E[1]||(E[1]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Fd)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)]))}}),Gd=["left","center","right","justify"],qd=10,tn={align:{default:"left",validate:e=>Gd.includes(e)},color:{default:"default",validate:e=>typeof e=="string"&&e.length>0},bgColor:{default:"default",validate:e=>typeof e=="string"&&e.length>0},indent:{default:0,validate:e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=qd}},Yd={align:tn.align,color:tn.color,bgColor:tn.bgColor},Zd={indent:tn.indent};function En(e){const n=[],o=e.align;typeof o=="string"&&o!=="left"&&n.push(`be-align-${o}`);const r=e.color;typeof r=="string"&&r!=="default"&&n.push(`be-color-${r}`);const l=e.bgColor;typeof l=="string"&&l!=="default"&&n.push(`be-bg-${l}`);const s=e.indent;return typeof s=="number"&&s>0&&n.push(`be-indent-${s}`),n}const Xi=[{key:"default",label:"Default",cssValue:"var(--be-fg)",opacity:1},{key:"gray",label:"Gray",cssValue:"var(--be-color-gray)",opacity:1},{key:"brown",label:"Brown",cssValue:"var(--be-color-brown)",opacity:1},{key:"orange",label:"Orange",cssValue:"var(--be-color-orange)",opacity:1},{key:"yellow",label:"Yellow",cssValue:"var(--be-color-yellow)",opacity:1},{key:"green",label:"Green",cssValue:"var(--be-color-green)",opacity:1},{key:"blue",label:"Blue",cssValue:"var(--be-color-blue)",opacity:1},{key:"purple",label:"Purple",cssValue:"var(--be-color-purple)",opacity:1},{key:"pink",label:"Pink",cssValue:"var(--be-color-pink)",opacity:1},{key:"red",label:"Red",cssValue:"var(--be-color-red)",opacity:1}],ji=[{key:"default",label:"None",cssValue:"transparent",opacity:0},{key:"gray",label:"Gray",cssValue:"var(--be-swatch-bg-gray)",opacity:.15,displayCssValue:"var(--be-swatch-display-bg-gray)"},{key:"brown",label:"Brown",cssValue:"var(--be-swatch-bg-brown)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-brown)"},{key:"orange",label:"Orange",cssValue:"var(--be-swatch-bg-orange)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-orange)"},{key:"yellow",label:"Yellow",cssValue:"var(--be-swatch-bg-yellow)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-yellow)"},{key:"green",label:"Green",cssValue:"var(--be-swatch-bg-green)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-green)"},{key:"blue",label:"Blue",cssValue:"var(--be-swatch-bg-blue)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-blue)"},{key:"purple",label:"Purple",cssValue:"var(--be-swatch-bg-purple)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-purple)"},{key:"pink",label:"Pink",cssValue:"var(--be-swatch-bg-pink)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-pink)"},{key:"red",label:"Red",cssValue:"var(--be-swatch-bg-red)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-red)"}],el='<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="M426.666667 939.050667a32 32 0 1 1 0-64h53.333333V160H235.093333V170.666667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667A32 32 0 0 1 171.093333 170.666667V128a32 32 0 0 1 32-32H820.693333a32 32 0 0 1 31.701334 27.648l0.298666 4.352v42.666667a32 32 0 1 1-64 0l-0.042666-10.666667H544v715.050667H597.333333a32 32 0 0 1 31.701334 27.648l0.298666 4.352a32 32 0 0 1-32 32h-170.666666z" fill="currentColor"/></svg>',ko="M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z",tl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} M848.512 366.933333A32 32 0 0 1 896 394.965333v426.666667a32 32 0 1 1-64 0v-372.565333l-80.554667 44.416a32 32 0 0 1-41.130666-8.96l-2.346667-3.626667a32 32 0 0 1 12.586667-43.477333l128-70.485334z" fill="currentColor"/></svg>`,nl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} M786.133333 362.666667a152.661333 152.661333 0 0 1 107.946667 260.693333l-166.058667 165.973333h178.773334a32 32 0 0 1 31.744 27.648l0.256 4.352a32 32 0 0 1-32 32h-256a32 32 0 0 1-22.613334-54.613333l220.672-220.672A88.661333 88.661333 0 0 0 786.133333 426.666667h-7.338666a96 96 0 0 0-96 96v20.565333a32 32 0 0 1-64 0v-20.565333a160 160 0 0 1 160-160h7.338666z" fill="currentColor"/></svg>`,ol=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m362.410667 192a32 32 0 0 1 22.613333 54.656L809.813333 536.746667l1.792 0.341333a160.085333 160.085333 0 0 1 126.506667 148.053333l0.256 8.490667a160 160 0 0 1-310.912 53.248 32 32 0 0 1 60.373333-21.333333 96 96 0 1 0 90.538667-127.914667h-42.666667a32 32 0 0 1-22.613333-54.613333l116.010667-116.053334h-178.773334a32 32 0 0 1-31.701333-27.648l-0.256-4.352a32 32 0 0 1 32-32h256z" fill="currentColor"/></svg>`,rl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m244.309333 193.493333a32 32 0 0 1 20.992 40.106667l-93.738666 299.776h116.48v-96a32 32 0 0 1 64 0v96h10.666666a32 32 0 0 1 31.744 27.648l0.298667 4.352a32 32 0 0 1-32 32H896v53.333333a32 32 0 1 1-64 0v-53.333333h-160a32 32 0 0 1-30.506667-41.557334l106.666667-341.333333a32 32 0 0 1 40.106667-20.992z" fill="currentColor"/></svg>`,ll=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m363.477333 192.426666a32 32 0 1 1 0 64h-145.706666l-28.245334 113.450667 5.12-1.493333a160.042667 160.042667 0 0 1 100.949334 6.4l9.472 4.266666a160 160 0 1 1-189.610667 249.856 32 32 0 0 1 48-42.325333 96 96 0 1 0 0-126.976c-22.186667 25.130667-63.146667 3.584-55.04-28.928l53.333333-214.016a32 32 0 0 1 31.061334-24.234667h170.666666z" fill="currentColor"/></svg>`,il=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m292.522667 153.173333a32 32 0 0 1 12.586666 43.52l-93.141333 168.874667a159.957333 159.957333 0 0 1 102.4 19.712 158.848 158.848 0 0 1 58.581333 217.685333 160.426667 160.426667 0 0 1-218.453333 58.24 158.890667 158.890667 0 0 1-62.762667-209.962667l157.312-285.44a32 32 0 0 1 43.52-12.586666z m-141.226667 322.517333a94.890667 94.890667 0 0 0 35.072 130.048 96.426667 96.426667 0 0 0 131.242667-34.901333 94.848 94.848 0 0 0-35.114667-130.048 96.426667 96.426667 0 0 0-131.242667 34.901333z" fill="currentColor"/></svg>`,sl='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="3" cy="4" r="1.1" fill="currentColor" stroke="none"/><circle cx="3" cy="8" r="1.1" fill="currentColor" stroke="none"/><circle cx="3" cy="12" r="1.1" fill="currentColor" stroke="none"/><line x1="6.5" y1="4" x2="13.5" y2="4"/><line x1="6.5" y1="8" x2="13.5" y2="8"/><line x1="6.5" y1="12" x2="13.5" y2="12"/></svg>',cl='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.3 3.7L3.1 2.8L3.1 5.8" stroke-width="1.1"/><line x1="6.5" y1="4" x2="13.5" y2="4" stroke-width="1.3"/><path d="M1.8 7.4C1.8 6.6 4.2 6.6 4.2 7.4C4.2 8.2 1.8 9.5 1.8 9.5L4.2 9.5" stroke-width="1.1"/><line x1="6.5" y1="8" x2="13.5" y2="8" stroke-width="1.3"/><path d="M4.2 11.2C4.2 10.5 3 10.5 1.8 11.5C1.8 12 3 12 3 12C3 12 4.2 12 4.2 13C4.2 13.5 3 13.5 1.8 12.8" stroke-width="1.1"/><line x1="6.5" y1="12" x2="13.5" y2="12" stroke-width="1.3"/></svg>',al='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="2.5" width="11" height="11" rx="2.5"/><path d="M5.5 8L7 9.8L10.8 5.8"/></svg>',dl='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="3" width="2" height="10" rx="1" fill="currentColor" stroke="none"/><line x1="6.5" y1="5" x2="13" y2="5"/><line x1="6.5" y1="8" x2="13" y2="8"/><line x1="6.5" y1="11" x2="10" y2="11"/></svg>',ul='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 4L2 8L5 12"/><path d="M11 4L14 8L11 12"/><line x1="10" y1="3" x2="6" y2="13"/></svg>',Xd='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="2" y1="8" x2="14" y2="8"/></svg>',jd='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 3.5h10M2 8h10M2 12.5h10"/><path d="M14.5 3.5v.01M14.5 8v.01M14.5 12.5v.01"/></svg>',Qd='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="1.5"/><circle cx="5.5" cy="6.5" r="1.1" fill="currentColor" stroke="none"/><path d="M13 11.5L10 8.5L7 11.5L5 9.5L3 11.5"/></svg>',Jd='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M12 3a9 9 0 0 1 9 9" opacity="0.25"/><path d="M12 3a9 9 0 0 0-9 9" class="be-spinner-arc"/></g></svg>',eu='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 8a5 5 0 0 1 8.5-3.5M13 3v3h-3"/><path d="M13 8a5 5 0 0 1-8.5 3.5M3 13v-3h3"/></svg>',tu='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4L12 12"/><path d="M12 4L4 12"/></svg>',nu='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 5H12M9 2L12 5L9 8"/><path d="M14 11H4M7 8L4 11L7 14"/></svg>',ou='<svg viewBox="0 0 1024 1024" width="32" height="32" aria-hidden="true"><path d="M768.35456 416a256 256 0 1 0-512 0 192 192 0 1 0 0 384v64a256 256 0 0 1-58.88-505.216 320.128 320.128 0 0 1 629.76 0A256.128 256.128 0 0 1 768.35456 864v-64a192 192 0 0 0 0-384z m-512 384h128v64H256.35456v-64z m384 0h128v64h-128v-64z" fill="currentColor"/><path d="M539.04256 589.184v333.056a32.448 32.448 0 0 1-32 32.192 32.448 32.448 0 0 1-32-32.192V589.184l-36.096 36.096a32.192 32.192 0 0 1-45.056-0.192 31.616 31.616 0 0 1-0.192-45.056l90.88-90.88a31.36 31.36 0 0 1 22.528-9.152 30.08 30.08 0 0 1 22.4 9.088l90.88 90.944a32.192 32.192 0 0 1-0.192 45.056 31.616 31.616 0 0 1-45.056 0.192l-36.096-36.096z" fill="currentColor"/></svg>',ru=["aria-label"],lu={class:"bsm-group"},iu={class:"bsm-icon-grid"},su=["title","onMousedown","onMouseenter"],cu={key:1,class:"bsm-group"},au={class:"bsm-collapse-title"},du={class:"bsm-collapse-body"},uu={class:"bsm-row"},fu=["disabled","title","onMousedown"],mu={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},pu={class:"bsm-row"},hu=["disabled","title"],gu=["disabled","title"],bu={key:2,class:"bsm-group"},ku={class:"bsm-collapse-title"},yu={class:"bsm-collapse-body"},wu={class:"bsm-row"},Eu=["disabled","title"],vu=["disabled","title"],Cu={key:3,class:"bsm-group bsm-colors"},Tu={class:"bsm-collapse-title"},_u={class:"bsm-collapse-body"},xu={class:"bsm-swatches"},Mu=["title","disabled","onMousedown"],Nu={key:4,class:"bsm-group bsm-colors"},Su={class:"bsm-collapse-title"},Au={class:"bsm-collapse-body"},Iu={class:"bsm-swatches"},Bu=["title","disabled","onMousedown"],Ru={class:"bsm-group"},Lu=["onMousedown","onMouseenter"],Ou={class:"bsm-title"},Du={key:1,class:"bsm-shortcut"},$u=["aria-label"],fl=260,Pu=80,Qi=24,Hu='<svg viewBox="0 0 16 16" width="14" height="14"><rect x="5" y="5" width="8" height="8" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.2"/><path d="M3 10.5V3.5C3 2.67 3.67 2 4.5 2H10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>',Vu='<svg viewBox="0 0 16 16" width="14" height="14"><rect x="5" y="5" width="8" height="8" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.2"/><path d="M3 10.5V3.5C3 2.67 3.67 2 4.5 2H10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>',Uu='<svg viewBox="0 0 16 16" width="14" height="14"><circle cx="4.5" cy="11.5" r="1.8" fill="none" stroke="currentColor" stroke-width="1.2"/><circle cx="11.5" cy="11.5" r="1.8" fill="none" stroke="currentColor" stroke-width="1.2"/><line x1="6" y1="10" x2="13" y2="3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><line x1="10" y1="10" x2="3" y2="3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>',zu='<svg viewBox="0 0 16 16" width="14" height="14"><path d="M8 12V4M4 8L8 4L12 8" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>',Fu='<svg viewBox="0 0 16 16" width="14" height="14"><path d="M8 4V12M4 8L8 12L12 8" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>',Ku='<svg viewBox="0 0 16 16" width="14" height="14"><path d="M3.5 4.5H12.5M6.5 4.5V3C6.5 2.45 6.95 2 7.5 2H8.5C9.05 2 9.5 2.45 9.5 3V4.5M5 4.5L5.5 13C5.55 13.55 6 14 6.55 14H9.45C10 14 10.45 13.55 10.5 13L11 4.5" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>',Wu='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M597.333333 451.669333l55.168-55.168a42.666667 42.666667 0 0 1 60.330667 60.330667L657.664 512l55.168 55.168a42.666667 42.666667 0 0 1-60.330667 60.330667L597.333333 572.330667l-55.168 55.168a42.666667 42.666667 0 0 1-60.330666-60.330667L537.002667 512l-55.168-55.168a42.666667 42.666667 0 0 1 60.330666-60.330667L597.333333 451.669333zM874.581333 832H376.32c-47.402667 0-106.730667-25.941333-138.752-60.672l-163.178667-176.938667c-42.325333-45.866667-42.346667-118.869333 0-164.778666l163.2-176.938667C269.525333 218.026667 329.045333 192 376.32 192h498.24A106.666667 106.666667 0 0 1 981.333333 298.837333v426.325334A106.752 106.752 0 0 1 874.581333 832z m0-85.333333C886.4 746.666667 896 737.088 896 725.162667V298.837333c0-11.946667-9.514667-21.504-21.418667-21.504H376.32c-23.466667 0-60.224 16.064-76.010667 33.194667l-163.2 176.917333c-12.181333 13.226667-12.16 35.882667 0 49.109334l163.2 176.917333C316.16 730.666667 352.746667 746.666667 376.32 746.666667h498.24z" fill="currentColor"/></svg>',Ji='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M672.01024 896l-320 0c-17.67424 0-32.01024-14.336-32.01024-32.01024l0-352.01024-128 0c-12.94336 0-24.61696-7.80288-29.57312-19.7632s-2.21184-25.72288 6.94272-34.87744l320-320c12.4928-12.4928 32.768-12.4928 45.2608 0l320 320c9.15456 9.15456 11.89888 22.91712 6.94272 34.87744s-16.62976 19.7632-29.57312 19.7632l-128 0 0 352.01024c0 17.67424-14.336 32.01024-32.01024 32.01024zM384 832l256 0 0-352.01024c0-17.67424 14.336-32.01024 32.01024-32.01024l82.7392 0-242.74944-242.74944-242.74944 242.74944 82.7392 0c17.67424 0 32.01024 14.336 32.01024 32.01024l0 352.01024z" fill="currentColor"/></svg>',Gu='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M512.00988746 141.21142578c10.45623779 0 19.24145531 3.50024414 26.37542748 10.71331811l259.5421145 259.55200196C805.03668189 418.58105492 808.63085938 427.33660865 808.63085938 437.84228516c0 10.60949731-3.53485132 19.46887183-10.56994606 26.46936011-7.02026391 7.00543237-15.88952661 10.60949731-26.50891137 10.60949731-10.44140625 0-19.22167969-3.60900903-26.35565185-10.71331811L549.09863305 267.79370094V845.7097168c0 10.19915748-3.62384057 18.94976782-10.89624071 26.16284179-7.23284888 7.31195068-15.97357177 10.91601563-26.2122798 10.91601563-10.23376465 0-18.959656-3.60900903-26.22216796-10.91601563-7.24273705-7.21307397-10.87646508-15.96862769-10.87646508-26.16284179V267.79370094l-196.10760522 196.41906761C271.65484619 471.31213355 262.87951684 474.92114258 252.41833496 474.92114258c-10.61938477 0-19.45898438-3.60900903-26.4990232-10.60949731C218.86444068 457.31115699 215.36914062 448.45178247 215.36914062 437.84228516c0-10.50567651 3.55462623-19.26123023 10.69354248-26.36553931l259.53717042-259.55200196C492.7288816 144.71166992 501.52398658 141.21142578 511.97033691 141.21142578h0.03955055z" fill="currentColor"/></svg>',qu='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M511.99011254 141.21142578c10.23376465 0 18.95471191 3.60900903 26.2122798 10.81713891 7.25262451 7.20812988 10.86657691 15.96862769 10.86657763 26.2666626v577.89129615l196.1619873-196.43884254c7.099365-7.00543237 15.90435815-10.61444068 26.34082031-10.61444139 10.61938477 0 19.43426538 3.50518822 26.51385474 10.51062059 7.04498291 7.10430908 10.54522705 15.96862769 10.54522706 26.57318092 0 10.40679908-3.54473877 19.16235352-10.69354248 26.37542748l-259.55694604 259.48278761C531.23156714 879.28833008 522.44635033 882.78857422 512.00988746 882.78857422c-10.45623779 0-19.24145531-3.50024414-26.3704834-10.71331811l-259.55200195-259.48278761C218.94848656 605.37939453 215.36914062 596.62384009 215.36914062 586.21704102c0-10.60949731 3.52496314-19.46887183 10.56994606-26.57318092C232.99395776 552.63842773 241.82861328 549.12829614 252.44799805 549.12829614c10.42163062 0 19.2167356 3.60900903 26.36553931 10.61444068l196.1125493 196.43884253V178.29522729c0-10.30297828 3.60900903-19.05853271 10.88635255-26.2666626C493.05517555 144.81549073 501.80084252 141.21142578 512.02966309 141.21142578h-0.03955055z" fill="currentColor"/></svg>',Yu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><path fill="currentColor" d="M 75,28.5 L 71,32 C 67,26.8 61.5,22.5 53.5,22.5 C 38,22.5 24.5,34.5 24.5,50 C 24.5,65.5 38,77.5 53.5,77.5 C 61.5,77.5 67,73.2 71,68 L 75,71.5 C 70,77.8 62.5,83 53.5,83 C 34.5,83 19,68.5 19,50 C 19,31.5 34.5,17 53.5,17 C 62.5,17 70,22.2 75,28.5 Z"/></svg>',Zu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M 22,17 H 49 C 68,17 79,30.5 79,50 C 79,69.5 68,83 49,83 H 22 Z M 27.5,22.5 H 48.5 C 64.5,22.5 73.5,33.5 73.5,50 C 73.5,66.5 64.5,77.5 48.5,77.5 H 27.5 Z"/></svg>',Xu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><path fill="currentColor" d="M 20,17 L 26.5,17 L 50,46.2 L 73.5,17 L 80,17 L 53.8,50 L 80,83 L 73.5,83 L 50,53.8 L 26.5,83 L 20,83 L 46.2,50 Z"/></svg>',ju='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M768 597.333333h-85.333333V426.666667h85.333333c94.250667 0 170.666667-76.416 170.666667-170.666667S862.250667 85.333333 768 85.333333c-94.261333 0-170.666667 76.416-170.666667 170.666667v85.333333H426.666667v-85.333333c0-94.250667-76.416-170.666667-170.666667-170.666667S85.333333 161.749333 85.333333 256s76.416 170.666667 170.666667 170.666667h85.333333v170.666666h-85.333333c-94.250667 0-170.666667 76.416-170.666667 170.666667s76.416 170.666667 170.666667 170.666667c94.261333 0 170.666667-76.416 170.666667-170.666667v-85.333333h170.666666v85.12l-0.010666 0.213333c0 94.250667 76.416 170.666667 170.666666 170.666667s170.666667-76.416 170.666667-170.666667S862.250667 597.354667 768 597.333333z m0-426.666666a85.333333 85.333333 0 0 1 0 170.666666h-85.333333v-85.333333a85.333333 85.333333 0 0 1 85.333333-85.333333z m-597.333333 85.333333a85.333333 85.333333 0 0 1 170.666666 0v85.333333h-85.333333c-47.125333 0-85.333333-38.218667-85.333333-85.333333z m85.333333 597.333333a85.333333 85.333333 0 0 1 0-170.666666h85.333333v85.333333a85.333333 85.333333 0 0 1-85.333333 85.333333z m170.666667-256V426.666667h170.666666v170.666666H426.666667z m341.333333 256a85.333333 85.333333 0 0 1-85.333333-85.333333v-85.333333h85.322666A85.333333 85.333333 0 0 1 768 853.333333z" fill="currentColor"/></svg>',Qu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><rect x="8" y="8" width="84" height="84" rx="16" fill="none" stroke="currentColor" stroke-width="4.8" stroke-linecap="round" stroke-linejoin="round"/><path fill="currentColor" d="M 43.5,32 C 40.3,30.3 36.3,29.5 31.5,29.5 C 20.5,29.5 14,38.2 14,50 C 14,61.8 20.5,70.5 31.5,70.5 C 36.3,70.5 40.3,69.7 43.5,68 L 43.5,60.5 C 40.5,62.8 36.5,64 32,64 C 23.7,64 20,58 20,50 C 20,42 23.7,36 32,36 C 36.5,36 40.5,37.2 43.5,39.5 Z M 50,32 H 56 V 41.5 H 59.5 V 47.5 H 56 V 62 C 56,64.2 57,65 59,65 H 60 V 70.5 C 58.5,70.8 56.7,71 54.5,71 C 50,71 48,68.5 48,63 V 47.5 H 44.5 V 41.5 H 48 V 32 Z M 62.5,41.5 H 68 V 47 C 70,43.2 73,41.5 76.5,41.5 V 47.5 C 74,47.5 71,49 68.5,52.5 V 70.5 H 62.5 V 41.5 Z M 79.5,32 H 85.5 V 70.5 H 79.5 Z"/></svg>',Ju=t.defineComponent({__name:"BlockSettingsMenu",props:{visible:{type:Boolean},anchorEl:{},blockId:{},rootEl:{}},emits:["close"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:s}=en(),i=fn(),c=t.inject(Do,t.ref(!1)),a=t.ref(null),d=t.ref(null),f=t.ref("paragraph"),u=t.ref({top:0,left:0,availableHeight:520,above:!1,bottom:0,topBaseline:0}),h=t.ref(!1),p=t.ref(!1),m=t.ref(!1),k=t.reactive({alignIndent:!1,indent:!1,textColor:!1,bgColor:!1}),x=t.ref(!1);let D=null;t.watch(()=>r.visible,P=>{P?(D&&(clearTimeout(D),D=null),x.value=!0):D=setTimeout(()=>{x.value=!1,D=null},300)},{immediate:!0});const U=t.shallowRef(i.getState());let F=null;const ee=t.computed(()=>r.blockId!=null?U.value.doc.blocks.get(r.blockId):void 0),$=t.ref(void 0),V=t.computed(()=>{var w;const P=(w=ee.value)==null?void 0:w.attrs.align;return typeof P=="string"?P:"left"}),re=t.computed(()=>{const P=$.value;return P?!("align"in i.registries.schema.get(P).attrs):!0}),G=t.computed(()=>$.value==="image"||$.value==="table"),ne=t.computed(()=>$.value==="divider"||$.value==="tableOfContents"),Z=t.computed(()=>$.value==="divider"||$.value==="table"||$.value==="tableOfContents"),S=t.computed(()=>{const P=$.value;if(!P)return!0;const w=i.registries.schema.get(P);return!("color"in w.attrs)||!("bgColor"in w.attrs)}),K=t.computed(()=>{const P=ee.value;return P?Dn(U.value.doc,P.id):0});function _(P){return["paragraph","heading","orderedList","bulletList","todoList"].includes(P)}const O=t.computed(()=>!!$.value),M=t.computed(()=>{const P=ee.value;if(!P)return!0;const w=U.value.doc,z=Ar(w,P.id);return!z||!_(z.type)||Dn(w,z.id)>=10}),E=t.computed(()=>K.value<=0),N=t.computed(()=>{var w;const P=(w=ee.value)==null?void 0:w.attrs.color;return typeof P=="string"?P:"default"}),A=t.computed(()=>{var w;const P=(w=ee.value)==null?void 0:w.attrs.bgColor;return typeof P=="string"?P:"default"}),W=t.computed(()=>[{id:"paragraph",iconHtml:el,title:s("turnInto.paragraph"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"paragraph"}))}},{id:"h1",iconHtml:tl,title:s("turnInto.h1"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:1}}))}},{id:"h2",iconHtml:nl,title:s("turnInto.h2"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:2}}))}},{id:"h3",iconHtml:ol,title:s("turnInto.h3"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:3}}))}},{id:"h4",iconHtml:rl,title:s("turnInto.h4"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:4}}))}},{id:"h5",iconHtml:ll,title:s("turnInto.h5"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:5}}))}},{id:"h6",iconHtml:il,title:s("turnInto.h6"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:6}}))}},{id:"bullet",iconHtml:sl,title:s("turnInto.bullet"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"bulletList"}))}},{id:"ordered",iconHtml:cl,title:s("turnInto.ordered"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"orderedList"}))}},{id:"todo",iconHtml:al,title:s("turnInto.todo"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"todoList",attrs:{checked:!1}}))}},{id:"quote",iconHtml:dl,title:s("turnInto.quote"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"quote"}))}},{id:"code",iconHtml:ul,title:s("turnInto.code"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"codeBlock",attrs:{language:"plain"}}))}}]);function me(P){const w=ee.value;if(!w)return!1;switch(P){case"paragraph":return w.type==="paragraph";case"h1":return w.type==="heading"&&Number(w.attrs.level)===1;case"h2":return w.type==="heading"&&Number(w.attrs.level)===2;case"h3":return w.type==="heading"&&Number(w.attrs.level)===3;case"h4":return w.type==="heading"&&Number(w.attrs.level)===4;case"h5":return w.type==="heading"&&Number(w.attrs.level)===5;case"h6":return w.type==="heading"&&Number(w.attrs.level)===6;case"bullet":return w.type==="bulletList";case"ordered":return w.type==="orderedList";case"todo":return w.type==="todoList";case"quote":return w.type==="quote";case"code":return w.type==="codeBlock";default:return!1}}function le(P){return me(P)}t.watch(()=>r.visible,P=>{var z;if(!P)return;$.value=r.blockId!=null?(z=U.value.doc.blocks.get(r.blockId))==null?void 0:z.type:void 0;const w=W.value.find(we=>me(we.id));f.value=w?w.id:"paragraph",k.alignIndent=!1,k.indent=!1,k.textColor=!1,k.bgColor=!1},{immediate:!0});const he=t.computed(()=>{const P=[{id:"align-left",value:"left",title:s("align.left"),run:()=>ae("left")},{id:"align-center",value:"center",title:s("align.center"),run:()=>ae("center")},{id:"align-right",value:"right",title:s("align.right"),run:()=>ae("right")}];return G.value||P.push({id:"align-justify",value:"justify",title:s("align.justify"),run:()=>ae("justify")}),P});function ae(P){var w,z;(z=(w=i.commands).setBlockAlign)==null||z.call(w,{id:r.blockId,align:P})}function ie(){var P,w;(w=(P=i.commands).indentBlock)==null||w.call(P,{id:r.blockId})}function Se(){var P,w;(w=(P=i.commands).outdentBlock)==null||w.call(P,{id:r.blockId})}const Te=Xi,We=ji;function Mt(P){var w,z;(z=(w=i.commands).setBlockColor)==null||z.call(w,{id:r.blockId,color:P})}function Zt(P){var w,z;(z=(w=i.commands).setBlockBgColor)==null||z.call(w,{id:r.blockId,bgColor:P})}async function Gt(){var nt,lt;const P=ee.value;if(!P)return;const w=Ae(P.content),we=`<meta charset="utf-8"><!-- blockeditor:${JSON.stringify({id:P.id,type:P.type,attrs:P.attrs,text:w}).replace(/--/g,"\\-\\-")} -->${Rt(w)}`;let ve=!1;try{if((nt=navigator.clipboard)!=null&&nt.write&&typeof ClipboardItem<"u"){const on=new ClipboardItem({"text/plain":new Blob([w],{type:"text/plain"}),"text/html":new Blob([we],{type:"text/html"})});await navigator.clipboard.write([on]),ve=!0}}catch{ve=!1}if(!ve)try{(lt=navigator.clipboard)!=null&&lt.writeText&&(await navigator.clipboard.writeText(w),ve=!0)}catch{ve=!1}ve||(ve=tt(w))}function Rt(P){return P.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function tt(P){const w=document.createElement("textarea");w.value=P,w.setAttribute("readonly",""),w.style.position="fixed",w.style.top="-9999px",w.style.left="-9999px",w.style.opacity="0",document.body.appendChild(w);const z=document.activeElement;w.focus(),w.select();try{return document.execCommand("copy")}catch{return!1}finally{if(document.body.removeChild(w),z&&typeof z.focus=="function")try{z.focus()}catch{}}}function yt(){Gt().then(()=>{var P,w;return(w=(P=i.commands).removeBlock)==null?void 0:w.call(P,{id:r.blockId})})}const vt=/Mac|iP(hone|[ao]d)/.test(navigator.platform)?ju:Qu;function Ze(...P){return P.join("")}const Ve=t.computed(()=>[{id:"dup",iconHtml:Hu,title:s("action.duplicate"),shortcutHtml:Ze(vt,Zu),run:()=>{var P,w;return void((w=(P=i.commands).duplicateBlock)==null?void 0:w.call(P,{id:r.blockId}))}},{id:"copy",iconHtml:Vu,title:s("action.copy"),shortcutHtml:Ze(vt,Yu),run:()=>void Gt()},{id:"cut",iconHtml:Uu,title:s("action.cut"),shortcutHtml:Ze(vt,Xu),run:()=>void yt()},{id:"up",iconHtml:zu,title:s("action.moveUp"),shortcutHtml:Ze(vt,Ji,Gu),run:()=>{var P,w;return void((w=(P=i.commands).moveBlockUp)==null?void 0:w.call(P,{id:r.blockId}))}},{id:"down",iconHtml:Fu,title:s("action.moveDown"),shortcutHtml:Ze(vt,Ji,qu),run:()=>{var P,w;return void((w=(P=i.commands).moveBlockDown)==null?void 0:w.call(P,{id:r.blockId}))}},{id:"del",iconHtml:Ku,title:s("action.delete"),shortcutHtml:Wu,danger:!0,run:()=>{var P,w;return void((w=(P=i.commands).removeBlock)==null?void 0:w.call(P,{id:r.blockId}))}}]);t.watch(()=>r.visible,P=>{P&&(h.value=!1,u.value={top:0,left:0,availableHeight:520,above:!1,bottom:0,topBaseline:0})});function Ct(){const P=r.anchorEl,w=r.rootEl,z=a.value;!r.visible||!P||!w||!z||t.nextTick().then(()=>{const we=a.value;if(!we)return;const ve=we.getBoundingClientRect(),nt=!!P.closest(".fixed-toolbar"),lt=nt?c.value?"up":"down":"auto",on=nt?10:0,cn=Wi(w,P,{width:Math.max(ve.width,fl),height:ve.height},8,lt,on,on);u.value=cn,h.value=!0,t.nextTick(Tt)})}t.watch([()=>r.visible,()=>r.anchorEl,a,p,m],Ct,{flush:"post"});function fe(P){k[P]=!k[P],t.nextTick(Ct)}function Tt(){const P=d.value;P&&(p.value=P.scrollTop>1,m.value=P.scrollTop+P.clientHeight<P.scrollHeight-1)}function Xe(){const P=d.value;P&&(P.scrollTop-=P.clientHeight*.8)}function Re(){const P=d.value;P&&(P.scrollTop+=P.clientHeight*.8)}dr(d,Tt);const qt=t.computed(()=>{if(!r.rootEl)return{display:"none"};if(!h.value)return{visibility:"hidden",top:"0px",left:"0px",width:`${fl}px`,"--scroll-max-height":"100vh"};const P=u.value.above,w=u.value.left,z=(p.value?Qi:0)+(m.value?Qi:0),we=u.value.availableHeight-z,ve={left:`${w}px`,width:`${fl}px`,maxHeight:`${u.value.availableHeight}px`,"--scroll-max-height":`${Math.max(Pu,we)}px`};if(P){const nt=document.documentElement.clientHeight;ve.bottom=`${Math.max(0,nt-u.value.bottom)}px`,ve.top="auto"}else ve.top=`${u.value.top}px`,ve.bottom="auto";return ve});function rt(P){if(P.kind==="turnInto"&&le(P.id)){const w=W.value.find(z=>z.id==="paragraph");if(w){f.value="paragraph",w.run(),l("close");return}}f.value=P.id,P.run(),l("close")}function Et(P){const w=[...W.value,...Ve.value];if(w.length===0)return!1;const z=w.findIndex(ve=>ve.id===f.value),we=ve=>(ve%w.length+w.length)%w.length;switch(P.key){case"ArrowDown":return P.preventDefault(),f.value=w[we(z+1)].id,!0;case"ArrowUp":return P.preventDefault(),f.value=w[we(z-1)].id,!0;case"Enter":return P.preventDefault(),rt(w[we(z)]),!0;case"Escape":return P.preventDefault(),l("close"),!0;default:return!1}}return n({onKeyDown:Et}),Yi(a,()=>r.visible,()=>l("close"),()=>r.anchorEl),t.onMounted(()=>{F=i.subscribe(P=>{U.value=P.state})}),t.onBeforeUnmount(()=>{F==null||F(),F=null}),(P,w)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[x.value&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:a,class:t.normalizeClass(["block-settings-menu",{"menu-closing":!e.visible}]),style:t.normalizeStyle(qt.value),role:"menu"},[p.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(s)("ui.scrollUp"),onMousedown:t.withModifiers(Xe,["prevent"])},[...w[8]||(w[8]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,ru)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:d,class:"bsm-scroll",onScroll:Tt},[!G.value&&!ne.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",lu,[t.createElementVNode("div",iu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W.value,z=>(t.openBlock(),t.createElementBlock("button",{key:z.id,class:t.normalizeClass(["bsm-icon-cell",{active:le(z.id)}]),title:z.title,role:"menuitem",onMousedown:t.withModifiers(we=>rt(z),["prevent"]),onMouseenter:we=>f.value=z.id},[t.createVNode(pn,{class:"bsm-icon-svg",html:z.iconHtml},null,8,["html"])],42,su))),128))])]),w[9]||(w[9]=t.createElementVNode("div",{class:"bsm-sep"},null,-1))],64)):t.createCommentVNode("",!0),Z.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",cu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":re.value&&!O.value,expanded:k.alignIndent}]),role:"menuitem",onMousedown:w[0]||(w[0]=t.withModifiers(z=>fe("alignIndent"),["prevent"]))},[t.createElementVNode("span",au,t.toDisplayString(t.unref(s)("bsm.section.alignIndent")),1),w[10]||(w[10]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",du,[t.createElementVNode("div",uu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he.value,z=>(t.openBlock(),t.createElementBlock("button",{key:z.id,class:t.normalizeClass(["bsm-icon-btn",{active:!re.value&&V.value===z.value,"bsm-disabled":re.value}]),disabled:re.value,title:z.title,role:"menuitem",onMousedown:t.withModifiers(we=>!re.value&&rt(z),["prevent"])},[(t.openBlock(),t.createElementBlock("svg",mu,[z.value==="left"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[w[11]||(w[11]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[12]||(w[12]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"10",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[13]||(w[13]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"12",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):z.value==="center"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[w[14]||(w[14]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[15]||(w[15]=t.createElementVNode("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[16]||(w[16]=t.createElementVNode("line",{x1:"3",y1:"12",x2:"13",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):z.value==="right"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[w[17]||(w[17]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[18]||(w[18]=t.createElementVNode("line",{x1:"6",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[19]||(w[19]=t.createElementVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[w[20]||(w[20]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[21]||(w[21]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[22]||(w[22]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64))]))],42,fu))),128))]),t.createElementVNode("div",pu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":E.value}]),disabled:E.value,title:t.unref(s)("bsm.indent.decrease"),role:"menuitem",onMousedown:w[1]||(w[1]=t.withModifiers(z=>!E.value&&rt({id:"outdent",run:Se}),["prevent"]))},[...w[23]||(w[23]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM285.866667 657.066667c14.933333 8.533333 34.133333 0 34.133333-17.066667V384c0-17.066667-19.2-27.733333-34.133333-17.066667l-192 128c-12.8 8.533333-12.8 27.733333 0 36.266667l192 125.866667z",fill:"currentColor"})],-1)])],42,hu),t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":M.value}]),disabled:M.value,title:t.unref(s)("bsm.indent.increase"),role:"menuitem",onMousedown:w[2]||(w[2]=t.withModifiers(z=>!M.value&&rt({id:"indent",run:ie}),["prevent"]))},[...w[24]||(w[24]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM119.466667 657.066667A21.333333 21.333333 0 0 1 85.333333 640V384c0-17.066667 19.2-27.733333 34.133334-17.066667l192 128c12.8 8.533333 12.8 27.733333 0 36.266667l-192 125.866667z",fill:"currentColor"})],-1)])],42,gu)])],512),[[t.vShow,k.alignIndent]])])),Z.value?(t.openBlock(),t.createElementBlock("div",bu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":!O.value,expanded:k.indent}]),role:"menuitem",onMousedown:w[3]||(w[3]=t.withModifiers(z=>fe("indent"),["prevent"]))},[t.createElementVNode("span",ku,t.toDisplayString(t.unref(s)("bsm.section.indent")),1),w[25]||(w[25]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",yu,[t.createElementVNode("div",wu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":E.value}]),disabled:E.value,title:t.unref(s)("bsm.indent.decrease"),role:"menuitem",onMousedown:w[4]||(w[4]=t.withModifiers(z=>!E.value&&rt({id:"outdent",run:Se}),["prevent"]))},[...w[26]||(w[26]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM285.866667 657.066667c14.933333 8.533333 34.133333 0 34.133333-17.066667V384c0-17.066667-19.2-27.733333-34.133333-17.066667l-192 128c-12.8 8.533333-12.8 27.733333 0 36.266667l192 125.866667z",fill:"currentColor"})],-1)])],42,Eu),t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":M.value}]),disabled:M.value,title:t.unref(s)("bsm.indent.increase"),role:"menuitem",onMousedown:w[5]||(w[5]=t.withModifiers(z=>!M.value&&rt({id:"indent",run:ie}),["prevent"]))},[...w[27]||(w[27]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM119.466667 657.066667A21.333333 21.333333 0 0 1 85.333333 640V384c0-17.066667 19.2-27.733333 34.133334-17.066667l192 128c12.8 8.533333 12.8 27.733333 0 36.266667l-192 125.866667z",fill:"currentColor"})],-1)])],42,vu)])],512),[[t.vShow,k.indent]])])):t.createCommentVNode("",!0),!G.value&&!ne.value?(t.openBlock(),t.createElementBlock("div",Cu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":S.value,expanded:k.textColor}]),role:"menuitem",onMousedown:w[6]||(w[6]=t.withModifiers(z=>!S.value&&fe("textColor"),["prevent"]))},[t.createElementVNode("span",Tu,t.toDisplayString(t.unref(s)("bsm.section.textColor")),1),w[28]||(w[28]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",_u,[t.createElementVNode("div",xu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Te),z=>(t.openBlock(),t.createElementBlock("button",{key:"tc-"+z.key,class:t.normalizeClass(["bsm-swatch",{active:N.value===z.key,"bsm-disabled":S.value}]),title:t.unref(s)(z.key==="default"?"color.default":"color."+z.key),style:t.normalizeStyle({backgroundColor:z.displayCssValue??z.cssValue}),disabled:S.value,onMousedown:t.withModifiers(we=>!S.value&&rt({id:`tc-${z.key}`,run:()=>Mt(z.key)}),["prevent"])},null,46,Mu))),128))])],512),[[t.vShow,k.textColor]])])):t.createCommentVNode("",!0),!G.value&&!ne.value?(t.openBlock(),t.createElementBlock("div",Nu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":S.value,expanded:k.bgColor}]),role:"menuitem",onMousedown:w[7]||(w[7]=t.withModifiers(z=>!S.value&&fe("bgColor"),["prevent"]))},[t.createElementVNode("span",Su,t.toDisplayString(t.unref(s)("bsm.section.bgColor")),1),w[29]||(w[29]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",Au,[t.createElementVNode("div",Iu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(We),z=>(t.openBlock(),t.createElementBlock("button",{key:"bc-"+z.key,class:t.normalizeClass(["bsm-swatch",[{active:A.value===z.key,"bsm-disabled":S.value},z.key==="default"?"bsm-swatch--none":""]]),title:t.unref(s)(z.key==="default"?"color.none":"color."+z.key),style:t.normalizeStyle({backgroundColor:z.displayCssValue??z.cssValue}),disabled:S.value,onMousedown:t.withModifiers(we=>!S.value&&rt({id:`bc-${z.key}`,run:()=>Zt(z.key)}),["prevent"])},null,46,Bu))),128))])],512),[[t.vShow,k.bgColor]])])):t.createCommentVNode("",!0),w[30]||(w[30]=t.createElementVNode("div",{class:"bsm-sep"},null,-1)),t.createElementVNode("div",Ru,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ve.value,z=>(t.openBlock(),t.createElementBlock("button",{key:z.id,class:t.normalizeClass(["bsm-item bsm-action",{danger:z.danger}]),role:"menuitem",onMousedown:t.withModifiers(we=>rt(z),["prevent"]),onMouseenter:we=>f.value=z.id},[t.createVNode(pn,{class:"bsm-action-icon",html:z.iconHtml},null,8,["html"]),t.createElementVNode("span",Ou,t.toDisplayString(z.title),1),z.shortcutHtml?(t.openBlock(),t.createBlock(pn,{key:0,class:"bsm-shortcut",html:z.shortcutHtml},null,8,["html"])):z.shortcut?(t.openBlock(),t.createElementBlock("span",Du,t.toDisplayString(z.shortcut),1)):t.createCommentVNode("",!0)],42,Lu))),128))])],544),m.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(s)("ui.scrollDown"),onMousedown:t.withModifiers(Re,["prevent"])},[...w[31]||(w[31]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,$u)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)]))}}),ef=["aria-hidden"],tf=["aria-label"],nf=["title","aria-label"],of={class:"ht-dropdown-wrap"},rf=["title","disabled"],lf={class:"ht-type-label"},sf=["aria-label"],cf=["onMousedown"],af={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},df=["aria-label"],uf={class:"ht-dropdown-wrap"},ff=["title","disabled"],mf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},pf=["aria-label"],hf=["onMousedown"],gf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},bf={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},kf=["aria-label"],yf={key:0,class:"ht-dropdown-wrap"},wf=["title","disabled"],Ef={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},vf=["aria-label"],Cf=["onMousedown"],Tf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},_f={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},xf=["aria-label"],Mf=["title","disabled","onMousedown","onTouchstart"],Nf=["title","disabled"],Sf={class:"ht-dropdown-wrap"},Af=["title","disabled"],If=["aria-label"],Bf={class:"ht-color-section"},Rf={class:"ht-color-label"},Lf={class:"ht-swatches"},Of=["title","onMousedown"],Df={class:"ht-color-section"},$f={class:"ht-color-label"},Pf={class:"ht-swatches"},Hf=["title","onMousedown"],Vf=["aria-label"],Uf=["title","aria-label","disabled"],zf={key:0,class:"ht-sep"},Ff=["title"],Kf=["title"],Wf=["title"],Gf={key:0,class:"ht-sep"},qf=["title"],Yf=["title","aria-label"],Zf=80,Xf=24,ml=36,jf=360,es=10,ts=200,Qf=t.defineComponent({__name:"HoverToolbar",props:{visible:{type:Boolean},selectionRect:{},blockId:{},blockType:{},blockAttrs:{},rootEl:{},tableMode:{type:Boolean},showDelete:{type:Boolean},deleteLabel:{},deleteIcon:{},showMerge:{type:Boolean},showSplit:{type:Boolean},showHeaderRow:{type:Boolean},headerRowActive:{type:Boolean},cellEditMode:{type:Boolean},tableActiveMarks:{},tableActiveColor:{},tableActiveBgColor:{},tableActiveVerticalAlign:{},mobile:{type:Boolean}},emits:["close","interacting","linkClick","delete","merge","split","tableHeaderRow","tableType","tableAlign","tableVerticalAlign","tableMark","tableTextColor","tableBgColor","tableCopy"],setup(e,{expose:n,emit:o}){const r=e,l=o;function s(){l("interacting")}const{t:i}=en(),c=fn(),a=t.inject(Do,t.ref(!1)),d=t.ref(null),f=t.ref(null),u=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(null),k=t.ref(null),x=t.ref(null),D=t.ref(null),U=t.ref({top:0,left:0,above:!1}),F=t.ref(null),ee=t.ref(!1),$=t.ref(null),V=t.ref(null),re=t.ref(!1),G=t.ref(!1),ne=t.ref(null),Z=t.ref(!1),S=t.ref(!1),K=t.ref(!1),_=t.computed(()=>({maxHeight:$.value!==null?`${$.value}px`:void 0})),O=t.ref(null),M=t.computed(()=>{if(!r.mobile||!O.value)return;const B=O.value,b={position:"fixed",left:`${B.left}px`};return B.top!==void 0&&(b.top=`${B.top}px`),B.bottom!==void 0&&(b.bottom=`${B.bottom}px`),B.right!==void 0&&(b.right=`${B.right}px`),b}),E=t.shallowRef(null);t.watch(()=>r.blockId,B=>{E.value=B},{immediate:!0});const N=t.shallowRef(c.getState());let A=null;const W=t.computed(()=>N.value.doc.blocks.get(E.value??"")),me=t.computed(()=>{var b;if(r.cellEditMode||r.tableMode){const L=r.blockAttrs.align;return typeof L=="string"?L:"left"}const B=(b=W.value)==null?void 0:b.attrs.align;return typeof B=="string"?B:"left"}),le=t.computed(()=>{if(r.tableMode){const B=r.tableActiveVerticalAlign;return typeof B=="string"?B:"middle"}if(r.cellEditMode){const B=r.blockAttrs.verticalAlign;return typeof B=="string"?B:"middle"}return"middle"}),he=t.ref(""),ae=t.ref("");t.watch(()=>r.visible,B=>{B||(F.value=null)}),t.watch(()=>r.blockId,()=>{F.value=null});const ie=t.ref(new Set),Se=t.ref(0);function Te(){var B;if(!r.rootEl)return null;if(r.cellEditMode){const b=window.getSelection();if(!b||b.rangeCount===0)return null;const L=b.getRangeAt(0);return(B=L.commonAncestorContainer.nodeType===1?L.commonAncestorContainer:L.commonAncestorContainer.parentElement)==null?void 0:B.closest(".table-cell-inner")}return r.rootEl.querySelector(`[data-block-id="${r.blockId}"]`)}function We(){const B=new Set;if(!r.visible||!r.blockId||!r.rootEl){ie.value=B;return}if(r.tableMode&&r.tableActiveMarks){ie.value=new Set(r.tableActiveMarks);return}const b=Te();if(b){const y=window.getSelection();if(y&&y.rangeCount>0){const v=y.getRangeAt(0);if(!v.collapsed&&b.contains(v.commonAncestorContainer)){const T=[],R=document.createTreeWalker(b,NodeFilter.SHOW_TEXT);for(;R.nextNode();){const q=R.currentNode;(q.nodeValue??"").length!==0&&v.intersectsNode(q)&&T.push(q)}if(T.length>0){const q={bold:["B","STRONG"],italic:["I","EM"],underline:["U"],strikethrough:["S","STRIKE","DEL"],code:["CODE"],link:["A"]};for(const[X,ce]of Object.entries(q))T.every(ke=>{let pe=ke.parentNode;for(;pe&&pe!==b;){if(pe.nodeType===Node.ELEMENT_NODE&&ce.includes(pe.nodeName))return!0;pe=pe.parentNode}return!1})&&B.add(X);if(B.size>0){ie.value=B;return}}}}}const L=N.value,de=r.blockId?L.doc.blocks.get(r.blockId):void 0;if(!de){ie.value=B;return}const _e=L.selection;let Oe=0,Be=Ae(de.content).length;if(_e.kind==="text"&&_e.anchor.blockId===r.blockId&&_e.focus.blockId===r.blockId)Oe=Math.min(_e.anchor.offset,_e.focus.offset),Be=Math.max(_e.anchor.offset,_e.focus.offset);else{const y=_t();y&&(Oe=y.from,Be=y.to)}if(Oe>=Be){ie.value=B;return}const be=["bold","italic","underline","strikethrough","code","link"];for(const y of be){let v=!0,T=!1,R=0;for(const q of de.content){if(q.type!=="text")continue;const X=R,ce=R+q.text.length;if(ce>Oe&&X<Be&&(T=!0,!q.marks||!q.marks.some(ke=>ke.type===y))){v=!1;break}R=ce}T&&v&&B.add(y)}ie.value=B}const Mt=t.computed(()=>r.mobile&&!r.tableMode&&!r.cellEditMode&&!r.selectionRect),Zt=t.computed(()=>Mt.value||r.blockType==="codeBlock"),Gt=t.computed(()=>r.tableMode||r.cellEditMode?Mt.value:!r.blockId),Rt=t.computed(()=>{if(r.tableMode||r.cellEditMode)return Mt.value?!0:r.blockType==="codeBlock";if(!r.blockId||r.blockType==="codeBlock")return!0;const B=r.blockType;return B?!("align"in c.registries.schema.get(B).attrs):!1});function tt(B){if(r.tableMode||r.cellEditMode)return!!(r.blockType==="codeBlock"||r.blockType==="quote"&&B==="italic"||B!=="code"&&ie.value.has("code"));if(Zt.value)return!0;if(B==="italic"){const b=r.blockType;if(b&&c.registries.schema.isMarkDisallowed(b,"italic"))return!0}if(B==="link"){const b=c.getState().selection;return!!(b.kind==="text"&&Ht(b))}return!!(B!=="code"&&ie.value.has("code"))}const yt=t.computed(()=>[{id:"bold",title:i("mark.bold"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z" fill="currentColor"/></svg>'},{id:"italic",title:i("mark.italic"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z" fill="currentColor"/></svg>'},{id:"underline",title:i("mark.underline"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z" fill="currentColor"/></svg>'},{id:"strikethrough",title:i("mark.strikethrough"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z" fill="currentColor"/></svg>'},{id:"code",title:i("mark.inlineCode"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M197.802 747.664v-145.287a58.916 58.916 0 0 0-58.916-58.916h-19.619v-62.922h19.619a58.916 58.916 0 0 0 58.916-58.916V276.336a117.832 117.832 0 0 1 117.832-117.832h39.297v78.535h-39.356a39.297 39.297 0 0 0-39.238 39.297v161.017A78.594 78.594 0 0 1 222.37 512a78.594 78.594 0 0 1 53.967 74.646V747.664a39.238 39.238 0 0 0 39.238 39.238h39.356v78.594h-39.356a117.832 117.832 0 0 1-117.832-117.832z m628.456-145.287V747.664a117.832 117.832 0 0 1-117.832 117.832h-39.356v-78.594h39.356a39.238 39.238 0 0 0 39.238-39.238v-161.017A78.535 78.535 0 0 1 801.63 512a78.594 78.594 0 0 1-53.967-74.646V276.336a39.297 39.297 0 0 0-39.238-39.297h-39.356V158.504h39.356a117.832 117.832 0 0 1 117.832 117.832v145.287a58.916 58.916 0 0 0 58.916 58.916h19.56v62.922h-19.56a58.916 58.916 0 0 0-58.916 58.916z" fill="currentColor"/></svg>'}]),vt=t.computed(()=>{const B=r.blockType,b=r.blockAttrs,L=(_e,Oe)=>B===_e&&(Oe===void 0||Number(b.level)===Oe);return[{id:"text",label:i("turnInto.paragraph"),iconHtml:el,active:L("paragraph"),convertType:"paragraph"},{id:"h1",label:i("turnInto.h1"),iconHtml:tl,active:L("heading",1),convertType:"heading",convertAttrs:{level:1}},{id:"h2",label:i("turnInto.h2"),iconHtml:nl,active:L("heading",2),convertType:"heading",convertAttrs:{level:2}},{id:"h3",label:i("turnInto.h3"),iconHtml:ol,active:L("heading",3),convertType:"heading",convertAttrs:{level:3}},{id:"h4",label:i("turnInto.h4"),iconHtml:rl,active:L("heading",4),convertType:"heading",convertAttrs:{level:4}},{id:"h5",label:i("turnInto.h5"),iconHtml:ll,active:L("heading",5),convertType:"heading",convertAttrs:{level:5}},{id:"h6",label:i("turnInto.h6"),iconHtml:il,active:L("heading",6),convertType:"heading",convertAttrs:{level:6}},{id:"bullet",label:i("turnInto.bullet"),iconHtml:sl,active:L("bulletList"),convertType:"bulletList"},{id:"ordered",label:i("turnInto.ordered"),iconHtml:cl,active:L("orderedList"),convertType:"orderedList"},{id:"todo",label:i("turnInto.todo"),iconHtml:al,active:L("todoList"),convertType:"todoList",convertAttrs:{checked:!1}},{id:"quote",label:i("turnInto.quote"),iconHtml:dl,active:L("quote"),convertType:"quote"},{id:"code",label:i("turnInto.code"),iconHtml:ul,active:L("codeBlock"),convertType:"codeBlock",convertAttrs:{language:"plain"}}]}),Ze=t.computed(()=>{const B=vt.value.find(b=>b.active);return B?B.label:i("turnInto.paragraph")}),Ve=t.computed(()=>[{id:"left",label:i("align.left"),value:"left"},{id:"center",label:i("align.center"),value:"center"},{id:"right",label:i("align.right"),value:"right"},{id:"justify",label:i("align.justify"),value:"justify"}]),Ct=t.computed(()=>[{id:"top",label:i("verticalAlign.top"),value:"top"},{id:"middle",label:i("verticalAlign.middle"),value:"middle"},{id:"bottom",label:i("verticalAlign.bottom"),value:"bottom"}]),fe=Xi,Tt=ji;function Xe(){var be;const B=d.value,b=ne.value;if(!B||!b){Z.value=!1;return}const L=b.scrollLeft;b.style.maxWidth="",b.offsetWidth;const de=b.scrollWidth,_e=r.mobile?Math.max(120,(((be=B.parentElement)==null?void 0:be.clientWidth)??B.clientWidth)-8):Math.max(200,document.documentElement.clientWidth-32),Oe=Xf*2,Be=_e-Oe;if(de>Be){Z.value=!0,b.style.maxWidth=`${Be}px`;const y=Math.max(0,b.scrollWidth-b.clientWidth);b.scrollLeft=Math.min(L,y),Re()}else Z.value=!1,b.style.maxWidth="",S.value=!1,K.value=!1}function Re(){const B=ne.value;B&&(S.value=B.scrollLeft>0,K.value=B.scrollLeft+B.clientWidth<B.scrollWidth-1)}function qt(B){F.value=null;const b=ne.value;b&&(b.scrollLeft+=B*Zf,Re())}let rt=null,Et=0,P=0,w=!1,z=!1;function we(B){if(!w)return;const b=B.touches[0];if(!b)return;const L=Math.abs(b.clientX-Et),de=Math.abs(b.clientY-P);(L>es||de>es)&&(z||(F.value=null),z=!0)}function ve(B){if(!w)return;const b=rt;rt=null,w=!1;const L=z;z=!1,L||(B.cancelable&&B.preventDefault(),b&&b())}function nt(B,b){b.cancelable&&b.preventDefault(),qt(B)}function lt(B,b){const L=b.touches[0];L&&(Et=L.clientX,P=L.clientY),rt=B,w=!0,z=!1}t.watch([()=>r.visible,()=>r.selectionRect,d,()=>r.mobile],async()=>{if(r.mobile){r.visible&&Xe();return}if(!r.visible||!r.selectionRect||!r.rootEl)return;const B=d.value;if(!B)return;Xe(),await t.nextTick();const b=B.getBoundingClientRect(),L=b.width,de=Math.max(b.height,ml);U.value=r.tableMode?qi(r.rootEl,r.selectionRect,{width:L,height:de}):Gi(r.rootEl,r.selectionRect,{width:L,height:de})},{flush:"post",immediate:!0});const on=t.computed(()=>({top:"0px",left:"0px",width:"100vw",height:"100vh"})),cn=t.computed(()=>{const B=d.value,b=(B==null?void 0:B.offsetWidth)??jf,L=document.documentElement.clientWidth,de=8;let _e=U.value.left;const Oe=Math.max(de,L-b-de);_e=Math.max(de,Math.min(Oe,_e));const Be={top:`${U.value.top}px`,left:`${_e}px`};if(r.selectionRect){const y=r.selectionRect.left+r.selectionRect.width/2-_e,v=Math.max(10,Math.min(b-10,y));Be["--ht-arrow-x"]=`${v}px`}return Be});async function He(B){F.value=F.value===B?null:B,F.value&&(await t.nextTick(),vn())}function vn(){const B=F.value;if(!B)return;const b=B==="type"?f.value:B==="align"?u.value:B==="verticalAlign"?h.value:p.value,L=B==="type"?m.value:B==="align"?k.value:B==="verticalAlign"?x.value:D.value;if(!b||!L)return;const de=L.getBoundingClientRect(),_e=window.innerHeight,Oe=6,Be=Math.floor(_e-de.bottom-Oe),be=Math.floor(de.top-Oe),y=b.scrollHeight;if(r.mobile){const q=document.documentElement.clientHeight,X=10;if(a.value){ee.value=!0,$.value=Math.max(120,be-X);const ue=q-de.top+Oe;if(B==="color"){const ke=document.documentElement.clientWidth;O.value={left:8,bottom:ue,right:Math.max(8,ke-de.right)}}else O.value={left:Math.max(8,de.left),bottom:ue}}else{ee.value=!1,$.value=Math.max(120,Be-X);const ue=de.bottom+Oe;if(B==="color"){const ke=document.documentElement.clientWidth;O.value={left:8,top:ue,right:Math.max(8,ke-de.right)}}else O.value={left:Math.max(8,de.left),top:ue}}t.nextTick(Xt);return}O.value=null;let v=!1;if(r.rootEl&&d.value){const q=r.rootEl.getBoundingClientRect(),X=d.value.getBoundingClientRect();q.bottom-X.bottom<ts&&be>ts&&(v=!0)}let T=!1,R;v?(T=!0,R=be):y<=Be?(T=!1,R=Be):be>Be?(T=!0,R=be):(T=!1,R=Be),ee.value=T,$.value=Math.max(120,Math.min(R,360)),t.nextTick(Xt)}function Xt(){const B=V.value;if(!B){re.value=!1,G.value=!1;return}re.value=B.scrollTop>1,G.value=B.scrollTop+B.clientHeight<B.scrollHeight-1}function bn(){const B=V.value;B&&(B.scrollTop-=B.clientHeight*.8)}function Cn(){const B=V.value;B&&(B.scrollTop+=B.clientHeight*.8)}dr(V,Xt);function Tn(B){var L,de,_e,Oe,Be;if(l("interacting"),r.tableMode||r.cellEditMode){B.convertType==="heading"&&((L=B.convertAttrs)!=null&&L.level)?l("tableType",`heading${B.convertAttrs.level}`):l("tableType",B.convertType),F.value=null,r.tableMode&&l("close");return}const b=ft();if(b){for(const be of b.ranges)(_e=(de=c.commands).convertBlock)==null||_e.call(de,{id:be.id,type:B.convertType,attrs:B.convertAttrs??{}});F.value=null,l("close");return}E.value&&((Be=(Oe=c.commands).convertBlock)==null||Be.call(Oe,{id:E.value,type:B.convertType,attrs:B.convertAttrs??{}}),F.value=null,l("close"))}function Me(B){var L,de,_e,Oe;if(l("interacting"),r.tableMode||r.cellEditMode){l("tableAlign",B),F.value=null;return}const b=ft();if(b){for(const Be of b.ranges)(de=(L=c.commands).setBlockAlign)==null||de.call(L,{id:Be.id,align:B});F.value=null;return}E.value&&((Oe=(_e=c.commands).setBlockAlign)==null||Oe.call(_e,{id:E.value,align:B}),F.value=null)}function Ie(B){if(r.tableMode||r.cellEditMode){l("tableVerticalAlign",B),F.value=null;return}F.value=null}function Ge(B){var de,_e,Oe,Be;if(l("interacting"),r.tableMode){l("tableTextColor",B==="default"?null:B),F.value=null;return}if(r.cellEditMode){const be=window.getSelection();if(be&&be.rangeCount>0&&!be.isCollapsed){const y=be.getRangeAt(0);if(B==="default"){const v=y.extractContents();v.querySelectorAll('span[class*="be-color-"]').forEach(T=>{const R=T.className.replace(/be-color-\w+/g,"").trim();if(R)T.className=R;else{for(;T.firstChild;)T.parentNode.insertBefore(T.firstChild,T);T.parentNode.removeChild(T)}}),y.insertNode(v)}else{const v=document.createElement("span");v.className=`be-color-${B}`,v.appendChild(y.extractContents()),y.insertNode(v),be.removeAllRanges();const T=document.createRange();T.selectNodeContents(v),be.addRange(T)}}F.value=null,Ke();return}const b=ft();if(b){for(const be of b.ranges)(_e=(de=c.commands).setInlineMark)==null||_e.call(de,{id:be.id,markType:"color",attrs:B==="default"?null:{color:B},from:be.from,to:be.to});return}if(!E.value)return;const L=_t();L&&((Be=(Oe=c.commands).setInlineMark)==null||Be.call(Oe,{id:E.value,markType:"color",attrs:B==="default"?null:{color:B},from:L.from,to:L.to}),t.nextTick(()=>{var X;const be=window.getSelection(),y=(X=r.rootEl)==null?void 0:X.querySelector(`[data-block-id="${r.blockId}"]`),v=be&&be.rangeCount>0?be.getRangeAt(0):null,T=!!y,R=!!(v&&y&&y.contains(v.commonAncestorContainer)),q=!!(v&&!v.collapsed&&R);if(!T){l("close");return}if(!q&&!R){l("close");return}Ke(),We()}))}function ct(B){var de,_e,Oe,Be;if(l("interacting"),r.tableMode){l("tableBgColor",B==="default"?null:B),F.value=null;return}if(r.cellEditMode){const be=window.getSelection();if(be&&be.rangeCount>0&&!be.isCollapsed){const y=be.getRangeAt(0);if(B==="default"){const v=y.extractContents();v.querySelectorAll('span[class*="be-bg-"]').forEach(T=>{const R=T.className.replace(/be-bg-\w+/g,"").trim();if(R)T.className=R;else{for(;T.firstChild;)T.parentNode.insertBefore(T.firstChild,T);T.parentNode.removeChild(T)}}),y.insertNode(v)}else{const v=document.createElement("span");v.className=`be-bg-${B}`,v.appendChild(y.extractContents()),y.insertNode(v),be.removeAllRanges();const T=document.createRange();T.selectNodeContents(v),be.addRange(T)}}F.value=null,Ke();return}const b=ft();if(b){for(const be of b.ranges)(_e=(de=c.commands).setInlineMark)==null||_e.call(de,{id:be.id,markType:"bgColor",attrs:B==="default"?null:{bgColor:B},from:be.from,to:be.to});return}if(!E.value)return;const L=_t();L&&((Be=(Oe=c.commands).setInlineMark)==null||Be.call(Oe,{id:E.value,markType:"bgColor",attrs:B==="default"?null:{bgColor:B},from:L.from,to:L.to}),t.nextTick(()=>{var X;const be=window.getSelection(),y=(X=r.rootEl)==null?void 0:X.querySelector(`[data-block-id="${r.blockId}"]`),v=be&&be.rangeCount>0?be.getRangeAt(0):null,T=!!y,R=!!(v&&y&&y.contains(v.commonAncestorContainer)),q=!!(v&&!v.collapsed&&R);if(!T){l("close");return}if(!q&&!R){l("close");return}Ke(),We()}))}function Ke(){if(r.tableMode){he.value=r.tableActiveColor??"",ae.value=r.tableActiveBgColor??"";return}if(r.visible&&r.blockId&&r.rootEl){const y=Te(),v=window.getSelection();if(y&&v&&v.rangeCount>0){const T=v.getRangeAt(0);if(!T.collapsed&&y.contains(T.commonAncestorContainer)){const R=new Set,q=new Set,X=[],ce=document.createTreeWalker(y,NodeFilter.SHOW_TEXT);for(;ce.nextNode();){const ue=ce.currentNode;(ue.nodeValue??"").length!==0&&T.intersectsNode(ue)&&X.push(ue)}for(const ue of X){let ke=ue.parentNode;for(;ke&&ke!==y;){if(ke.nodeType===Node.ELEMENT_NODE){const pe=ke.className;if(typeof pe=="string"){const xe=pe.match(/be-color-(\w+)/);xe&&R.add(xe[1]);const Ne=pe.match(/be-bg-(\w+)/);Ne&&q.add(Ne[1])}}ke=ke.parentNode}}if(R.size>0||q.size>0){he.value=R.size===1?[...R][0]:"",ae.value=q.size===1?[...q][0]:"";return}}}}const B=N.value,b=r.blockId?B.doc.blocks.get(r.blockId):void 0;if(!b){he.value="",ae.value="";return}const L=B.selection;let de,_e;if(L.kind==="text"&&L.anchor.blockId===r.blockId&&L.focus.blockId===r.blockId)de=Math.min(L.anchor.offset,L.focus.offset),_e=Math.max(L.anchor.offset,L.focus.offset);else{const y=_t();de=y?y.from:0,_e=y?y.to:Ae(b.content).length}if(de>=_e){he.value="",ae.value="";return}const Oe=new Set,Be=new Set;let be=0;for(const y of b.content){if(y.type!=="text")continue;const v=be,T=be+y.text.length;if(T>de&&v<_e&&y.marks)for(const R of y.marks)R.type==="color"&&R.attrs&&typeof R.attrs.color=="string"&&Oe.add(R.attrs.color),R.type==="bgColor"&&R.attrs&&typeof R.attrs.bgColor=="string"&&Be.add(R.attrs.bgColor);be=T}he.value=Oe.size===1?[...Oe][0]:"",ae.value=Be.size===1?[...Be][0]:""}function _t(){if(!r.blockId||!r.rootEl)return null;const B=r.rootEl.querySelector(`[data-block-id="${r.blockId}"]`);if(!B)return null;const b=window.getSelection();if(!b||b.rangeCount===0)return null;const L=b.getRangeAt(0);if(L.collapsed||!B.contains(L.commonAncestorContainer))return null;const de=document.createRange();de.selectNodeContents(B),de.setEnd(L.startContainer,L.startOffset);const _e=de.toString().length;de.setEnd(L.endContainer,L.endOffset);const Oe=de.toString().length;return{from:Math.min(_e,Oe),to:Math.max(_e,Oe)}}function ft(){const B=N.value.selection;if(B.kind!=="text"||!Ht(B))return null;const b=N.value.doc,L=In(b),de=L.indexOf(B.anchor.blockId),_e=L.indexOf(B.focus.blockId);if(de===-1||_e===-1)return null;const[Oe,Be]=de<=_e?[B.anchor,B.focus]:[B.focus,B.anchor],be=L.indexOf(Oe.blockId),y=L.indexOf(Be.blockId);if(be===-1||y===-1||be>y)return null;const v=[];for(let T=be;T<=y;T++){const R=L[T],q=b.blocks.get(R);if(!q)continue;const X=Ae(q.content).length;let ce=0,ue=X;T===be&&(ce=Math.min(Oe.offset,X)),T===y&&(ue=Math.min(Be.offset,X)),v.push({id:R,from:ce,to:ue})}return{ranges:v}}function ht(){const B=N.value.selection;if(B.kind!=="text"||!Ht(B))return null;const b=ft();if(!b)return null;const L=N.value.doc,de=[],_e=[];for(const Oe of b.ranges){const Be=L.blocks.get(Oe.id);if(!Be)continue;const[,be]=Wt(Be.content,Oe.from),[y]=Wt(be,Oe.to-Oe.from);de.push(Ae(y)),_e.push(Zn(y))}return{text:de.join(`
11
+ `));for(const h of Array.from(a.childNodes))r.push(h);l=0}continue}if(d==="img"){const f=id(a);f&&(s(),o.push({type:"image",attrs:{src:f.src,alt:f.alt,title:f.title},content:[]}),l=0);continue}if(d==="table"){const f=od(a);f&&(s(),o.push({type:"table",attrs:f,content:[]}),l=0);continue}if((i=a.querySelector)!=null&&i.call(a,"img")){s(),Ko(a.childNodes,n,o),l=0;continue}r.push(c),l=0}}s()}function fd(e,n,o){const r=[[]];for(const l of e.childNodes)l.nodeType===Node.ELEMENT_NODE&&l.tagName.toLowerCase()==="br"?r.push([]):r[r.length-1].push(l);for(const l of r){const s=n.createElement("div");for(const c of l)s.appendChild(c.cloneNode(!0));const i=mn(s);o.push({type:"paragraph",attrs:{},content:i})}}const lo=new Map,cr=new Set;function Li(e,n){for(const o of cr)o(e,n)}function Xn(e){return lo.get(e)??null}function wn(e,n){if(n===null){if(lo.has(e)){const o=lo.get(e);if(o!=null&&o.tempPreviewUrl&&URL.revokeObjectURL(o.tempPreviewUrl),o!=null&&o.controller)try{o.controller.abort()}catch{}lo.delete(e),Li(e,null)}}else lo.set(e,n),Li(e,n)}function Oi(e){return cr.add(e),()=>{cr.delete(e)}}const md=Oi;function pd(){for(const[,e]of lo)if(e!=null&&e.tempPreviewUrl&&URL.revokeObjectURL(e.tempPreviewUrl),e!=null&&e.controller)try{e.controller.abort()}catch{}lo.clear();for(const e of cr)e("",null)}const hd=pd,ar=new Set;function gd(){for(const e of ar)try{URL.revokeObjectURL(e)}catch{}ar.clear()}function Xr(e){const n=URL.createObjectURL(e);return ar.add(n),n}function bd(e){for(const n of e)wn(n,null)}function kd(e){bd(e)}let jr=null;function yd(e){jr=e}const wd=yd;function Di(e,n,o,r){if(!jr){r.onError("Upload handler not registered");return}jr(e,n,o,r)}function Ed(e,n){return new Promise((o,r)=>{const l=Date.now(),s=500+Math.min(2500,Math.round(e.size/2e3));let i=!1;const c=()=>{if(i)return;const a=Date.now()-l,d=Math.min(1,a/s),f=1-Math.pow(1-d,2);if(n==null||n(f),d<1)requestAnimationFrame(c);else{const u=Xr(e);if(typeof document>"u"){o({url:u});return}const h=document.createElement("img");let p=!1;const m=(k,x)=>{p||(p=!0,o({url:u,width:k,height:x}))};h.onload=()=>m(h.naturalWidth||void 0,h.naturalHeight||void 0),h.onerror=()=>m(),h.src=u,setTimeout(()=>m(),5e3)}};requestAnimationFrame(c),e.type.startsWith("image/")||(i=!0,setTimeout(()=>r(new Error("Not an image file")),30))})}function vd(e,n){return new Promise(o=>{const r=Xr(n),l=new AbortController;wn(e,{status:"pending",progress:0,file:n,tempPreviewUrl:r,controller:l});let s,i;if(typeof document<"u"){const c=document.createElement("img");let a=!1;const d=()=>{a||(a=!0,s=c.naturalWidth||void 0,i=c.naturalHeight||void 0)};c.onload=d,c.onerror=d,c.src=r,setTimeout(d,4e3)}try{Di(n.name,n,l,{onProgress:c=>{const a=Xn(e);if(!a)return;const d=Math.max(0,Math.min(1,Number.isFinite(c)?c:0));wn(e,{...a,progress:d})},onSuccess:c=>{const a=Xn(e);if(a!=null&&a.tempPreviewUrl&&a.tempPreviewUrl!==c.url){try{URL.revokeObjectURL(a.tempPreviewUrl)}catch{}ar.delete(a.tempPreviewUrl)}wn(e,null),o({ok:!0,value:{url:c.url,width:c.width??s,height:c.height??i,alt:c.alt,title:c.title,fileId:c.fileId}})},onError:c=>{const a=Xn(e);wn(e,{status:"error",progress:0,error:c,file:(a==null?void 0:a.file)??n,tempPreviewUrl:a==null?void 0:a.tempPreviewUrl}),o({ok:!1,error:c})}})}catch(c){const a=c instanceof Error?c.message:String(c);wn(e,{status:"error",progress:0,error:a,file:n,tempPreviewUrl:r}),o({ok:!1,error:a})}})}async function Qr(e,n){if(!e)return null;try{if(e.startsWith("data:"))return Cd(e,n);const o=await fetch(e);if(!o.ok)return null;const r=await o.blob(),l=$i(r.type,e),s=n?Pi(n,l):`image-${Date.now()}${l}`;return new File([r],s,{type:r.type||"image/png"})}catch{return null}}function Cd(e,n){const o=e.match(/^data:([^;,]+)?(;base64)?,(.*)$/);if(!o)return null;const[,r,l,s]=o,i=r||"image/png",c=!!l;let a;if(c){const h=atob(s);a=new Uint8Array(h.length);for(let p=0;p<h.length;p++)a[p]=h.charCodeAt(p)}else{const h=decodeURIComponent(s);a=new TextEncoder().encode(h)}const d=$i(i,e),f=n?Pi(n,d):`image-${Date.now()}${d}`,u=new Blob([a],{type:i});return new File([u],f,{type:i})}function $i(e,n){if(e.includes("png"))return".png";if(e.includes("jpeg")||e.includes("jpg"))return".jpg";if(e.includes("gif"))return".gif";if(e.includes("webp"))return".webp";if(e.includes("svg"))return".svg";if(e.includes("bmp"))return".bmp";const o=n.match(/\.(png|jpe?g|gif|webp|svg|bmp)$/i);return o?`.${o[1].toLowerCase()}`:".png"}function Pi(e,n){return e.toLowerCase().endsWith(n.toLowerCase())?e:e+n}const Td=["data-block-id","data-empty","data-placeholder","contenteditable"],Un=t.defineComponent({__name:"BlockContent",props:{block:{},placeholder:{}},emits:["slashTrigger","inputChanged","linkClick","focusIn"],setup(e,{emit:n}){const o=e,r=n,l=fn(),s=Yn(),i=t.ref(null),c=t.shallowRef(!1);function a(){return Ae(o.block.content).length===0}const d=t.ref(a());t.onMounted(()=>{const S=i.value;if(!S)return;const K=Ae(o.block.content);Ei(o.block.content)?S.innerHTML=Zn(o.block.content):S.textContent=K,d.value=K.length===0});function f(S){const K=window.getSelection();if(!K||K.rangeCount===0)return null;const _=K.getRangeAt(0);if(!S.contains(_.commonAncestorContainer))return null;const O=document.createRange();O.selectNodeContents(S),O.setEnd(_.startContainer,_.startOffset);const M=O.toString().length;O.setEnd(_.endContainer,_.endOffset);const E=O.toString().length;return{from:Math.min(M,E),to:Math.max(M,E)}}function u(S,K){const _=document.createTreeWalker(S,NodeFilter.SHOW_TEXT);let O=Math.max(0,K),M=null;for(;_.nextNode();){const E=_.currentNode;M=E;const N=(E.nodeValue??"").length;if(O<=N)return{node:E,offset:O};O-=N}return M?{node:M,offset:(M.nodeValue??"").length}:{node:S,offset:0}}function h(S,K,_){const O=window.getSelection();if(!O)return;const M=u(S,K),E=u(S,Math.max(K,_));try{const N=document.createRange();K<=_?(N.setStart(M.node,M.offset),N.setEnd(E.node,E.offset)):(N.setStart(E.node,E.offset),N.setEnd(M.node,M.offset)),O.removeAllRanges(),O.addRange(N)}catch{try{const N=document.createRange();N.setStart(E.node,E.offset),N.collapse(!0),O.removeAllRanges(),O.addRange(N)}catch{}}}t.watch(()=>o.block,S=>{if(c.value)return;const K=i.value;if(!K)return;const _=f(K),O=_&&_.from!==_.to,M=document.activeElement===K,E=Ae(S.content),N=E.length===0;let A=!1;if(N)K.childNodes.length>0&&(K.textContent="",A=!0);else{const W=Ei(S.content),me=!!K.querySelector(Da);if(!W&&!me)K.textContent!==E&&(K.textContent=E,A=!0);else{const le=vi(mn(K)),he=vi(S.content);le!==he&&(K.innerHTML=Zn(S.content),A=!0)}}d.value=N,A&&_&&(M||O)&&h(K,_.from,_.to)});function p(S){S.key==="Enter"&&!S.shiftKey&&!S.isComposing&&S.preventDefault()}function m(S){var A,W;if(!s.value)return;const K=i.value;if(!K)return;const _=mn(K),O=Ae(_);if(d.value=O.length===0,r("inputChanged",o.block.id,O),c.value||Ia({editor:l,registry:l.registries.inputRules,blockId:o.block.id,text:O}))return;if(Ba(O)){const me=O.match(/\/([^/]*)$/),le=O.lastIndexOf("/"),he=me&&me[1]!==void 0?me[1]:le>=0?O.slice(le+1):"";r("slashTrigger",K,o.block.id,he)}let E=_;l.registries.schema.get(o.block.type).inlineMarks&&S.data&&/\s/.test(S.data)&&(E=lr(_)),(W=(A=l.commands).setText)==null||W.call(A,{id:o.block.id,content:E})}function k(S){c.value=!0}function x(S){var N,A;if(c.value=!1,!s.value)return;const K=i.value;if(!K)return;const _=mn(K),O=Ae(_);d.value=O.length===0,r("inputChanged",o.block.id,O);const E=l.registries.schema.get(o.block.type).inlineMarks?lr(_):_;(A=(N=l.commands).setText)==null||A.call(N,{id:o.block.id,content:E})}function D(){const S=i.value;if(!S)return null;const K=window.getSelection();if(!K||K.rangeCount===0)return null;const _=K.getRangeAt(0);if(!S.contains(_.commonAncestorContainer))return null;const O=Ae(o.block.content),M=document.createRange();M.selectNodeContents(S),M.setEnd(_.startContainer,_.startOffset);const E=Math.min(M.toString().length,O.length);M.setEnd(_.endContainer,_.endOffset);const N=Math.min(M.toString().length,O.length);return[Math.min(E,N),Math.max(E,N)]}function U(S){var W,me;const K=D();if(!K)return;const[_,O]=K;if(_===O)return;const[,M]=Wt(o.block.content,_),[E]=Wt(M,O-_),N=Ae(E),A=Zn(E);S.preventDefault(),(W=S.clipboardData)==null||W.setData("text/plain",N),(me=S.clipboardData)==null||me.setData("text/html",A)}function F(S){var le,he,ae,ie;if(!s.value){S.preventDefault();return}const K=D();if(!K)return;const[_,O]=K;if(_===O)return;const[M,E]=Wt(o.block.content,_),[N,A]=Wt(E,O-_),W=Ae(N),me=Zn(N);S.preventDefault(),(le=S.clipboardData)==null||le.setData("text/plain",W),(he=S.clipboardData)==null||he.setData("text/html",me),(ie=(ae=l.commands).setText)==null||ie.call(ae,{id:o.block.id,content:[...M,...A],selectionAfter:st(o.block.id,_)})}const ee=_a();function $(S){const K=[],_=new Set;if(S.items&&S.items.length>0)for(let O=0;O<S.items.length;O++){const M=S.items[O];if(M.kind!=="file")continue;const E=M.getAsFile();if(!E||!E.type.startsWith("image/"))continue;const N=`${E.name||""}:${E.size}:${E.type}`;_.has(N)||(_.add(N),K.push(E))}if(S.files&&S.files.length>0)for(let O=0;O<S.files.length;O++){const M=S.files[O];if(!M.type.startsWith("image/"))continue;const E=`${M.name||""}:${M.size}:${M.type}`;_.has(E)||(_.add(E),K.push(M))}return K}async function V(S){var Mt,Zt,Gt,Rt,tt,yt,vt,Ze,Ve,Ct,fe,Tt,Xe,Re,qt,rt,Et,P,w,z,we,ve,nt,lt,on,cn,He,vn,Xt,bn,Cn,Tn;if(!s.value){S.preventDefault();return}const K=S.clipboardData;if(!K)return;if(ee){const Me=$(K);if(Me.length>0){S.preventDefault();let Ie=o.block.id;for(let Ge=0;Ge<Me.length;Ge++){const ct=Me[Ge],Ke=await ee(ct,{relativeToBlockId:Ie,convertIfEmpty:Ge===0,position:"after"});Ke&&(Ie=Ke)}return}}const _=K.getData("text/html"),O=K.getData("text/plain"),M=sd(_||null,O||null);if(M.length===0)return;const E=M.some(Me=>Me.type==="image"),N=D(),A=Ae(o.block.content).length,W=N?N[0]:A,me=N?N[1]:A,[le]=Wt(o.block.content,W),[,he]=Wt(o.block.content,me),ae=l.registries.schema.get(o.block.type),ie=Me=>ae.inlineMarks?Me:Me.map(Ie=>({type:"text",text:Ie.text}));if(!E){if(M.length===1){const Ge=ie(M[0].content);if(ae.inlineMarks&&W<me&&Ge.length===1&&Ge[0].type==="text"&&!Ge[0].marks){const At=Ge[0].text;if(Ur(At)){const an=to(At),Lt=Pn(an);if(Lt){(Zt=(Mt=l.commands).setLink)==null||Zt.call(Mt,{id:o.block.id,href:Lt,from:W,to:me});return}}}const ct=[...le,...Ge,...he],Ke=ae.inlineMarks?lr(ct):ct,_t=Ae(le).length,ft=Ae(Ge).length,ht=_t+ft;(Rt=(Gt=l.commands).setText)==null||Rt.call(Gt,{id:o.block.id,content:Ke,selectionAfter:st(o.block.id,ht)});return}const Me=[...le,...ie(M[0].content)];(yt=(tt=l.commands).setText)==null||yt.call(tt,{id:o.block.id,content:Me});let Ie=o.block.id;for(let Ge=1;Ge<M.length;Ge++){const ct=M[Ge],Ke=Ge===M.length-1,_t=ie(ct.content),ft=Ke?[..._t,...he]:_t,ht=l.registries.schema.coerceAttrsFor(ct.type,ct.attrs);(Ze=(vt=l.commands).insertBlock)==null||Ze.call(vt,{after:Ie,type:ct.type,attrs:ht,content:ft});const At=l.getState();if(At.selection.kind==="caret"&&(Ie=At.selection.blockId),Ke){const an=Ae(_t).length,Lt=he.length>0?an:Ae(ft).length;(Ct=(Ve=l.commands).setSelection)==null||Ct.call(Ve,{selection:st(Ie,Lt)})}}return}if(!ee){const Me=M.filter(Ie=>Ie.type!=="image");if(Me.length===0)return;if(M.splice(0,M.length,...Me),M.length===1){const Ie=ie(M[0].content),Ge=[...le,...Ie,...he];(Tt=(fe=l.commands).setText)==null||Tt.call(fe,{id:o.block.id,content:Ge,selectionAfter:st(o.block.id,Ae(le).length+Ae(Ie).length)})}return}let Se=-1;for(let Me=M.length-1;Me>=0;Me--)if(M[Me].type!=="image"){Se=Me;break}let Te=o.block.id;const We=M[0];if(We.type!=="image"){const Ie=Se===0?[...le,...ie(We.content),...he]:[...le,...ie(We.content)];(Re=(Xe=l.commands).setText)==null||Re.call(Xe,{id:o.block.id,content:Ie}),Te=o.block.id}else{const Me=le.length===0&&he.length===0,Ie=We.attrs.src,Ge=We.attrs.alt??"";if(Me){const ct=await Qr(Ie,Ge||void 0);if(ct){const Ke=await ee(ct,{relativeToBlockId:Te,position:"after",convertIfEmpty:!0});Ke&&(Te=Ke)}else{const Ke=l.registries.schema.coerceAttrsFor(We.type,We.attrs);(rt=(qt=l.commands).replaceBlock)==null||rt.call(qt,{id:o.block.id,type:We.type,attrs:Ke}),Te=o.block.id}}else{(P=(Et=l.commands).setText)==null||P.call(Et,{id:o.block.id,content:le});const ct=await Qr(Ie,Ge||void 0);if(ct){const Ke=await ee(ct,{relativeToBlockId:Te,position:"after",convertIfEmpty:!1});Ke&&(Te=Ke)}else{const Ke=l.registries.schema.coerceAttrsFor(We.type,We.attrs);(z=(w=l.commands).insertBlock)==null||z.call(w,{after:Te,type:We.type,attrs:Ke,content:[]});const _t=l.getState();_t.selection.kind==="caret"&&(Te=_t.selection.blockId)}}}for(let Me=1;Me<M.length;Me++){const Ie=M[Me],Ge=Me===Se;if(Ie.type==="image"){const ct=Ie.attrs.src,Ke=Ie.attrs.alt??"",_t=await Qr(ct,Ke||void 0);if(_t){const ft=await ee(_t,{relativeToBlockId:Te,position:"after",convertIfEmpty:!1});ft&&(Te=ft)}else{const ft=l.registries.schema.coerceAttrsFor(Ie.type,Ie.attrs);(ve=(we=l.commands).insertBlock)==null||ve.call(we,{after:Te,type:Ie.type,attrs:ft,content:[]});const ht=l.getState();ht.selection.kind==="caret"&&(Te=ht.selection.blockId)}}else{const ct=ie(Ie.content),Ke=Ge?[...ct,...he]:ct,_t=l.registries.schema.coerceAttrsFor(Ie.type,Ie.attrs);(lt=(nt=l.commands).insertBlock)==null||lt.call(nt,{after:Te,type:Ie.type,attrs:_t,content:Ke});const ft=l.getState();if(ft.selection.kind==="caret"&&(Te=ft.selection.blockId),Ge){const ht=Ae(ct).length,At=he.length>0?ht:Ae(Ke).length;(cn=(on=l.commands).setSelection)==null||cn.call(on,{selection:st(Te,At)})}}}if(Se===-1&&he.length>0){(vn=(He=l.commands).insertBlock)==null||vn.call(He,{after:Te,type:"paragraph",attrs:{},content:he});const Me=l.getState();Me.selection.kind==="caret"&&(Te=Me.selection.blockId,(bn=(Xt=l.commands).setSelection)==null||bn.call(Xt,{selection:st(Te,Ae(he).length)}))}else Se===-1&&(le.length>0||he.length>0)&&((Tn=(Cn=l.commands).insertBlock)==null||Tn.call(Cn,{after:Te,type:"paragraph",attrs:{},content:[]}))}function re(){r("focusIn",o.block.id)}function G(){}function ne(S){return document.createTreeWalker(S,NodeFilter.SHOW_TEXT).nextNode()}function Z(S){var N;const K=S.target;if(!K)return;const _=K.closest("a");if(!_||!((N=i.value)!=null&&N.contains(_)))return;S.preventDefault();const O=window.getSelection();let M=0;if(O&&O.rangeCount>0&&!!_.contains(O.getRangeAt(0).commonAncestorContainer)){const A=O.getRangeAt(0),W=document.createRange();W.selectNodeContents(i.value),W.setEnd(A.startContainer,A.startOffset),M=W.toString().length}else{const A=ne(_);if(A){const W=document.createRange();W.selectNodeContents(i.value),W.setEnd(A,0),M=W.toString().length}}r("linkClick",o.block.id,M)}return(S,K)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:i,class:"block-content","data-block-id":e.block.id,"data-empty":d.value,"data-placeholder":e.placeholder,contenteditable:t.unref(s),spellcheck:"false",onInput:m,onCompositionstart:k,onCompositionend:x,onFocus:re,onBlur:G,onKeydown:p,onClick:Z,onPaste:t.withModifiers(V,["prevent"]),onCopy:U,onCut:F},null,40,Td))}});function Hi(e){return e==="zh-CN"||e===null||e===void 0||e===""?"zh-CN":"en-US"}function Vi(e){return e==="dark"?"dark":"light"}const _d={"zh-CN":{"editor.placeholder":"输入文字,或按 '/' 获取命令…","handle.plus.title":"点击添加块","handle.plus.ariaLabel":"Insert block below","handle.grip.title":"拖拽移动 / 点击设置","handle.grip.ariaLabel":"Drag to move block, click to open settings","ui.scrollUp":"向上滚动","ui.scrollDown":"向下滚动","ui.scrollLeft":"向左","ui.scrollRight":"向右","plus.category.basic":"基本区块","plus.category.list":"列表","plus.category.other":"其他","plus.noMatch":"未找到匹配的命令","plus.searchPlaceholder":"搜索命令…","slash.paragraph.title":"正文","slash.paragraph.description":"普通文本段落。","slash.heading1.title":"一级标题","slash.heading1.description":"用于文章的主标题。","slash.heading2.title":"二级标题","slash.heading2.description":"用于主要章节的标题。","slash.heading3.title":"三级标题","slash.heading3.description":"用于子章节的标题。","slash.heading4.title":"四级标题","slash.heading4.description":"用于更细分层的标题。","slash.heading5.title":"五级标题","slash.heading5.description":"用于较小层级的标题。","slash.heading6.title":"六级标题","slash.heading6.description":"用于最小层级的标题。","slash.bulletList.title":"项目符号列表","slash.bulletList.description":"创建一个无序列表。","slash.orderedList.title":"编号列表","slash.orderedList.description":"创建一个带编号的有序列表。","slash.todoList.title":"待办列表","slash.todoList.description":"用复选框追踪待办任务。","slash.quote.title":"引用","slash.quote.description":"引用一段话。","slash.codeBlock.title":"代码块","slash.codeBlock.description":"插入一段代码块。","codeBlock.title":"代码块","slash.divider.title":"分隔符","slash.divider.description":"插入一条水平分隔线。","slash.image.title":"图片","slash.image.description":"插入一张图片(从本地上传或选择文件)。","slash.table3x3.title":"表格(3×3)","slash.table3x3.description":"插入一个 3 行 3 列的表格。","slash.table2x2.title":"表格(2×2)","slash.table2x2.description":"插入一个 2 行 2 列的表格。","slash.table4x4.title":"表格(4×4)","slash.table4x4.description":"插入一个 4 行 4 列的表格。","bsm.section.turnInto":"转换为","bsm.section.alignIndent":"对齐与缩进","bsm.section.align":"对齐","bsm.section.indent":"缩进","bsm.section.action":"操作","bsm.section.textColor":"文字颜色","bsm.section.bgColor":"背景颜色","bsm.indent.decrease":"减少缩进","bsm.indent.increase":"增加缩进","turnInto.paragraph":"正文","turnInto.h1":"一级标题","turnInto.h2":"二级标题","turnInto.h3":"三级标题","turnInto.h4":"四级标题","turnInto.h5":"五级标题","turnInto.h6":"六级标题","turnInto.bullet":"项目符号","turnInto.ordered":"编号列表","turnInto.todo":"待办","turnInto.quote":"引用","turnInto.code":"代码块","align.left":"左对齐","align.center":"居中","align.right":"右对齐","align.justify":"两端对齐","verticalAlign.top":"顶端对齐","verticalAlign.middle":"垂直居中","verticalAlign.bottom":"底端对齐","hoverToolbar.verticalAlignBtnTitle":"垂直对齐","action.duplicate":"复制","action.copy":"拷贝","action.cut":"剪切","action.moveUp":"上移","action.moveDown":"下移","action.delete":"删除","ol.continue":"继续之前的编号","ol.startNew":"开始新列表(从1开始)","ol.modify":"修改编号值…","numberPicker.title":"修改编号值","numberPicker.inputLabel":"编号值","numberPicker.confirm":"确定","codeLang.title":"设置代码类型","codeLang.inputLabel":"代码类型","codeLang.placeholder":"请输入代码类型","codeLang.confirm":"确定","codeLang.custom":"自定义…","codeLang.cancel":"取消","codeLang.plain":"纯文本","hoverToolbar.label":"格式化","hoverToolbar.typeBtnTitle":"切换块类型","hoverToolbar.alignBtnTitle":"对齐方式","hoverToolbar.colorBtnTitle":"颜色","hoverToolbar.textColor":"文字颜色","hoverToolbar.bgColor":"背景颜色","hoverToolbar.copySelection":"复制选中文本","hoverToolbar.deleteBlock":"删除块","mark.bold":"加粗","mark.italic":"斜体","mark.underline":"下划线","mark.strikethrough":"删除线","mark.inlineCode":"行内代码","mark.link":"链接","link.popoverLabel":"链接","link.open":"打开链接","link.copy":"复制链接","link.edit":"编辑链接","link.remove":"移除链接","link.save":"保存","link.cancel":"取消","link.urlPlaceholder":"输入链接地址…","link.textPlaceholder":"链接文本…","link.emptyUrl":"(空链接)","link.invalidUrl":"请输入有效的链接地址","hoverToolbar.linkBtnTitle":"链接","color.default":"默认","color.gray":"灰色","color.brown":"棕色","color.orange":"橙色","color.yellow":"黄色","color.green":"绿色","color.blue":"蓝色","color.purple":"紫色","color.pink":"粉色","color.red":"红色","color.none":"无","image.uploading":"正在上传图片…","image.uploadFailed":"上传失败","image.loadFailed":"图片加载失败","image.retry":"重试","image.replace":"替换图片","image.remove":"删除图片","image.resize":"拖拽调整尺寸","image.emptyTitle":"点击上传图片","image.emptySub":"或拖入图片文件到此处","image.captionPlaceholder":"添加图片说明…","turnInto.image":"图片","table.title":"表格","table.cellPlaceholder":"输入内容…","table.resizeCol":"拖拽调整列宽","table.rowActions":"行操作","table.colActions":"列操作","table.selectRow":"选择此行","table.selectCol":"选择此列","table.selectAll":"选择整个表格","table.insertRowAbove":"在上方插入行","table.insertRowBelow":"在下方插入行","table.insertColLeft":"在左侧插入列","table.insertColRight":"在右侧插入列","table.removeRow":"删除此行","table.removeCol":"删除此列","table.deleteRow":"删除行","table.deleteCol":"删除列","table.toggleHeader":"切换表头行","table.mergeCells":"合并单元格","table.splitCell":"拆分单元格","table.deleteTable":"删除表格","turnInto.table":"表格","toc.title":"目录","toc.empty":"暂无标题","slash.tableOfContents.title":"目录","slash.tableOfContents.description":"插入文档目录。"},"en-US":{"editor.placeholder":"Type '/' for commands...","handle.plus.title":"Insert block below","handle.plus.ariaLabel":"Insert block below","handle.grip.title":"Drag to move / click for settings","handle.grip.ariaLabel":"Drag to move block, click to open settings","ui.scrollUp":"Scroll up","ui.scrollDown":"Scroll down","ui.scrollLeft":"Scroll left","ui.scrollRight":"Scroll right","plus.category.basic":"Basic blocks","plus.category.list":"Lists","plus.category.other":"Other","plus.noMatch":"No matching commands","plus.searchPlaceholder":"Search commands...","slash.paragraph.title":"Paragraph","slash.paragraph.description":"Plain text paragraph.","slash.heading1.title":"Heading 1","slash.heading1.description":"Main title for the document.","slash.heading2.title":"Heading 2","slash.heading2.description":"Title for major sections.","slash.heading3.title":"Heading 3","slash.heading3.description":"Title for sub-sections.","slash.heading4.title":"Heading 4","slash.heading4.description":"Title for finer hierarchy levels.","slash.heading5.title":"Heading 5","slash.heading5.description":"Title for smaller hierarchy levels.","slash.heading6.title":"Heading 6","slash.heading6.description":"Title for the smallest hierarchy level.","slash.bulletList.title":"Bullet list","slash.bulletList.description":"Create an unordered list.","slash.orderedList.title":"Numbered list","slash.orderedList.description":"Create a numbered ordered list.","slash.todoList.title":"To-do list","slash.todoList.description":"Track tasks with checkboxes.","slash.quote.title":"Quote","slash.quote.description":"Quote a passage of text.","slash.codeBlock.title":"Code block","slash.codeBlock.description":"Insert a code block.","codeBlock.title":"Code block","slash.divider.title":"Divider","slash.divider.description":"Insert a horizontal divider line.","slash.image.title":"Image","slash.image.description":"Insert an image (upload or choose a file).","slash.table3x3.title":"Table (3×3)","slash.table3x3.description":"Insert a 3-row 3-column table.","slash.table2x2.title":"Table (2×2)","slash.table2x2.description":"Insert a 2-row 2-column table.","slash.table4x4.title":"Table (4×4)","slash.table4x4.description":"Insert a 4-row 4-column table.","bsm.section.turnInto":"Turn into","bsm.section.alignIndent":"Align & Indent","bsm.section.align":"Align","bsm.section.indent":"Indent","bsm.section.action":"Actions","bsm.section.textColor":"Text color","bsm.section.bgColor":"Background color","bsm.indent.decrease":"Decrease indent","bsm.indent.increase":"Increase indent","turnInto.paragraph":"Paragraph","turnInto.h1":"Heading 1","turnInto.h2":"Heading 2","turnInto.h3":"Heading 3","turnInto.h4":"Heading 4","turnInto.h5":"Heading 5","turnInto.h6":"Heading 6","turnInto.bullet":"Bullet list","turnInto.ordered":"Numbered list","turnInto.todo":"To-do","turnInto.quote":"Quote","turnInto.code":"Code block","align.left":"Align left","align.center":"Center","align.right":"Align right","align.justify":"Justify","verticalAlign.top":"Align top","verticalAlign.middle":"Vertical center","verticalAlign.bottom":"Align bottom","hoverToolbar.verticalAlignBtnTitle":"Vertical align","action.duplicate":"Duplicate","action.copy":"Copy","action.cut":"Cut","action.moveUp":"Move up","action.moveDown":"Move down","action.delete":"Delete","ol.continue":"Continue previous numbering","ol.startNew":"Start a new list (from 1)","ol.modify":"Modify starting number...","numberPicker.title":"Modify number value","numberPicker.inputLabel":"Number value","numberPicker.confirm":"Confirm","codeLang.title":"Set code language","codeLang.inputLabel":"Code language","codeLang.placeholder":"Enter code language","codeLang.confirm":"Confirm","codeLang.custom":"Custom…","codeLang.cancel":"Cancel","codeLang.plain":"Plain text","hoverToolbar.label":"Formatting","hoverToolbar.typeBtnTitle":"Switch block type","hoverToolbar.alignBtnTitle":"Alignment","hoverToolbar.colorBtnTitle":"Color","hoverToolbar.textColor":"Text color","hoverToolbar.bgColor":"Background color","hoverToolbar.copySelection":"Copy selection","hoverToolbar.deleteBlock":"Delete block","mark.bold":"Bold","mark.italic":"Italic","mark.underline":"Underline","mark.strikethrough":"Strikethrough","mark.inlineCode":"Inline code","mark.link":"Link","link.popoverLabel":"Link","link.open":"Open link","link.copy":"Copy link","link.edit":"Edit link","link.remove":"Remove link","link.save":"Save","link.cancel":"Cancel","link.urlPlaceholder":"Enter URL...","link.textPlaceholder":"Link text...","link.emptyUrl":"(empty link)","link.invalidUrl":"Please enter a valid URL","hoverToolbar.linkBtnTitle":"Link","hoverToolbar.linkPrompt":"Enter URL:","color.default":"Default","color.gray":"Gray","color.brown":"Brown","color.orange":"Orange","color.yellow":"Yellow","color.green":"Green","color.blue":"Blue","color.purple":"Purple","color.pink":"Pink","color.red":"Red","color.none":"None","image.uploading":"Uploading image...","image.uploadFailed":"Upload failed","image.loadFailed":"Failed to load image","image.retry":"Retry","image.replace":"Replace image","image.remove":"Remove image","image.resize":"Drag to resize","image.emptyTitle":"Click to upload an image","image.emptySub":"or drag an image file here","image.captionPlaceholder":"Add a caption...","turnInto.image":"Image","table.title":"Table","table.cellPlaceholder":"Type here...","table.resizeCol":"Drag to resize column","table.rowActions":"Row actions","table.colActions":"Column actions","table.selectRow":"Select row","table.selectCol":"Select column","table.selectAll":"Select entire table","table.insertRowAbove":"Insert row above","table.insertRowBelow":"Insert row below","table.insertColLeft":"Insert column left","table.insertColRight":"Insert column right","table.removeRow":"Delete row","table.removeCol":"Delete column","table.deleteRow":"Delete row","table.deleteCol":"Delete column","table.toggleHeader":"Toggle header row","table.mergeCells":"Merge cells","table.splitCell":"Split cell","table.deleteTable":"Delete table","turnInto.table":"Table","toc.title":"Table of Contents","toc.empty":"No headings","slash.tableOfContents.title":"Table of Contents","slash.tableOfContents.description":"Insert a table of contents."}},Ui=Symbol("be-locale"),zi=Symbol("be-theme");function xd(e,n){t.provide(Ui,e),t.provide(zi,n)}function en(){const e=t.inject(Ui,t.ref("zh-CN")),n=t.inject(zi,t.ref("light"));return{get locale(){return e.value},get theme(){return n.value},t(o){const l=_d[e.value][o];return typeof l=="string"?l:o}}}const Md=["title","aria-label","onKeydown"],Nd=["title","aria-label","onKeydown"],Sd=4,Ad=300,Id=t.defineComponent({__name:"BlockHandle",props:{blockId:{},visible:{type:Boolean}},emits:["openPlusMenu","openSettingsMenu","gripPointerDown","gripPointerUp"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:s}=en(),i=Yn(),c=t.ref(null),a=t.ref(null),d=t.ref(null),f=t.ref(!1),u=t.ref(!1),h=t.ref(null);let p=null;const m=t.computed(()=>h.value===null?void 0:{top:`${h.value}px`});function k(){var O;const S=(O=c.value)==null?void 0:O.parentElement;if(!S)return null;const K=S.querySelector(".block-host-content");if(!K)return null;const _=K.firstElementChild;return _ instanceof HTMLElement?_:K}function x(){var M;const S=(M=c.value)==null?void 0:M.parentElement,K=k();if(!S||!K)return;const _=S.getBoundingClientRect(),O=K.getBoundingClientRect();h.value=O.top-_.top+O.height/2}function D(){const S=k();S&&(U(),p=new ResizeObserver(()=>x()),p.observe(S))}function U(){p==null||p.disconnect(),p=null}t.watch(()=>r.visible,S=>{S?t.nextTick().then(()=>{x(),D()}):U()}),t.onMounted(x),t.onBeforeUnmount(U);function F(){i.value&&a.value&&l("openPlusMenu",a.value)}let ee=0,$=0,V=0,re=!1;function G(S){i.value&&(V=Date.now(),ee=S.clientX,$=S.clientY,re=!0,u.value=!1,l("gripPointerDown",r.blockId,ee,$,{thresholdPx:Sd}))}function ne(S){u.value=S}function Z(){i.value&&(u.value||re&&Date.now()-V>Ad||(re=!1,d.value&&l("openSettingsMenu",d.value)))}return n({isOpen:f,insertBtn:a,gripBtn:d,setLocalDragging:ne}),(S,K)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handleEl",ref:c,class:t.normalizeClass(["block-handle",{visible:e.visible,dragging:u.value}]),style:t.normalizeStyle(m.value)},[t.createElementVNode("div",{ref_key:"insertBtn",ref:a,class:"handle-btn handle-insert",role:"button",tabindex:"0",title:t.unref(s)("handle.plus.title"),"aria-label":t.unref(s)("handle.plus.ariaLabel"),onMousedown:t.withModifiers(F,["prevent","stop"]),onKeydown:[t.withKeys(t.withModifiers(F,["prevent","stop"]),["enter"]),t.withKeys(t.withModifiers(F,["prevent","stop"]),["space"])]},[...K[0]||(K[0]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[t.createElementVNode("path",{d:"M8 3.5V12.5M3.5 8H12.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],40,Md),t.createElementVNode("div",{ref_key:"gripBtn",ref:d,class:"handle-btn handle-grip",role:"button",tabindex:"0",title:t.unref(s)("handle.grip.title"),"aria-label":t.unref(s)("handle.grip.ariaLabel"),onMousedown:t.withModifiers(G,["prevent","stop"]),onClick:t.withModifiers(Z,["stop"]),onKeydown:[t.withKeys(t.withModifiers(Z,["prevent","stop"]),["enter"]),t.withKeys(t.withModifiers(Z,["prevent","stop"]),["space"])]},[...K[1]||(K[1]=[t.createStaticVNode('<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><circle cx="5" cy="4" r="1.3" fill="currentColor"></circle><circle cx="11" cy="4" r="1.3" fill="currentColor"></circle><circle cx="5" cy="8" r="1.3" fill="currentColor"></circle><circle cx="11" cy="8" r="1.3" fill="currentColor"></circle><circle cx="5" cy="12" r="1.3" fill="currentColor"></circle><circle cx="11" cy="12" r="1.3" fill="currentColor"></circle></svg>',1)])],40,Nd)],6))}}),Bd=["data-block-id","data-block-type"],Rd={class:"block-host-content"},Fi=t.defineComponent({__name:"BlockHost",props:{block:{},placeholder:{},hoveredBlockId:{},focusedBlockId:{},hasTextSelection:{type:Boolean},draggingBlockId:{},dropTargetBlockId:{},dropPosition:{},menuOpenBlockId:{}},emits:["openSettingsMenu","openPlusMenu","slashTrigger","inputChanged","hoverChange","gripPointerDown","gripPointerUp","linkClick","focusIn"],setup(e,{expose:n,emit:o}){const r=e,l=o,s=fn(),i=Yn(),c=t.ref(null),a=t.ref(null),d=t.computed(()=>!i.value||r.hasTextSelection?!1:r.hoveredBlockId===r.block.id||r.hoveredBlockId===null&&r.focusedBlockId===r.block.id),f=t.computed(()=>r.draggingBlockId===r.block.id),u=t.computed(()=>r.menuOpenBlockId===r.block.id),h=t.computed(()=>r.dropTargetBlockId===r.block.id),p=t.computed(()=>r.dropPosition??"after");function m(Z,S,K,_){l("gripPointerDown",Z,S,K,_)}function k(Z){l("gripPointerUp",Z)}function x(Z){var S,K;(K=(S=a.value)==null?void 0:S.setLocalDragging)==null||K.call(S,Z)}function D(){l("hoverChange",r.block.id)}function U(){l("hoverChange",null)}function F(Z){l("openPlusMenu",r.block.id,Z)}function ee(Z){l("openSettingsMenu",r.block.id,Z)}function $(Z,S,K){l("slashTrigger",Z,r.block.id,K)}function V(Z,S){l("inputChanged",Z,S)}function re(Z,S){l("linkClick",Z,S)}function G(Z){l("focusIn",Z)}const ne=t.computed(()=>{const Z=s.registries.renderers.get(r.block.type);return Z!=null&&Z.component?Z.component:Un});return n({setHandleDragging:x}),(Z,S)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"hostEl",ref:c,class:t.normalizeClass(["block-host",{"block-dragging":f.value,"block-menu-active":u.value,"block-drop-target":h.value,"block-drop-before":h.value&&p.value==="before","block-drop-after":h.value&&p.value==="after","block-drop-into":h.value&&p.value==="into","block-host-readonly":!t.unref(i),"block-focused":e.focusedBlockId===e.block.id}]),"data-block-id":e.block.id,"data-block-type":e.block.type,onMouseenter:D,onMouseleave:U},[t.unref(i)?(t.openBlock(),t.createBlock(Id,{key:0,ref_key:"handleRef",ref:a,"block-id":e.block.id,visible:d.value,onOpenPlusMenu:F,onOpenSettingsMenu:ee,onGripPointerDown:m,onGripPointerUp:k},null,8,["block-id","visible"])):t.createCommentVNode("",!0),t.createElementVNode("div",Rd,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(ne.value),{block:e.block,placeholder:e.placeholder,onSlashTrigger:$,onInputChanged:V,onLinkClick:re,onFocusIn:G},null,40,["block","placeholder"]))])],42,Bd))}}),Ki=t.defineComponent({__name:"BlockList",props:{items:{},blocksMap:{},firstBlockPlaceholder:{},isNested:{type:Boolean},hoveredBlockId:{},focusedBlockId:{},hasTextSelection:{type:Boolean},draggingBlockId:{},dropTargetBlockId:{},dropPosition:{},menuOpenBlockId:{}},emits:["openSettingsMenu","openPlusMenu","slashTrigger","inputChanged","hoverChange","gripPointerDown","gripPointerUp","linkClick","focusIn"],setup(e,{expose:n,emit:o}){const r=e,l=o,s=new Map;function i($,V){V?s.set($,V):s.delete($)}function c($,V){var re,G;(G=(re=s.get($))==null?void 0:re.setHandleDragging)==null||G.call(re,V)}function a($){const V=[];for(const re of $.children){const G=r.blocksMap.get(re);G&&V.push({id:re,block:G})}return V}const d=t.computed(()=>!r.isNested&&!r.dropTargetBlockId&&r.dropPosition==="first"&&!!r.draggingBlockId),f=t.computed(()=>!r.isNested&&!r.dropTargetBlockId&&r.dropPosition==="last"&&!!r.draggingBlockId);function u($,V){l("openSettingsMenu",$,V)}function h($,V){l("openPlusMenu",$,V)}function p($,V,re){l("slashTrigger",$,V,re)}function m($,V){l("inputChanged",$,V)}function k($){l("hoverChange",$)}function x(){r.isNested||l("hoverChange",null)}function D($,V,re,G){l("gripPointerDown",$,V,re,G)}function U($){l("gripPointerUp",$)}function F($,V){l("linkClick",$,V)}function ee($){l("focusIn",$)}return n({setBlockHandleDragging:c}),($,V)=>{const re=t.resolveComponent("BlockList",!0);return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["block-list",{"block-children":e.isNested,"drop-indicator-first":d.value,"drop-indicator-last":f.value}]),onMouseleave:x},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.items,(G,ne)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:G.id},[t.createVNode(Fi,{ref_for:!0,ref:Z=>i(G.id,Z),block:G.block,placeholder:!e.isNested&&ne===0?e.firstBlockPlaceholder:void 0,"hovered-block-id":e.hoveredBlockId,"focused-block-id":e.focusedBlockId,"has-text-selection":e.hasTextSelection,"dragging-block-id":e.draggingBlockId,"drop-target-block-id":e.dropTargetBlockId,"drop-position":e.dropPosition,"menu-open-block-id":e.menuOpenBlockId,onOpenSettingsMenu:u,onOpenPlusMenu:h,onSlashTrigger:p,onInputChanged:m,onHoverChange:k,onGripPointerDown:D,onGripPointerUp:U,onLinkClick:F,onFocusIn:ee},null,8,["block","placeholder","hovered-block-id","focused-block-id","has-text-selection","dragging-block-id","drop-target-block-id","drop-position","menu-open-block-id"]),G.block.children.length>0?(t.openBlock(),t.createBlock(re,{key:"__nested_"+G.id,"is-nested":"",items:a(G.block),"hovered-block-id":e.hoveredBlockId,"focused-block-id":e.focusedBlockId,"has-text-selection":e.hasTextSelection,"dragging-block-id":e.draggingBlockId,"drop-target-block-id":e.dropTargetBlockId,"drop-position":e.dropPosition,"menu-open-block-id":e.menuOpenBlockId,"blocks-map":e.blocksMap,onOpenSettingsMenu:V[0]||(V[0]=(Z,S)=>l("openSettingsMenu",Z,S)),onOpenPlusMenu:V[1]||(V[1]=(Z,S)=>l("openPlusMenu",Z,S)),onSlashTrigger:V[2]||(V[2]=(Z,S,K)=>l("slashTrigger",Z,S,K)),onInputChanged:V[3]||(V[3]=(Z,S)=>l("inputChanged",Z,S)),onHoverChange:V[4]||(V[4]=Z=>l("hoverChange",Z)),onGripPointerDown:V[5]||(V[5]=(Z,S,K,_)=>l("gripPointerDown",Z,S,K,_)),onGripPointerUp:V[6]||(V[6]=Z=>l("gripPointerUp",Z)),onLinkClick:V[7]||(V[7]=(Z,S)=>l("linkClick",Z,S)),onFocusIn:V[8]||(V[8]=Z=>l("focusIn",Z))},null,8,["items","hovered-block-id","focused-block-id","has-text-selection","dragging-block-id","drop-target-block-id","drop-position","menu-open-block-id","blocks-map"])):t.createCommentVNode("",!0)],64))),128))],34)}}});function Wi(e,n,o,r=6,l="auto",s=0,i=0){const c=n instanceof HTMLElement?n.getBoundingClientRect():n,a=document.documentElement.clientHeight,d=Ld(),f=Math.max(0,a-c.bottom-r-s),u=Math.max(0,c.top-r-i),h=f>=o.height+r,p=u>=o.height+r,m=l==="down"?!1:l==="up"?!0:!h&&(p||u>f);let k,x,D;const U=c.bottom+r,F=c.top-r;m?(k=Math.max(r+i,F-o.height),x=F,D=Math.max(120,u)):(k=U,x=k+o.height,D=Math.max(120,f));const ee=d-o.width-r,$=Math.max(r,Math.min(ee,c.left));return{top:k,left:$,above:m,availableHeight:D,bottom:x,topBaseline:U}}function Gi(e,n,o,r=8){const l=document.documentElement.clientHeight,s=document.documentElement.clientWidth,i=n.left+(n.width-o.width)/2,c=Math.max(r,Math.min(s-o.width-r,i)),a=l-n.bottom-r,d=n.top-r,f=a>=o.height,u=d>=o.height,h=!f&&(u||d>a),p=n.bottom+r,m=n.top-r,k=h?Math.max(r,m-o.height):p,x=h?m:k+o.height,D=h?Math.max(120,d):Math.max(120,a);return{top:k,left:c,above:h,availableHeight:D,bottom:x,topBaseline:p}}function qi(e,n,o,r=8){const l=document.documentElement.clientHeight,s=document.documentElement.clientWidth,i=n.left+(n.width-o.width)/2,c=Math.max(r,Math.min(s-o.width-r,i)),a=n.top-r,d=l-n.bottom-r,f=a>=o.height,u=d>=o.height,h=f||!u&&a>d||a>=d,p=n.bottom+r,m=n.top-r,k=h?Math.max(r,m-o.height):p,x=h?m:k+o.height,D=h?Math.max(120,a):Math.max(120,d);return{top:k,left:c,above:h,availableHeight:D,bottom:x,topBaseline:p}}function Ld(){return document.documentElement.clientWidth}function dr(e,n){let o=0;function r(d){const f=e.value;if(!f)return;d.preventDefault();const u=d.deltaMode===WheelEvent.DOM_DELTA_LINE?d.deltaY*22:d.deltaY;f.scrollTop+=u,n()}function l(d){d.touches.length===1&&(o=d.touches[0].clientY)}function s(d){if(d.touches.length!==1)return;const f=e.value;if(!f)return;const u=d.touches[0].clientY;f.scrollTop-=u-o,o=u,d.preventDefault(),n()}function i(d){d&&(d.addEventListener("wheel",r,{passive:!1}),d.addEventListener("touchstart",l,{passive:!0}),d.addEventListener("touchmove",s,{passive:!1}))}function c(d){d&&(d.removeEventListener("wheel",r),d.removeEventListener("touchstart",l),d.removeEventListener("touchmove",s))}let a=null;t.watch(e,(d,f,u)=>{c(a),a=d,i(d),u(()=>{c(d),a===d&&(a=null)})},{immediate:!0}),t.onBeforeUnmount(()=>{c(a),a=null})}function Yi(e,n,o,r){function l(u){const h=e.value;if(!h||!u)return!1;if(u instanceof Node&&h.contains(u))return!0;if(r){const p=r(),m=Array.isArray(p)?p:[p];for(const k of m)if(k&&u instanceof Node&&k.contains(u))return!0}return!1}function s(u){n()&&(l(u.target)||o())}function i(u){n()&&(l(u.target)||o())}function c(){n()&&o()}function a(u){u&&u.addEventListener("mouseleave",c)}function d(u){u&&u.removeEventListener("mouseleave",c)}let f=null;t.watch(e,(u,h,p)=>{d(f),f=u,a(u),p(()=>{d(u),f===u&&(f=null)})},{immediate:!0}),t.onMounted(()=>{window.addEventListener("mousedown",s,!0),window.addEventListener("touchstart",s,!0),window.addEventListener("wheel",i,!0)}),t.onBeforeUnmount(()=>{window.removeEventListener("mousedown",s,!0),window.removeEventListener("touchstart",s,!0),window.removeEventListener("wheel",i,!0),d(f),f=null})}const Od=["innerHTML"],pn=t.defineComponent({__name:"SafeHtml",props:{html:{default:""}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("span",{innerHTML:e.html},null,8,Od))}}),Dd=["aria-label"],$d={key:0,class:"slash-menu-empty"},Pd={key:0,class:"slash-menu-group-label"},Hd=["aria-selected","onMousedown","onMouseenter"],Vd={class:"slash-menu-text"},Ud={class:"slash-menu-title"},zd={key:0,class:"slash-menu-desc"},Fd=["aria-label"],Jr=300,Kd=80,Zi=24,Wd=t.defineComponent({__name:"PlusMenu",props:{visible:{type:Boolean},anchorEl:{},blockId:{},query:{},rootEl:{},mode:{default:"slash"}},emits:["close","commit"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:s}=en(),i=t.computed(()=>({basic:s("plus.category.basic"),list:s("plus.category.list"),other:s("plus.category.other")})),c=fn(),a=t.inject(Do,t.ref(!1)),d=t.ref(null),f=t.ref(null),u=t.ref(0),h=t.ref({top:0,left:0,availableHeight:360,above:!1,bottom:0,topBaseline:0}),p=t.ref(!1),m=t.ref(!1),k=t.ref(!1),x=t.ref(!1);let D=null;t.watch(()=>r.visible,M=>{M?(D&&(clearTimeout(D),D=null),x.value=!0):D=setTimeout(()=>{x.value=!1,D=null},300)},{immediate:!0});function U(M){return typeof M=="string"?M:"•"}const F=t.computed(()=>{const M=r.query.trim().toLowerCase(),E=c.registries.slash.all;return M?E.filter(N=>(s(N.title)+" "+(N.keywords??[]).join(" ")).toLowerCase().includes(M)):E}),ee=t.computed(()=>{const M=[],E=new Map;for(const A of F.value){const W=A.category??"other";E.has(W)||E.set(W,[]),E.get(W).push(A)}const N=["basic","list","other"];for(const A of N){const W=E.get(A);W&&W.length>0&&M.push({category:A,label:i.value[A]??A,items:W})}for(const[A,W]of E)N.includes(A)||M.push({category:A,label:i.value[A]??A,items:W});return M});function $(M){return F.value.findIndex(E=>E.id===M)}t.watch([F,()=>r.visible],()=>{u.value=0,t.nextTick(()=>{f.value&&(f.value.scrollTop=0),V()})});function V(){const M=f.value;M&&(m.value=M.scrollTop>1,k.value=M.scrollTop+M.clientHeight<M.scrollHeight-1)}function re(){const M=f.value;M&&(M.scrollTop-=M.clientHeight*.8)}function G(){const M=f.value;M&&(M.scrollTop+=M.clientHeight*.8)}dr(f,V),t.watch(()=>r.visible,M=>{M&&(p.value=!1,h.value={top:0,left:0,availableHeight:360,above:!1,bottom:0,topBaseline:0})}),t.watch([()=>r.visible,()=>r.anchorEl,d,F,m,k],async()=>{if(!r.visible||!r.anchorEl||!r.rootEl)return;await t.nextTick();const M=d.value;if(!M)return;const E=M.getBoundingClientRect(),N=!!r.anchorEl.closest(".fixed-toolbar"),A=N?a.value?"up":"down":"auto",W=N?10:0,me=Wi(r.rootEl,r.anchorEl,{width:Jr,height:E.height},6,A,W,W);h.value=me,p.value=!0,t.nextTick(V)},{flush:"post"});const ne=t.computed(()=>{if(!r.rootEl)return{display:"none"};if(!p.value)return{visibility:"hidden",top:"0px",left:"0px",width:`${Jr}px`,"--scroll-max-height":"100vh"};const M=h.value.above,E=h.value.left,N=(m.value?Zi:0)+(k.value?Zi:0),A=h.value.availableHeight-N,W={left:`${E}px`,width:`${Jr}px`,maxHeight:`${h.value.availableHeight}px`,"--scroll-max-height":`${Math.max(Kd,A)}px`};if(M){const me=document.documentElement.clientHeight;W.bottom=`${Math.max(0,me-h.value.bottom)}px`,W.top="auto"}else W.top=`${h.value.top}px`,W.bottom="auto";return W});function Z(M){if(F.value.length===0)return;const E=F.value.length;u.value=((u.value+M)%E+E)%E,S()}function S(){var N;const M=(N=f.value)==null?void 0:N.querySelectorAll(".slash-menu-item"),E=M==null?void 0:M[u.value];E&&E.scrollIntoView({block:"nearest"}),t.nextTick(V)}function K(M){switch(M.key){case"ArrowDown":return M.preventDefault(),Z(1),!0;case"ArrowUp":return M.preventDefault(),Z(-1),!0;case"PageDown":return M.preventDefault(),Z(5),!0;case"PageUp":return M.preventDefault(),Z(-5),!0;case"Home":return M.preventDefault(),u.value=0,S(),!0;case"End":return M.preventDefault(),u.value=Math.max(0,F.value.length-1),S(),!0;case"Enter":return M.preventDefault(),_(),!0;case"Escape":return M.preventDefault(),l("close"),!0;default:return!1}}function _(){const M=F.value[u.value];M&&l("commit",M,r.mode),l("close")}function O(M){const E=F.value.indexOf(M);E>=0&&(u.value=E),_()}return n({onKeyDown:K}),Yi(d,()=>r.visible,()=>l("close"),()=>r.anchorEl),t.onMounted(()=>{window.addEventListener("resize",V)}),t.onBeforeUnmount(()=>{window.removeEventListener("resize",V)}),(M,E)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[x.value&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:d,class:t.normalizeClass(["plus-menu slash-menu",{"menu-closing":!e.visible}]),style:t.normalizeStyle(ne.value),role:"listbox"},[m.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(s)("ui.scrollUp"),onMousedown:t.withModifiers(re,["prevent"])},[...E[0]||(E[0]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Dd)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:f,class:"slash-menu-scroll",onScroll:V},[F.value.length===0?(t.openBlock(),t.createElementBlock("div",$d,t.toDisplayString(t.unref(s)("plus.noMatch")),1)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(ee.value,N=>(t.openBlock(),t.createElementBlock("div",{key:N.category,class:"slash-menu-group"},[N.label?(t.openBlock(),t.createElementBlock("div",Pd,t.toDisplayString(N.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.items,A=>(t.openBlock(),t.createElementBlock("div",{key:A.id,class:t.normalizeClass(["slash-menu-item",{active:$(A.id)===u.value}]),"aria-selected":$(A.id)===u.value,role:"option",onMousedown:t.withModifiers(W=>O(A),["prevent"]),onMouseenter:W=>u.value=$(A.id)},[t.createVNode(pn,{class:"slash-menu-icon",html:U(A.icon)},null,8,["html"]),t.createElementVNode("div",Vd,[t.createElementVNode("div",Ud,t.toDisplayString(t.unref(s)(A.title)),1),A.description?(t.openBlock(),t.createElementBlock("div",zd,t.toDisplayString(t.unref(s)(A.description)),1)):t.createCommentVNode("",!0)])],42,Hd))),128))]))),128))],544),k.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(s)("ui.scrollDown"),onMousedown:t.withModifiers(G,["prevent"])},[...E[1]||(E[1]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Fd)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)]))}}),Gd=["left","center","right","justify"],qd=10,tn={align:{default:"left",validate:e=>Gd.includes(e)},color:{default:"default",validate:e=>typeof e=="string"&&e.length>0},bgColor:{default:"default",validate:e=>typeof e=="string"&&e.length>0},indent:{default:0,validate:e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=qd}},Yd={align:tn.align,color:tn.color,bgColor:tn.bgColor},Zd={indent:tn.indent};function En(e){const n=[],o=e.align;typeof o=="string"&&o!=="left"&&n.push(`be-align-${o}`);const r=e.color;typeof r=="string"&&r!=="default"&&n.push(`be-color-${r}`);const l=e.bgColor;typeof l=="string"&&l!=="default"&&n.push(`be-bg-${l}`);const s=e.indent;return typeof s=="number"&&s>0&&n.push(`be-indent-${s}`),n}const Xi=[{key:"default",label:"Default",cssValue:"var(--be-fg)",opacity:1},{key:"gray",label:"Gray",cssValue:"var(--be-color-gray)",opacity:1},{key:"brown",label:"Brown",cssValue:"var(--be-color-brown)",opacity:1},{key:"orange",label:"Orange",cssValue:"var(--be-color-orange)",opacity:1},{key:"yellow",label:"Yellow",cssValue:"var(--be-color-yellow)",opacity:1},{key:"green",label:"Green",cssValue:"var(--be-color-green)",opacity:1},{key:"blue",label:"Blue",cssValue:"var(--be-color-blue)",opacity:1},{key:"purple",label:"Purple",cssValue:"var(--be-color-purple)",opacity:1},{key:"pink",label:"Pink",cssValue:"var(--be-color-pink)",opacity:1},{key:"red",label:"Red",cssValue:"var(--be-color-red)",opacity:1}],ji=[{key:"default",label:"None",cssValue:"transparent",opacity:0},{key:"gray",label:"Gray",cssValue:"var(--be-swatch-bg-gray)",opacity:.15,displayCssValue:"var(--be-swatch-display-bg-gray)"},{key:"brown",label:"Brown",cssValue:"var(--be-swatch-bg-brown)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-brown)"},{key:"orange",label:"Orange",cssValue:"var(--be-swatch-bg-orange)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-orange)"},{key:"yellow",label:"Yellow",cssValue:"var(--be-swatch-bg-yellow)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-yellow)"},{key:"green",label:"Green",cssValue:"var(--be-swatch-bg-green)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-green)"},{key:"blue",label:"Blue",cssValue:"var(--be-swatch-bg-blue)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-blue)"},{key:"purple",label:"Purple",cssValue:"var(--be-swatch-bg-purple)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-purple)"},{key:"pink",label:"Pink",cssValue:"var(--be-swatch-bg-pink)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-pink)"},{key:"red",label:"Red",cssValue:"var(--be-swatch-bg-red)",opacity:.18,displayCssValue:"var(--be-swatch-display-bg-red)"}],el='<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="M426.666667 939.050667a32 32 0 1 1 0-64h53.333333V160H235.093333V170.666667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667A32 32 0 0 1 171.093333 170.666667V128a32 32 0 0 1 32-32H820.693333a32 32 0 0 1 31.701334 27.648l0.298666 4.352v42.666667a32 32 0 1 1-64 0l-0.042666-10.666667H544v715.050667H597.333333a32 32 0 0 1 31.701334 27.648l0.298666 4.352a32 32 0 0 1-32 32h-170.666666z" fill="currentColor"/></svg>',ko="M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z",tl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} M848.512 366.933333A32 32 0 0 1 896 394.965333v426.666667a32 32 0 1 1-64 0v-372.565333l-80.554667 44.416a32 32 0 0 1-41.130666-8.96l-2.346667-3.626667a32 32 0 0 1 12.586667-43.477333l128-70.485334z" fill="currentColor"/></svg>`,nl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} M786.133333 362.666667a152.661333 152.661333 0 0 1 107.946667 260.693333l-166.058667 165.973333h178.773334a32 32 0 0 1 31.744 27.648l0.256 4.352a32 32 0 0 1-32 32h-256a32 32 0 0 1-22.613334-54.613333l220.672-220.672A88.661333 88.661333 0 0 0 786.133333 426.666667h-7.338666a96 96 0 0 0-96 96v20.565333a32 32 0 0 1-64 0v-20.565333a160 160 0 0 1 160-160h7.338666z" fill="currentColor"/></svg>`,ol=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m362.410667 192a32 32 0 0 1 22.613333 54.656L809.813333 536.746667l1.792 0.341333a160.085333 160.085333 0 0 1 126.506667 148.053333l0.256 8.490667a160 160 0 0 1-310.912 53.248 32 32 0 0 1 60.373333-21.333333 96 96 0 1 0 90.538667-127.914667h-42.666667a32 32 0 0 1-22.613333-54.613333l116.010667-116.053334h-178.773334a32 32 0 0 1-31.701333-27.648l-0.256-4.352a32 32 0 0 1 32-32h256z" fill="currentColor"/></svg>`,rl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m244.309333 193.493333a32 32 0 0 1 20.992 40.106667l-93.738666 299.776h116.48v-96a32 32 0 0 1 64 0v96h10.666666a32 32 0 0 1 31.744 27.648l0.298667 4.352a32 32 0 0 1-32 32H896v53.333333a32 32 0 1 1-64 0v-53.333333h-160a32 32 0 0 1-30.506667-41.557334l106.666667-341.333333a32 32 0 0 1 40.106667-20.992z" fill="currentColor"/></svg>`,ll=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m363.477333 192.426666a32 32 0 1 1 0 64h-145.706666l-28.245334 113.450667 5.12-1.493333a160.042667 160.042667 0 0 1 100.949334 6.4l9.472 4.266666a160 160 0 1 1-189.610667 249.856 32 32 0 0 1 48-42.325333 96 96 0 1 0 0-126.976c-22.186667 25.130667-63.146667 3.584-55.04-28.928l53.333333-214.016a32 32 0 0 1 31.061334-24.234667h170.666666z" fill="currentColor"/></svg>`,il=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${ko} m292.522667 153.173333a32 32 0 0 1 12.586666 43.52l-93.141333 168.874667a159.957333 159.957333 0 0 1 102.4 19.712 158.848 158.848 0 0 1 58.581333 217.685333 160.426667 160.426667 0 0 1-218.453333 58.24 158.890667 158.890667 0 0 1-62.762667-209.962667l157.312-285.44a32 32 0 0 1 43.52-12.586666z m-141.226667 322.517333a94.890667 94.890667 0 0 0 35.072 130.048 96.426667 96.426667 0 0 0 131.242667-34.901333 94.848 94.848 0 0 0-35.114667-130.048 96.426667 96.426667 0 0 0-131.242667 34.901333z" fill="currentColor"/></svg>`,sl='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="3" cy="4" r="1.1" fill="currentColor" stroke="none"/><circle cx="3" cy="8" r="1.1" fill="currentColor" stroke="none"/><circle cx="3" cy="12" r="1.1" fill="currentColor" stroke="none"/><line x1="6.5" y1="4" x2="13.5" y2="4"/><line x1="6.5" y1="8" x2="13.5" y2="8"/><line x1="6.5" y1="12" x2="13.5" y2="12"/></svg>',cl='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.3 3.7L3.1 2.8L3.1 5.8" stroke-width="1.1"/><line x1="6.5" y1="4" x2="13.5" y2="4" stroke-width="1.3"/><path d="M1.8 7.4C1.8 6.6 4.2 6.6 4.2 7.4C4.2 8.2 1.8 9.5 1.8 9.5L4.2 9.5" stroke-width="1.1"/><line x1="6.5" y1="8" x2="13.5" y2="8" stroke-width="1.3"/><path d="M4.2 11.2C4.2 10.5 3 10.5 1.8 11.5C1.8 12 3 12 3 12C3 12 4.2 12 4.2 13C4.2 13.5 3 13.5 1.8 12.8" stroke-width="1.1"/><line x1="6.5" y1="12" x2="13.5" y2="12" stroke-width="1.3"/></svg>',al='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="2.5" width="11" height="11" rx="2.5"/><path d="M5.5 8L7 9.8L10.8 5.8"/></svg>',dl='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="3" width="2" height="10" rx="1" fill="currentColor" stroke="none"/><line x1="6.5" y1="5" x2="13" y2="5"/><line x1="6.5" y1="8" x2="13" y2="8"/><line x1="6.5" y1="11" x2="10" y2="11"/></svg>',ul='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 4L2 8L5 12"/><path d="M11 4L14 8L11 12"/><line x1="10" y1="3" x2="6" y2="13"/></svg>',Xd='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="2" y1="8" x2="14" y2="8"/></svg>',jd='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 3.5h10M2 8h10M2 12.5h10"/><path d="M14.5 3.5v.01M14.5 8v.01M14.5 12.5v.01"/></svg>',Qd='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="1.5"/><circle cx="5.5" cy="6.5" r="1.1" fill="currentColor" stroke="none"/><path d="M13 11.5L10 8.5L7 11.5L5 9.5L3 11.5"/></svg>',Jd='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"><path d="M12 3a9 9 0 0 1 9 9" opacity="0.25"/><path d="M12 3a9 9 0 0 0-9 9" class="be-spinner-arc"/></g></svg>',eu='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 8a5 5 0 0 1 8.5-3.5M13 3v3h-3"/><path d="M13 8a5 5 0 0 1-8.5 3.5M3 13v-3h3"/></svg>',tu='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4L12 12"/><path d="M12 4L4 12"/></svg>',nu='<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 5H12M9 2L12 5L9 8"/><path d="M14 11H4M7 8L4 11L7 14"/></svg>',ou='<svg viewBox="0 0 1024 1024" width="32" height="32" aria-hidden="true"><path d="M768.35456 416a256 256 0 1 0-512 0 192 192 0 1 0 0 384v64a256 256 0 0 1-58.88-505.216 320.128 320.128 0 0 1 629.76 0A256.128 256.128 0 0 1 768.35456 864v-64a192 192 0 0 0 0-384z m-512 384h128v64H256.35456v-64z m384 0h128v64h-128v-64z" fill="currentColor"/><path d="M539.04256 589.184v333.056a32.448 32.448 0 0 1-32 32.192 32.448 32.448 0 0 1-32-32.192V589.184l-36.096 36.096a32.192 32.192 0 0 1-45.056-0.192 31.616 31.616 0 0 1-0.192-45.056l90.88-90.88a31.36 31.36 0 0 1 22.528-9.152 30.08 30.08 0 0 1 22.4 9.088l90.88 90.944a32.192 32.192 0 0 1-0.192 45.056 31.616 31.616 0 0 1-45.056 0.192l-36.096-36.096z" fill="currentColor"/></svg>',ru=["aria-label"],lu={class:"bsm-group"},iu={class:"bsm-icon-grid"},su=["title","onMousedown","onMouseenter"],cu={key:1,class:"bsm-group"},au={class:"bsm-collapse-title"},du={class:"bsm-collapse-body"},uu={class:"bsm-row"},fu=["disabled","title","onMousedown"],mu={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},pu={class:"bsm-row"},hu=["disabled","title"],gu=["disabled","title"],bu={key:2,class:"bsm-group"},ku={class:"bsm-collapse-title"},yu={class:"bsm-collapse-body"},wu={class:"bsm-row"},Eu=["disabled","title"],vu=["disabled","title"],Cu={key:3,class:"bsm-group bsm-colors"},Tu={class:"bsm-collapse-title"},_u={class:"bsm-collapse-body"},xu={class:"bsm-swatches"},Mu=["title","disabled","onMousedown"],Nu={key:4,class:"bsm-group bsm-colors"},Su={class:"bsm-collapse-title"},Au={class:"bsm-collapse-body"},Iu={class:"bsm-swatches"},Bu=["title","disabled","onMousedown"],Ru={class:"bsm-group"},Lu=["onMousedown","onMouseenter"],Ou={class:"bsm-title"},Du={key:1,class:"bsm-shortcut"},$u=["aria-label"],fl=260,Pu=80,Qi=24,Hu='<svg viewBox="0 0 16 16" width="14" height="14"><rect x="5" y="5" width="8" height="8" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.2"/><path d="M3 10.5V3.5C3 2.67 3.67 2 4.5 2H10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>',Vu='<svg viewBox="0 0 16 16" width="14" height="14"><rect x="5" y="5" width="8" height="8" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.2"/><path d="M3 10.5V3.5C3 2.67 3.67 2 4.5 2H10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>',Uu='<svg viewBox="0 0 16 16" width="14" height="14"><circle cx="4.5" cy="11.5" r="1.8" fill="none" stroke="currentColor" stroke-width="1.2"/><circle cx="11.5" cy="11.5" r="1.8" fill="none" stroke="currentColor" stroke-width="1.2"/><line x1="6" y1="10" x2="13" y2="3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><line x1="10" y1="10" x2="3" y2="3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>',zu='<svg viewBox="0 0 16 16" width="14" height="14"><path d="M8 12V4M4 8L8 4L12 8" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>',Fu='<svg viewBox="0 0 16 16" width="14" height="14"><path d="M8 4V12M4 8L8 12L12 8" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>',Ku='<svg viewBox="0 0 16 16" width="14" height="14"><path d="M3.5 4.5H12.5M6.5 4.5V3C6.5 2.45 6.95 2 7.5 2H8.5C9.05 2 9.5 2.45 9.5 3V4.5M5 4.5L5.5 13C5.55 13.55 6 14 6.55 14H9.45C10 14 10.45 13.55 10.5 13L11 4.5" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>',Wu='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M597.333333 451.669333l55.168-55.168a42.666667 42.666667 0 0 1 60.330667 60.330667L657.664 512l55.168 55.168a42.666667 42.666667 0 0 1-60.330667 60.330667L597.333333 572.330667l-55.168 55.168a42.666667 42.666667 0 0 1-60.330666-60.330667L537.002667 512l-55.168-55.168a42.666667 42.666667 0 0 1 60.330666-60.330667L597.333333 451.669333zM874.581333 832H376.32c-47.402667 0-106.730667-25.941333-138.752-60.672l-163.178667-176.938667c-42.325333-45.866667-42.346667-118.869333 0-164.778666l163.2-176.938667C269.525333 218.026667 329.045333 192 376.32 192h498.24A106.666667 106.666667 0 0 1 981.333333 298.837333v426.325334A106.752 106.752 0 0 1 874.581333 832z m0-85.333333C886.4 746.666667 896 737.088 896 725.162667V298.837333c0-11.946667-9.514667-21.504-21.418667-21.504H376.32c-23.466667 0-60.224 16.064-76.010667 33.194667l-163.2 176.917333c-12.181333 13.226667-12.16 35.882667 0 49.109334l163.2 176.917333C316.16 730.666667 352.746667 746.666667 376.32 746.666667h498.24z" fill="currentColor"/></svg>',Ji='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M672.01024 896l-320 0c-17.67424 0-32.01024-14.336-32.01024-32.01024l0-352.01024-128 0c-12.94336 0-24.61696-7.80288-29.57312-19.7632s-2.21184-25.72288 6.94272-34.87744l320-320c12.4928-12.4928 32.768-12.4928 45.2608 0l320 320c9.15456 9.15456 11.89888 22.91712 6.94272 34.87744s-16.62976 19.7632-29.57312 19.7632l-128 0 0 352.01024c0 17.67424-14.336 32.01024-32.01024 32.01024zM384 832l256 0 0-352.01024c0-17.67424 14.336-32.01024 32.01024-32.01024l82.7392 0-242.74944-242.74944-242.74944 242.74944 82.7392 0c17.67424 0 32.01024 14.336 32.01024 32.01024l0 352.01024z" fill="currentColor"/></svg>',Gu='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M512.00988746 141.21142578c10.45623779 0 19.24145531 3.50024414 26.37542748 10.71331811l259.5421145 259.55200196C805.03668189 418.58105492 808.63085938 427.33660865 808.63085938 437.84228516c0 10.60949731-3.53485132 19.46887183-10.56994606 26.46936011-7.02026391 7.00543237-15.88952661 10.60949731-26.50891137 10.60949731-10.44140625 0-19.22167969-3.60900903-26.35565185-10.71331811L549.09863305 267.79370094V845.7097168c0 10.19915748-3.62384057 18.94976782-10.89624071 26.16284179-7.23284888 7.31195068-15.97357177 10.91601563-26.2122798 10.91601563-10.23376465 0-18.959656-3.60900903-26.22216796-10.91601563-7.24273705-7.21307397-10.87646508-15.96862769-10.87646508-26.16284179V267.79370094l-196.10760522 196.41906761C271.65484619 471.31213355 262.87951684 474.92114258 252.41833496 474.92114258c-10.61938477 0-19.45898438-3.60900903-26.4990232-10.60949731C218.86444068 457.31115699 215.36914062 448.45178247 215.36914062 437.84228516c0-10.50567651 3.55462623-19.26123023 10.69354248-26.36553931l259.53717042-259.55200196C492.7288816 144.71166992 501.52398658 141.21142578 511.97033691 141.21142578h0.03955055z" fill="currentColor"/></svg>',qu='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M511.99011254 141.21142578c10.23376465 0 18.95471191 3.60900903 26.2122798 10.81713891 7.25262451 7.20812988 10.86657691 15.96862769 10.86657763 26.2666626v577.89129615l196.1619873-196.43884254c7.099365-7.00543237 15.90435815-10.61444068 26.34082031-10.61444139 10.61938477 0 19.43426538 3.50518822 26.51385474 10.51062059 7.04498291 7.10430908 10.54522705 15.96862769 10.54522706 26.57318092 0 10.40679908-3.54473877 19.16235352-10.69354248 26.37542748l-259.55694604 259.48278761C531.23156714 879.28833008 522.44635033 882.78857422 512.00988746 882.78857422c-10.45623779 0-19.24145531-3.50024414-26.3704834-10.71331811l-259.55200195-259.48278761C218.94848656 605.37939453 215.36914062 596.62384009 215.36914062 586.21704102c0-10.60949731 3.52496314-19.46887183 10.56994606-26.57318092C232.99395776 552.63842773 241.82861328 549.12829614 252.44799805 549.12829614c10.42163062 0 19.2167356 3.60900903 26.36553931 10.61444068l196.1125493 196.43884253V178.29522729c0-10.30297828 3.60900903-19.05853271 10.88635255-26.2666626C493.05517555 144.81549073 501.80084252 141.21142578 512.02966309 141.21142578h-0.03955055z" fill="currentColor"/></svg>',Yu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><path fill="currentColor" d="M 75,28.5 L 71,32 C 67,26.8 61.5,22.5 53.5,22.5 C 38,22.5 24.5,34.5 24.5,50 C 24.5,65.5 38,77.5 53.5,77.5 C 61.5,77.5 67,73.2 71,68 L 75,71.5 C 70,77.8 62.5,83 53.5,83 C 34.5,83 19,68.5 19,50 C 19,31.5 34.5,17 53.5,17 C 62.5,17 70,22.2 75,28.5 Z"/></svg>',Zu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M 22,17 H 49 C 68,17 79,30.5 79,50 C 79,69.5 68,83 49,83 H 22 Z M 27.5,22.5 H 48.5 C 64.5,22.5 73.5,33.5 73.5,50 C 73.5,66.5 64.5,77.5 48.5,77.5 H 27.5 Z"/></svg>',Xu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><path fill="currentColor" d="M 20,17 L 26.5,17 L 50,46.2 L 73.5,17 L 80,17 L 53.8,50 L 80,83 L 73.5,83 L 50,53.8 L 26.5,83 L 20,83 L 46.2,50 Z"/></svg>',ju='<svg viewBox="0 0 1024 1024" width="14" height="14" aria-hidden="true"><path d="M768 597.333333h-85.333333V426.666667h85.333333c94.250667 0 170.666667-76.416 170.666667-170.666667S862.250667 85.333333 768 85.333333c-94.261333 0-170.666667 76.416-170.666667 170.666667v85.333333H426.666667v-85.333333c0-94.250667-76.416-170.666667-170.666667-170.666667S85.333333 161.749333 85.333333 256s76.416 170.666667 170.666667 170.666667h85.333333v170.666666h-85.333333c-94.250667 0-170.666667 76.416-170.666667 170.666667s76.416 170.666667 170.666667 170.666667c94.261333 0 170.666667-76.416 170.666667-170.666667v-85.333333h170.666666v85.12l-0.010666 0.213333c0 94.250667 76.416 170.666667 170.666666 170.666667s170.666667-76.416 170.666667-170.666667S862.250667 597.354667 768 597.333333z m0-426.666666a85.333333 85.333333 0 0 1 0 170.666666h-85.333333v-85.333333a85.333333 85.333333 0 0 1 85.333333-85.333333z m-597.333333 85.333333a85.333333 85.333333 0 0 1 170.666666 0v85.333333h-85.333333c-47.125333 0-85.333333-38.218667-85.333333-85.333333z m85.333333 597.333333a85.333333 85.333333 0 0 1 0-170.666666h85.333333v85.333333a85.333333 85.333333 0 0 1-85.333333 85.333333z m170.666667-256V426.666667h170.666666v170.666666H426.666667z m341.333333 256a85.333333 85.333333 0 0 1-85.333333-85.333333v-85.333333h85.322666A85.333333 85.333333 0 0 1 768 853.333333z" fill="currentColor"/></svg>',Qu='<svg viewBox="0 0 100 100" width="14" height="14" aria-hidden="true"><rect x="8" y="8" width="84" height="84" rx="16" fill="none" stroke="currentColor" stroke-width="4.8" stroke-linecap="round" stroke-linejoin="round"/><path fill="currentColor" d="M 43.5,32 C 40.3,30.3 36.3,29.5 31.5,29.5 C 20.5,29.5 14,38.2 14,50 C 14,61.8 20.5,70.5 31.5,70.5 C 36.3,70.5 40.3,69.7 43.5,68 L 43.5,60.5 C 40.5,62.8 36.5,64 32,64 C 23.7,64 20,58 20,50 C 20,42 23.7,36 32,36 C 36.5,36 40.5,37.2 43.5,39.5 Z M 50,32 H 56 V 41.5 H 59.5 V 47.5 H 56 V 62 C 56,64.2 57,65 59,65 H 60 V 70.5 C 58.5,70.8 56.7,71 54.5,71 C 50,71 48,68.5 48,63 V 47.5 H 44.5 V 41.5 H 48 V 32 Z M 62.5,41.5 H 68 V 47 C 70,43.2 73,41.5 76.5,41.5 V 47.5 C 74,47.5 71,49 68.5,52.5 V 70.5 H 62.5 V 41.5 Z M 79.5,32 H 85.5 V 70.5 H 79.5 Z"/></svg>',Ju=t.defineComponent({__name:"BlockSettingsMenu",props:{visible:{type:Boolean},anchorEl:{},blockId:{},rootEl:{}},emits:["close"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:s}=en(),i=fn(),c=t.inject(Do,t.ref(!1)),a=t.ref(null),d=t.ref(null),f=t.ref("paragraph"),u=t.ref({top:0,left:0,availableHeight:520,above:!1,bottom:0,topBaseline:0}),h=t.ref(!1),p=t.ref(!1),m=t.ref(!1),k=t.reactive({alignIndent:!1,indent:!1,textColor:!1,bgColor:!1}),x=t.ref(!1);let D=null;t.watch(()=>r.visible,P=>{P?(D&&(clearTimeout(D),D=null),x.value=!0):D=setTimeout(()=>{x.value=!1,D=null},300)},{immediate:!0});const U=t.shallowRef(i.getState());let F=null;const ee=t.computed(()=>r.blockId!=null?U.value.doc.blocks.get(r.blockId):void 0),$=t.ref(void 0),V=t.computed(()=>{var w;const P=(w=ee.value)==null?void 0:w.attrs.align;return typeof P=="string"?P:"left"}),re=t.computed(()=>{const P=$.value;return P?!("align"in i.registries.schema.get(P).attrs):!0}),G=t.computed(()=>$.value==="image"||$.value==="table"),ne=t.computed(()=>$.value==="divider"||$.value==="tableOfContents"),Z=t.computed(()=>$.value==="divider"||$.value==="table"||$.value==="tableOfContents"),S=t.computed(()=>{const P=$.value;if(!P)return!0;const w=i.registries.schema.get(P);return!("color"in w.attrs)||!("bgColor"in w.attrs)}),K=t.computed(()=>{const P=ee.value;return P?Dn(U.value.doc,P.id):0});function _(P){return["paragraph","heading","orderedList","bulletList","todoList"].includes(P)}const O=t.computed(()=>!!$.value),M=t.computed(()=>{const P=ee.value;if(!P)return!0;const w=U.value.doc,z=Ar(w,P.id);return!z||!_(z.type)||Dn(w,z.id)>=10}),E=t.computed(()=>K.value<=0),N=t.computed(()=>{var w;const P=(w=ee.value)==null?void 0:w.attrs.color;return typeof P=="string"?P:"default"}),A=t.computed(()=>{var w;const P=(w=ee.value)==null?void 0:w.attrs.bgColor;return typeof P=="string"?P:"default"}),W=t.computed(()=>[{id:"paragraph",iconHtml:el,title:s("turnInto.paragraph"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"paragraph"}))}},{id:"h1",iconHtml:tl,title:s("turnInto.h1"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:1}}))}},{id:"h2",iconHtml:nl,title:s("turnInto.h2"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:2}}))}},{id:"h3",iconHtml:ol,title:s("turnInto.h3"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:3}}))}},{id:"h4",iconHtml:rl,title:s("turnInto.h4"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:4}}))}},{id:"h5",iconHtml:ll,title:s("turnInto.h5"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:5}}))}},{id:"h6",iconHtml:il,title:s("turnInto.h6"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"heading",attrs:{level:6}}))}},{id:"bullet",iconHtml:sl,title:s("turnInto.bullet"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"bulletList"}))}},{id:"ordered",iconHtml:cl,title:s("turnInto.ordered"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"orderedList"}))}},{id:"todo",iconHtml:al,title:s("turnInto.todo"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"todoList",attrs:{checked:!1}}))}},{id:"quote",iconHtml:dl,title:s("turnInto.quote"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"quote"}))}},{id:"code",iconHtml:ul,title:s("turnInto.code"),kind:"turnInto",run:()=>{var P,w;return void((w=(P=i.commands).convertBlock)==null?void 0:w.call(P,{id:r.blockId,type:"codeBlock",attrs:{language:"plain"}}))}}]);function me(P){const w=ee.value;if(!w)return!1;switch(P){case"paragraph":return w.type==="paragraph";case"h1":return w.type==="heading"&&Number(w.attrs.level)===1;case"h2":return w.type==="heading"&&Number(w.attrs.level)===2;case"h3":return w.type==="heading"&&Number(w.attrs.level)===3;case"h4":return w.type==="heading"&&Number(w.attrs.level)===4;case"h5":return w.type==="heading"&&Number(w.attrs.level)===5;case"h6":return w.type==="heading"&&Number(w.attrs.level)===6;case"bullet":return w.type==="bulletList";case"ordered":return w.type==="orderedList";case"todo":return w.type==="todoList";case"quote":return w.type==="quote";case"code":return w.type==="codeBlock";default:return!1}}function le(P){return me(P)}t.watch(()=>r.visible,P=>{var z;if(!P)return;$.value=r.blockId!=null?(z=U.value.doc.blocks.get(r.blockId))==null?void 0:z.type:void 0;const w=W.value.find(we=>me(we.id));f.value=w?w.id:"paragraph",k.alignIndent=!1,k.indent=!1,k.textColor=!1,k.bgColor=!1},{immediate:!0});const he=t.computed(()=>{const P=[{id:"align-left",value:"left",title:s("align.left"),run:()=>ae("left")},{id:"align-center",value:"center",title:s("align.center"),run:()=>ae("center")},{id:"align-right",value:"right",title:s("align.right"),run:()=>ae("right")}];return G.value||P.push({id:"align-justify",value:"justify",title:s("align.justify"),run:()=>ae("justify")}),P});function ae(P){var w,z;(z=(w=i.commands).setBlockAlign)==null||z.call(w,{id:r.blockId,align:P})}function ie(){var P,w;(w=(P=i.commands).indentBlock)==null||w.call(P,{id:r.blockId})}function Se(){var P,w;(w=(P=i.commands).outdentBlock)==null||w.call(P,{id:r.blockId})}const Te=Xi,We=ji;function Mt(P){var w,z;(z=(w=i.commands).setBlockColor)==null||z.call(w,{id:r.blockId,color:P})}function Zt(P){var w,z;(z=(w=i.commands).setBlockBgColor)==null||z.call(w,{id:r.blockId,bgColor:P})}async function Gt(){var nt,lt;const P=ee.value;if(!P)return;const w=Ae(P.content),we=`<meta charset="utf-8"><!-- blockeditor:${JSON.stringify({id:P.id,type:P.type,attrs:P.attrs,text:w}).replace(/--/g,"\\-\\-")} -->${Rt(w)}`;let ve=!1;try{if((nt=navigator.clipboard)!=null&&nt.write&&typeof ClipboardItem<"u"){const on=new ClipboardItem({"text/plain":new Blob([w],{type:"text/plain"}),"text/html":new Blob([we],{type:"text/html"})});await navigator.clipboard.write([on]),ve=!0}}catch{ve=!1}if(!ve)try{(lt=navigator.clipboard)!=null&&lt.writeText&&(await navigator.clipboard.writeText(w),ve=!0)}catch{ve=!1}ve||(ve=tt(w))}function Rt(P){return P.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function tt(P){const w=document.createElement("textarea");w.value=P,w.setAttribute("readonly",""),w.style.position="fixed",w.style.top="-9999px",w.style.left="-9999px",w.style.opacity="0",document.body.appendChild(w);const z=document.activeElement;w.focus(),w.select();try{return document.execCommand("copy")}catch{return!1}finally{if(document.body.removeChild(w),z&&typeof z.focus=="function")try{z.focus()}catch{}}}function yt(){Gt().then(()=>{var P,w;return(w=(P=i.commands).removeBlock)==null?void 0:w.call(P,{id:r.blockId})})}const vt=/Mac|iP(hone|[ao]d)/.test(navigator.platform)?ju:Qu;function Ze(...P){return P.join("")}const Ve=t.computed(()=>[{id:"dup",iconHtml:Hu,title:s("action.duplicate"),shortcutHtml:Ze(vt,Zu),run:()=>{var P,w;return void((w=(P=i.commands).duplicateBlock)==null?void 0:w.call(P,{id:r.blockId}))}},{id:"copy",iconHtml:Vu,title:s("action.copy"),shortcutHtml:Ze(vt,Yu),run:()=>void Gt()},{id:"cut",iconHtml:Uu,title:s("action.cut"),shortcutHtml:Ze(vt,Xu),run:()=>void yt()},{id:"up",iconHtml:zu,title:s("action.moveUp"),shortcutHtml:Ze(vt,Ji,Gu),run:()=>{var P,w;return void((w=(P=i.commands).moveBlockUp)==null?void 0:w.call(P,{id:r.blockId}))}},{id:"down",iconHtml:Fu,title:s("action.moveDown"),shortcutHtml:Ze(vt,Ji,qu),run:()=>{var P,w;return void((w=(P=i.commands).moveBlockDown)==null?void 0:w.call(P,{id:r.blockId}))}},{id:"del",iconHtml:Ku,title:s("action.delete"),shortcutHtml:Wu,danger:!0,run:()=>{var P,w;return void((w=(P=i.commands).removeBlock)==null?void 0:w.call(P,{id:r.blockId}))}}]);t.watch(()=>r.visible,P=>{P&&(h.value=!1,u.value={top:0,left:0,availableHeight:520,above:!1,bottom:0,topBaseline:0})});function Ct(){const P=r.anchorEl,w=r.rootEl,z=a.value;!r.visible||!P||!w||!z||t.nextTick().then(()=>{const we=a.value;if(!we)return;const ve=we.getBoundingClientRect(),nt=!!P.closest(".fixed-toolbar"),lt=nt?c.value?"up":"down":"auto",on=nt?10:0,cn=Wi(w,P,{width:Math.max(ve.width,fl),height:ve.height},8,lt,on,on);u.value=cn,h.value=!0,t.nextTick(Tt)})}t.watch([()=>r.visible,()=>r.anchorEl,a,p,m],Ct,{flush:"post"});function fe(P){k[P]=!k[P],t.nextTick(Ct)}function Tt(){const P=d.value;P&&(p.value=P.scrollTop>1,m.value=P.scrollTop+P.clientHeight<P.scrollHeight-1)}function Xe(){const P=d.value;P&&(P.scrollTop-=P.clientHeight*.8)}function Re(){const P=d.value;P&&(P.scrollTop+=P.clientHeight*.8)}dr(d,Tt);const qt=t.computed(()=>{if(!r.rootEl)return{display:"none"};if(!h.value)return{visibility:"hidden",top:"0px",left:"0px",width:`${fl}px`,"--scroll-max-height":"100vh"};const P=u.value.above,w=u.value.left,z=(p.value?Qi:0)+(m.value?Qi:0),we=u.value.availableHeight-z,ve={left:`${w}px`,width:`${fl}px`,maxHeight:`${u.value.availableHeight}px`,"--scroll-max-height":`${Math.max(Pu,we)}px`};if(P){const nt=document.documentElement.clientHeight;ve.bottom=`${Math.max(0,nt-u.value.bottom)}px`,ve.top="auto"}else ve.top=`${u.value.top}px`,ve.bottom="auto";return ve});function rt(P){if(P.kind==="turnInto"&&le(P.id)){const w=W.value.find(z=>z.id==="paragraph");if(w){f.value="paragraph",w.run(),l("close");return}}f.value=P.id,P.run(),l("close")}function Et(P){const w=[...W.value,...Ve.value];if(w.length===0)return!1;const z=w.findIndex(ve=>ve.id===f.value),we=ve=>(ve%w.length+w.length)%w.length;switch(P.key){case"ArrowDown":return P.preventDefault(),f.value=w[we(z+1)].id,!0;case"ArrowUp":return P.preventDefault(),f.value=w[we(z-1)].id,!0;case"Enter":return P.preventDefault(),rt(w[we(z)]),!0;case"Escape":return P.preventDefault(),l("close"),!0;default:return!1}}return n({onKeyDown:Et}),Yi(a,()=>r.visible,()=>l("close"),()=>r.anchorEl),t.onMounted(()=>{F=i.subscribe(P=>{U.value=P.state})}),t.onBeforeUnmount(()=>{F==null||F(),F=null}),(P,w)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[x.value&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:a,class:t.normalizeClass(["block-settings-menu",{"menu-closing":!e.visible}]),style:t.normalizeStyle(qt.value),role:"menu"},[p.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(s)("ui.scrollUp"),onMousedown:t.withModifiers(Xe,["prevent"])},[...w[8]||(w[8]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,ru)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:d,class:"bsm-scroll",onScroll:Tt},[!G.value&&!ne.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",lu,[t.createElementVNode("div",iu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(W.value,z=>(t.openBlock(),t.createElementBlock("button",{key:z.id,class:t.normalizeClass(["bsm-icon-cell",{active:le(z.id)}]),title:z.title,role:"menuitem",onMousedown:t.withModifiers(we=>rt(z),["prevent"]),onMouseenter:we=>f.value=z.id},[t.createVNode(pn,{class:"bsm-icon-svg",html:z.iconHtml},null,8,["html"])],42,su))),128))])]),w[9]||(w[9]=t.createElementVNode("div",{class:"bsm-sep"},null,-1))],64)):t.createCommentVNode("",!0),Z.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",cu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":re.value&&!O.value,expanded:k.alignIndent}]),role:"menuitem",onMousedown:w[0]||(w[0]=t.withModifiers(z=>fe("alignIndent"),["prevent"]))},[t.createElementVNode("span",au,t.toDisplayString(t.unref(s)("bsm.section.alignIndent")),1),w[10]||(w[10]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",du,[t.createElementVNode("div",uu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(he.value,z=>(t.openBlock(),t.createElementBlock("button",{key:z.id,class:t.normalizeClass(["bsm-icon-btn",{active:!re.value&&V.value===z.value,"bsm-disabled":re.value}]),disabled:re.value,title:z.title,role:"menuitem",onMousedown:t.withModifiers(we=>!re.value&&rt(z),["prevent"])},[(t.openBlock(),t.createElementBlock("svg",mu,[z.value==="left"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[w[11]||(w[11]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[12]||(w[12]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"10",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[13]||(w[13]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"12",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):z.value==="center"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[w[14]||(w[14]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[15]||(w[15]=t.createElementVNode("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[16]||(w[16]=t.createElementVNode("line",{x1:"3",y1:"12",x2:"13",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):z.value==="right"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[w[17]||(w[17]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[18]||(w[18]=t.createElementVNode("line",{x1:"6",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[19]||(w[19]=t.createElementVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[w[20]||(w[20]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[21]||(w[21]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),w[22]||(w[22]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64))]))],42,fu))),128))]),t.createElementVNode("div",pu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":E.value}]),disabled:E.value,title:t.unref(s)("bsm.indent.decrease"),role:"menuitem",onMousedown:w[1]||(w[1]=t.withModifiers(z=>!E.value&&rt({id:"outdent",run:Se}),["prevent"]))},[...w[23]||(w[23]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM285.866667 657.066667c14.933333 8.533333 34.133333 0 34.133333-17.066667V384c0-17.066667-19.2-27.733333-34.133333-17.066667l-192 128c-12.8 8.533333-12.8 27.733333 0 36.266667l192 125.866667z",fill:"currentColor"})],-1)])],42,hu),t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":M.value}]),disabled:M.value,title:t.unref(s)("bsm.indent.increase"),role:"menuitem",onMousedown:w[2]||(w[2]=t.withModifiers(z=>!M.value&&rt({id:"indent",run:ie}),["prevent"]))},[...w[24]||(w[24]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM119.466667 657.066667A21.333333 21.333333 0 0 1 85.333333 640V384c0-17.066667 19.2-27.733333 34.133334-17.066667l192 128c12.8 8.533333 12.8 27.733333 0 36.266667l-192 125.866667z",fill:"currentColor"})],-1)])],42,gu)])],512),[[t.vShow,k.alignIndent]])])),Z.value?(t.openBlock(),t.createElementBlock("div",bu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":!O.value,expanded:k.indent}]),role:"menuitem",onMousedown:w[3]||(w[3]=t.withModifiers(z=>fe("indent"),["prevent"]))},[t.createElementVNode("span",ku,t.toDisplayString(t.unref(s)("bsm.section.indent")),1),w[25]||(w[25]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",yu,[t.createElementVNode("div",wu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":E.value}]),disabled:E.value,title:t.unref(s)("bsm.indent.decrease"),role:"menuitem",onMousedown:w[4]||(w[4]=t.withModifiers(z=>!E.value&&rt({id:"outdent",run:Se}),["prevent"]))},[...w[26]||(w[26]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM285.866667 657.066667c14.933333 8.533333 34.133333 0 34.133333-17.066667V384c0-17.066667-19.2-27.733333-34.133333-17.066667l-192 128c-12.8 8.533333-12.8 27.733333 0 36.266667l192 125.866667z",fill:"currentColor"})],-1)])],42,Eu),t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":M.value}]),disabled:M.value,title:t.unref(s)("bsm.indent.increase"),role:"menuitem",onMousedown:w[5]||(w[5]=t.withModifiers(z=>!M.value&&rt({id:"indent",run:ie}),["prevent"]))},[...w[27]||(w[27]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M906.666667 379.733333h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM906.666667 580.266667h-448c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h448c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM117.333333 245.333333h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-789.333334C100.266667 181.333333 85.333333 196.266667 85.333333 213.333333s14.933333 32 32 32zM906.666667 778.666667h-789.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h789.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM119.466667 657.066667A21.333333 21.333333 0 0 1 85.333333 640V384c0-17.066667 19.2-27.733333 34.133334-17.066667l192 128c12.8 8.533333 12.8 27.733333 0 36.266667l-192 125.866667z",fill:"currentColor"})],-1)])],42,vu)])],512),[[t.vShow,k.indent]])])):t.createCommentVNode("",!0),!G.value&&!ne.value?(t.openBlock(),t.createElementBlock("div",Cu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":S.value,expanded:k.textColor}]),role:"menuitem",onMousedown:w[6]||(w[6]=t.withModifiers(z=>!S.value&&fe("textColor"),["prevent"]))},[t.createElementVNode("span",Tu,t.toDisplayString(t.unref(s)("bsm.section.textColor")),1),w[28]||(w[28]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",_u,[t.createElementVNode("div",xu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Te),z=>(t.openBlock(),t.createElementBlock("button",{key:"tc-"+z.key,class:t.normalizeClass(["bsm-swatch",{active:N.value===z.key,"bsm-disabled":S.value}]),title:t.unref(s)(z.key==="default"?"color.default":"color."+z.key),style:t.normalizeStyle({backgroundColor:z.displayCssValue??z.cssValue}),disabled:S.value,onMousedown:t.withModifiers(we=>!S.value&&rt({id:`tc-${z.key}`,run:()=>Mt(z.key)}),["prevent"])},null,46,Mu))),128))])],512),[[t.vShow,k.textColor]])])):t.createCommentVNode("",!0),!G.value&&!ne.value?(t.openBlock(),t.createElementBlock("div",Nu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":S.value,expanded:k.bgColor}]),role:"menuitem",onMousedown:w[7]||(w[7]=t.withModifiers(z=>!S.value&&fe("bgColor"),["prevent"]))},[t.createElementVNode("span",Su,t.toDisplayString(t.unref(s)("bsm.section.bgColor")),1),w[29]||(w[29]=t.createElementVNode("svg",{class:"bsm-collapse-chevron",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],34),t.withDirectives(t.createElementVNode("div",Au,[t.createElementVNode("div",Iu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(We),z=>(t.openBlock(),t.createElementBlock("button",{key:"bc-"+z.key,class:t.normalizeClass(["bsm-swatch",[{active:A.value===z.key,"bsm-disabled":S.value},z.key==="default"?"bsm-swatch--none":""]]),title:t.unref(s)(z.key==="default"?"color.none":"color."+z.key),style:t.normalizeStyle({backgroundColor:z.displayCssValue??z.cssValue}),disabled:S.value,onMousedown:t.withModifiers(we=>!S.value&&rt({id:`bc-${z.key}`,run:()=>Zt(z.key)}),["prevent"])},null,46,Bu))),128))])],512),[[t.vShow,k.bgColor]])])):t.createCommentVNode("",!0),w[30]||(w[30]=t.createElementVNode("div",{class:"bsm-sep"},null,-1)),t.createElementVNode("div",Ru,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ve.value,z=>(t.openBlock(),t.createElementBlock("button",{key:z.id,class:t.normalizeClass(["bsm-item bsm-action",{danger:z.danger}]),role:"menuitem",onMousedown:t.withModifiers(we=>rt(z),["prevent"]),onMouseenter:we=>f.value=z.id},[t.createVNode(pn,{class:"bsm-action-icon",html:z.iconHtml},null,8,["html"]),t.createElementVNode("span",Ou,t.toDisplayString(z.title),1),z.shortcutHtml?(t.openBlock(),t.createBlock(pn,{key:0,class:"bsm-shortcut",html:z.shortcutHtml},null,8,["html"])):z.shortcut?(t.openBlock(),t.createElementBlock("span",Du,t.toDisplayString(z.shortcut),1)):t.createCommentVNode("",!0)],42,Lu))),128))])],544),m.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(s)("ui.scrollDown"),onMousedown:t.withModifiers(Re,["prevent"])},[...w[31]||(w[31]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,$u)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)]))}}),ef=["aria-hidden"],tf=["aria-label"],nf=["title","aria-label"],of={class:"ht-dropdown-wrap"},rf=["title","disabled"],lf={class:"ht-type-label"},sf=["aria-label"],cf=["onMousedown"],af={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},df=["aria-label"],uf={class:"ht-dropdown-wrap"},ff=["title","disabled"],mf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},pf=["aria-label"],hf=["onMousedown"],gf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},bf={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},kf=["aria-label"],yf={key:0,class:"ht-dropdown-wrap"},wf=["title","disabled"],Ef={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},vf=["aria-label"],Cf=["onMousedown"],Tf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},_f={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},xf=["aria-label"],Mf=["title","disabled","onMousedown","onTouchstart"],Nf=["title","disabled"],Sf={class:"ht-dropdown-wrap"},Af=["title","disabled"],If=["aria-label"],Bf={class:"ht-color-section"},Rf={class:"ht-color-label"},Lf={class:"ht-swatches"},Of=["title","onMousedown"],Df={class:"ht-color-section"},$f={class:"ht-color-label"},Pf={class:"ht-swatches"},Hf=["title","onMousedown"],Vf=["aria-label"],Uf=["title","aria-label","disabled"],zf={key:0,class:"ht-sep"},Ff=["title"],Kf=["title"],Wf=["title"],Gf={key:0,class:"ht-sep"},qf=["title"],Yf=["title","aria-label"],Zf=80,Xf=24,ml=36,jf=360,es=10,ts=200,Qf=t.defineComponent({__name:"HoverToolbar",props:{visible:{type:Boolean},selectionRect:{},blockId:{},blockType:{},blockAttrs:{},rootEl:{},tableMode:{type:Boolean},showDelete:{type:Boolean},deleteLabel:{},deleteIcon:{},showMerge:{type:Boolean},showSplit:{type:Boolean},showHeaderRow:{type:Boolean},headerRowActive:{type:Boolean},cellEditMode:{type:Boolean},tableActiveMarks:{},tableActiveColor:{},tableActiveBgColor:{},tableActiveVerticalAlign:{},mobile:{type:Boolean}},emits:["close","interacting","linkClick","delete","merge","split","tableHeaderRow","tableType","tableAlign","tableVerticalAlign","tableMark","tableTextColor","tableBgColor","tableCopy"],setup(e,{expose:n,emit:o}){const r=e,l=o;function s(){l("interacting")}const{t:i}=en(),c=fn(),a=t.inject(Do,t.ref(!1)),d=t.ref(null),f=t.ref(null),u=t.ref(null),h=t.ref(null),p=t.ref(null),m=t.ref(null),k=t.ref(null),x=t.ref(null),D=t.ref(null),U=t.ref({top:0,left:0,above:!1}),F=t.ref(null),ee=t.ref(!1),$=t.ref(null),V=t.ref(null),re=t.ref(!1),G=t.ref(!1),ne=t.ref(null),Z=t.ref(!1),S=t.ref(!1),K=t.ref(!1),_=t.computed(()=>({maxHeight:$.value!==null?`${$.value}px`:void 0})),O=t.ref(null),M=t.computed(()=>{if(!r.mobile||!O.value)return;const B=O.value,b={position:"fixed",left:`${B.left}px`};return B.top!==void 0&&(b.top=`${B.top}px`),B.bottom!==void 0&&(b.bottom=`${B.bottom}px`),B.right!==void 0&&(b.right=`${B.right}px`),b}),E=t.shallowRef(null);t.watch(()=>r.blockId,B=>{E.value=B},{immediate:!0});const N=t.shallowRef(c.getState());let A=null;const W=t.computed(()=>N.value.doc.blocks.get(E.value??"")),me=t.computed(()=>{var b;if(r.cellEditMode||r.tableMode){const L=r.blockAttrs.align;return typeof L=="string"?L:"left"}const B=(b=W.value)==null?void 0:b.attrs.align;return typeof B=="string"?B:"left"}),le=t.computed(()=>{if(r.tableMode){const B=r.tableActiveVerticalAlign;return typeof B=="string"?B:"middle"}if(r.cellEditMode){const B=r.blockAttrs.verticalAlign;return typeof B=="string"?B:"middle"}return"middle"}),he=t.ref(""),ae=t.ref("");t.watch(()=>r.visible,B=>{B||(F.value=null)}),t.watch(()=>r.blockId,()=>{F.value=null});const ie=t.ref(new Set),Se=t.ref(0);function Te(){var B;if(!r.rootEl)return null;if(r.cellEditMode){const b=window.getSelection();if(!b||b.rangeCount===0)return null;const L=b.getRangeAt(0);return(B=L.commonAncestorContainer.nodeType===1?L.commonAncestorContainer:L.commonAncestorContainer.parentElement)==null?void 0:B.closest(".table-cell-inner")}return r.rootEl.querySelector(`[data-block-id="${r.blockId}"]`)}function We(){const B=new Set;if(!r.visible||!r.blockId||!r.rootEl){ie.value=B;return}if(r.tableMode&&r.tableActiveMarks){ie.value=new Set(r.tableActiveMarks);return}const b=Te();if(b){const y=window.getSelection();if(y&&y.rangeCount>0){const v=y.getRangeAt(0);if(!v.collapsed&&b.contains(v.commonAncestorContainer)){const T=[],R=document.createTreeWalker(b,NodeFilter.SHOW_TEXT);for(;R.nextNode();){const q=R.currentNode;(q.nodeValue??"").length!==0&&v.intersectsNode(q)&&T.push(q)}if(T.length>0){const q={bold:["B","STRONG"],italic:["I","EM"],underline:["U"],strikethrough:["S","STRIKE","DEL"],code:["CODE"],link:["A"]};for(const[X,ce]of Object.entries(q))T.every(ke=>{let pe=ke.parentNode;for(;pe&&pe!==b;){if(pe.nodeType===Node.ELEMENT_NODE&&ce.includes(pe.nodeName))return!0;pe=pe.parentNode}return!1})&&B.add(X);if(B.size>0){ie.value=B;return}}}}}const L=N.value,de=r.blockId?L.doc.blocks.get(r.blockId):void 0;if(!de){ie.value=B;return}const _e=L.selection;let Oe=0,Be=Ae(de.content).length;if(_e.kind==="text"&&_e.anchor.blockId===r.blockId&&_e.focus.blockId===r.blockId)Oe=Math.min(_e.anchor.offset,_e.focus.offset),Be=Math.max(_e.anchor.offset,_e.focus.offset);else{const y=_t();y&&(Oe=y.from,Be=y.to)}if(Oe>=Be){ie.value=B;return}const be=["bold","italic","underline","strikethrough","code","link"];for(const y of be){let v=!0,T=!1,R=0;for(const q of de.content){if(q.type!=="text")continue;const X=R,ce=R+q.text.length;if(ce>Oe&&X<Be&&(T=!0,!q.marks||!q.marks.some(ke=>ke.type===y))){v=!1;break}R=ce}T&&v&&B.add(y)}ie.value=B}const Mt=t.computed(()=>r.mobile&&!r.tableMode&&!r.cellEditMode&&!r.selectionRect),Zt=t.computed(()=>Mt.value||r.blockType==="codeBlock"),Gt=t.computed(()=>r.tableMode||r.cellEditMode?Mt.value:!r.blockId),Rt=t.computed(()=>{if(r.tableMode||r.cellEditMode)return Mt.value?!0:r.blockType==="codeBlock";if(!r.blockId||r.blockType==="codeBlock")return!0;const B=r.blockType;return B?!("align"in c.registries.schema.get(B).attrs):!1});function tt(B){if(r.tableMode||r.cellEditMode)return!!(r.blockType==="codeBlock"||r.blockType==="quote"&&B==="italic"||B!=="code"&&ie.value.has("code"));if(Zt.value)return!0;if(B==="italic"){const b=r.blockType;if(b&&c.registries.schema.isMarkDisallowed(b,"italic"))return!0}if(B==="link"){const b=c.getState().selection;return!!(b.kind==="text"&&Ht(b))}return!!(B!=="code"&&ie.value.has("code"))}const yt=t.computed(()=>[{id:"bold",title:i("mark.bold"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M214.857 889.143v-68.571h68.571V203.429H214.857v-68.571h411.429v1.257c96.114 10.629 171.429 87.383 171.429 181.6 0 58.971-29.486 111.086-75.109 144.457 72.069 39.291 120.823 113.234 120.823 198.4 0 119.291-95.634 216.594-217.12 227.543l-0.286.029H214.857z m388.572-388.571H352v320h251.429c95.086 0 171.429-72.091 171.429-160s-76.343-160-171.429-160z m0-297.143H352v228.571h251.429l5.211-0.091c67.52-2.515 120.503-53.235 120.503-114.195 0-62.537-55.749-114.285-125.714-114.285z" fill="currentColor"/></svg>'},{id:"italic",title:i("mark.italic"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M730.143 127.714v64.286h-112.329l-166.521 621.429h128.871v64.286H276.286v-64.286h108.45l166.5-621.429H426.286V127.714h303.857z" fill="currentColor"/></svg>'},{id:"underline",title:i("mark.underline"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M512 123.639a36.409 36.409 0 0 1 33.642 22.525l230.59 558.27a36.409 36.409 0 1 1-67.284 27.768L638.072 560.545H385.928l-70.876 171.656a36.409 36.409 0 1 1-67.332-27.768l230.59-558.27A36.409 36.409 0 0 1 512 123.639z m-95.974 364.089h191.948L512 255.439l-95.974 232.289zM769.289 827.544c19.418 0 38.836 14.564 38.836 38.836 0 19.418-14.564 33.982-29.127 33.982H259.565c-19.418 0-38.836-14.564-38.836-38.836 0-19.418 14.564-33.982 29.127-33.982h519.433z" fill="currentColor"/></svg>'},{id:"strikethrough",title:i("mark.strikethrough"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M182.044 490.667h659.911a34.133 34.133 0 0 1 4.642 67.948l-4.597 0.319h-135.395c40.05 37 60.803 81.601 60.803 133.575 0 128.569-147.092 211.171-307.382 192.512-101.717-11.833-173.352-52.565-210.944-122.971a34.133 34.133 0 0 1 60.211-32.176c25.942 48.606 77.46 77.915 158.606 87.381 124.837 14.473 231.242-45.283 231.242-124.746 0-53.339-36.636-96.802-116.736-131.345l-5.279-2.23H182.044a34.133 34.133 0 0 1-33.815-29.492L147.911 524.8a34.133 34.133 0 0 1 29.491-33.815l4.642-0.318z m68.767-176.447c6.918-128.796 128.432-203.343 287.812-184.82 99.579 11.56 175.81 47.923 226.737 109.636a34.133 34.133 0 1 1-52.657 43.463c-38.775-47.013-98.759-75.639-181.999-85.288-123.654-14.381-211.627 36.591-211.627 117.009 0 35.135 10.65 61.349 37.774 90.203l5.826 6.007c4.278 4.369 8.966 8.875 11.377 10.923l1.411 0.91H288.085l-1.092-1.729c-6.508-9.376-38.958-54.386-36.182-106.314z" fill="currentColor"/></svg>'},{id:"code",title:i("mark.inlineCode"),iconHtml:'<svg viewBox="0 0 1024 1024" width="15" height="15" aria-hidden="true"><path d="M197.802 747.664v-145.287a58.916 58.916 0 0 0-58.916-58.916h-19.619v-62.922h19.619a58.916 58.916 0 0 0 58.916-58.916V276.336a117.832 117.832 0 0 1 117.832-117.832h39.297v78.535h-39.356a39.297 39.297 0 0 0-39.238 39.297v161.017A78.594 78.594 0 0 1 222.37 512a78.594 78.594 0 0 1 53.967 74.646V747.664a39.238 39.238 0 0 0 39.238 39.238h39.356v78.594h-39.356a117.832 117.832 0 0 1-117.832-117.832z m628.456-145.287V747.664a117.832 117.832 0 0 1-117.832 117.832h-39.356v-78.594h39.356a39.238 39.238 0 0 0 39.238-39.238v-161.017A78.535 78.535 0 0 1 801.63 512a78.594 78.594 0 0 1-53.967-74.646V276.336a39.297 39.297 0 0 0-39.238-39.297h-39.356V158.504h39.356a117.832 117.832 0 0 1 117.832 117.832v145.287a58.916 58.916 0 0 0 58.916 58.916h19.56v62.922h-19.56a58.916 58.916 0 0 0-58.916 58.916z" fill="currentColor"/></svg>'}]),vt=t.computed(()=>{const B=r.blockType,b=r.blockAttrs,L=(_e,Oe)=>B===_e&&(Oe===void 0||Number(b.level)===Oe);return[{id:"text",label:i("turnInto.paragraph"),iconHtml:el,active:L("paragraph"),convertType:"paragraph"},{id:"h1",label:i("turnInto.h1"),iconHtml:tl,active:L("heading",1),convertType:"heading",convertAttrs:{level:1}},{id:"h2",label:i("turnInto.h2"),iconHtml:nl,active:L("heading",2),convertType:"heading",convertAttrs:{level:2}},{id:"h3",label:i("turnInto.h3"),iconHtml:ol,active:L("heading",3),convertType:"heading",convertAttrs:{level:3}},{id:"h4",label:i("turnInto.h4"),iconHtml:rl,active:L("heading",4),convertType:"heading",convertAttrs:{level:4}},{id:"h5",label:i("turnInto.h5"),iconHtml:ll,active:L("heading",5),convertType:"heading",convertAttrs:{level:5}},{id:"h6",label:i("turnInto.h6"),iconHtml:il,active:L("heading",6),convertType:"heading",convertAttrs:{level:6}},{id:"bullet",label:i("turnInto.bullet"),iconHtml:sl,active:L("bulletList"),convertType:"bulletList"},{id:"ordered",label:i("turnInto.ordered"),iconHtml:cl,active:L("orderedList"),convertType:"orderedList"},{id:"todo",label:i("turnInto.todo"),iconHtml:al,active:L("todoList"),convertType:"todoList",convertAttrs:{checked:!1}},{id:"quote",label:i("turnInto.quote"),iconHtml:dl,active:L("quote"),convertType:"quote"},{id:"code",label:i("turnInto.code"),iconHtml:ul,active:L("codeBlock"),convertType:"codeBlock",convertAttrs:{language:"plain"}}]}),Ze=t.computed(()=>{const B=vt.value.find(b=>b.active);return B?B.label:i("turnInto.paragraph")}),Ve=t.computed(()=>[{id:"left",label:i("align.left"),value:"left"},{id:"center",label:i("align.center"),value:"center"},{id:"right",label:i("align.right"),value:"right"},{id:"justify",label:i("align.justify"),value:"justify"}]),Ct=t.computed(()=>[{id:"top",label:i("verticalAlign.top"),value:"top"},{id:"middle",label:i("verticalAlign.middle"),value:"middle"},{id:"bottom",label:i("verticalAlign.bottom"),value:"bottom"}]),fe=Xi,Tt=ji;function Xe(){var be;const B=d.value,b=ne.value;if(!B||!b){Z.value=!1;return}const L=b.scrollLeft;b.style.maxWidth="",b.offsetWidth;const de=b.scrollWidth,_e=r.mobile?Math.max(120,(((be=B.parentElement)==null?void 0:be.clientWidth)??B.clientWidth)-8):Math.max(200,document.documentElement.clientWidth-32),Oe=Xf*2,Be=_e-Oe;if(de>Be){Z.value=!0,b.style.maxWidth=`${Be}px`;const y=Math.max(0,b.scrollWidth-b.clientWidth);b.scrollLeft=Math.min(L,y),Re()}else Z.value=!1,b.style.maxWidth="",S.value=!1,K.value=!1}function Re(){const B=ne.value;B&&(S.value=B.scrollLeft>0,K.value=B.scrollLeft+B.clientWidth<B.scrollWidth-1)}function qt(B){F.value=null;const b=ne.value;b&&(b.scrollLeft+=B*Zf,Re())}let rt=null,Et=0,P=0,w=!1,z=!1;function we(B){if(!w)return;const b=B.touches[0];if(!b)return;const L=Math.abs(b.clientX-Et),de=Math.abs(b.clientY-P);(L>es||de>es)&&(z||(F.value=null),z=!0)}function ve(B){if(!w)return;const b=rt;rt=null,w=!1;const L=z;z=!1,L||(B.cancelable&&B.preventDefault(),b&&b())}function nt(B,b){b.cancelable&&b.preventDefault(),qt(B)}function lt(B,b){const L=b.touches[0];L&&(Et=L.clientX,P=L.clientY),rt=B,w=!0,z=!1}t.watch([()=>r.visible,()=>r.selectionRect,d,()=>r.mobile],async()=>{if(r.mobile){r.visible&&Xe();return}if(!r.visible||!r.selectionRect||!r.rootEl)return;const B=d.value;if(!B)return;Xe(),await t.nextTick();const b=B.getBoundingClientRect(),L=b.width,de=Math.max(b.height,ml);U.value=r.tableMode?qi(r.rootEl,r.selectionRect,{width:L,height:de}):Gi(r.rootEl,r.selectionRect,{width:L,height:de})},{flush:"post",immediate:!0});const on=t.computed(()=>({top:"0px",left:"0px",width:"100vw",height:"100vh"})),cn=t.computed(()=>{const B=d.value,b=(B==null?void 0:B.offsetWidth)??jf,L=document.documentElement.clientWidth,de=8;let _e=U.value.left;const Oe=Math.max(de,L-b-de);_e=Math.max(de,Math.min(Oe,_e));const Be={top:`${U.value.top}px`,left:`${_e}px`};if(r.selectionRect){const y=r.selectionRect.left+r.selectionRect.width/2-_e,v=Math.max(10,Math.min(b-10,y));Be["--ht-arrow-x"]=`${v}px`}return Be});async function He(B){F.value=F.value===B?null:B,F.value&&(await t.nextTick(),vn())}function vn(){const B=F.value;if(!B)return;const b=B==="type"?f.value:B==="align"?u.value:B==="verticalAlign"?h.value:p.value,L=B==="type"?m.value:B==="align"?k.value:B==="verticalAlign"?x.value:D.value;if(!b||!L)return;const de=L.getBoundingClientRect(),_e=window.innerHeight,Oe=6,Be=Math.floor(_e-de.bottom-Oe),be=Math.floor(de.top-Oe),y=b.scrollHeight;if(r.mobile){const q=document.documentElement.clientHeight,X=10;if(a.value){ee.value=!0,$.value=Math.max(120,be-X);const ue=q-de.top+Oe;if(B==="color"){const ke=document.documentElement.clientWidth;O.value={bottom:ue,right:Math.max(8,ke-de.right)}}else O.value={left:Math.max(8,de.left),bottom:ue}}else{ee.value=!1,$.value=Math.max(120,Be-X);const ue=de.bottom+Oe;if(B==="color"){const ke=document.documentElement.clientWidth;O.value={top:ue,right:Math.max(8,ke-de.right)}}else O.value={left:Math.max(8,de.left),top:ue}}t.nextTick(Xt);return}O.value=null;let v=!1;if(r.rootEl&&d.value){const q=r.rootEl.getBoundingClientRect(),X=d.value.getBoundingClientRect();q.bottom-X.bottom<ts&&be>ts&&(v=!0)}let T=!1,R;v?(T=!0,R=be):y<=Be?(T=!1,R=Be):be>Be?(T=!0,R=be):(T=!1,R=Be),ee.value=T,$.value=Math.max(120,Math.min(R,360)),t.nextTick(Xt)}function Xt(){const B=V.value;if(!B){re.value=!1,G.value=!1;return}re.value=B.scrollTop>1,G.value=B.scrollTop+B.clientHeight<B.scrollHeight-1}function bn(){const B=V.value;B&&(B.scrollTop-=B.clientHeight*.8)}function Cn(){const B=V.value;B&&(B.scrollTop+=B.clientHeight*.8)}dr(V,Xt);function Tn(B){var L,de,_e,Oe,Be;if(l("interacting"),r.tableMode||r.cellEditMode){B.convertType==="heading"&&((L=B.convertAttrs)!=null&&L.level)?l("tableType",`heading${B.convertAttrs.level}`):l("tableType",B.convertType),F.value=null,r.tableMode&&l("close");return}const b=ft();if(b){for(const be of b.ranges)(_e=(de=c.commands).convertBlock)==null||_e.call(de,{id:be.id,type:B.convertType,attrs:B.convertAttrs??{}});F.value=null,l("close");return}E.value&&((Be=(Oe=c.commands).convertBlock)==null||Be.call(Oe,{id:E.value,type:B.convertType,attrs:B.convertAttrs??{}}),F.value=null,l("close"))}function Me(B){var L,de,_e,Oe;if(l("interacting"),r.tableMode||r.cellEditMode){l("tableAlign",B),F.value=null;return}const b=ft();if(b){for(const Be of b.ranges)(de=(L=c.commands).setBlockAlign)==null||de.call(L,{id:Be.id,align:B});F.value=null;return}E.value&&((Oe=(_e=c.commands).setBlockAlign)==null||Oe.call(_e,{id:E.value,align:B}),F.value=null)}function Ie(B){if(r.tableMode||r.cellEditMode){l("tableVerticalAlign",B),F.value=null;return}F.value=null}function Ge(B){var de,_e,Oe,Be;if(l("interacting"),r.tableMode){l("tableTextColor",B==="default"?null:B),F.value=null;return}if(r.cellEditMode){const be=window.getSelection();if(be&&be.rangeCount>0&&!be.isCollapsed){const y=be.getRangeAt(0);if(B==="default"){const v=y.extractContents();v.querySelectorAll('span[class*="be-color-"]').forEach(T=>{const R=T.className.replace(/be-color-\w+/g,"").trim();if(R)T.className=R;else{for(;T.firstChild;)T.parentNode.insertBefore(T.firstChild,T);T.parentNode.removeChild(T)}}),y.insertNode(v)}else{const v=document.createElement("span");v.className=`be-color-${B}`,v.appendChild(y.extractContents()),y.insertNode(v),be.removeAllRanges();const T=document.createRange();T.selectNodeContents(v),be.addRange(T)}}F.value=null,Ke();return}const b=ft();if(b){for(const be of b.ranges)(_e=(de=c.commands).setInlineMark)==null||_e.call(de,{id:be.id,markType:"color",attrs:B==="default"?null:{color:B},from:be.from,to:be.to});return}if(!E.value)return;const L=_t();L&&((Be=(Oe=c.commands).setInlineMark)==null||Be.call(Oe,{id:E.value,markType:"color",attrs:B==="default"?null:{color:B},from:L.from,to:L.to}),t.nextTick(()=>{var X;const be=window.getSelection(),y=(X=r.rootEl)==null?void 0:X.querySelector(`[data-block-id="${r.blockId}"]`),v=be&&be.rangeCount>0?be.getRangeAt(0):null,T=!!y,R=!!(v&&y&&y.contains(v.commonAncestorContainer)),q=!!(v&&!v.collapsed&&R);if(!T){l("close");return}if(!q&&!R){l("close");return}Ke(),We()}))}function ct(B){var de,_e,Oe,Be;if(l("interacting"),r.tableMode){l("tableBgColor",B==="default"?null:B),F.value=null;return}if(r.cellEditMode){const be=window.getSelection();if(be&&be.rangeCount>0&&!be.isCollapsed){const y=be.getRangeAt(0);if(B==="default"){const v=y.extractContents();v.querySelectorAll('span[class*="be-bg-"]').forEach(T=>{const R=T.className.replace(/be-bg-\w+/g,"").trim();if(R)T.className=R;else{for(;T.firstChild;)T.parentNode.insertBefore(T.firstChild,T);T.parentNode.removeChild(T)}}),y.insertNode(v)}else{const v=document.createElement("span");v.className=`be-bg-${B}`,v.appendChild(y.extractContents()),y.insertNode(v),be.removeAllRanges();const T=document.createRange();T.selectNodeContents(v),be.addRange(T)}}F.value=null,Ke();return}const b=ft();if(b){for(const be of b.ranges)(_e=(de=c.commands).setInlineMark)==null||_e.call(de,{id:be.id,markType:"bgColor",attrs:B==="default"?null:{bgColor:B},from:be.from,to:be.to});return}if(!E.value)return;const L=_t();L&&((Be=(Oe=c.commands).setInlineMark)==null||Be.call(Oe,{id:E.value,markType:"bgColor",attrs:B==="default"?null:{bgColor:B},from:L.from,to:L.to}),t.nextTick(()=>{var X;const be=window.getSelection(),y=(X=r.rootEl)==null?void 0:X.querySelector(`[data-block-id="${r.blockId}"]`),v=be&&be.rangeCount>0?be.getRangeAt(0):null,T=!!y,R=!!(v&&y&&y.contains(v.commonAncestorContainer)),q=!!(v&&!v.collapsed&&R);if(!T){l("close");return}if(!q&&!R){l("close");return}Ke(),We()}))}function Ke(){if(r.tableMode){he.value=r.tableActiveColor??"",ae.value=r.tableActiveBgColor??"";return}if(r.visible&&r.blockId&&r.rootEl){const y=Te(),v=window.getSelection();if(y&&v&&v.rangeCount>0){const T=v.getRangeAt(0);if(!T.collapsed&&y.contains(T.commonAncestorContainer)){const R=new Set,q=new Set,X=[],ce=document.createTreeWalker(y,NodeFilter.SHOW_TEXT);for(;ce.nextNode();){const ue=ce.currentNode;(ue.nodeValue??"").length!==0&&T.intersectsNode(ue)&&X.push(ue)}for(const ue of X){let ke=ue.parentNode;for(;ke&&ke!==y;){if(ke.nodeType===Node.ELEMENT_NODE){const pe=ke.className;if(typeof pe=="string"){const xe=pe.match(/be-color-(\w+)/);xe&&R.add(xe[1]);const Ne=pe.match(/be-bg-(\w+)/);Ne&&q.add(Ne[1])}}ke=ke.parentNode}}if(R.size>0||q.size>0){he.value=R.size===1?[...R][0]:"",ae.value=q.size===1?[...q][0]:"";return}}}}const B=N.value,b=r.blockId?B.doc.blocks.get(r.blockId):void 0;if(!b){he.value="",ae.value="";return}const L=B.selection;let de,_e;if(L.kind==="text"&&L.anchor.blockId===r.blockId&&L.focus.blockId===r.blockId)de=Math.min(L.anchor.offset,L.focus.offset),_e=Math.max(L.anchor.offset,L.focus.offset);else{const y=_t();de=y?y.from:0,_e=y?y.to:Ae(b.content).length}if(de>=_e){he.value="",ae.value="";return}const Oe=new Set,Be=new Set;let be=0;for(const y of b.content){if(y.type!=="text")continue;const v=be,T=be+y.text.length;if(T>de&&v<_e&&y.marks)for(const R of y.marks)R.type==="color"&&R.attrs&&typeof R.attrs.color=="string"&&Oe.add(R.attrs.color),R.type==="bgColor"&&R.attrs&&typeof R.attrs.bgColor=="string"&&Be.add(R.attrs.bgColor);be=T}he.value=Oe.size===1?[...Oe][0]:"",ae.value=Be.size===1?[...Be][0]:""}function _t(){if(!r.blockId||!r.rootEl)return null;const B=r.rootEl.querySelector(`[data-block-id="${r.blockId}"]`);if(!B)return null;const b=window.getSelection();if(!b||b.rangeCount===0)return null;const L=b.getRangeAt(0);if(L.collapsed||!B.contains(L.commonAncestorContainer))return null;const de=document.createRange();de.selectNodeContents(B),de.setEnd(L.startContainer,L.startOffset);const _e=de.toString().length;de.setEnd(L.endContainer,L.endOffset);const Oe=de.toString().length;return{from:Math.min(_e,Oe),to:Math.max(_e,Oe)}}function ft(){const B=N.value.selection;if(B.kind!=="text"||!Ht(B))return null;const b=N.value.doc,L=In(b),de=L.indexOf(B.anchor.blockId),_e=L.indexOf(B.focus.blockId);if(de===-1||_e===-1)return null;const[Oe,Be]=de<=_e?[B.anchor,B.focus]:[B.focus,B.anchor],be=L.indexOf(Oe.blockId),y=L.indexOf(Be.blockId);if(be===-1||y===-1||be>y)return null;const v=[];for(let T=be;T<=y;T++){const R=L[T],q=b.blocks.get(R);if(!q)continue;const X=Ae(q.content).length;let ce=0,ue=X;T===be&&(ce=Math.min(Oe.offset,X)),T===y&&(ue=Math.min(Be.offset,X)),v.push({id:R,from:ce,to:ue})}return{ranges:v}}function ht(){const B=N.value.selection;if(B.kind!=="text"||!Ht(B))return null;const b=ft();if(!b)return null;const L=N.value.doc,de=[],_e=[];for(const Oe of b.ranges){const Be=L.blocks.get(Oe.id);if(!Be)continue;const[,be]=Wt(Be.content,Oe.from),[y]=Wt(be,Oe.to-Oe.from);de.push(Ae(y)),_e.push(Zn(y))}return{text:de.join(`
12
12
  `),html:_e.join("<br>")}}function At(B){var de,_e,Oe,Be;if(l("interacting"),r.tableMode){l("tableMark",B);return}if(r.cellEditMode){const y={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikeThrough",code:"insertHTML"}[B];if(y==="insertHTML"){const v=window.getSelection();if(v&&v.rangeCount>0&&!v.isCollapsed){const T=v.getRangeAt(0),R=document.createElement("code");try{R.appendChild(T.extractContents()),T.insertNode(R),v.removeAllRanges();const q=document.createRange();q.selectNodeContents(R),v.addRange(q)}catch{}}}else y&&document.execCommand(y);We();return}const b=ft();if(b){for(const be of b.ranges)(_e=(de=c.commands).toggleMark)==null||_e.call(de,{id:be.id,markType:B,from:be.from,to:be.to});return}if(!E.value)return;const L=_t();L&&((Be=(Oe=c.commands).toggleMark)==null||Be.call(Oe,{id:E.value,markType:B,from:L.from,to:L.to}),t.nextTick(()=>{var X;Se.value++;const be=window.getSelection(),y=(X=r.rootEl)==null?void 0:X.querySelector(`[data-block-id="${r.blockId}"]`),v=be&&be.rangeCount>0?be.getRangeAt(0):null,T=!!y,R=!!(v&&y&&y.contains(v.commonAncestorContainer)),q=!!(v&&!v.collapsed&&R);if(!T){l("close");return}if(!q&&!R){l("close");return}We(),Ke()}))}function an(){if(l("interacting"),F.value=null,r.cellEditMode){l("linkClick",E.value??"",0,0);return}if(E.value){const B=_t();B&&l("linkClick",E.value,B.from,B.to)}}function Lt(){var de,_e;if(r.tableMode){l("tableCopy"),l("close");return}const B=ht();if(B){(de=navigator.clipboard)==null||de.writeText(B.text),l("close");return}const b=window.getSelection(),L=b?b.toString():"";L&&((_e=navigator.clipboard)==null||_e.writeText(L)),l("close")}n({});async function hn(){if(r.mobile){r.visible&&Xe(),F.value&&vn(),Xt(),We(),Ke();return}if(r.visible&&r.selectionRect&&r.rootEl&&d.value){Xe(),await t.nextTick();const B=d.value.getBoundingClientRect();U.value=r.tableMode?qi(r.rootEl,r.selectionRect,{width:B.width,height:Math.max(B.height,ml)}):Gi(r.rootEl,r.selectionRect,{width:B.width,height:Math.max(B.height,ml)})}F.value&&vn(),Xt(),We(),Ke()}function _n(B){if(!F.value)return;const b=[f.value,u.value,h.value,p.value],L=[m.value,k.value,x.value,D.value];for(const de of b)if(de&&de.contains(B))return;for(const de of L)if(de&&de.contains(B))return;F.value=null}function xn(B){if(!r.visible)return;const b=d.value;if(b&&b.contains(B.target)){B.preventDefault();return}_n(B.target)}function dn(B){if(!r.visible||!B.touches[0])return;const L=B.target,de=d.value;if(de&&de.contains(L)){const _e=ne.value;if(_e&&_e.contains(L))return;B.preventDefault();return}_n(L)}t.watch(()=>r.visible,B=>{B&&t.nextTick(()=>{We(),Ke()})}),t.onMounted(()=>{window.addEventListener("scroll",hn,!0),window.addEventListener("resize",hn),window.addEventListener("mousedown",xn,!0),window.addEventListener("touchstart",dn,!0),document.addEventListener("selectionchange",Qn),A=c.subscribe(()=>{t.nextTick(()=>{const B=c.getState();N.value=B,Se.value++,We(),Ke()})})}),t.onBeforeUnmount(()=>{window.removeEventListener("scroll",hn,!0),window.removeEventListener("resize",hn),window.removeEventListener("mousedown",xn,!0),window.removeEventListener("touchstart",dn,!0),document.removeEventListener("selectionchange",Qn),A==null||A(),A=null});function Qn(){r.visible&&Mn===null&&(Mn=requestAnimationFrame(()=>{Mn=null,r.visible&&(We(),Ke())}))}let Mn=null;return(B,b)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:e.mobile},[t.createElementVNode("div",{class:t.normalizeClass(["hover-toolbar-shell",{visible:e.visible,"mobile-shell":e.mobile,"mobile-visible":e.mobile&&e.visible}]),style:t.normalizeStyle(e.mobile?void 0:on.value),"aria-hidden":!e.visible,onMousedownCapture:t.withModifiers(s,["prevent"])},[t.createElementVNode("div",{ref_key:"toolbarEl",ref:d,class:t.normalizeClass(["hover-toolbar",{above:U.value.above,below:!U.value.above,"ht-overflow":Z.value,"mobile-mode":e.mobile}]),style:t.normalizeStyle(e.mobile?void 0:cn.value),role:"toolbar","aria-label":t.unref(i)("hoverToolbar.label")},[Z.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:t.normalizeClass(["ht-nav-btn ht-nav-left",{disabled:!S.value}]),title:t.unref(i)("ui.scrollLeft"),"aria-label":t.unref(i)("ui.scrollLeft"),onMousedown:b[0]||(b[0]=t.withModifiers(L=>qt(-1),["prevent","stop"])),onTouchstart:b[1]||(b[1]=t.withModifiers(()=>{},["stop"])),onTouchend:b[2]||(b[2]=t.withModifiers(L=>nt(-1,L),["stop"])),onClick:b[3]||(b[3]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[39]||(b[39]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M7.5 3L4.5 6L7.5 9",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],42,nf)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"htContentEl",ref:ne,class:t.normalizeClass(["ht-content",{"dropdown-open":!e.mobile&&!!F.value}]),onScroll:Re,onTouchmovePassive:we,onTouchend:t.withModifiers(ve,["stop"])},[t.createElementVNode("div",of,[t.createElementVNode("button",{ref_key:"typeBtnEl",ref:m,class:t.normalizeClass(["ht-btn ht-type-btn",{open:F.value==="type",disabled:Gt.value}]),title:t.unref(i)("hoverToolbar.typeBtnTitle"),disabled:Gt.value,onMousedown:b[4]||(b[4]=t.withModifiers(L=>!Gt.value&&He("type"),["prevent","stop"])),onTouchstart:b[5]||(b[5]=t.withModifiers(L=>{lt(()=>{Gt.value||He("type")},L)},["stop"])),onClick:b[6]||(b[6]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createElementVNode("span",lf,t.toDisplayString(Ze.value),1),b[40]||(b[40]=t.createElementVNode("svg",{class:"ht-caret",viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],42,rf),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[F.value==="type"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"typeDropdownEl",ref:f,class:t.normalizeClass(["ht-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:ee.value}]]),style:t.normalizeStyle([_.value,M.value])},[re.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(i)("ui.scrollUp"),onMousedown:t.withModifiers(bn,["prevent"])},[...b[41]||(b[41]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,sf)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:V,class:"ht-dropdown-scroll",onScroll:Xt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(vt.value,L=>(t.openBlock(),t.createElementBlock("button",{key:L.id,class:t.normalizeClass(["ht-dropdown-item",{active:L.active}]),onMousedown:t.withModifiers(de=>Tn(L),["prevent","stop"])},[t.createVNode(pn,{class:"ht-dropdown-icon",html:L.iconHtml},null,8,["html"]),t.createElementVNode("span",null,t.toDisplayString(L.label),1),L.active?(t.openBlock(),t.createElementBlock("svg",af,[...b[42]||(b[42]=[t.createElementVNode("path",{d:"M2.5 6L5 8.5L9.5 4",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):t.createCommentVNode("",!0)],42,cf))),128))],544),G.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(i)("ui.scrollDown"),onMousedown:t.withModifiers(Cn,["prevent"])},[...b[43]||(b[43]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,df)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))]),t.createElementVNode("div",uf,[t.createElementVNode("button",{ref_key:"alignBtnEl",ref:k,class:t.normalizeClass(["ht-btn ht-icon-only",{open:F.value==="align",disabled:Rt.value}]),title:t.unref(i)("hoverToolbar.alignBtnTitle"),disabled:Rt.value,onMousedown:b[7]||(b[7]=t.withModifiers(L=>!Rt.value&&He("align"),["prevent","stop"])),onTouchstart:b[8]||(b[8]=t.withModifiers(L=>{lt(()=>{Rt.value||He("align")},L)},["stop"])),onClick:b[9]||(b[9]=t.withModifiers(()=>{},["prevent","stop"]))},[(t.openBlock(),t.createElementBlock("svg",mf,[me.value==="left"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[b[44]||(b[44]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[45]||(b[45]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"10",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[46]||(b[46]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"12",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):me.value==="center"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[b[47]||(b[47]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[48]||(b[48]=t.createElementVNode("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[49]||(b[49]=t.createElementVNode("line",{x1:"3",y1:"12",x2:"13",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):me.value==="right"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[b[50]||(b[50]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[51]||(b[51]=t.createElementVNode("line",{x1:"6",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[52]||(b[52]=t.createElementVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[b[53]||(b[53]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[54]||(b[54]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[55]||(b[55]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64))]))],42,ff),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[F.value==="align"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"alignDropdownEl",ref:u,class:t.normalizeClass(["ht-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:ee.value}]]),style:t.normalizeStyle([_.value,M.value])},[re.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(i)("ui.scrollUp"),onMousedown:t.withModifiers(bn,["prevent"])},[...b[56]||(b[56]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,pf)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:V,class:"ht-dropdown-scroll",onScroll:Xt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ve.value,L=>(t.openBlock(),t.createElementBlock("button",{key:L.id,class:t.normalizeClass(["ht-dropdown-item ht-align-item",{active:me.value===L.value}]),onMousedown:t.withModifiers(de=>Me(L.value),["prevent","stop"])},[(t.openBlock(),t.createElementBlock("svg",gf,[L.value==="left"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[b[57]||(b[57]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[58]||(b[58]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"10",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[59]||(b[59]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"12",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):L.value==="center"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[b[60]||(b[60]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[61]||(b[61]=t.createElementVNode("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[62]||(b[62]=t.createElementVNode("line",{x1:"3",y1:"12",x2:"13",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):L.value==="right"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[b[63]||(b[63]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[64]||(b[64]=t.createElementVNode("line",{x1:"6",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[65]||(b[65]=t.createElementVNode("line",{x1:"4",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[b[66]||(b[66]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[67]||(b[67]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[68]||(b[68]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"14",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64))])),t.createElementVNode("span",null,t.toDisplayString(L.label),1),me.value===L.value?(t.openBlock(),t.createElementBlock("svg",bf,[...b[69]||(b[69]=[t.createElementVNode("path",{d:"M2.5 6L5 8.5L9.5 4",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):t.createCommentVNode("",!0)],42,hf))),128))],544),G.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(i)("ui.scrollDown"),onMousedown:t.withModifiers(Cn,["prevent"])},[...b[70]||(b[70]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,kf)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))]),e.tableMode||e.cellEditMode?(t.openBlock(),t.createElementBlock("div",yf,[t.createElementVNode("button",{ref_key:"verticalAlignBtnEl",ref:x,class:t.normalizeClass(["ht-btn ht-icon-only",{open:F.value==="verticalAlign",disabled:Rt.value}]),title:t.unref(i)("hoverToolbar.verticalAlignBtnTitle"),disabled:Rt.value,onMousedown:b[10]||(b[10]=t.withModifiers(L=>!Rt.value&&He("verticalAlign"),["prevent","stop"])),onTouchstart:b[11]||(b[11]=t.withModifiers(L=>{lt(()=>{Rt.value||He("verticalAlign")},L)},["stop"])),onClick:b[12]||(b[12]=t.withModifiers(()=>{},["prevent","stop"]))},[(t.openBlock(),t.createElementBlock("svg",Ef,[le.value==="top"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[b[71]||(b[71]=t.createElementVNode("line",{x1:"2",y1:"3",x2:"14",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[72]||(b[72]=t.createElementVNode("line",{x1:"4",y1:"7",x2:"12",y2:"7",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[73]||(b[73]=t.createElementVNode("line",{x1:"5",y1:"11",x2:"11",y2:"11",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):le.value==="bottom"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[b[74]||(b[74]=t.createElementVNode("line",{x1:"5",y1:"5",x2:"11",y2:"5",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[75]||(b[75]=t.createElementVNode("line",{x1:"4",y1:"9",x2:"12",y2:"9",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[76]||(b[76]=t.createElementVNode("line",{x1:"2",y1:"13",x2:"14",y2:"13",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[b[77]||(b[77]=t.createElementVNode("line",{x1:"5",y1:"3",x2:"11",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[78]||(b[78]=t.createElementVNode("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[79]||(b[79]=t.createElementVNode("line",{x1:"5",y1:"13",x2:"11",y2:"13",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64))]))],42,wf),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[F.value==="verticalAlign"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"verticalAlignDropdownEl",ref:h,class:t.normalizeClass(["ht-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:ee.value}]]),style:t.normalizeStyle([_.value,M.value])},[re.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(i)("ui.scrollUp"),onMousedown:t.withModifiers(bn,["prevent"])},[...b[80]||(b[80]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,vf)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:V,class:"ht-dropdown-scroll",onScroll:Xt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ct.value,L=>(t.openBlock(),t.createElementBlock("button",{key:L.id,class:t.normalizeClass(["ht-dropdown-item ht-align-item",{active:le.value===L.value}]),onMousedown:t.withModifiers(de=>Ie(L.value),["prevent","stop"])},[(t.openBlock(),t.createElementBlock("svg",Tf,[L.value==="top"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[b[81]||(b[81]=t.createElementVNode("line",{x1:"2",y1:"3",x2:"14",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[82]||(b[82]=t.createElementVNode("line",{x1:"4",y1:"7",x2:"12",y2:"7",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[83]||(b[83]=t.createElementVNode("line",{x1:"5",y1:"11",x2:"11",y2:"11",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):L.value==="bottom"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[b[84]||(b[84]=t.createElementVNode("line",{x1:"5",y1:"5",x2:"11",y2:"5",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[85]||(b[85]=t.createElementVNode("line",{x1:"4",y1:"9",x2:"12",y2:"9",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[86]||(b[86]=t.createElementVNode("line",{x1:"2",y1:"13",x2:"14",y2:"13",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[b[87]||(b[87]=t.createElementVNode("line",{x1:"5",y1:"3",x2:"11",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[88]||(b[88]=t.createElementVNode("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),b[89]||(b[89]=t.createElementVNode("line",{x1:"5",y1:"13",x2:"11",y2:"13",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64))])),t.createElementVNode("span",null,t.toDisplayString(L.label),1),le.value===L.value?(t.openBlock(),t.createElementBlock("svg",_f,[...b[90]||(b[90]=[t.createElementVNode("path",{d:"M2.5 6L5 8.5L9.5 4",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):t.createCommentVNode("",!0)],42,Cf))),128))],544),G.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(i)("ui.scrollDown"),onMousedown:t.withModifiers(Cn,["prevent"])},[...b[91]||(b[91]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,xf)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))])):t.createCommentVNode("",!0),b[100]||(b[100]=t.createElementVNode("div",{class:"ht-sep"},null,-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(yt.value,L=>(t.openBlock(),t.createElementBlock("button",{key:L.id,class:t.normalizeClass(["ht-btn ht-icon-only",{active:ie.value.has(L.id),disabled:tt(L.id)}]),title:L.title,disabled:tt(L.id),onMousedown:t.withModifiers(de=>!tt(L.id)&&At(L.id),["prevent","stop"]),onTouchstart:t.withModifiers(de=>{lt(()=>{tt(L.id)||At(L.id)},de)},["stop"]),onClick:b[13]||(b[13]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createVNode(pn,{html:L.iconHtml},null,8,["html"])],42,Mf))),128)),e.tableMode?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:1,class:t.normalizeClass(["ht-btn ht-icon-only",{active:ie.value.has("link"),disabled:tt("link")}]),title:t.unref(i)("hoverToolbar.linkBtnTitle"),disabled:tt("link"),onMousedown:b[14]||(b[14]=t.withModifiers(L=>!tt("link")&&an(),["prevent","stop"])),onTouchstart:b[15]||(b[15]=t.withModifiers(L=>{lt(()=>{tt("link")||an()},L)},["stop"])),onClick:b[16]||(b[16]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[92]||(b[92]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M394.666667 298.666667a32 32 0 0 1 4.693333 63.658666l-4.693333 0.341334H298.666667a149.333333 149.333333 0 0 0-8.789334 298.410666L298.666667 661.333333h96a32 32 0 0 1 4.693333 63.658667L394.666667 725.333333H298.666667a213.333333 213.333333 0 0 1-10.666667-426.410666L298.666667 298.666667h96zM725.333333 298.666667a213.333333 213.333333 0 0 1 10.666667 426.410666L725.333333 725.333333h-96a32 32 0 0 1-4.693333-63.658666l4.693333-0.341334H725.333333a149.333333 149.333333 0 0 0 8.789334-298.410666L725.333333 362.666667h-96a32 32 0 0 1-4.693333-63.658667L629.333333 298.666667H725.333333zM298.666667 480h426.666666a32 32 0 0 1 4.352 63.701333L725.333333 544H298.666667a32 32 0 0 1-4.352-63.701333L298.666667 480h426.666666H298.666667z",fill:"currentColor"})],-1)])],42,Nf)),b[101]||(b[101]=t.createElementVNode("div",{class:"ht-sep"},null,-1)),t.createElementVNode("div",Sf,[t.createElementVNode("button",{ref_key:"colorBtnEl",ref:D,class:t.normalizeClass(["ht-btn ht-icon-only",{open:F.value==="color",disabled:tt("color")}]),title:t.unref(i)("hoverToolbar.colorBtnTitle"),disabled:tt("color"),onMousedown:b[17]||(b[17]=t.withModifiers(L=>!tt("color")&&He("color"),["prevent","stop"])),onTouchstart:b[18]||(b[18]=t.withModifiers(L=>{lt(()=>{tt("color")||He("color")},L)},["stop"])),onClick:b[19]||(b[19]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[93]||(b[93]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("path",{d:"M163.797333 249.941333c125.44-167.082667 385.28-215.68 570.197334-100.693333 182.613333 113.493333 249.770667 331.818667 174.933333 536.618667-70.613333 193.408-256.682667 269.994667-390.784 172.714666-50.218667-36.437333-69.717333-82.133333-79.104-156.330666l-4.522667-42.112-1.92-16.981334c-5.248-39.850667-13.269333-57.685333-30.08-67.072-22.826667-12.714667-38.058667-13.013333-68.053333-1.408l-14.976 6.229334-7.637333 3.328c-43.264 18.773333-72.021333 25.386667-108.416 17.749333l-8.533334-2.005333-6.997333-2.005334c-118.997333-36.864-136.618667-198.272-24.106667-348.032z m41.984 286.549334l5.248 1.578666 5.717334 1.28c18.730667 3.712 34.730667 0.64 61.312-10.325333l25.685333-10.965333c51.285333-21.034667 84.693333-23.04 129.962667 2.133333 39.125333 21.845333 54.4 55.381333 62.165333 113.493333l2.261333 19.584 2.346667 22.698667 2.005333 18.005333c7.338667 58.069333 20.693333 89.173333 53.248 112.810667 97.066667 70.4 236.117333 13.184 293.12-142.890667 64.682667-177.152 7.424-363.264-148.650666-460.330666-156.8-97.450667-379.690667-55.722667-485.248 84.778666-88.533333 117.888-77.653333 225.28-9.173334 248.149334z m478.933334-85.077334a53.333333 53.333333 0 1 1 102.997333-27.605333 53.333333 53.333333 0 0 1-102.997333 27.605333z m21.077333 148.821334a53.333333 53.333333 0 1 1 103.04-27.605334 53.333333 53.333333 0 0 1-103.04 27.605334zM600.32 323.285333a53.333333 53.333333 0 1 1 103.04-27.605333 53.333333 53.333333 0 0 1-103.04 27.605333z m-1.194667 383.914667a53.333333 53.333333 0 1 1 102.997334-27.605333 53.333333 53.333333 0 0 1-102.997334 27.605333z m-149.205333-425.386667a53.333333 53.333333 0 1 1 103.04-27.562666 53.333333 53.333333 0 0 1-103.04 27.562666z",fill:"currentColor"})],-1)])],42,Af),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[F.value==="color"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"colorDropdownEl",ref:p,class:t.normalizeClass(["ht-dropdown ht-color-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:ee.value}]]),style:t.normalizeStyle([_.value,M.value])},[re.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(i)("ui.scrollUp"),onMousedown:t.withModifiers(bn,["prevent"])},[...b[94]||(b[94]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,If)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:V,class:"ht-dropdown-scroll",onScroll:Xt},[t.createElementVNode("div",Bf,[t.createElementVNode("div",Rf,t.toDisplayString(t.unref(i)("hoverToolbar.textColor")),1),t.createElementVNode("div",Lf,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(fe),L=>(t.openBlock(),t.createElementBlock("button",{key:"tc-"+L.key,class:t.normalizeClass(["ht-swatch",{active:he.value===L.key}]),title:t.unref(i)(L.key==="default"?"color.default":"color."+L.key),style:t.normalizeStyle({backgroundColor:L.displayCssValue??L.cssValue}),onMousedown:t.withModifiers(de=>Ge(L.key),["prevent","stop"])},null,46,Of))),128))])]),t.createElementVNode("div",Df,[t.createElementVNode("div",$f,t.toDisplayString(t.unref(i)("hoverToolbar.bgColor")),1),t.createElementVNode("div",Pf,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Tt),L=>(t.openBlock(),t.createElementBlock("button",{key:"bc-"+L.key,class:t.normalizeClass(["ht-swatch",[{active:ae.value===L.key},L.key==="default"?"ht-swatch--none":""]]),title:t.unref(i)(L.key==="default"?"color.none":"color."+L.key),style:t.normalizeStyle({backgroundColor:L.displayCssValue??L.cssValue}),onMousedown:t.withModifiers(de=>ct(L.key),["prevent","stop"])},null,46,Hf))),128))])])],544),G.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(i)("ui.scrollDown"),onMousedown:t.withModifiers(Cn,["prevent"])},[...b[95]||(b[95]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Vf)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))]),b[102]||(b[102]=t.createElementVNode("div",{class:"ht-sep"},null,-1)),t.createElementVNode("button",{class:t.normalizeClass(["ht-btn ht-icon-only",{disabled:Mt.value}]),title:t.unref(i)("hoverToolbar.copySelection"),"aria-label":t.unref(i)("hoverToolbar.copySelection"),disabled:Mt.value,onMousedown:b[20]||(b[20]=t.withModifiers(L=>!Mt.value&&Lt(),["prevent","stop"])),onTouchstart:b[21]||(b[21]=t.withModifiers(L=>{lt(()=>{Mt.value||Lt()},L)},["stop"])),onClick:b[22]||(b[22]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[96]||(b[96]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},[t.createElementVNode("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1.5",fill:"none",stroke:"currentColor","stroke-width":"1.3"}),t.createElementVNode("path",{d:"M3 10.5V3.5C3 2.67 3.67 2 4.5 2H10",fill:"none",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"})],-1)])],42,Uf),e.tableMode?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.showMerge||e.showSplit||e.showHeaderRow||e.showDelete?(t.openBlock(),t.createElementBlock("div",zf)):t.createCommentVNode("",!0),e.showMerge?(t.openBlock(),t.createElementBlock("button",{key:1,class:"ht-btn ht-icon-only",title:t.unref(i)("table.mergeCells"),onMousedown:b[23]||(b[23]=t.withModifiers(L=>l("merge"),["prevent","stop"])),onTouchstart:b[24]||(b[24]=t.withModifiers(L=>lt(()=>l("merge"),L),["stop"])),onClick:b[25]||(b[25]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[97]||(b[97]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15",fill:"currentColor","aria-hidden":"true"},[t.createElementVNode("path",{d:"M266.666667 128A138.666667 138.666667 0 0 0 128 266.666667v490.666666A138.666667 138.666667 0 0 0 266.666667 896h490.666666A138.666667 138.666667 0 0 0 896 757.333333V266.666667A138.666667 138.666667 0 0 0 757.333333 128H266.666667zM192 266.666667c0-41.216 33.450667-74.666667 74.666667-74.666667H469.333333v128H192V266.666667z m341.333333 437.333333h298.666667v53.333333a74.666667 74.666667 0 0 1-74.666667 74.666667H533.333333v-128z m298.666667-384h-298.666667v-128h224c41.216 0 74.666667 33.450667 74.666667 74.666667V320z m-362.666667 384v128H266.666667a74.666667 74.666667 0 0 1-74.666667-74.666667V704H469.333333zM192 384h640v256h-640V384z"})],-1)])],40,Ff)):t.createCommentVNode("",!0),e.showSplit?(t.openBlock(),t.createElementBlock("button",{key:2,class:"ht-btn ht-icon-only",title:t.unref(i)("table.splitCell"),onMousedown:b[26]||(b[26]=t.withModifiers(L=>l("split"),["prevent","stop"])),onTouchstart:b[27]||(b[27]=t.withModifiers(L=>lt(()=>l("split"),L),["stop"])),onClick:b[28]||(b[28]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[98]||(b[98]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15",fill:"currentColor","aria-hidden":"true"},[t.createElementVNode("path",{d:"M533.333333 426.666667H469.333333v170.666666h64v-170.666666z"}),t.createElementVNode("path",{d:"M128 266.666667A138.666667 138.666667 0 0 1 266.666667 128h490.666666A138.666667 138.666667 0 0 1 896 266.666667v490.666666A138.666667 138.666667 0 0 1 757.333333 896H266.666667A138.666667 138.666667 0 0 1 128 757.333333V266.666667zM266.666667 192A74.666667 74.666667 0 0 0 192 266.666667V320H469.333333v-128H266.666667z m565.333333 512h-298.666667v128h224a74.666667 74.666667 0 0 0 74.666667-74.666667V704z m0-437.333333a74.666667 74.666667 0 0 0-74.666667-74.666667H533.333333v128h298.666667V266.666667zM192 704v53.333333c0 41.216 33.450667 74.666667 74.666667 74.666667H469.333333v-128H192z m0-64h640V384h-640v256z"})],-1)])],40,Kf)):t.createCommentVNode("",!0),e.showHeaderRow?(t.openBlock(),t.createElementBlock("button",{key:3,class:t.normalizeClass(["ht-btn ht-icon-only",{active:e.headerRowActive}]),title:t.unref(i)("table.toggleHeader"),onMousedown:b[29]||(b[29]=t.withModifiers(L=>l("tableHeaderRow"),["prevent","stop"])),onTouchstart:b[30]||(b[30]=t.withModifiers(L=>lt(()=>l("tableHeaderRow"),L),["stop"])),onClick:b[31]||(b[31]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[99]||(b[99]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"15",height:"15",fill:"none",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[t.createElementVNode("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1"}),t.createElementVNode("path",{d:"M2 6h12"}),t.createElementVNode("path",{d:"M5 2v4"})],-1)])],42,Wf)):t.createCommentVNode("",!0),e.showDelete?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[e.showMerge||e.showSplit||e.showHeaderRow?(t.openBlock(),t.createElementBlock("div",Gf)):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"ht-btn ht-danger ht-icon-only",title:e.deleteLabel||t.unref(i)("hoverToolbar.deleteBlock"),onMousedown:b[32]||(b[32]=t.withModifiers(L=>l("delete"),["prevent","stop"])),onTouchstart:b[33]||(b[33]=t.withModifiers(L=>lt(()=>l("delete"),L),["stop"])),onClick:b[34]||(b[34]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createVNode(pn,{html:e.deleteIcon||"<svg viewBox='0 0 1024 1024' width='15' height='15' fill='currentColor' aria-hidden='true'><path d='M128 266.666667A138.666667 138.666667 0 0 1 266.666667 128h490.666666A138.666667 138.666667 0 0 1 896 266.666667v246.272a276.096 276.096 0 0 0-64-30.250667V426.666667h-170.666667v56.021333a276.096 276.096 0 0 0-64 30.250667V426.666667h-170.666666v170.666666h86.272a276.096 276.096 0 0 0-30.250667 64H426.666667v170.666667h56.021333c7.381333 22.784 17.578667 44.245333 30.250667 64H266.666667A138.666667 138.666667 0 0 1 128 757.333333V266.666667zM266.666667 192A74.666667 74.666667 0 0 0 192 266.666667V362.666667h170.666667v-170.666667H266.666667zM192 426.666667v170.666666h170.666667v-170.666666h-170.666667z m469.333333-64h170.666667V266.666667a74.666667 74.666667 0 0 0-74.666667-74.666667H661.333333v170.666667z m-64-170.666667h-170.666666v170.666667h170.666666v-170.666667z m-405.333333 469.333333v96c0 41.216 33.450667 74.666667 74.666667 74.666667H362.666667v-170.666667h-170.666667z'/><path d='M981.333333 746.666667a234.666667 234.666667 0 1 1-469.333333 0 234.666667 234.666667 0 0 1 469.333333 0z m-234.666666-30.165334l-70.229334-70.272a21.333333 21.333333 0 0 0-30.208 30.208l70.272 70.229334-70.272 70.229333a21.333333 21.333333 0 0 0 30.208 30.208l70.229334-70.272 70.229333 70.272a21.333333 21.333333 0 0 0 30.208-30.208L776.832 746.666667l70.272-70.229334a21.333333 21.333333 0 0 0-30.208-30.208L746.666667 716.501333z'/></svg>"},null,8,["html"])],40,qf)],64)):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],34),Z.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:t.normalizeClass(["ht-nav-btn ht-nav-right",{disabled:!K.value}]),title:t.unref(i)("ui.scrollRight"),"aria-label":t.unref(i)("ui.scrollRight"),onMousedown:b[35]||(b[35]=t.withModifiers(L=>qt(1),["prevent","stop"])),onTouchstart:b[36]||(b[36]=t.withModifiers(()=>{},["stop"])),onTouchend:b[37]||(b[37]=t.withModifiers(L=>nt(1,L),["stop"])),onClick:b[38]||(b[38]=t.withModifiers(()=>{},["prevent","stop"]))},[...b[103]||(b[103]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],42,Yf)):t.createCommentVNode("",!0)],14,tf)],46,ef)],8,["disabled"]))}}),Jf=["aria-label"],em={class:"tt-left"},tm=["disabled","title","aria-label"],nm=["disabled","title","aria-label"],om={key:0,class:"tt-sep"},rm=t.defineComponent({__name:"FixedToolbar",props:{rootEl:{},focusBlockId:{},hoverVisible:{type:Boolean},hoverSelectionRect:{},hoverBlockId:{},hoverBlockType:{},hoverBlockAttrs:{},plusMenuVisible:{type:Boolean},settingsMenuVisible:{type:Boolean},position:{}},emits:["openPlusMenu","openSettingsMenu","linkClick","hoverClose","toolbarInteracting"],setup(e,{emit:n}){const o=e,r=n;function l($){r("toolbarInteracting")}const{t:s}=en(),i=Yn(),c=fn(),a=t.inject(mi,t.ref(!1)),d=t.computed(()=>o.position==="top"?!1:o.position==="bottom"?!0:a.value);t.provide(Do,d);const f=t.inject($r,t.ref(null)),u=t.ref(null),h=$=>{var G;if(!$)return null;const V=$.nodeType===1?$:$.parentElement;if(!V)return null;const re=V.closest(".block-content");return re&&(((G=o.rootEl)==null?void 0:G.contains(re))??!1)?re:null};let p=null;const m=()=>{if(!u.value){p=null;return}try{const $=window.getSelection();if($&&$.rangeCount>0){const V=$.getRangeAt(0);if(!V.collapsed&&[$.anchorNode,$.focusNode,V.startContainer,V.endContainer].some(G=>h(G)!==null)){p=setTimeout(m,1500);return}}}catch{}u.value=null,p=null};t.watch([f,()=>o.hoverVisible,()=>o.hoverSelectionRect,()=>o.hoverBlockId,()=>o.hoverBlockType,()=>o.hoverBlockAttrs],()=>{const $=f.value;if(!($&&$.visible))if(o.hoverVisible){if(p&&(clearTimeout(p),p=null),o.hoverSelectionRect===null||o.hoverBlockId===null||o.hoverBlockType===null)return;u.value={visible:!0,selectionRect:o.hoverSelectionRect,blockId:o.hoverBlockId,blockType:o.hoverBlockType,blockAttrs:o.hoverBlockAttrs,rootEl:o.rootEl,onClose:()=>r("hoverClose"),onLinkClick:(V,re,G)=>r("linkClick",V,re,G)}}else u.value&&!p&&(p=setTimeout(m,1500))},{immediate:!0,flush:"sync"});const k=t.computed(()=>{const $=f.value;if($&&$.visible)return $;if(o.hoverVisible)return{visible:!0,selectionRect:o.hoverSelectionRect,blockId:o.hoverBlockId,blockType:o.hoverBlockType,blockAttrs:o.hoverBlockAttrs,rootEl:o.rootEl,onClose:()=>r("hoverClose"),onLinkClick:(re,G,ne)=>r("linkClick",re,G,ne)};if(u.value)return{...u.value,visible:!0};const V=o.focusBlockId;if(V){const re=c.getState().doc.blocks.get(V);return{visible:!0,selectionRect:null,blockId:V,blockType:(re==null?void 0:re.type)??null,blockAttrs:(re==null?void 0:re.attrs)??{},rootEl:o.rootEl,onClose:()=>r("hoverClose"),onLinkClick:(G,ne,Z)=>r("linkClick",G,ne,Z)}}return{visible:!1,selectionRect:null,blockId:null,blockType:null,blockAttrs:{},rootEl:o.rootEl}}),x=t.computed(()=>{const $=f.value;return $&&$.visible?$.blockId:o.hoverVisible&&o.hoverBlockId?o.hoverBlockId:o.focusBlockId}),D=t.ref(null),U=t.ref(null);function F(){const $=x.value,V=D.value;!$||!V||r("openPlusMenu",$,V)}function ee(){const $=x.value,V=U.value;!$||!V||r("openSettingsMenu",$,V)}return t.watch(()=>o.focusBlockId,($,V)=>{if($!==V&&u.value){const re=u.value;$!==null&&re.blockId!==$&&(u.value=null)}}),($,V)=>t.unref(i)?(t.openBlock(),t.createElementBlock("div",{key:0,ref:"toolbarRoot",class:t.normalizeClass(["fixed-toolbar",{"fixed-toolbar--bottom":d.value}]),role:"toolbar","aria-label":t.unref(s)("hoverToolbar.label"),onMousedownCapture:t.withModifiers(l,["prevent"])},[t.createElementVNode("div",em,[t.createElementVNode("button",{ref_key:"plusBtnEl",ref:D,class:t.normalizeClass(["tt-btn tt-plus",{disabled:!x.value,active:e.plusMenuVisible}]),disabled:!x.value,title:t.unref(s)("handle.plus.title"),"aria-label":t.unref(s)("handle.plus.ariaLabel"),onMousedown:t.withModifiers(F,["prevent","stop"]),onTouchstart:V[0]||(V[0]=t.withModifiers(()=>{},["stop"]))},[...V[3]||(V[3]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"18",height:"18","aria-hidden":"true"},[t.createElementVNode("path",{d:"M8 3.5V12.5M3.5 8H12.5",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"})],-1)])],42,tm),t.createElementVNode("button",{ref_key:"handleBtnEl",ref:U,class:t.normalizeClass(["tt-btn tt-handle",{disabled:!x.value,active:e.settingsMenuVisible}]),disabled:!x.value,title:t.unref(s)("handle.grip.title"),"aria-label":t.unref(s)("handle.grip.ariaLabel"),onMousedown:t.withModifiers(ee,["prevent","stop"]),onTouchstart:V[1]||(V[1]=t.withModifiers(()=>{},["stop"]))},[...V[4]||(V[4]=[t.createStaticVNode('<svg viewBox="0 0 16 16" width="18" height="18" aria-hidden="true"><circle cx="5" cy="4" r="1.3" fill="currentColor"></circle><circle cx="11" cy="4" r="1.3" fill="currentColor"></circle><circle cx="5" cy="8" r="1.3" fill="currentColor"></circle><circle cx="11" cy="8" r="1.3" fill="currentColor"></circle><circle cx="5" cy="12" r="1.3" fill="currentColor"></circle><circle cx="11" cy="12" r="1.3" fill="currentColor"></circle></svg>',1)])],42,nm)]),k.value.visible?(t.openBlock(),t.createElementBlock("div",om)):t.createCommentVNode("",!0),t.createVNode(Qf,t.mergeProps({mobile:""},k.value,{onInteracting:V[2]||(V[2]=re=>r("toolbarInteracting"))}),null,16)],42,Jf)):t.createCommentVNode("",!0)}}),lm={class:"olm-label"},im={class:"olm-label"},sm={class:"olm-label"},ur=6,ns=t.defineComponent({__name:"OrderedListMenu",props:{visible:{type:Boolean},blockId:{},anchor:{},rootEl:{},canContinue:{type:Boolean},canStartNew:{type:Boolean},currentNumber:{}},emits:["continue","startNew","modify","close"],setup(e,{emit:n}){const o=e,r=n,{t:l}=en(),s=t.ref(null),i=t.ref({top:0,left:0,above:!1});t.watch([()=>o.visible,()=>o.anchor,s],async()=>{if(!o.visible||!o.anchor)return;await t.nextTick();const u=s.value;if(!u)return;const h=o.anchor.getBoundingClientRect(),p=u.getBoundingClientRect(),k=window.innerHeight-h.bottom-ur,x=h.top-ur,D=Math.max(p.height,10);let U=!1;k>=D?U=!1:x>=D?U=!0:U=x>k,i.value={top:U?h.top-(p.height+ur):h.bottom+ur,left:h.left,above:U}},{flush:"post",immediate:!0});const c=t.computed(()=>({top:`${i.value.top}px`,left:`${i.value.left}px`}));function a(){o.canContinue&&r("continue")}function d(){o.canStartNew&&r("startNew")}function f(){r("modify",o.currentNumber)}return(u,h)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[e.visible&&e.anchor&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:s,class:t.normalizeClass(["ordered-list-menu",{above:i.value.above}]),style:t.normalizeStyle(c.value),role:"menu",onMousedown:h[0]||(h[0]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createElementVNode("button",{class:t.normalizeClass(["olm-item",{disabled:!e.canContinue}]),role:"menuitem",onClick:a},[h[1]||(h[1]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true",fill:"currentColor"},[t.createElementVNode("path",{d:"M2.27072 1012.662857c0 6.253714 5.046857 11.337143 11.337143 11.337143h226.267428a11.337143 11.337143 0 0 0 11.337143-11.337143v-52.114286a11.337143 11.337143 0 0 0-11.337143-11.337142H120.067291L181.031863 885.028571c14.701714-15.323429 26.770286-29.257143 36.205714-41.801142l0.036572-0.109715c9.508571-13.019429 16.859429-25.965714 21.796571-38.875428a110.445714 110.445714 0 0 0 7.570286-39.862857c0-20.955429-5.193143-39.789714-15.872-56.027429a101.302857 101.302857 0 0 0-43.081143-37.156571C169.621577 662.454857 148.849006 658.285714 125.809006 658.285714a136.777143 136.777143 0 0 0-56.137143 11.812572c-17.554286 7.68-32.548571 18.797714-44.8 33.426285a111.542857 111.542857 0 0 0-24.649143 51.309715 11.337143 11.337143 0 0 0 7.753143 13.056l53.833143 16.786285a11.300571 11.300571 0 0 0 14.189714-7.570285c4.315429-14.299429 10.898286-24.137143 19.163429-30.537143l0.182857-0.146286c8.411429-6.729143 18.358857-10.203429 30.464-10.203428 11.52 0 19.931429 3.291429 26.258285 9.216l0.146286 0.109714c6.253714 5.668571 9.801143 13.531429 9.801143 25.124571 0 6.656-1.499429 13.275429-4.754286 20.004572-3.291429 6.838857-9.508571 15.798857-19.163428 26.989714-9.508571 10.971429-23.222857 25.929143-41.289143 44.909714L5.379291 958.171429a11.337143 11.337143 0 0 0-3.108571 7.826285v46.665143zM512.003291 0v109.714286h329.142858a182.857143 182.857143 0 0 1 182.857142 182.857143v438.857142a182.857143 182.857143 0 0 1-182.857142 182.857143H402.289006a36.571429 36.571429 0 1 1 0-73.142857h438.857143a109.714286 109.714286 0 0 0 109.714285-109.714286V292.571429a109.714286 109.714286 0 0 0-109.714285-109.714286h-329.142858v109.714286L292.57472 146.285714l219.428571-146.285714zM108.913006 365.714286a11.483429 11.483429 0 0 1-11.52-11.483429V76.361143H42.791863a11.483429 11.483429 0 0 1-11.52-11.483429V11.483429C31.235291 5.156571 36.391863 0 42.791863 0h128.621714C177.703863 0 182.860434 5.12 182.860434 11.483429v342.747428c0 6.326857-5.12 11.483429-11.483428 11.483429H108.913006z"})],-1)),t.createElementVNode("span",lm,t.toDisplayString(t.unref(l)("ol.continue")),1)],2),t.createElementVNode("button",{class:t.normalizeClass(["olm-item",{disabled:!e.canStartNew}]),role:"menuitem",onClick:d},[h[2]||(h[2]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true",fill:"currentColor"},[t.createElementVNode("path",{d:"M128 324.288V162.112l-17.088 17.088c-17.024 17.088-42.624 8.512-59.712-8.512C34.112 153.6 42.688 128 59.712 119.488L128 76.8c25.6-17.088 51.2-17.088 68.288 8.512 8.512 8.576 8.512 17.088 8.512 25.6v204.8c0 25.6-17.088 42.688-34.112 42.688C153.6 358.4 128 341.312 128 324.288zM170.688 469.312c-25.6 0-42.688 25.6-42.688 42.688v213.312H59.712c-8.512 0-17.024 8.576-17.024 25.6v8.576L153.6 955.712c8.512 8.576 17.088 17.088 25.6 8.576l8.512-8.576 110.976-196.224c8.512-8.576 0-25.6-8.576-25.6h-76.8V512c0-17.088-17.024-42.688-42.624-42.688zM426.688 810.688c-25.6 0-42.688 17.024-42.688 42.624s17.088 42.688 42.688 42.688h512c25.6 0 42.624-17.088 42.624-42.688s-17.024-42.624-42.624-42.624h-512zM384 512c0-25.6 17.088-42.688 42.688-42.688h512c25.6 0 42.624 17.088 42.624 42.688s-17.024 42.688-42.624 42.688h-512C401.088 554.688 384 537.6 384 512zM426.688 128c-25.6 0-42.688 17.088-42.688 42.688s17.088 42.624 42.688 42.624h512c25.6 0 42.624-17.024 42.624-42.624S964.288 128 938.688 128h-512z"})],-1)),t.createElementVNode("span",im,t.toDisplayString(t.unref(l)("ol.startNew")),1)],2),t.createElementVNode("button",{class:"olm-item",role:"menuitem",onClick:f},[h[3]||(h[3]=t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"15",height:"15","aria-hidden":"true",fill:"currentColor"},[t.createElementVNode("path",{d:"M45.421714 279.771429c0 4.388571 3.547429 7.936 7.899429 7.936H96.182857c4.388571 0 7.899429-3.547429 7.899429-7.899429V44.470857A7.899429 7.899429 0 0 0 96.182857 36.571429H7.899429A7.899429 7.899429 0 0 0 0 44.470857v36.644572c0 4.388571 3.547429 7.899429 7.899429 7.899428h37.522285V279.771429z m-32.182857 326.729142a7.899429 7.899429 0 0 1-7.899428-7.899428v-32.548572c0-2.011429 0.804571-3.986286 2.194285-5.449142l63.707429-66.633143c12.617143-13.238857 22.162286-23.661714 28.781714-31.305143 6.765714-7.789714 11.081143-14.043429 13.385143-18.797714a31.817143 31.817143 0 0 0 3.291429-13.933715c0-8.045714-2.450286-13.568-6.838858-17.554285l-0.109714-0.073143c-4.388571-4.096-10.24-6.4-18.285714-6.4a32.731429 32.731429 0 0 0-21.211429 7.131428l-0.146285 0.073143c-5.741714 4.461714-10.349714 11.337143-13.348572 21.321143a7.899429 7.899429 0 0 1-9.874286 5.229714l-37.558857-11.702857a7.899429 7.899429 0 0 1-5.376-9.106286c2.742857-13.641143 8.484571-25.6 17.188572-35.730285a84.114286 84.114286 0 0 1 31.195428-23.296c12.397714-5.485714 25.453714-8.228571 39.131429-8.228572 16.091429 0 30.537143 2.889143 43.154286 8.96a69.595429 69.595429 0 0 1 41.069714 64.950857c0 9.435429-1.755429 18.688-5.229714 27.794286a118.198857 118.198857 0 0 1-15.213715 27.062857l-0.036571 0.109715c-6.582857 8.740571-14.994286 18.468571-25.234286 29.110857L87.515429 554.422857h83.492571c4.388571 0 7.899429 3.510857 7.899429 7.899429v36.315428c0 4.388571-3.547429 7.899429-7.899429 7.899429H13.238857z m38.217143 354.486858a94.939429 94.939429 0 0 1-31.963429-22.052572l-0.109714-0.109714a79.030857 79.030857 0 0 1-18.212571-34.706286 7.899429 7.899429 0 0 1 5.010285-9.325714l37.558858-13.275429c4.096-1.462857 8.594286 0.731429 10.057142 4.827429 3.328 9.508571 8.265143 16.237714 14.482286 20.845714 6.326857 4.388571 13.824 6.729143 22.857143 6.729143 7.460571 0 13.421714-1.389714 18.176-3.84l0.073143-0.073143a27.721143 27.721143 0 0 0 11.593143-10.569143 33.938286 33.938286 0 0 0 4.242285-17.408 30.573714 30.573714 0 0 0-4.132571-16.64l-0.182857-0.292571A25.673143 25.673143 0 0 0 109.714286 854.637714a41.691429 41.691429 0 0 0-18.870857-3.913143 59.465143 59.465143 0 0 0-15.213715 2.194286 33.28 33.28 0 0 0-5.229714 2.048 7.862857 7.862857 0 0 1-10.642286-3.657143l-9.801143-20.553143a7.899429 7.899429 0 0 1 1.206858-8.594285l49.371428-56.393143H22.089143a7.899429 7.899429 0 0 1-7.862857-7.899429v-36.315428c0-4.388571 3.510857-7.899429 7.862857-7.899429h144.164571c4.388571 0 7.899429 3.547429 7.899429 7.899429v33.792a7.899429 7.899429 0 0 1-1.901714 5.12L132.388571 807.131429a76.909714 76.909714 0 0 1 14.043429 6.070857c11.739429 6.582857 20.992 15.725714 27.611429 27.318857 6.656 11.702857 9.874286 25.197714 9.874285 40.228571 0 16.530286-4.022857 31.634286-12.178285 45.165715a86.930286 86.930286 0 0 1-33.28 31.268571 97.755429 97.755429 0 0 1-47.323429 11.373714c-13.787429 0-26.989714-2.486857-39.497143-7.497143l-0.182857-0.073142zM292.571429 841.142857a36.571429 36.571429 0 1 0 0 73.142857h694.857142a36.571429 36.571429 0 1 0 0-73.142857H292.571429zM986.185143 138.605714a52.516571 52.516571 0 0 0-3.254857-10.532571 112.64 112.64 0 0 0-19.712-28.818286c-8.484571-9.216-16.237714-15.652571-23.222857-19.309714a72.045714 72.045714 0 0 0-11.702858-4.534857A55.515429 55.515429 0 0 0 914.285714 73.179429a43.776 43.776 0 0 0-29.184 9.764571c-3.657143 2.998857-8.228571 7.094857-13.714285 12.288-5.485714 5.193143-10.24 9.618286-14.262858 13.275429l93.366858 93.769142c2.340571-2.011429 4.827429-4.315429 7.497142-7.021714 2.304-2.340571 5.083429-5.010286 8.228572-8.009143 3.145143-2.998857 6.729143-6.509714 10.715428-10.532571 3.657143-4.022857 6.326857-8.192 8.009143-12.544A36.205714 36.205714 0 0 0 987.428571 151.149714c0-4.352-0.402286-8.521143-1.243428-12.544zM352.073143 614.509714c-7.314286 7.533714-11.958857 12.288-13.970286 14.262857a82.578286 82.578286 0 0 0-10.715428 12.8c-2.523429 3.876571-4.754286 8.118857-6.765715 12.8a111.798857 111.798857 0 0 0-6.473143 16.566858c-2.669714 8.009143-5.412571 16.786286-8.228571 26.331428-2.852571 9.508571-5.485714 18.688-8.009143 27.574857a169.764571 169.764571 0 0 0-4.754286 20.297143c-1.316571 8.704-0.475429 14.884571 2.523429 18.541714 2.998857 3.657143 8.996571 5.010286 17.956571 4.022858 4.352-0.658286 10.898286-2.194286 19.748572-4.498286a686.957714 686.957714 0 0 0 56.137143-18.066286c8.996571-3.328 15.798857-6.217143 20.48-8.521143 4.644571-2.011429 9.142857-4.681143 13.458285-8.045714a215.954286 215.954286 0 0 0 23.954286-21.577143c6.985143-6.985143 15.798857-15.945143 26.441143-26.806857 10.678857-10.861714 22.674286-22.820571 35.949714-35.84l39.936-40.594286 363.300572-363.885714-93.330286-94.244571-363.300571 363.849142-40.448 40.594286-36.425143 36.608c-10.971429 11.044571-20.114286 20.297143-27.428572 27.830857z"})],-1)),t.createElementVNode("span",sm,t.toDisplayString(t.unref(l)("ol.modify")),1)])],38)):t.createCommentVNode("",!0)]))}}),cm=["aria-label"],am=["aria-label"],dm={class:"np-ok",type:"submit"},fr=6,os=t.defineComponent({__name:"NumberPicker",props:{visible:{type:Boolean},initialValue:{},anchor:{},rootEl:{}},emits:["confirm","close"],setup(e,{emit:n}){const o=e,r=n,{t:l}=en(),s=t.ref(null),i=t.ref(o.initialValue),c=t.ref({top:0,left:0});t.watch([()=>o.visible,()=>o.anchor,()=>o.initialValue],async()=>{if(!o.visible||!o.anchor)return;i.value=o.initialValue,await t.nextTick();const f=o.anchor.getBoundingClientRect(),u=window.innerHeight,h=52;let p=!1;u-f.bottom-fr<h&&f.top-fr>h&&(p=!0),c.value={top:p?f.top-(h+fr):f.bottom+fr,left:f.left},t.nextTick(()=>{var m,k;(m=s.value)==null||m.focus(),(k=s.value)==null||k.select()})},{flush:"post",immediate:!0});const a=t.computed(()=>({top:`${c.value.top}px`,left:`${c.value.left}px`}));function d(){let f=i.value;Number.isFinite(f)||(f=o.initialValue),f=Math.max(1,Math.floor(f)),r("confirm",f)}return(f,u)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[e.visible&&e.anchor&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,class:"number-picker",style:t.normalizeStyle(a.value),role:"dialog","aria-label":t.unref(l)("numberPicker.title"),onMousedown:u[2]||(u[2]=t.withModifiers(()=>{},["stop"])),onTouchstart:u[3]||(u[3]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("form",{class:"np-form",onSubmit:t.withModifiers(d,["prevent"])},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:s,"onUpdate:modelValue":u[0]||(u[0]=h=>i.value=h),type:"number",class:"np-input",min:"1",step:"1","aria-label":t.unref(l)("numberPicker.inputLabel"),onKeydown:u[1]||(u[1]=t.withKeys(h=>r("close"),["escape"]))},null,40,am),[[t.vModelText,i.value,void 0,{number:!0}]]),t.createElementVNode("button",dm,t.toDisplayString(t.unref(l)("numberPicker.confirm")),1)],32)],44,cm)):t.createCommentVNode("",!0)]))}}),um=["aria-label"],fm={key:0,class:"clp-custom"},mm=["placeholder","aria-label"],pm={class:"clp-actions"},hm={class:"clp-ok",type:"submit"},gm=["aria-label"],bm=["onClick"],km={class:"clp-item-name"},ym={key:0,class:"clp-item-check","aria-hidden":"true"},wm={class:"clp-item-name"},Em=["aria-label"],io=6,rs=200,vm=120,Cm=360,Tm=t.defineComponent({__name:"CodeLangPicker",props:{visible:{type:Boolean},initialValue:{},anchor:{},rootEl:{}},emits:["confirm","close"],setup(e,{emit:n}){const o=e,r=n,{t:l}=en(),s=["plain","javascript","typescript","python","java","c","cpp","csharp","go","rust","ruby","php","swift","kotlin","html","css","json","xml","yaml","markdown","lua","bash","shell","powershell","cmd","bat","sql","dart"],i=t.ref(null),c=t.ref(null),a=t.ref(null),d=t.ref(!1),f=t.ref(""),u=t.ref(o.initialValue),h=t.ref({top:0,left:0,above:!1,maxHeight:360}),p=t.ref(!1),m=t.ref(!1);function k(ne){return ne==="plain"?l("codeLang.plain"):ne}function x(){if(!o.visible||!o.anchor||!o.rootEl)return;const ne=i.value;if(!ne)return;const Z=o.anchor.getBoundingClientRect(),S=window.innerHeight,K=Math.floor(S-Z.bottom-io),_=Math.floor(Z.top-io),O=ne.scrollHeight;let M=!1;o.rootEl.getBoundingClientRect().bottom-Z.bottom<rs&&_>rs&&(M=!0);let A,W;M?(A=!0,W=_):O<=K?(A=!1,W=K):_>K?(A=!0,W=_):(A=!1,W=K);const me=Math.max(vm,Math.min(W,Cm)),le=document.documentElement.clientWidth,he=Math.max(ne.clientWidth,200),ae=Math.max(io,Math.min(le-he-io,Z.left)),ie=A?Math.max(io,Z.top-io-Math.min(O,me)):Z.bottom+io;h.value={top:ie,left:ae,above:A,maxHeight:me},t.nextTick(D)}t.watch([()=>o.visible,()=>o.anchor,()=>o.initialValue],async()=>{o.visible&&(d.value=!1,u.value=o.initialValue??"plain",f.value=u.value==="plain"?"":u.value,await t.nextTick(),x())},{flush:"post",immediate:!0});function D(){const ne=a.value;ne&&(p.value=ne.scrollTop>1,m.value=ne.scrollTop+ne.clientHeight<ne.scrollHeight-1)}function U(){const ne=a.value;ne&&(ne.scrollTop-=ne.clientHeight*.8)}function F(){const ne=a.value;ne&&(ne.scrollTop+=ne.clientHeight*.8)}dr(a,D);function ee(){d.value=!0,f.value=u.value==="plain"?"":u.value,t.nextTick(()=>{var ne,Z;(ne=c.value)==null||ne.focus(),(Z=c.value)==null||Z.select(),x()})}function $(){d.value=!1,t.nextTick(x)}function V(){const ne=f.value.replace(/[^a-zA-Z]/g,"").slice(0,20);ne!==f.value&&(f.value=ne)}function re(){const ne=(f.value??"").replace(/[^a-zA-Z]/g,"").slice(0,20);r("confirm",ne.length===0?"plain":ne)}const G=t.computed(()=>({top:`${h.value.top}px`,left:`${h.value.left}px`,maxHeight:`${h.value.maxHeight}px`}));return(ne,Z)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[e.visible&&e.anchor&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:i,class:t.normalizeClass(["code-lang-picker",{above:h.value.above}]),style:t.normalizeStyle(G.value),role:"menu","aria-label":t.unref(l)("codeLang.title"),onMousedown:Z[1]||(Z[1]=t.withModifiers(()=>{},["stop"])),onTouchstart:Z[2]||(Z[2]=t.withModifiers(()=>{},["stop"])),onWheel:Z[3]||(Z[3]=t.withModifiers(()=>{},["prevent"])),onTouchmove:Z[4]||(Z[4]=t.withModifiers(()=>{},["prevent"]))},[d.value?(t.openBlock(),t.createElementBlock("div",fm,[t.createElementVNode("form",{class:"clp-form",onSubmit:t.withModifiers(re,["prevent"])},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:c,"onUpdate:modelValue":Z[0]||(Z[0]=S=>f.value=S),type:"text",class:"clp-input",maxlength:"20",placeholder:t.unref(l)("codeLang.placeholder"),"aria-label":t.unref(l)("codeLang.inputLabel"),autocomplete:"off",spellcheck:"false",onInput:V,onKeydown:t.withKeys($,["escape"])},null,40,mm),[[t.vModelText,f.value]]),t.createElementVNode("div",pm,[t.createElementVNode("button",hm,t.toDisplayString(t.unref(l)("codeLang.confirm")),1),t.createElementVNode("button",{class:"clp-cancel",type:"button",onClick:$},t.toDisplayString(t.unref(l)("codeLang.cancel")),1)])],32)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[p.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"menu-scroll-btn menu-scroll-up",type:"button","aria-label":t.unref(l)("ui.scrollUp"),onMousedown:t.withModifiers(U,["prevent"])},[...Z[5]||(Z[5]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 7.5L6 4.5L9 7.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,gm)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:a,class:"clp-list",onScroll:D},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(s,S=>t.createElementVNode("button",{key:S,class:t.normalizeClass(["clp-item",{active:S===u.value}]),role:"menuitem",onClick:K=>r("confirm",S)},[t.createElementVNode("span",km,t.toDisplayString(k(S)),1),S===u.value?(t.openBlock(),t.createElementBlock("span",ym,"✓")):t.createCommentVNode("",!0)],10,bm)),64)),t.createElementVNode("button",{class:"clp-item clp-item-custom",role:"menuitem",onClick:ee},[t.createElementVNode("span",wm,t.toDisplayString(t.unref(l)("codeLang.custom")),1)])],544),m.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"menu-scroll-btn menu-scroll-down",type:"button","aria-label":t.unref(l)("ui.scrollDown"),onMousedown:t.withModifiers(F,["prevent"])},[...Z[6]||(Z[6]=[t.createElementVNode("svg",{viewBox:"0 0 12 12",width:"10",height:"10","aria-hidden":"true"},[t.createElementVNode("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Em)):t.createCommentVNode("",!0)],64))],46,um)):t.createCommentVNode("",!0)]))}}),_m=["aria-label"],xm={key:0,class:"link-popover-view"},Mm=["href","title"],Nm={class:"link-popover-actions"},Sm=["title","aria-label"],Am=["title","aria-label"],Im=["title","aria-label"],Bm=["title","aria-label"],Rm={key:1,class:"link-popover-edit"},Lm=["placeholder"],Om={key:0,class:"link-popover-error",role:"alert"},Dm=["placeholder"],$m={class:"link-popover-edit-actions"},Pm=["title"],Hm=["title"],ls=t.defineComponent({__name:"LinkPopover",props:{visible:{type:Boolean},anchorRect:{},blockId:{},from:{},to:{},href:{},text:{},initialMode:{},showTextInput:{type:Boolean},onSaveLink:{type:Function},onRemoveLinkMark:{type:Function},readonly:{type:Boolean}},emits:["close"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:s}=en(),i=fn(),c=t.ref(null),a=t.ref(null),d=t.ref(!1),f=t.ref(!1),u=t.ref("view"),h=t.ref(""),p=t.ref(""),m=t.ref({top:0,left:0}),k=t.ref(""),x=t.computed(()=>r.showTextInput??!1),D=t.computed(()=>u.value==="edit"?h.value:r.href),U=t.computed(()=>{const _=to(D.value);return Pn(_)??"#"}),F=t.computed(()=>{const _=D.value;return _?_.length>60?_.slice(0,57)+"...":_:s("link.emptyUrl")}),ee=t.computed(()=>({top:`${m.value.top}px`,left:`${m.value.left}px`,visibility:f.value?"visible":"hidden"}));async function $(){if(!r.visible||!r.anchorRect||!c.value)return;await t.nextTick();const O=c.value.getBoundingClientRect(),M=8,E=document.documentElement.clientWidth,A=document.documentElement.clientHeight-r.anchorRect.bottom-M,W=r.anchorRect.top-M,le=A<O.height+M&&W>A?Math.max(M,r.anchorRect.top-O.height-M):r.anchorRect.bottom+M,he=r.anchorRect.left+(r.anchorRect.width-O.width)/2,ae=Math.max(M,E-O.width-M),ie=Math.max(M,Math.min(ae,he));m.value={top:le,left:ie},f.value=!0}t.watch(()=>r.visible,_=>{_?(d.value=!0,u.value=r.readonly?"view":r.initialMode??(r.href?"view":"edit"),h.value=r.href,p.value=r.text,f.value=!1,t.nextTick(()=>{var O,M;$(),u.value==="edit"&&((O=a.value)==null||O.focus(),(M=a.value)==null||M.select())})):(f.value=!1,setTimeout(()=>{r.visible||(d.value=!1)},200))},{immediate:!0}),t.watch(()=>r.anchorRect,()=>{r.visible&&$()});function V(){r.readonly||(u.value="edit",h.value=r.href,p.value=r.text,k.value="",t.nextTick(()=>{var _,O;(_=a.value)==null||_.focus(),(O=a.value)==null||O.select()}))}function re(){const _=h.value;if(!_.trim()){k.value="";return}const O=to(_);Pn(O)?k.value="":k.value=s("link.invalidUrl")}function G(){var E,N,A;if(!r.blockId&&!r.onSaveLink)return;const _=to(h.value),O=Pn(_);if(!O){k.value=s("link.invalidUrl"),(E=a.value)==null||E.focus();return}k.value="";const M=x.value&&p.value!==r.text;r.onSaveLink?r.onSaveLink(O,M?p.value:void 0):(A=(N=i.commands).setLink)==null||A.call(N,{id:r.blockId,href:O,from:r.from,to:r.to,text:M?p.value:void 0}),r.href?(u.value="view",t.nextTick(()=>{$()})):l("close")}function ne(){r.href?(u.value="view",h.value=r.href,p.value=r.text):l("close")}function Z(){var _,O;!r.blockId&&!r.onRemoveLinkMark||(r.onRemoveLinkMark?r.onRemoveLinkMark():(O=(_=i.commands).unsetLink)==null||O.call(_,{id:r.blockId,from:r.from,to:r.to}),l("close"))}function S(){var O;const _=to(r.href);_&&((O=navigator.clipboard)==null||O.writeText(_))}function K(){const _=to(r.href),O=Pn(_);O&&O!=="#"&&window.open(O,"_blank","noopener,noreferrer")}return t.onBeforeUnmount(()=>{d.value=!1}),n({isEditing:()=>u.value==="edit",save:G,cancel:ne}),(_,O)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[d.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"popoverEl",ref:c,class:t.normalizeClass(["link-popover",{visible:f.value}]),style:t.normalizeStyle(ee.value),role:"dialog","aria-label":t.unref(s)("link.popoverLabel"),onMousedown:O[2]||(O[2]=t.withModifiers(()=>{},["stop"])),onTouchstart:O[3]||(O[3]=t.withModifiers(()=>{},["stop"]))},[u.value==="view"?(t.openBlock(),t.createElementBlock("div",xm,[t.createElementVNode("a",{href:U.value,target:"_blank",rel:"noopener noreferrer",class:"link-popover-url",title:D.value,onClick:K},t.toDisplayString(F.value),9,Mm),t.createElementVNode("div",Nm,[t.createElementVNode("button",{class:"link-popover-btn",title:t.unref(s)("link.open"),"aria-label":t.unref(s)("link.open"),onMousedown:t.withModifiers(K,["prevent","stop"])},[...O[4]||(O[4]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M6 3H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2v-2",fill:"none",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round","stroke-linejoin":"round"}),t.createElementVNode("path",{d:"M9 3h4v4M13 3L7 9",fill:"none",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Sm),t.createElementVNode("button",{class:"link-popover-btn",title:t.unref(s)("link.copy"),"aria-label":t.unref(s)("link.copy"),onMousedown:t.withModifiers(S,["prevent","stop"])},[...O[5]||(O[5]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},[t.createElementVNode("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1.5",fill:"none",stroke:"currentColor","stroke-width":"1.3"}),t.createElementVNode("path",{d:"M3 10.5V3.5C3 2.67 3.67 2 4.5 2H10",fill:"none",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"})],-1)])],40,Am),e.readonly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,class:"link-popover-btn",title:t.unref(s)("link.edit"),"aria-label":t.unref(s)("link.edit"),onMousedown:t.withModifiers(V,["prevent","stop"])},[...O[6]||(O[6]=[t.createElementVNode("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M11.5 2.5l2 2L6 12l-2.5.5L4 10l7.5-7.5z",fill:"none",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],40,Im)),e.readonly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:1,class:"link-popover-btn link-popover-danger",title:t.unref(s)("link.remove"),"aria-label":t.unref(s)("link.remove"),onMousedown:t.withModifiers(Z,["prevent","stop"])},[...O[7]||(O[7]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"14",height:"14","aria-hidden":"true"},[t.createElementVNode("path",{d:"M394.666667 213.333333a32 32 0 0 1 4.693333 63.658667l-4.693333 0.341333H298.666667a149.333333 149.333333 0 0 0-8.789334 298.410667L298.666667 576h96a32 32 0 0 1 4.693333 63.658667L394.666667 640H298.666667a213.333333 213.333333 0 0 1-10.666667-426.410667L298.666667 213.333333h96zM725.333333 213.333333a213.333333 213.333333 0 0 1 189.013334 312.405334 277.162667 277.162667 0 0 0-55.210667-32.64 149.333333 149.333333 0 0 0-125.013333-215.466667L725.333333 277.290667h-96a32 32 0 0 1-4.693333-63.658667L629.333333 213.333333H725.333333zM298.666667 394.666667h426.666666a32 32 0 0 1 4.352 63.701333L725.333333 458.666667H298.666667a32 32 0 0 1-4.352-63.701334L298.666667 394.666667z m682.666666 352a234.666667 234.666667 0 1 1-469.333333 0 234.666667 234.666667 0 0 1 469.333333 0z m-304.896-100.437334a21.333333 21.333333 0 0 0-30.208 30.208l70.272 70.229334-70.272 70.229333a21.333333 21.333333 0 0 0 30.208 30.208l70.229334-70.272 70.229333 70.272a21.333333 21.333333 0 0 0 30.208-30.208L776.832 746.666667l70.272-70.229334a21.333333 21.333333 0 0 0-30.208-30.208L746.666667 716.501333l-70.229334-70.272z",fill:"currentColor"})],-1)])],40,Bm))])])):(t.openBlock(),t.createElementBlock("div",Rm,[t.withDirectives(t.createElementVNode("input",{ref_key:"urlInputEl",ref:a,"onUpdate:modelValue":O[0]||(O[0]=M=>h.value=M),class:t.normalizeClass(["link-popover-input",{"link-popover-input-error":k.value}]),type:"text",placeholder:t.unref(s)("link.urlPlaceholder"),onKeydown:[t.withKeys(G,["enter"]),t.withKeys(ne,["escape"])],onInput:re},null,42,Lm),[[t.vModelText,h.value]]),k.value?(t.openBlock(),t.createElementBlock("div",Om,t.toDisplayString(k.value),1)):t.createCommentVNode("",!0),x.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,"onUpdate:modelValue":O[1]||(O[1]=M=>p.value=M),class:"link-popover-input",type:"text",placeholder:t.unref(s)("link.textPlaceholder"),onKeydown:[t.withKeys(G,["enter"]),t.withKeys(ne,["escape"])]},null,40,Dm)),[[t.vModelText,p.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",$m,[t.createElementVNode("button",{class:"link-popover-btn link-popover-save",title:t.unref(s)("link.save"),onMousedown:t.withModifiers(G,["prevent","stop"])},t.toDisplayString(t.unref(s)("link.save")),41,Pm),t.createElementVNode("button",{class:"link-popover-btn link-popover-cancel",title:t.unref(s)("link.cancel"),onMousedown:t.withModifiers(ne,["prevent","stop"])},t.toDisplayString(t.unref(s)("link.cancel")),41,Hm)])]))],46,_m)):t.createCommentVNode("",!0)]))}}),Vm={default:null,validate:e=>e==null?!0:Number.isInteger(e)&&e>=1};function is(e,n){const o=mo(e,n),r=sn(e,n);if(r<0)return 1;const l=e.blocks.get(n);if(!l)return 1;const s=l.attrs.startNumber;if(typeof s=="number")return s;let i=null,c=0;for(let a=r-1;a>=0;a--){const d=e.blocks.get(o[a]);if(!d||d.type!=="orderedList")break;const f=d.attrs.startNumber;if(typeof f=="number"){i=f;break}c++}return i!==null?i+c+1:1+c}const Um=t.defineComponent({name:"OrderedListBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){const n=fn(),o=Yn(),r=t.ref(null),l=t.useAttrs(),s={...typeof l.onLinkClick=="function"?{onLinkClick:l.onLinkClick}:{},...typeof l.onSlashTrigger=="function"?{onSlashTrigger:l.onSlashTrigger}:{},...typeof l.onInputChanged=="function"?{onInputChanged:l.onInputChanged}:{}},i=t.ref(0),c=n.subscribe(()=>{i.value++});return t.onBeforeUnmount(c),()=>{i.value;const a=n.getState().doc,d=is(a,e.block.id),f=t.h("div",{ref:r,class:"ol-marker","data-ol-number":String(d),onMousedown:k=>{k.preventDefault(),k.stopPropagation()},onClick:k=>{if(k.stopPropagation(),!o.value)return;const x=new CustomEvent("ordered-list-marker-click",{bubbles:!0,detail:{blockId:e.block.id,anchor:r.value}});k.currentTarget.dispatchEvent(x)}},[`${d}.`]),u=En(e.block.attrs),h=u.filter(k=>k.startsWith("be-indent-")),p=u.filter(k=>!k.startsWith("be-indent-")),m=t.h(Un,{block:e.block,placeholder:e.placeholder,class:["block-ordered-list-content",...p],...s});return t.h("div",{class:["block-ordered-list-wrapper",...h],"data-block-type":"orderedList"},[f,m])}}}),zm={name:"orderedList",schema:{type:"orderedList",content:"text",nestable:!0,listLike:!0,attrs:{...tn,startNumber:Vm}},renderer:{component:Um},slashCommands:[{id:"ordered-list",title:"slash.orderedList.title",keywords:["list","numbered","ordered","有序列表","编号列表","ol","1"],description:"slash.orderedList.description",icon:cl,command:"convertBlock",category:"list",args:()=>({id:"__currentBlock__",type:"orderedList"})}],inputRules:[{name:"ordered-1-dot",pattern:/^1\. $/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"orderedList",__stripPrefix:3})}]},Fm=t.defineComponent({name:"ParagraphBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return()=>t.h(Un,{block:e.block,placeholder:e.placeholder,class:["block-paragraph",...En(e.block.attrs)]})}}),ss={name:"paragraph",schema:{type:"paragraph",content:"text",nestable:!0,attrs:{...tn}},renderer:{component:Fm},slashCommands:[{id:"paragraph",title:"slash.paragraph.title",keywords:["text","paragraph","normal","正文","段落"],description:"slash.paragraph.description",icon:el,command:"convertBlock",category:"basic",args:e=>({id:"__currentBlock__",type:"paragraph"})}],inputRules:[{name:"paragraph-noop",pattern:/^$/,command:"setText",args:e=>({id:"__currentBlock__",content:[]})}]},Km=t.defineComponent({name:"HeadingBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return()=>{const n=e.block.attrs.level??1;return t.h(Un,{block:e.block,placeholder:e.placeholder,class:["block-heading",`block-heading-h${n}`,...En(e.block.attrs)]})}}});function yo(e){const n="#".repeat(e);return{name:`heading-h${e}`,pattern:new RegExp(`^${n} $`),command:"convertBlock",args:()=>({id:"__currentBlock__",type:"heading",attrs:{level:e},__stripPrefix:e+1})}}const wo=(e,n,o,r,l,s)=>({id:e,title:o,keywords:s,description:r,icon:l,command:"convertBlock",category:"basic",args:()=>({id:"__currentBlock__",type:"heading",attrs:{level:n}})}),cs={name:"heading",schema:{type:"heading",content:"text",nestable:!0,attrs:{level:{default:1,validate:e=>typeof e=="number"&&e>=1&&e<=6},...tn}},renderer:{component:Km},slashCommands:[wo("heading-1",1,"slash.heading1.title","slash.heading1.description",tl,["h1","标题1","大标题","title"]),wo("heading-2",2,"slash.heading2.title","slash.heading2.description",nl,["h2","标题2","小标题"]),wo("heading-3",3,"slash.heading3.title","slash.heading3.description",ol,["h3","标题3","section"]),wo("heading-4",4,"slash.heading4.title","slash.heading4.description",rl,["h4","标题4"]),wo("heading-5",5,"slash.heading5.title","slash.heading5.description",ll,["h5","标题5"]),wo("heading-6",6,"slash.heading6.title","slash.heading6.description",il,["h6","标题6"])],inputRules:[yo(1),yo(2),yo(3),yo(4),yo(5),yo(6)]},as={name:"default-keymap",keymap:[{key:"Enter",command:"enter"},{key:"Backspace",command:"backspace"},{key:"Delete",command:"backspace"},{key:"Tab",command:"indentBlock"},{key:"Shift-Tab",command:"outdentBlock"},{key:"Mod-a",command:"selectAll"},{key:"ArrowUp",command:"moveToPreviousBlock"},{key:"ArrowDown",command:"moveToNextBlock"}]},ds={name:"history-keymap",keymap:[{key:"Mod-z",command:"undo"},{key:"Mod-Shift-z",command:"redo"},{key:"Mod-y",command:"redo"}]},Wm=t.defineComponent({name:"BulletListBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return()=>t.h(Un,{block:e.block,placeholder:e.placeholder,class:["block-bullet-list",...En(e.block.attrs)]})}}),Gm={name:"bulletList",schema:{type:"bulletList",content:"text",nestable:!0,listLike:!0,attrs:{...tn}},renderer:{component:Wm},slashCommands:[{id:"bullet-list",title:"slash.bulletList.title",keywords:["list","bullet","unordered","项目符号","无序列表","ul","-","*"],description:"slash.bulletList.description",icon:sl,command:"convertBlock",category:"list",args:()=>({id:"__currentBlock__",type:"bulletList"})}],inputRules:[{name:"bullet-dash",pattern:/^- $/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"bulletList",__stripPrefix:2})},{name:"bullet-star",pattern:/^\* $/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"bulletList",__stripPrefix:2})}]},qm=t.defineComponent({name:"TodoListBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){const n=fn(),o=t.useAttrs(),r={...typeof o.onLinkClick=="function"?{onLinkClick:o.onLinkClick}:{},...typeof o.onSlashTrigger=="function"?{onSlashTrigger:o.onSlashTrigger}:{},...typeof o.onInputChanged=="function"?{onInputChanged:o.onInputChanged}:{}};function l(s){var c,a;const i=s.target;(a=(c=n.commands).setAttrs)==null||a.call(c,{id:e.block.id,attrs:{...e.block.attrs,checked:i.checked}})}return()=>{const s=!!e.block.attrs.checked,i=En(e.block.attrs),c=i.filter(f=>f.startsWith("be-indent-")),a=i.filter(f=>!f.startsWith("be-indent-")),d=["block-todo-list",s?"todo-checked":"todo-unchecked",...a];return t.h("div",{class:["block-todo-wrapper",...c]},[t.h("input",{type:"checkbox",class:"block-todo-checkbox",checked:s,onchange:l}),t.h(Un,{block:e.block,placeholder:e.placeholder,class:d,...r})])}}}),Ym={name:"todoList",schema:{type:"todoList",content:"text",nestable:!0,listLike:!0,attrs:{...tn,checked:{default:!1,validate:e=>typeof e=="boolean"}}},renderer:{component:qm},slashCommands:[{id:"todo-list",title:"slash.todoList.title",keywords:["todo","task","checkbox","待办","任务","复选框","[]","[ ]"],description:"slash.todoList.description",icon:al,command:"convertBlock",category:"list",args:()=>({id:"__currentBlock__",type:"todoList",attrs:{checked:!1}})}],inputRules:[{name:"todo-empty",pattern:/^\[\] $/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"todoList",attrs:{checked:!1},__stripPrefix:3})},{name:"todo-space-bracket",pattern:/^\[ \] $/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"todoList",attrs:{checked:!1},__stripPrefix:4})}]},Zm=t.defineComponent({name:"QuoteBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return()=>t.h(Un,{block:e.block,placeholder:e.placeholder,class:["block-quote",...En(e.block.attrs)]})}}),Xm={name:"quote",schema:{type:"quote",content:"text",nestable:!1,disallowedMarks:["italic"],attrs:{...Yd,indent:tn.indent}},renderer:{component:Zm},slashCommands:[{id:"quote",title:"slash.quote.title",keywords:["quote","blockquote","引用",">","引言"],description:"slash.quote.description",icon:dl,command:"convertBlock",category:"other",args:()=>({id:"__currentBlock__",type:"quote"})}],inputRules:[{name:"quote-gt",pattern:/^> $/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"quote",__stripPrefix:2})}]};function jm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function us(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(n=>{const o=e[n],r=typeof o;(r==="object"||r==="function")&&!Object.isFrozen(o)&&us(o)}),e}class fs{constructor(n){n.data===void 0&&(n.data={}),this.data=n.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function ms(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function jn(e,...n){const o=Object.create(null);for(const r in e)o[r]=e[r];return n.forEach(function(r){for(const l in r)o[l]=r[l]}),o}const Qm="</span>",ps=e=>!!e.scope,Jm=(e,{prefix:n})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const o=e.split(".");return[`${n}${o.shift()}`,...o.map((r,l)=>`${r}${"_".repeat(l+1)}`)].join(" ")}return`${n}${e}`};class ep{constructor(n,o){this.buffer="",this.classPrefix=o.classPrefix,n.walk(this)}addText(n){this.buffer+=ms(n)}openNode(n){if(!ps(n))return;const o=Jm(n.scope,{prefix:this.classPrefix});this.span(o)}closeNode(n){ps(n)&&(this.buffer+=Qm)}value(){return this.buffer}span(n){this.buffer+=`<span class="${n}">`}}const hs=(e={})=>{const n={children:[]};return Object.assign(n,e),n};class pl{constructor(){this.rootNode=hs(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(n){this.top.children.push(n)}openNode(n){const o=hs({scope:n});this.add(o),this.stack.push(o)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(n){return this.constructor._walk(n,this.rootNode)}static _walk(n,o){return typeof o=="string"?n.addText(o):o.children&&(n.openNode(o),o.children.forEach(r=>this._walk(n,r)),n.closeNode(o)),n}static _collapse(n){typeof n!="string"&&n.children&&(n.children.every(o=>typeof o=="string")?n.children=[n.children.join("")]:n.children.forEach(o=>{pl._collapse(o)}))}}class tp extends pl{constructor(n){super(),this.options=n}addText(n){n!==""&&this.add(n)}startScope(n){this.openNode(n)}endScope(){this.closeNode()}__addSublanguage(n,o){const r=n.root;o&&(r.scope=`language:${o}`),this.add(r)}toHTML(){return new ep(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Wo(e){return e?typeof e=="string"?e:e.source:null}function gs(e){return so("(?=",e,")")}function np(e){return so("(?:",e,")*")}function op(e){return so("(?:",e,")?")}function so(...e){return e.map(o=>Wo(o)).join("")}function rp(e){const n=e[e.length-1];return typeof n=="object"&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}function hl(...e){return"("+(rp(e).capture?"":"?:")+e.map(r=>Wo(r)).join("|")+")"}function bs(e){return new RegExp(e.toString()+"|").exec("").length-1}function lp(e,n){const o=e&&e.exec(n);return o&&o.index===0}const ip=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function gl(e,{joinWith:n}){let o=0;return e.map(r=>{o+=1;const l=o;let s=Wo(r),i="";for(;s.length>0;){const c=ip.exec(s);if(!c){i+=s;break}i+=s.substring(0,c.index),s=s.substring(c.index+c[0].length),c[0][0]==="\\"&&c[1]?i+="\\"+String(Number(c[1])+l):(i+=c[0],c[0]==="("&&o++)}return i}).map(r=>`(${r})`).join(n)}const sp=/\b\B/,ks="[a-zA-Z]\\w*",bl="[a-zA-Z_]\\w*",ys="\\b\\d+(\\.\\d+)?",ws="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Es="\\b(0b[01]+)",cp="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ap=(e={})=>{const n=/^#![ ]*\//;return e.binary&&(e.begin=so(n,/.*\b/,e.binary,/\b.*/)),jn({scope:"meta",begin:n,end:/$/,relevance:0,"on:begin":(o,r)=>{o.index!==0&&r.ignoreMatch()}},e)},Go={begin:"\\\\[\\s\\S]",relevance:0},dp={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Go]},up={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Go]},fp={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},mr=function(e,n,o={}){const r=jn({scope:"comment",begin:e,end:n,contains:[]},o);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const l=hl("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:so(/[ ]+/,"(",l,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},mp=mr("//","$"),pp=mr("/\\*","\\*/"),hp=mr("#","$"),gp={scope:"number",begin:ys,relevance:0},bp={scope:"number",begin:ws,relevance:0},kp={scope:"number",begin:Es,relevance:0},yp={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Go,{begin:/\[/,end:/\]/,relevance:0,contains:[Go]}]},wp={scope:"title",begin:ks,relevance:0},Ep={scope:"title",begin:bl,relevance:0},vp={begin:"\\.\\s*"+bl,relevance:0};var pr=Object.freeze({__proto__:null,APOS_STRING_MODE:dp,BACKSLASH_ESCAPE:Go,BINARY_NUMBER_MODE:kp,BINARY_NUMBER_RE:Es,COMMENT:mr,C_BLOCK_COMMENT_MODE:pp,C_LINE_COMMENT_MODE:mp,C_NUMBER_MODE:bp,C_NUMBER_RE:ws,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(n,o)=>{o.data._beginMatch=n[1]},"on:end":(n,o)=>{o.data._beginMatch!==n[1]&&o.ignoreMatch()}})},HASH_COMMENT_MODE:hp,IDENT_RE:ks,MATCH_NOTHING_RE:sp,METHOD_GUARD:vp,NUMBER_MODE:gp,NUMBER_RE:ys,PHRASAL_WORDS_MODE:fp,QUOTE_STRING_MODE:up,REGEXP_MODE:yp,RE_STARTERS_RE:cp,SHEBANG:ap,TITLE_MODE:wp,UNDERSCORE_IDENT_RE:bl,UNDERSCORE_TITLE_MODE:Ep});function Cp(e,n){e.input[e.index-1]==="."&&n.ignoreMatch()}function Tp(e,n){e.className!==void 0&&(e.scope=e.className,delete e.className)}function _p(e,n){n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Cp,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function xp(e,n){Array.isArray(e.illegal)&&(e.illegal=hl(...e.illegal))}function Mp(e,n){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Np(e,n){e.relevance===void 0&&(e.relevance=1)}const Sp=(e,n)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const o=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=o.keywords,e.begin=so(o.beforeMatch,gs(o.begin)),e.starts={relevance:0,contains:[Object.assign(o,{endsParent:!0})]},e.relevance=0,delete o.beforeMatch},Ap=["of","and","for","in","not","or","if","then","parent","list","value"],Ip="keyword";function vs(e,n,o=Ip){const r=Object.create(null);return typeof e=="string"?l(o,e.split(" ")):Array.isArray(e)?l(o,e):Object.keys(e).forEach(function(s){Object.assign(r,vs(e[s],n,s))}),r;function l(s,i){n&&(i=i.map(c=>c.toLowerCase())),i.forEach(function(c){const a=c.split("|");r[a[0]]=[s,Bp(a[0],a[1])]})}}function Bp(e,n){return n?Number(n):Rp(e)?0:1}function Rp(e){return Ap.includes(e.toLowerCase())}const Cs={},co=e=>{console.error(e)},Ts=(e,...n)=>{console.log(`WARN: ${e}`,...n)},Eo=(e,n)=>{Cs[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),Cs[`${e}/${n}`]=!0)},hr=new Error;function _s(e,n,{key:o}){let r=0;const l=e[o],s={},i={};for(let c=1;c<=n.length;c++)i[c+r]=l[c],s[c+r]=!0,r+=bs(n[c-1]);e[o]=i,e[o]._emit=s,e[o]._multi=!0}function Lp(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw co("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),hr;if(typeof e.beginScope!="object"||e.beginScope===null)throw co("beginScope must be object"),hr;_s(e,e.begin,{key:"beginScope"}),e.begin=gl(e.begin,{joinWith:""})}}function Op(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw co("skip, excludeEnd, returnEnd not compatible with endScope: {}"),hr;if(typeof e.endScope!="object"||e.endScope===null)throw co("endScope must be object"),hr;_s(e,e.end,{key:"endScope"}),e.end=gl(e.end,{joinWith:""})}}function Dp(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function $p(e){Dp(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Lp(e),Op(e)}function Pp(e){function n(i,c){return new RegExp(Wo(i),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(c?"g":""))}class o{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(c,a){a.position=this.position++,this.matchIndexes[this.matchAt]=a,this.regexes.push([a,c]),this.matchAt+=bs(c)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const c=this.regexes.map(a=>a[1]);this.matcherRe=n(gl(c,{joinWith:"|"}),!0),this.lastIndex=0}exec(c){this.matcherRe.lastIndex=this.lastIndex;const a=this.matcherRe.exec(c);if(!a)return null;const d=a.findIndex((u,h)=>h>0&&u!==void 0),f=this.matchIndexes[d];return a.splice(0,d),Object.assign(a,f)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(c){if(this.multiRegexes[c])return this.multiRegexes[c];const a=new o;return this.rules.slice(c).forEach(([d,f])=>a.addRule(d,f)),a.compile(),this.multiRegexes[c]=a,a}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(c,a){this.rules.push([c,a]),a.type==="begin"&&this.count++}exec(c){const a=this.getMatcher(this.regexIndex);a.lastIndex=this.lastIndex;let d=a.exec(c);if(this.resumingScanAtSamePosition()&&!(d&&d.index===this.lastIndex)){const f=this.getMatcher(0);f.lastIndex=this.lastIndex+1,d=f.exec(c)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function l(i){const c=new r;return i.contains.forEach(a=>c.addRule(a.begin,{rule:a,type:"begin"})),i.terminatorEnd&&c.addRule(i.terminatorEnd,{type:"end"}),i.illegal&&c.addRule(i.illegal,{type:"illegal"}),c}function s(i,c){const a=i;if(i.isCompiled)return a;[Tp,Mp,$p,Sp].forEach(f=>f(i,c)),e.compilerExtensions.forEach(f=>f(i,c)),i.__beforeBegin=null,[_p,xp,Np].forEach(f=>f(i,c)),i.isCompiled=!0;let d=null;return typeof i.keywords=="object"&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords),d=i.keywords.$pattern,delete i.keywords.$pattern),d=d||/\w+/,i.keywords&&(i.keywords=vs(i.keywords,e.case_insensitive)),a.keywordPatternRe=n(d,!0),c&&(i.begin||(i.begin=/\B|\b/),a.beginRe=n(a.begin),!i.end&&!i.endsWithParent&&(i.end=/\B|\b/),i.end&&(a.endRe=n(a.end)),a.terminatorEnd=Wo(a.end)||"",i.endsWithParent&&c.terminatorEnd&&(a.terminatorEnd+=(i.end?"|":"")+c.terminatorEnd)),i.illegal&&(a.illegalRe=n(i.illegal)),i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map(function(f){return Hp(f==="self"?i:f)})),i.contains.forEach(function(f){s(f,a)}),i.starts&&s(i.starts,c),a.matcher=l(a),a}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=jn(e.classNameAliases||{}),s(e)}function xs(e){return e?e.endsWithParent||xs(e.starts):!1}function Hp(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(n){return jn(e,{variants:null},n)})),e.cachedVariants?e.cachedVariants:xs(e)?jn(e,{starts:e.starts?jn(e.starts):null}):Object.isFrozen(e)?jn(e):e}var Vp="11.11.0";class Up extends Error{constructor(n,o){super(n),this.name="HTMLInjectionError",this.html=o}}const kl=ms,Ms=jn,Ns=Symbol("nomatch"),zp=7,Ss=function(e){const n=Object.create(null),o=Object.create(null),r=[];let l=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",i={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:tp};function a(E){return c.noHighlightRe.test(E)}function d(E){let N=E.className+" ";N+=E.parentNode?E.parentNode.className:"";const A=c.languageDetectRe.exec(N);if(A){const W=G(A[1]);return W||(Ts(s.replace("{}",A[1])),Ts("Falling back to no-highlight mode for this block.",E)),W?A[1]:"no-highlight"}return N.split(/\s+/).find(W=>a(W)||G(W))}function f(E,N,A){let W="",me="";typeof N=="object"?(W=E,A=N.ignoreIllegals,me=N.language):(Eo("10.7.0","highlight(lang, code, ...args) has been deprecated."),Eo("10.7.0",`Please use highlight(code, options) instead.
13
13
  https://github.com/highlightjs/highlight.js/issues/2277`),me=E,W=N),A===void 0&&(A=!0);const le={code:W,language:me};O("before:highlight",le);const he=le.result?le.result:u(le.language,le.code,A);return he.code=le.code,O("after:highlight",he),he}function u(E,N,A,W){const me=Object.create(null);function le(w,z){return w.keywords[z]}function he(){if(!fe.keywords){Xe.addText(Re);return}let w=0;fe.keywordPatternRe.lastIndex=0;let z=fe.keywordPatternRe.exec(Re),we="";for(;z;){we+=Re.substring(w,z.index);const ve=Ze.case_insensitive?z[0].toLowerCase():z[0],nt=le(fe,ve);if(nt){const[lt,on]=nt;if(Xe.addText(we),we="",me[ve]=(me[ve]||0)+1,me[ve]<=zp&&(qt+=on),lt.startsWith("_"))we+=z[0];else{const cn=Ze.classNameAliases[lt]||lt;Se(z[0],cn)}}else we+=z[0];w=fe.keywordPatternRe.lastIndex,z=fe.keywordPatternRe.exec(Re)}we+=Re.substring(w),Xe.addText(we)}function ae(){if(Re==="")return;let w=null;if(typeof fe.subLanguage=="string"){if(!n[fe.subLanguage]){Xe.addText(Re);return}w=u(fe.subLanguage,Re,!0,Tt[fe.subLanguage]),Tt[fe.subLanguage]=w._top}else w=p(Re,fe.subLanguage.length?fe.subLanguage:null);fe.relevance>0&&(qt+=w.relevance),Xe.__addSublanguage(w._emitter,w.language)}function ie(){fe.subLanguage!=null?ae():he(),Re=""}function Se(w,z){w!==""&&(Xe.startScope(z),Xe.addText(w),Xe.endScope())}function Te(w,z){let we=1;const ve=z.length-1;for(;we<=ve;){if(!w._emit[we]){we++;continue}const nt=Ze.classNameAliases[w[we]]||w[we],lt=z[we];nt?Se(lt,nt):(Re=lt,he(),Re=""),we++}}function We(w,z){return w.scope&&typeof w.scope=="string"&&Xe.openNode(Ze.classNameAliases[w.scope]||w.scope),w.beginScope&&(w.beginScope._wrap?(Se(Re,Ze.classNameAliases[w.beginScope._wrap]||w.beginScope._wrap),Re=""):w.beginScope._multi&&(Te(w.beginScope,z),Re="")),fe=Object.create(w,{parent:{value:fe}}),fe}function Mt(w,z,we){let ve=lp(w.endRe,we);if(ve){if(w["on:end"]){const nt=new fs(w);w["on:end"](z,nt),nt.isMatchIgnored&&(ve=!1)}if(ve){for(;w.endsParent&&w.parent;)w=w.parent;return w}}if(w.endsWithParent)return Mt(w.parent,z,we)}function Zt(w){return fe.matcher.regexIndex===0?(Re+=w[0],1):(P=!0,0)}function Gt(w){const z=w[0],we=w.rule,ve=new fs(we),nt=[we.__beforeBegin,we["on:begin"]];for(const lt of nt)if(lt&&(lt(w,ve),ve.isMatchIgnored))return Zt(z);return we.skip?Re+=z:(we.excludeBegin&&(Re+=z),ie(),!we.returnBegin&&!we.excludeBegin&&(Re=z)),We(we,w),we.returnBegin?0:z.length}function Rt(w){const z=w[0],we=N.substring(w.index),ve=Mt(fe,w,we);if(!ve)return Ns;const nt=fe;fe.endScope&&fe.endScope._wrap?(ie(),Se(z,fe.endScope._wrap)):fe.endScope&&fe.endScope._multi?(ie(),Te(fe.endScope,w)):nt.skip?Re+=z:(nt.returnEnd||nt.excludeEnd||(Re+=z),ie(),nt.excludeEnd&&(Re=z));do fe.scope&&Xe.closeNode(),!fe.skip&&!fe.subLanguage&&(qt+=fe.relevance),fe=fe.parent;while(fe!==ve.parent);return ve.starts&&We(ve.starts,w),nt.returnEnd?0:z.length}function tt(){const w=[];for(let z=fe;z!==Ze;z=z.parent)z.scope&&w.unshift(z.scope);w.forEach(z=>Xe.openNode(z))}let yt={};function vt(w,z){const we=z&&z[0];if(Re+=w,we==null)return ie(),0;if(yt.type==="begin"&&z.type==="end"&&yt.index===z.index&&we===""){if(Re+=N.slice(z.index,z.index+1),!l){const ve=new Error(`0 width match regex (${E})`);throw ve.languageName=E,ve.badRule=yt.rule,ve}return 1}if(yt=z,z.type==="begin")return Gt(z);if(z.type==="illegal"&&!A){const ve=new Error('Illegal lexeme "'+we+'" for mode "'+(fe.scope||"<unnamed>")+'"');throw ve.mode=fe,ve}else if(z.type==="end"){const ve=Rt(z);if(ve!==Ns)return ve}if(z.type==="illegal"&&we==="")return Re+=`
14
14
  `,1;if(Et>1e5&&Et>z.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Re+=we,we.length}const Ze=G(E);if(!Ze)throw co(s.replace("{}",E)),new Error('Unknown language: "'+E+'"');const Ve=Pp(Ze);let Ct="",fe=W||Ve;const Tt={},Xe=new c.__emitter(c);tt();let Re="",qt=0,rt=0,Et=0,P=!1;try{if(Ze.__emitTokens)Ze.__emitTokens(N,Xe);else{for(fe.matcher.considerAll();;){Et++,P?P=!1:fe.matcher.considerAll(),fe.matcher.lastIndex=rt;const w=fe.matcher.exec(N);if(!w)break;const z=N.substring(rt,w.index),we=vt(z,w);rt=w.index+we}vt(N.substring(rt))}return Xe.finalize(),Ct=Xe.toHTML(),{language:E,value:Ct,relevance:qt,illegal:!1,_emitter:Xe,_top:fe}}catch(w){if(w.message&&w.message.includes("Illegal"))return{language:E,value:kl(N),illegal:!0,relevance:0,_illegalBy:{message:w.message,index:rt,context:N.slice(rt-100,rt+100),mode:w.mode,resultSoFar:Ct},_emitter:Xe};if(l)return{language:E,value:kl(N),illegal:!1,relevance:0,errorRaised:w,_emitter:Xe,_top:fe};throw w}}function h(E){const N={value:kl(E),illegal:!1,relevance:0,_top:i,_emitter:new c.__emitter(c)};return N._emitter.addText(E),N}function p(E,N){N=N||c.languages||Object.keys(n);const A=h(E),W=N.filter(G).filter(Z).map(ie=>u(ie,E,!1));W.unshift(A);const me=W.sort((ie,Se)=>{if(ie.relevance!==Se.relevance)return Se.relevance-ie.relevance;if(ie.language&&Se.language){if(G(ie.language).supersetOf===Se.language)return 1;if(G(Se.language).supersetOf===ie.language)return-1}return 0}),[le,he]=me,ae=le;return ae.secondBest=he,ae}function m(E,N,A){const W=N&&o[N]||A;E.classList.add("hljs"),E.classList.add(`language-${W}`)}function k(E){let N=null;const A=d(E);if(a(A))return;if(O("before:highlightElement",{el:E,language:A}),E.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",E);return}if(E.children.length>0&&(c.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(E)),c.throwUnescapedHTML))throw new Up("One of your code blocks includes unescaped HTML.",E.innerHTML);N=E;const W=N.textContent,me=A?f(W,{language:A,ignoreIllegals:!0}):p(W);E.innerHTML=me.value,E.dataset.highlighted="yes",m(E,A,me.language),E.result={language:me.language,re:me.relevance,relevance:me.relevance},me.secondBest&&(E.secondBest={language:me.secondBest.language,relevance:me.secondBest.relevance}),O("after:highlightElement",{el:E,result:me,text:W})}function x(E){c=Ms(c,E)}const D=()=>{ee(),Eo("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function U(){ee(),Eo("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let F=!1;function ee(){function E(){ee()}if(document.readyState==="loading"){F||window.addEventListener("DOMContentLoaded",E,!1),F=!0;return}document.querySelectorAll(c.cssSelector).forEach(k)}function $(E,N){let A=null;try{A=N(e)}catch(W){if(co("Language definition for '{}' could not be registered.".replace("{}",E)),l)co(W);else throw W;A=i}A.name||(A.name=E),n[E]=A,A.rawDefinition=N.bind(null,e),A.aliases&&ne(A.aliases,{languageName:E})}function V(E){delete n[E];for(const N of Object.keys(o))o[N]===E&&delete o[N]}function re(){return Object.keys(n)}function G(E){return E=(E||"").toLowerCase(),n[E]||n[o[E]]}function ne(E,{languageName:N}){typeof E=="string"&&(E=[E]),E.forEach(A=>{o[A.toLowerCase()]=N})}function Z(E){const N=G(E);return N&&!N.disableAutodetect}function S(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=N=>{E["before:highlightBlock"](Object.assign({block:N.el},N))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=N=>{E["after:highlightBlock"](Object.assign({block:N.el},N))})}function K(E){S(E),r.push(E)}function _(E){const N=r.indexOf(E);N!==-1&&r.splice(N,1)}function O(E,N){const A=E;r.forEach(function(W){W[A]&&W[A](N)})}function M(E){return Eo("10.7.0","highlightBlock will be removed entirely in v12.0"),Eo("10.7.0","Please use highlightElement now."),k(E)}Object.assign(e,{highlight:f,highlightAuto:p,highlightAll:ee,highlightElement:k,highlightBlock:M,configure:x,initHighlighting:D,initHighlightingOnLoad:U,registerLanguage:$,unregisterLanguage:V,listLanguages:re,getLanguage:G,registerAliases:ne,autoDetection:Z,inherit:Ms,addPlugin:K,removePlugin:_}),e.debugMode=function(){l=!1},e.safeMode=function(){l=!0},e.versionString=Vp,e.regex={concat:so,lookahead:gs,either:hl,optional:op,anyNumberOfTimes:np};for(const E in pr)typeof pr[E]=="object"&&us(pr[E]);return Object.assign(e,pr),e},vo=Ss({});vo.newInstance=()=>Ss({});var Fp=vo;vo.HighlightJS=vo,vo.default=vo;const As=jm(Fp),Is="[A-Za-z$_][0-9A-Za-z$_]*",Kp=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Wp=["true","false","null","undefined","NaN","Infinity"],Bs=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Rs=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ls=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Gp=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],qp=[].concat(Ls,Bs,Rs);function Yp(e){const n=e.regex,o=(A,{after:W})=>{const me="</"+A[0].slice(1);return A.input.indexOf(me,W)!==-1},r=Is,l={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(A,W)=>{const me=A[0].length+A.index,le=A.input[me];if(le==="<"||le===","){W.ignoreMatch();return}le===">"&&(o(A,{after:me})||W.ignoreMatch());let he;const ae=A.input.substring(me);if(he=ae.match(/^\s*=/)){W.ignoreMatch();return}if((he=ae.match(/^\s+extends\s+/))&&he.index===0){W.ignoreMatch();return}}},c={$pattern:Is,keyword:Kp,literal:Wp,built_in:qp,"variable.language":Gp},a="[0-9](_?[0-9])*",d=`\\.(${a})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${f})((${d})|\\.)?|(${d}))[eE][+-]?(${a})\\b`},{begin:`\\b(${f})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},U={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},F=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,k,x,{match:/\$\d+/},u];h.contains=F.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(F)});const ee=[].concat(U,h.contains),$=ee.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(ee)}]),V={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:$},re={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,n.concat(r,"(",n.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},G={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Bs,...Rs]}},ne={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Z={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[V],illegal:/%/},S={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function K(A){return n.concat("(?!",A.join("|"),")")}const _={match:n.concat(/\b/,K([...Ls,"super","import"].map(A=>`${A}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},O={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},V]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",N={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[V]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ne,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,k,x,U,{match:/\$\d+/},u,G,{scope:"attr",match:r+n.lookahead(":"),relevance:0},N,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[U,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:s},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},Z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[V,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[V]},_,S,re,M,{match:/\$[(.]/}]}}const gr="[A-Za-z$_][0-9A-Za-z$_]*",Os=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Ds=["true","false","null","undefined","NaN","Infinity"],$s=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ps=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Hs=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Vs=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Us=[].concat(Hs,$s,Ps);function Zp(e){const n=e.regex,o=(A,{after:W})=>{const me="</"+A[0].slice(1);return A.input.indexOf(me,W)!==-1},r=gr,l={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(A,W)=>{const me=A[0].length+A.index,le=A.input[me];if(le==="<"||le===","){W.ignoreMatch();return}le===">"&&(o(A,{after:me})||W.ignoreMatch());let he;const ae=A.input.substring(me);if(he=ae.match(/^\s*=/)){W.ignoreMatch();return}if((he=ae.match(/^\s+extends\s+/))&&he.index===0){W.ignoreMatch();return}}},c={$pattern:gr,keyword:Os,literal:Ds,built_in:Us,"variable.language":Vs},a="[0-9](_?[0-9])*",d=`\\.(${a})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${f})((${d})|\\.)?|(${d}))[eE][+-]?(${a})\\b`},{begin:`\\b(${f})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},k={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},U={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},F=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,k,x,{match:/\$\d+/},u];h.contains=F.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(F)});const ee=[].concat(U,h.contains),$=ee.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(ee)}]),V={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:$},re={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,n.concat(r,"(",n.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},G={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...$s,...Ps]}},ne={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Z={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[V],illegal:/%/},S={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function K(A){return n.concat("(?!",A.join("|"),")")}const _={match:n.concat(/\b/,K([...Hs,"super","import"].map(A=>`${A}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},O={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},V]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",N={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[V]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:G},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ne,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,k,x,U,{match:/\$\d+/},u,G,{scope:"attr",match:r+n.lookahead(":"),relevance:0},N,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[U,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:s},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},Z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[V,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},O,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[V]},_,S,re,M,{match:/\$[(.]/}]}}function Xp(e){const n=e.regex,o=Zp(e),r=gr,l=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},i={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:l},contains:[o.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},a=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:gr,keyword:Os.concat(a),literal:Ds,built_in:Us.concat(l),"variable.language":Vs},f={className:"meta",begin:"@"+r},u=(k,x,D)=>{const U=k.contains.findIndex(F=>F.label===x);if(U===-1)throw new Error("can not find mode to replace");k.contains.splice(U,1,D)};Object.assign(o.keywords,d),o.exports.PARAMS_CONTAINS.push(f);const h=o.contains.find(k=>k.scope==="attr"),p=Object.assign({},h,{match:n.concat(r,n.lookahead(/\s*\?:/))});o.exports.PARAMS_CONTAINS.push([o.exports.CLASS_REFERENCE,h,p]),o.contains=o.contains.concat([f,s,i,p]),u(o,"shebang",e.SHEBANG()),u(o,"use_strict",c);const m=o.contains.find(k=>k.label==="func.def");return m.relevance=0,Object.assign(o,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),o}function jp(e){const n=e.regex,o=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},a={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},f={begin:/\{\{/,relevance:0},u={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,f,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,f,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,f,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,f,d]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,k={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},x={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},D={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",a,k,u,e.HASH_COMMENT_MODE]}]};return d.contains=[u,k,a],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[a,k,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,x,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[D]},{variants:[{match:[/\bclass/,/\s+/,o,/\s*/,/\(\s*/,o,/\s*\)/]},{match:[/\bclass/,/\s+/,o]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[k,D,u]}]}}var Co="[0-9](_*[0-9])*",br=`\\.(${Co})`,kr="[0-9a-fA-F](_*[0-9a-fA-F])*",zs={className:"number",variants:[{begin:`(\\b(${Co})((${br})|\\.)?|(${br}))[eE][+-]?(${Co})[fFdD]?\\b`},{begin:`\\b(${Co})((${br})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${br})[fFdD]?\\b`},{begin:`\\b(${Co})[fFdD]\\b`},{begin:`\\b0[xX]((${kr})\\.?|(${kr})?\\.(${kr}))[pP][+-]?(${Co})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${kr})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Fs(e,n,o){return o===-1?"":e.replace(n,r=>Fs(e,n,o-1))}function Qp(e){const n=e.regex,o="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=o+Fs("(?:<"+o+"~~~(?:\\s*,\\s*"+o+"~~~)*>)?",/~~~/g,2),a={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},d={className:"meta",begin:"@"+o,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},f={className:"params",begin:/\(/,end:/\)/,keywords:a,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:a,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[n.concat(/(?!else)/,o),/\s+/,o,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,o],className:{1:"keyword",3:"title.class"},contains:[f,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:a,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:a,relevance:0,contains:[d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,zs,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},zs,d]}}function Jp(e){const n=e.regex,o=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",i="("+r+"|"+n.optional(l)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",c={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:n.optional(l)+e.IDENT_RE,relevance:0},p=n.optional(l)+e.IDENT_RE+"\\s*\\(",x={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},D=[u,c,o,e.C_BLOCK_COMMENT_MODE,f,d],U={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:D.concat([{begin:/\(/,end:/\)/,keywords:x,contains:D.concat(["self"]),relevance:0}]),relevance:0},F={begin:"("+i+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[o,e.C_BLOCK_COMMENT_MODE,d,f,c,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",o,e.C_BLOCK_COMMENT_MODE,d,f,c]}]},c,o,e.C_BLOCK_COMMENT_MODE,u]};return{name:"C",aliases:["h"],keywords:x,disableAutodetect:!0,illegal:"</",contains:[].concat(U,F,D,[u,{begin:e.IDENT_RE+"::",keywords:x},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:u,strings:d,keywords:x}}}function eh(e){const n=e.regex,o=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+n.optional(l)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",c={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},f={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:n.optional(l)+e.IDENT_RE,relevance:0},p=n.optional(l)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],D=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],ee={type:k,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},$={className:"function.dispatch",relevance:0,keywords:{_hint:D},begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))},V=[$,u,c,o,e.C_BLOCK_COMMENT_MODE,f,d],re={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:ee,contains:V.concat([{begin:/\(/,end:/\)/,keywords:ee,contains:V.concat(["self"]),relevance:0}]),relevance:0},G={className:"function",begin:"("+i+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:ee,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:ee,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,f]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:ee,relevance:0,contains:[o,e.C_BLOCK_COMMENT_MODE,d,f,c,{begin:/\(/,end:/\)/,keywords:ee,relevance:0,contains:["self",o,e.C_BLOCK_COMMENT_MODE,d,f,c]}]},c,o,e.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:ee,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(re,G,$,V,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:ee,contains:["self",c]},{begin:e.IDENT_RE+"::",keywords:ee},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function th(e){const n=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],o=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],l=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],i={keyword:l.concat(s),built_in:n,literal:r},c=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),a={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},f={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=e.inherit(f,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:i},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},k={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},x=e.inherit(k,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[k,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],p.contains=[x,m,u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const D={variants:[d,k,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},U={begin:"<",end:">",contains:[{beginKeywords:"in out"},c]},F=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",ee={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:i,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},D,a,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},c,U,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[c,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[c,U,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+F+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:i,contains:[{beginKeywords:o.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,U],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,relevance:0,contains:[D,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},ee]}}function nh(e){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:s,illegal:/["']/}]}]}}function oh(e){const n=e.regex,o=/(r#)?/,r=n.concat(o,e.UNDERSCORE_IDENT_RE),l=n.concat(o,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,n.lookahead(/\s*\(/))},i="([ui](8|16|32|64|128|size)|f(32|64))?",c=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],a=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],f=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:f,keyword:c,literal:a,built_in:d},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\(\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{begin:"\\b0b([01_]+)"+i},{begin:"\\b0o([0-7_]+)"+i},{begin:"\\b0x([A-Fa-f0-9_]+)"+i},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+i}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:f}},{className:"punctuation",begin:"->"},s]}}function rh(e){const n=e.regex,o="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),l=n.concat(r,/(::\w+)*/),i={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},c={className:"doctag",begin:"@[A-Za-z]+"},a={begin:"#<",end:">"},d=[e.COMMENT("#","$",{contains:[c]}),e.COMMENT("^=begin","^=end",{contains:[c],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],f={className:"subst",begin:/#\{/,end:/\}/,keywords:i},u={className:"string",contains:[e.BACKSLASH_ESCAPE,f],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,f]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},k={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:i}]},V=[u,{variants:[{match:[/class\s+/,l,/\s+<\s+/,l]},{match:[/\b(class|module)\s+/,l]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:i},{match:[/(include|extend)\s+/,l],scope:{2:"title.class"},keywords:i},{relevance:0,match:[l,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[k]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[u,{begin:o}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:i},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,f],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(a,d),relevance:0}].concat(a,d);f.contains=V,k.contains=V;const Z=[{begin:/^\s*=>/,starts:{end:"$",contains:V}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:i,contains:V}}];return d.unshift(a),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:i,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(Z).concat(d).concat(V)}}function lh(e){const n=e.regex,o=/(?![A-Za-z0-9])(?![$])/,r=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,o),l=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,o),s=n.concat(/[A-Z]+/,o),i={scope:"variable",match:"\\$+"+r},c={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},a={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=e.inherit(e.APOS_STRING_MODE,{illegal:null}),f=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(a)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(a),"on:begin":(O,M)=>{M.data._beginMatch=O[1]||O[2]},"on:end":(O,M)=>{M.data._beginMatch!==O[1]&&M.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[