xiaodao-editor 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +306 -0
- package/dist/block-editor.js +23254 -0
- package/dist/block-editor.umd.cjs +26 -0
- package/dist/core/Editor.d.ts +83 -0
- package/dist/core/command/Command.d.ts +32 -0
- package/dist/core/command/InputRule.d.ts +21 -0
- package/dist/core/command/Keymap.d.ts +42 -0
- package/dist/core/command/SlashCommand.d.ts +24 -0
- package/dist/core/command/primitiveCommands.d.ts +97 -0
- package/dist/core/extension/Extension.d.ts +52 -0
- package/dist/core/extension/Registry.d.ts +46 -0
- package/dist/core/history/HistoryManager.d.ts +37 -0
- package/dist/core/ids.d.ts +5 -0
- package/dist/core/index.d.ts +35 -0
- package/dist/core/plugin/Plugin.d.ts +26 -0
- package/dist/core/schema/BlockSchema.d.ts +70 -0
- package/dist/core/schema/SchemaRegistry.d.ts +22 -0
- package/dist/core/selection/Selection.d.ts +25 -0
- package/dist/core/serialize/Serializer.d.ts +31 -0
- package/dist/core/state/EditorState.d.ts +26 -0
- package/dist/core/state/Step.d.ts +39 -0
- package/dist/core/state/Transaction.d.ts +52 -0
- package/dist/core/state/invert.d.ts +19 -0
- package/dist/core/state/store.d.ts +78 -0
- package/dist/core/types.d.ts +105 -0
- package/dist/extensions/BulletList.d.ts +2 -0
- package/dist/extensions/CodeBlock.d.ts +2 -0
- package/dist/extensions/Divider.d.ts +2 -0
- package/dist/extensions/Heading.d.ts +2 -0
- package/dist/extensions/History.d.ts +2 -0
- package/dist/extensions/Image.d.ts +34 -0
- package/dist/extensions/Keymap.d.ts +2 -0
- package/dist/extensions/OrderedList.d.ts +18 -0
- package/dist/extensions/Paragraph.d.ts +5 -0
- package/dist/extensions/Quote.d.ts +2 -0
- package/dist/extensions/Table.d.ts +74 -0
- package/dist/extensions/TableOfContents.d.ts +18 -0
- package/dist/extensions/TodoList.d.ts +2 -0
- package/dist/extensions/_commonAttrs.d.ts +84 -0
- package/dist/extensions/builtin.d.ts +15 -0
- package/dist/extensions/tableModel.d.ts +199 -0
- package/dist/i18n.d.ts +31 -0
- package/dist/index.d.ts +30 -0
- package/dist/style.css +1 -0
- package/dist/test-img.png +0 -0
- package/dist/view/BlockContent.vue.d.ts +21 -0
- package/dist/view/BlockEditor.vue.d.ts +67 -0
- package/dist/view/BlockHost.vue.d.ts +51 -0
- package/dist/view/BlockList.vue.d.ts +64 -0
- package/dist/view/clipboard.d.ts +11 -0
- package/dist/view/context.d.ts +116 -0
- package/dist/view/domSelection.d.ts +65 -0
- package/dist/view/imageUpload.d.ts +130 -0
- package/dist/view/inlineDom.d.ts +23 -0
- package/dist/view/keymapHandler.d.ts +7 -0
- package/dist/view/ui/BlockHandle.vue.d.ts +33 -0
- package/dist/view/ui/BlockSettingsMenu.vue.d.ts +32 -0
- package/dist/view/ui/CodeLangPicker.vue.d.ts +20 -0
- package/dist/view/ui/HoverToolbar.vue.d.ts +81 -0
- package/dist/view/ui/LinkPopover.vue.d.ts +62 -0
- package/dist/view/ui/MobileToolbar.vue.d.ts +29 -0
- package/dist/view/ui/NumberPicker.vue.d.ts +20 -0
- package/dist/view/ui/OrderedListMenu.vue.d.ts +37 -0
- package/dist/view/ui/PlusMenu.vue.d.ts +29 -0
- package/dist/view/ui/SafeHtml.vue.d.ts +8 -0
- package/dist/view/ui/icons.d.ts +51 -0
- package/dist/view/ui/inputRulesEngine.d.ts +33 -0
- package/dist/view/ui/popup.d.ts +75 -0
- package/dist/view/ui/useMenuDismiss.d.ts +9 -0
- package/dist/view/ui/useMenuScroll.d.ts +2 -0
- package/dist/view/urlUtils.d.ts +39 -0
- package/package.json +73 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(function(le,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(le=typeof globalThis<"u"?globalThis:le||self,t(le.BlockEditor={},le.Vue))})(this,function(le,t){"use strict";var hg=Object.defineProperty;var gg=(le,t,io)=>t in le?hg(le,t,{enumerable:!0,configurable:!0,writable:!0,value:io}):le[t]=io;var _t=(le,t,io)=>gg(le,typeof t!="symbol"?t+"":t,io);function io(e){return typeof e=="string"&&e.length>0}function bc(e){return e.type==="text"}function Me(e){return e.reduce((n,o)=>o.type==="text"?n+o.text:n,"")}function Un(e){return e.length===0?[]:[{type:"text",text:e}]}function Ft(e,n){const o=Math.max(0,Math.floor(n));if(o<=0)return[[],e];const r=Me(e).length;if(o>=r)return[e,[]];const l=[],i=[];let s=0;for(const c of e){if(c.type!=="text"){s<o?l.push(c):i.push(c);continue}const a=c.text.length;if(s+a<=o){l.push(c),s+=a;continue}if(s>=o){i.push(c);continue}const d=o-s,m=c.text.slice(0,d),f=c.text.slice(d);m.length>0&&l.push(c.marks?{...c,text:m}:{...c,text:m,marks:void 0}),f.length>0&&i.push(c.marks?{...c,text:f}:{...c,text:f,marks:void 0}),s+=a}return[l,i]}const Ml="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-",Nl=12;function kc(e){const n=globalThis.crypto;if(!n||typeof n.getRandomValues!="function")throw new Error("BlockEditor: Web Crypto getRandomValues is unavailable in this environment.");const o=new Uint8Array(e);return n.getRandomValues(o),o}function so(){const e=kc(Nl);let n="";for(let o=0;o<Nl;o++)n+=Ml[e[o]%Ml.length];return n}function yc(e){return e}const wc={empty:e=>e.content.length===0||e.content.every(n=>n.text==="")};function Tr(e){return{type:e.type,attrs:e.attrs??{},content:e.content??"text",nestable:e.nestable??!1,allowedChildren:e.allowedChildren??"*",isolating:e.isolating??!1,listLike:e.listLike??!1,inlineMarks:e.inlineMarks??!0,disallowedMarks:e.disallowedMarks??[],empty:e.empty??wc.empty}}function zn(e){const n={};for(const[o,r]of Object.entries(e.attrs))n[o]=r.default;return n}function Sl(e,n){const o={};for(const[r,l]of Object.entries(e.attrs)){const i=n[r];i!==void 0&&(!l.validate||l.validate(i))?o[r]=i:o[r]=l.default}return o}function Al(e,n){return e.nestable?e.allowedChildren==="*"?!0:e.allowedChildren.includes(n):!1}function Il(e){return e.content==="text"}function Bl(e){return e.isolating}function Rl(e,n){return e.empty(n)}class Ll{constructor(n,o){_t(this,"schemas");_t(this,"fallback");this.schemas=n,this.fallback=o}get(n){return this.schemas.get(n)??this.fallback}has(n){return this.schemas.has(n)}defaultAttrsFor(n){return zn(this.get(n))}coerceAttrsFor(n,o){return Sl(this.get(n),o)}canContain(n,o){return Al(this.get(n),o)}hasText(n){return Il(this.get(n))}isIsolating(n){return Bl(this.get(n))}isListLike(n){return this.get(n).listLike}hasInlineMarks(n){return this.get(n).inlineMarks}isMarkDisallowed(n,o){return this.get(n).disallowedMarks.includes(o)}isEmpty(n){return Rl(this.get(n.type),n)}}const Ol=new Set(["paragraph","heading","bulletList","orderedList","todoList"]);function xr(e){const n=new Map,o=new Map,r=new Map,l=new Set,i=p=>{if(p&&!l.has(p)){const b=p;return l.add(b),p&&r.set(p,b),b}let u=so();for(;l.has(u);)u=so();return l.add(u),u},s=(p,u)=>{const b=i(p.id);o.set(b,u);const w=[];for(const S of p.children??[])w.push(s(S,b));return n.set(b,{id:b,type:p.type,attrs:p.attrs??{},content:p.content??[],children:w}),b},c=[];for(const p of e.blocks??[])c.push(s(p,null));const a=Array.from(o.values()).every(p=>p===null);let d=!1;for(const p of n.values())if(typeof p.attrs.indent=="number"&&p.attrs.indent>0){d=!0;break}a&&d&&Ec(n,o,c);const m=10;for(const[p,u]of n){const b=Math.min(m,Mr(o,p));if((typeof u.attrs.indent=="number"?u.attrs.indent:0)===b)continue;const{indent:S,...M}=u.attrs,I=b>0?{...M,indent:b}:M;n.set(p,{...u,attrs:I})}return{doc:{id:e.id??Tc(),root:c,blocks:n,parent:o},idMap:r}}function Ec(e,n,o){const r=[...o];for(const[c,a]of e)e.set(c,{...a,children:[]});const l=[],i=[],s=(c,a)=>{if(c===null){i.push(a),n.set(a,null);return}const d=e.get(c);if(!d){i.push(a),n.set(a,null);return}const m={...d,children:[...d.children,a]};e.set(c,m),n.set(a,c)};for(const c of r){const a=e.get(c);if(!a)continue;const d=typeof a.attrs.indent=="number"?a.attrs.indent:0,m=Ol.has(a.type),f=m?Math.max(0,d):0;for(;l.length>0&&l[l.length-1].indent>=f;)l.pop();let u=l.length>0?l[l.length-1].id:null;for(;u!==null;){const b=e.get(u);if(!b||!Ol.has(b.type))u=n.get(u)??null;else break}s(u,c),m&&l.push({indent:f,id:c})}o.length=0;for(const c of i)o.push(c)}function Dl(e){const n=r=>r.map(l=>l.type==="text"?{type:"text",text:l.text,marks:l.marks&&l.marks.length>0?l.marks.map(i=>({type:i.type,attrs:i.attrs?{...i.attrs}:void 0})):void 0}:{...l}),o=r=>{const l=e.blocks.get(r);if(!l)throw new Error(`BlockEditor: missing block ${r} during serialization`);const i=l.children.map(o);return{id:r,type:l.type,attrs:l.attrs?{...l.attrs}:void 0,content:n(l.content),...i.length?{children:i}:{}}};return{id:e.id,blocks:e.root.map(o)}}function St(e,n){return e.blocks.get(n)}function rn(e,n){const o=e.blocks.get(n);if(!o)throw new Error(`BlockEditor: unknown block ${n}`);return o}function Ot(e,n){return e.parent.get(n)??null}function In(e,n){return Mr(e.parent,n)}function Mr(e,n){let o=0,r=e.get(n);const l=new Set;for(;r!=null&&!l.has(r);)l.add(r),o++,r=e.get(r);return o}function co(e,n){const o=e.parent.get(n);if(o==null)return e.root;const r=e.blocks.get(o);return r?r.children:e.root}function ln(e,n){return co(e,n).indexOf(n)}function Nr(e,n){const o=ln(e,n);if(o<=0)return;const r=co(e,n);return e.blocks.get(r[o-1])}function vc(e,n){const o=co(e,n),r=o.indexOf(n);if(!(r<0||r>=o.length-1))return e.blocks.get(o[r+1])}function _n(e){const n=[],o=r=>{for(const l of r){n.push(l);const i=e.blocks.get(l);i&&o(i.children)}};return o(e.root),n}function Bn(e,n){const o=_n(e),r=o.indexOf(n);if(!(r<=0))return e.blocks.get(o[r-1])}function ao(e,n){const o=_n(e),r=o.indexOf(n);if(!(r<0||r>=o.length-1))return e.blocks.get(o[r+1])}function $l(e,n){const o=rn(e,n);if(o.children.length===0)return o;const r=o.children[o.children.length-1];return $l(e,r)}function Pl(e,n){const r=[];for(const[l,i]of e.blocks){const s=Math.min(10,Mr(e.parent,l)),c=n?n.get(i.type).attrs:void 0,a=c?"indent"in c:!0,d=a?s:0;if((typeof i.attrs.indent=="number"?i.attrs.indent:0)===d)continue;const{indent:f,...p}=i.attrs,u=d>0&&a?{...p,indent:d}:p;r.push({id:l,attrs:u})}return r}function Cc(e,n){return{...e,content:n}}function _c(e,n){return{...e,attrs:n}}function Tc(){return"doc_"+Math.random().toString(36).slice(2,10)}function xc(e){return{id:e.id,root:e.root,blocks:e.blocks,parent:e.parent}}function qo(e,n,o){e.blocks.set(n,o),e.changed.add(n)}function No(e,n,o){if(n===null)e.root=o;else{const r=e.blocks.get(n);if(!r)throw new Error(`BlockEditor: unknown parent ${n}`);qo(e,n,{...r,children:o})}}function So(e,n){if(n===null)return e.root;const o=e.blocks.get(n);if(!o)throw new Error(`BlockEditor: unknown parent ${n}`);return o.children}function Mc(e,n){if(!e.blocks.get(n))throw new Error(`BlockEditor: cannot remove unknown block ${n}`);const r=e.parent.get(n)??null,l=So(e,r).filter(s=>s!==n);No(e,r,l);const i=[n];for(;i.length;){const s=i.pop(),c=e.blocks.get(s);if(c)for(const a of c.children)i.push(a);e.blocks.delete(s),e.parent.delete(s),e.removed.add(s),e.changed.delete(s)}}function Yo(e,n){const o={id:e.id,root:[...e.root],blocks:new Map(e.blocks),parent:new Map(e.parent),changed:new Set,removed:new Set};for(const r of n)switch(r.op){case"insertBlock":{if(o.blocks.has(r.id))throw new Error(`BlockEditor: insertBlock id collision ${r.id}`);const l={id:r.id,type:r.type,attrs:r.attrs,content:r.content,children:[]};o.blocks.set(r.id,l),o.parent.set(r.id,r.parent),o.changed.add(r.id);const i=[...So(o,r.parent)],s=Math.max(0,Math.min(r.index,i.length));i.splice(s,0,r.id),No(o,r.parent,i);break}case"removeBlock":{Mc(o,r.id);break}case"replaceBlock":{const l=o.blocks.get(r.id);if(!l)throw new Error(`BlockEditor: replaceBlock unknown ${r.id}`);qo(o,r.id,{...l,type:r.type,attrs:r.attrs});break}case"moveBlock":{if(!o.blocks.get(r.id))throw new Error(`BlockEditor: moveBlock unknown ${r.id}`);const i=o.parent.get(r.id)??null;if(i===r.toParent){const s=So(o,i).filter(a=>a!==r.id),c=Math.max(0,Math.min(r.toIndex,s.length));s.splice(c,0,r.id),No(o,i,s)}else{const s=So(o,i).filter(d=>d!==r.id);No(o,i,s);const c=[...So(o,r.toParent)],a=Math.max(0,Math.min(r.toIndex,c.length));c.splice(a,0,r.id),No(o,r.toParent,c),o.parent.set(r.id,r.toParent)}break}case"setText":{const l=o.blocks.get(r.id);if(!l)throw new Error(`BlockEditor: setText unknown ${r.id}`);qo(o,r.id,{...l,content:r.content});break}case"setAttrs":{const l=o.blocks.get(r.id);if(!l)throw new Error(`BlockEditor: setAttrs unknown ${r.id}`);qo(o,r.id,{...l,attrs:r.attrs});break}}return{doc:xc(o),changed:o.changed,removed:o.removed}}function Hl(e,n,o){const{doc:r,changed:l,removed:i}=Yo(e.doc,n.steps),s=n.selectionAfter??e.selection,c={...e.pluginState};for(const a of o)a.applyTransaction&&(c[a.name]=a.applyTransaction(n,e,r,s));return{doc:r,state:{doc:r,selection:s,pluginState:c,version:e.version+1},changed:l,removed:i}}function Sr(e,n,o={}){return{doc:e,selection:n,pluginState:o,version:0}}class Vl{constructor(){_t(this,"steps",[]);_t(this,"selectionAfter");_t(this,"meta",{})}insertBlock(n){const o=n.id??so();return this.steps.push({op:"insertBlock",parent:n.parent,index:n.index,id:o,type:n.type,attrs:n.attrs??{},content:n.content??[]}),o}removeBlock(n){return this.steps.push({op:"removeBlock",id:n}),this}replaceBlock(n,o,r){return this.steps.push({op:"replaceBlock",id:n,type:o,attrs:r}),this}moveBlock(n,o,r){return this.steps.push({op:"moveBlock",id:n,toParent:o,toIndex:r}),this}setText(n,o){return this.steps.push({op:"setText",id:n,content:o}),this}setAttrs(n,o){return this.steps.push({op:"setAttrs",id:n,attrs:o}),this}peek(){return this.steps}appendSteps(n){for(const o of n)this.steps.push(o);return this}setSelection(n){return this.selectionAfter=n,this}setMeta(n){return this.meta={...this.meta,...n},this}addToHistory(n){return this.meta={...this.meta,addToHistory:n},this}historyGroup(n){return this.meta={...this.meta,historyGroup:n},this}skipDomWrite(n){return this.meta={...this.meta,viewHints:{...this.meta.viewHints,skipDomWrite:n}},this}build(){return{steps:this.steps,selectionAfter:this.selectionAfter,meta:this.meta}}}function et(){return new Vl}function Ul(e,n){const o=[];for(let r=e.length-1;r>=0;r--){const l=e[r];switch(l.op){case"insertBlock":o.push({op:"removeBlock",id:l.id});break;case"removeBlock":o.push(...Nc(l.id,n));break;case"replaceBlock":{const i=n.blocks.get(l.id);if(!i)break;o.push({op:"replaceBlock",id:l.id,type:i.type,attrs:i.attrs});break}case"moveBlock":{o.push({op:"moveBlock",id:l.id,toParent:Ot(n,l.id),toIndex:ln(n,l.id)});break}case"setText":{const i=n.blocks.get(l.id);if(!i)break;o.push({op:"setText",id:l.id,content:i.content});break}case"setAttrs":{const i=n.blocks.get(l.id);if(!i)break;o.push({op:"setAttrs",id:l.id,attrs:i.attrs});break}}}return o}function Nc(e,n){const o=[],r=l=>{const i=rn(n,l);o.push({op:"insertBlock",parent:Ot(n,l),index:ln(n,l),id:l,type:i.type,attrs:i.attrs,content:i.content});for(const s of i.children)r(s)};return r(e),o}function rt(e,n){return{kind:"caret",blockId:e,offset:n}}function Ar(e,n){return{kind:"text",anchor:e,focus:n}}function Sc(e){return{kind:"blocks",blockIds:[...e]}}function uo(e){return e.kind==="caret"}function Fn(e){return e.kind==="text"}function Ao(e){return e.kind==="blocks"}function Ir(e){return uo(e)?!0:Fn(e)?e.anchor.blockId===e.focus.blockId&&e.anchor.offset===e.focus.offset:e.blockIds.length===0}function zl(e){return uo(e)?e.blockId:Fn(e)?e.focus.blockId:e.blockIds[0]??null}function Ac(e){return uo(e)?e.offset:Fn(e)?e.focus.offset:0}function Ic(e,n){return Fn(e)?n(e.anchor,e.focus)<=0?[e.anchor,e.focus]:[e.focus,e.anchor]:null}class Fl{constructor(){_t(this,"entries",new Map)}register(n){if(this.entries.has(n.name))throw new Error(`BlockEditor: duplicate command "${n.name}"`);this.entries.set(n.name,n)}override(n){this.entries.set(n.name,n)}has(n){return this.entries.has(n)}get(n){return this.entries.get(n)}createProxy(n){const o=this.entries;return new Proxy({},{get:(r,l)=>o.has(l)?i=>n(l,i):()=>!1})}}function Zo(e){if(Ao(e))return null;const n=zl(e);if(!n)return null;const o=uo(e)?e.offset:e.focus.offset;return{blockId:n,offset:o}}const Br=10;function an(e,n,o){const r=n.peek();if(r.length===0)return;const l=Yo(e.doc,r),i=Pl(l.doc,o.registries.schema);for(const s of i)n.setAttrs(s.id,s.attrs)}function Xo(e){return{name:"insertBlock",run:n=>(o,r)=>{const l=n.type,i=n.attrs??e.registries.schema.defaultAttrsFor(l),s=n.content??[];let c,a;if(n.after){if(!St(o.doc,n.after))return!1;c=Ot(o.doc,n.after),a=ln(o.doc,n.after)+1}else if(n.parent!==void 0){c=n.parent;const f=c===null?o.doc.root:rn(o.doc,c).children;a=n.index??f.length}else c=null,a=o.doc.root.length;if(c!==null){const f=St(o.doc,c);if(!f)return!1;const p=e.registries.schema.get(f.type);if(!(p!=null&&p.nestable))return!1}const d=et(),m=d.insertBlock({parent:c,index:a,type:l,attrs:i,content:s});return d.setSelection(rt(m,0)),r==null||r(d.build()),!0}}}function Rr(e){return{name:"removeBlock",run:n=>(o,r)=>{if(!St(o.doc,n.id))return!1;const l=Bn(o.doc,n.id),i=ao(o.doc,n.id),s=l??i,c=et(),d=rn(o.doc,n.id).children??[];if(d.length>0){const m=Ot(o.doc,n.id),f=ln(o.doc,n.id);if((()=>{if(!l)return!1;const u=e.registries.schema.get(l.type);return!(!(u!=null&&u.nestable)||In(o.doc,l.id)>=Br)})()&&l){let b=(l.children??[]).length;for(const w of d)c.moveBlock(w,l.id,b),b++}else{let u=f;for(const b of d)c.moveBlock(b,m,u),u++}}if(c.removeBlock(n.id),an(o,c,e),s){const m=Me(s.content);c.setSelection(rt(s.id,m.length))}return r==null||r(c.build()),!0}}}function Bc(e){return{name:"replaceBlock",run:n=>(o,r)=>{if(!St(o.doc,n.id))return!1;const i=n.attrs??e.registries.schema.defaultAttrsFor(n.type),s=et();return s.replaceBlock(n.id,n.type,i),an(o,s,e),s.setSelection(rt(n.id,0)),r==null||r(s.build()),!0}}}function Rc(){return{name:"setText",run:e=>(n,o)=>{if(!St(n.doc,e.id))return!1;const r=et();return r.setText(e.id,e.content),e.selectionAfter&&r.setSelection(e.selectionAfter),r.historyGroup("type"),r.skipDomWrite([e.id]),r.setMeta({source:"input",addToHistory:!0}),o==null||o(r.build()),!0}}}function Lc(){return{name:"setAttrs",run:e=>(n,o)=>{if(!St(n.doc,e.id))return!1;const l=et();return l.setAttrs(e.id,e.attrs),o==null||o(l.build()),!0}}}function Lr(e){return{name:"splitBlock",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l||!e.registries.schema.hasText(l.type))return!1;const i=Me(l.content).length,s=Math.max(0,Math.min(n.offset,i)),[c,a]=Ft(l.content,s),d=Ot(o.doc,n.id),m=ln(o.doc,n.id),f=l.children??[],p=n.asType??e.registries.defaultBlockType,u=n.asAttrs??e.registries.schema.defaultAttrsFor(p),b=et();b.setText(n.id,c);const w=b.insertBlock({parent:d,index:m+1,type:p,attrs:u,content:a});if(f.length>0)for(let S=0;S<f.length;S++)b.moveBlock(f[S],w,S);return an(o,b,e),b.setSelection(rt(w,0)),r==null||r(b.build()),!0}}}function Kl(e){return{name:"mergeBlock",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l)return!1;const i=Bn(o.doc,n.id);if(!i||!e.registries.schema.hasText(i.type))return!1;const s=Me(i.content),c=[...i.content,...l.content],a=et();a.setText(i.id,c);const d=l.children??[];if(d.length>0){const m=Ot(o.doc,n.id),f=ln(o.doc,n.id),p=e.registries.schema.get(i.type);if(!!(p!=null&&p.nestable)&&In(o.doc,i.id)<Br){let w=(i.children??[]).length;for(const S of d)a.moveBlock(S,i.id,w),w++}else{let b=f;for(const w of d)a.moveBlock(w,m,b),b++}}return a.removeBlock(n.id),an(o,a,e),a.setSelection(rt(i.id,s.length)),r==null||r(a.build()),!0}}}function Oc(e){return{name:"enter",run:()=>(n,o)=>{const r=n.selection,l=Zo(r);if(!l){if(Ao(r)&&r.blockIds.length){const d=r.blockIds[r.blockIds.length-1];return Xo(e).run({type:e.registries.defaultBlockType,after:d})(n,o)}return!1}const i=rn(n.doc,l.blockId),s=e.registries.schema.get(i.type);if(!e.registries.schema.hasText(i.type))return Xo(e).run({type:e.registries.defaultBlockType,after:i.id})(n,o);if(s.isolating)return!1;const c=Me(i.content),a=l.offset>=c.length;return s.listLike&&e.registries.schema.isEmpty(i)?jo(e).run({id:i.id,type:e.registries.defaultBlockType})(n,o):a&&e.registries.schema.isEmpty(i)?Xo(e).run({type:e.registries.defaultBlockType,after:i.id})(n,o):s.listLike?Lr(e).run({id:i.id,offset:l.offset,asType:i.type})(n,o):Lr(e).run({id:i.id,offset:l.offset})(n,o)}}}function Dc(e){return{name:"backspace",run:()=>(n,o)=>{const r=n.selection;if(Ao(r)&&r.blockIds.length){const c=r.blockIds[0],a=Bn(n.doc,c),d=et();for(const f of r.blockIds)d.removeBlock(f);const m=a??ao(n.doc,r.blockIds[r.blockIds.length-1]);return an(n,d,e),m&&d.setSelection(rt(m.id,Me(m.content).length)),o==null||o(d.build()),!0}const l=Zo(r);if(!l)return!1;const i=rn(n.doc,l.blockId);if(Fn(r)&&!Ir(r)&&r.anchor.blockId===r.focus.blockId){const[c,a]=r.anchor.offset<=r.focus.offset?[r.anchor.offset,r.focus.offset]:[r.focus.offset,r.anchor.offset],d=Me(i.content),m=Un(d.slice(0,c)+d.slice(a)),f=et();return f.setText(i.id,m),f.setSelection(rt(i.id,c)),f.skipDomWrite([i.id]),o==null||o(f.build()),!0}if(Fn(r)&&!Ir(r)&&r.anchor.blockId!==r.focus.blockId){const c=_n(n.doc),a=c.indexOf(r.anchor.blockId),d=c.indexOf(r.focus.blockId);if(a===-1||d===-1)return!1;const[m,f]=a<=d?[r.anchor,r.focus]:[r.focus,r.anchor],p=c.indexOf(m.blockId),u=c.indexOf(f.blockId);if(p===-1||u===-1||p>=u)return!1;const b=rn(n.doc,m.blockId),w=rn(n.doc,f.blockId),S=Me(b.content).length,M=Me(w.content).length,I=Math.min(m.offset,S),j=Math.min(f.offset,M),[Q]=Ft(b.content,I),[,U]=Ft(w.content,j),F=[...Q,...U],ue=Me(Q).length,J=et();J.setText(m.blockId,F);for(let ne=u;ne>p;ne--)J.removeBlock(c[ne]);return J.setSelection(rt(m.blockId,ue)),an(n,J,e),o==null||o(J.build()),!0}if(l.offset>0)return!1;if(In(n.doc,i.id)>0)return Wl(e).run({id:i.id})(n,o);if(e.registries.schema.isListLike(i.type))return jo(e).run({id:i.id,type:e.registries.defaultBlockType})(n,o);if(e.registries.schema.isEmpty(i)&&i.type!==e.registries.defaultBlockType)return jo(e).run({id:i.id,type:e.registries.defaultBlockType})(n,o);const s=Bn(n.doc,i.id);return s?e.registries.schema.isIsolating(i.type)||e.registries.schema.isIsolating(s.type)?e.registries.schema.isEmpty(i)?Rr(e).run({id:i.id})(n,o):!1:e.registries.schema.hasText(s.type)?Kl(e).run({id:i.id})(n,o):e.registries.schema.isEmpty(i)?Rr(e).run({id:i.id})(n,o):!1:!1}}}function $c(){return{name:"moveToPreviousBlock",run:()=>(e,n)=>{const o=Zo(e.selection);if(!o)return!1;const r=Bn(e.doc,o.blockId);if(!r)return!1;const l=Math.min(o.offset,Me(r.content).length);return n==null||n(et().setSelection(rt(r.id,l)).setMeta({addToHistory:!1}).build()),!0}}}function Pc(){return{name:"moveToNextBlock",run:()=>(e,n)=>{const o=Zo(e.selection);if(!o)return!1;const r=ao(e.doc,o.blockId);if(!r)return!1;const l=Math.min(o.offset,Me(r.content).length);return n==null||n(et().setSelection(rt(r.id,l)).setMeta({addToHistory:!1}).build()),!0}}}function Hc(){return{name:"setSelection",run:e=>(n,o)=>(o==null||o(et().setSelection(e.selection).setMeta({addToHistory:!1}).build()),!0)}}function Vc(){return{name:"clearSelection",run:()=>(e,n)=>(n==null||n(et().setSelection({kind:"blocks",blockIds:[]}).setMeta({addToHistory:!1}).build()),!0)}}function Uc(){return{name:"selectAll",run:()=>(e,n)=>{const o=_n(e.doc);if(o.length===0)return!1;const r=o[0],l=o[o.length-1],i=rn(e.doc,l),s=Me(i.content).length,c={kind:"text",anchor:{blockId:r,offset:0},focus:{blockId:l,offset:s}};return n==null||n(et().setSelection(c).setMeta({addToHistory:!1}).build()),!0}}}function zc(){return{name:"selectBlock",run:e=>(n,o)=>(o==null||o(et().setSelection({kind:"blocks",blockIds:[e.id]}).setMeta({addToHistory:!1}).build()),!0)}}function Fc(e){return{name:"moveBlock",run:n=>(o,r)=>{if(!St(o.doc,n.id)||n.toParent===n.id)return!1;if(n.toParent!==null){let s=n.toParent;for(;s!==null;){if(s===n.id)return!1;s=Ot(o.doc,s)}}if(n.toParent!==null){const s=St(o.doc,n.toParent);if(!s)return!1;const c=e.registries.schema.get(s.type);if(!(c!=null&&c.nestable))return!1}const i=et();return i.moveBlock(n.id,n.toParent,n.toIndex),an(o,i,e),i.setSelection(rt(n.id,0)),r==null||r(i.build()),!0}}}function jo(e){return{name:"convertBlock",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l)return!1;const i={...l.attrs,...n.attrs??{}};let s=e.registries.schema.coerceAttrsFor(n.type,i);const c=e.registries.schema.get(n.type);let a=l.content;if(c.content==="none"&&(a=[]),!c.inlineMarks){a=a.map(u=>({type:"text",text:u.text}));const p={...s};"color"in p&&(p.color="default"),"bgColor"in p&&(p.bgColor="default"),s=p}const d=o.selection.kind==="caret"&&o.selection.blockId===n.id?o.selection.offset:0,m=et();m.replaceBlock(n.id,n.type,s),a!==l.content&&m.setText(n.id,a),an(o,m,e);const f=Me(a).length;return m.setSelection(rt(n.id,Math.min(d,f))),r==null||r(m.build()),!0}}}function Kc(e){return{name:"moveBlockUp",run:n=>(o,r)=>{const l=Bn(o.doc,n.id);if(!l)return!1;const i=Ot(o.doc,l.id),c=(i===null?o.doc.root:rn(o.doc,i).children).indexOf(l.id),a=i,d=et();return d.moveBlock(n.id,a,Math.max(0,c)),an(o,d,e),d.setSelection(rt(n.id,0)),r==null||r(d.build()),!0}}}function Wc(e){return{name:"moveBlockDown",run:n=>(o,r)=>{const l=ao(o.doc,n.id);if(!l)return!1;const i=Ot(o.doc,n.id),s=i===null?o.doc.root:rn(o.doc,i).children,c=s.indexOf(l.id),a=i,d=et(),m=s.indexOf(n.id),f=c>m?c:c+1;return d.moveBlock(n.id,a,Math.max(0,Math.min(s.length,f))),an(o,d,e),d.setSelection(rt(n.id,0)),r==null||r(d.build()),!0}}}function Gc(e){return{name:"duplicateBlock",run:n=>(o,r)=>{if(!St(o.doc,n.id))return!1;const i=[],s=[];for(s.push({id:n.id,parentOldId:Ot(o.doc,n.id)});s.length>0;){const{id:f,parentOldId:p}=s.pop(),u=St(o.doc,f);if(!u)continue;i.push({oldId:f,parentOldId:p});const b=u.children;for(let w=b.length-1;w>=0;w--)s.push({id:b[w],parentOldId:f})}if(i.length===0)return!1;const c=new Map,a=new Map,d=et();for(const f of i){const p=rn(o.doc,f.oldId);let u,b;if(f.oldId===n.id){u=f.parentOldId;const M=u===null?o.doc.root:rn(o.doc,u).children,I=M.indexOf(n.id);b=I>=0?I+1:M.length}else{const M=f.parentOldId,I=c.get(M)??null;if(I===null)return!1;u=I,b=a.get(I)??0,a.set(I,b+1)}const w=e.registries.schema.coerceAttrsFor(p.type,p.attrs),S=d.insertBlock({parent:u,index:b,type:p.type,attrs:w,content:p.content});c.set(f.oldId,S)}an(o,d,e);const m=c.get(n.id)??null;return m&&d.setSelection(rt(m,0)),r==null||r(d.build()),!0}}}function qc(e){return{name:"setBlockAlign",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l||!("align"in e.registries.schema.get(l.type).attrs))return!1;const s=et();return s.setAttrs(n.id,{...l.attrs,align:n.align}),r==null||r(s.build()),!0}}}function Yc(e){return{name:"setBlockColor",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l||!e.registries.schema.hasInlineMarks(l.type))return!1;const i=et();return i.setAttrs(n.id,{...l.attrs,color:n.color}),r==null||r(i.build()),!0}}}function Zc(e){return{name:"setBlockBgColor",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l||!e.registries.schema.hasInlineMarks(l.type))return!1;const i=et();return i.setAttrs(n.id,{...l.attrs,bgColor:n.bgColor}),r==null||r(i.build()),!0}}}function Xc(){return{name:"setStartNumber",run:e=>(n,o)=>{const r=St(n.doc,e.id);if(!r||r.type!=="orderedList")return!1;const l=r.attrs,i=e.startNumber;let s;if(i==null){const{startNumber:a,...d}=l;s=d}else{const a=Math.max(1,Math.floor(i));s={...l,startNumber:a}}const c=et();return c.setAttrs(e.id,s),o==null||o(c.build()),!0}}}function jc(e){return{name:"indentBlock",run:n=>(o,r)=>{const l=(n==null?void 0:n.id)??(o.selection.kind==="caret"?o.selection.blockId:o.selection.kind==="text"?o.selection.focus.blockId:o.selection.kind==="blocks"&&o.selection.blockIds[0]?o.selection.blockIds[0]:void 0);if(!l||!St(o.doc,l))return!1;const s=Nr(o.doc,l);if(!s||!e.registries.schema.get(s.type).nestable||In(o.doc,s.id)>=Br)return!1;const a=s.id,d=s.children.length,m=et();return m.moveBlock(l,a,d),an(o,m,e),m.setSelection(rt(l,0)),r==null||r(m.build()),!0}}}function Wl(e){return{name:"outdentBlock",run:n=>(o,r)=>{const l=(n==null?void 0:n.id)??(o.selection.kind==="caret"?o.selection.blockId:o.selection.kind==="text"?o.selection.focus.blockId:o.selection.kind==="blocks"&&o.selection.blockIds[0]?o.selection.blockIds[0]:void 0);if(!l||!St(o.doc,l))return!1;const s=Ot(o.doc,l);if(s===null)return!1;const c=Ot(o.doc,s),a=co(o.doc,s),d=a.indexOf(s),m=d===-1?a.length:d+1,f=et();return f.moveBlock(l,c,m),an(o,f,e),f.setSelection(rt(l,0)),r==null||r(f.build()),!0}}}function Qc(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 Gl(e,n){return e.length!==n.length?!1:e.every(o=>n.some(r=>Qc(o,r)))}function Jc(e){return{name:"toggleMark",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l||!e.registries.schema.hasInlineMarks(l.type)||e.registries.schema.isMarkDisallowed(l.type,n.markType))return!1;const i=Me(l.content),s=Math.max(0,Math.min(n.from,i.length)),c=Math.max(s,Math.min(n.to,i.length));if(s>=c)return!1;const a=[];let d=0;for(const w of l.content){if(w.type!=="text")continue;const S=(w.marks??[]).map(Q=>({...Q})),M=d,I=d+w.text.length,j=[M,I];s>M&&s<I&&j.push(s),c>M&&c<I&&j.push(c),j.sort((Q,U)=>Q-U);for(let Q=0;Q<j.length-1;Q++){const U=j[Q],F=j[Q+1];U>=F||a.push({text:w.text.slice(U-M,F-M),marks:S.map(ue=>({...ue}))})}d=I}let m=!0;d=0;for(const w of a){const S=d,M=d+w.text.length;if(M>s&&S<c&&!w.marks.some(I=>I.type===n.markType)){m=!1;break}d=M}const f=["bold","italic","underline","strikethrough","color","bgColor","link"];d=0;for(const w of a){const S=d,M=d+w.text.length;M>s&&S<c&&(m?w.marks=w.marks.filter(I=>I.type!==n.markType):n.markType==="code"?(w.marks=w.marks.filter(I=>!f.includes(I.type)),w.marks.some(I=>I.type==="code")||w.marks.push({type:"code"})):f.includes(n.markType)?!w.marks.some(I=>I.type==="code")&&!w.marks.some(I=>I.type===n.markType)&&w.marks.push({type:n.markType}):w.marks.some(I=>I.type===n.markType)||w.marks.push({type:n.markType})),d=M}const p=[];for(const w of a){if(w.text.length===0)continue;const S=p[p.length-1];S&&Gl(S.marks,w.marks)?S.text+=w.text:p.push({text:w.text,marks:[...w.marks]})}const u=p.map(w=>({type:"text",text:w.text,marks:w.marks.length>0?w.marks:void 0})),b=et();return b.setText(n.id,u),b.setMeta({addToHistory:!0}),r==null||r(b.build()),!0}}}function ql(e){return{name:"setInlineMark",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l||!e.registries.schema.hasInlineMarks(l.type))return!1;const i=Me(l.content),s=Math.max(0,Math.min(n.from,i.length)),c=Math.max(s,Math.min(n.to,i.length));if(s>=c)return!1;const a=[];let d=0;for(const u of l.content){if(u.type!=="text")continue;const b=(u.marks??[]).map(I=>({...I})),w=d,S=d+u.text.length,M=[w,S];s>w&&s<S&&M.push(s),c>w&&c<S&&M.push(c),M.sort((I,j)=>I-j);for(let I=0;I<M.length-1;I++){const j=M[I],Q=M[I+1];j>=Q||a.push({text:u.text.slice(j-w,Q-w),marks:[...b]})}d=S}d=0;for(const u of a){const b=d,w=d+u.text.length;if(w>s&&b<c){const S=u.marks.some(M=>M.type==="code");if(n.attrs!==null&&S){d=w;continue}n.attrs===null?u.marks=u.marks.filter(M=>M.type!==n.markType):(u.marks=u.marks.filter(M=>M.type!==n.markType),u.marks.push({type:n.markType,attrs:n.attrs}))}d=w}const m=[];for(const u of a){if(u.text.length===0)continue;const b=m[m.length-1];b&&Gl(b.marks,u.marks)?b.text+=u.text:m.push({text:u.text,marks:[...u.marks]})}const f=m.map(u=>({type:"text",text:u.text,marks:u.marks.length>0?u.marks:void 0})),p=et();return p.setText(n.id,f),p.setMeta({addToHistory:!0}),r==null||r(p.build()),!0}}}function ea(e){return{name:"setLink",run:n=>(o,r)=>{const l=St(o.doc,n.id);if(!l||!e.registries.schema.hasInlineMarks(l.type))return!1;const i=Me(l.content),s=Math.max(0,Math.min(n.from,i.length)),c=Math.max(s,Math.min(n.to,i.length));if(s>=c&&!n.text)return!1;const[a,d]=Ft(l.content,s),[,m]=Ft(d,c-s),p={type:"text",text:n.text??i.slice(s,c),marks:[{type:"link",attrs:{href:n.href}}]},u=[...a,p,...m],b=et();return b.setText(n.id,u),b.setMeta({addToHistory:!0}),r&&r(b.build()),!0}}}function ta(e){return{name:"unsetLink",run:n=>(o,r)=>{var f;const l=St(o.doc,n.id);if(!l||!e.registries.schema.hasInlineMarks(l.type))return!1;const i=Me(l.content),s=Math.max(0,Math.min(n.from,i.length)),c=Math.max(s,Math.min(n.to,i.length));if(s>=c)return!1;let a=!1,d=0;for(const p of l.content){if(p.type!=="text")continue;const u=d+p.text.length;if(u>s&&d<c&&((f=p.marks)!=null&&f.some(b=>b.type==="link"))){a=!0;break}d=u}return a?ql(e).run({id:n.id,markType:"link",attrs:null,from:s,to:c})(o,r):!1}}}function Yl(e){const n={registries:e};return[Xo(n),Rr(n),Bc(n),Rc(),Lc(),Lr(n),Kl(n),Oc(n),Dc(n),$c(),Pc(),Hc(),Uc(),zc(),Vc(),Fc(n),jo(n),Kc(n),Wc(n),Gc(n),qc(n),Yc(n),Zc(n),Xc(),jc(n),Wl(n),Jc(n),ql(n),ea(n),ta(n)]}const na=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform)?"Cmd":"Ctrl",oa={Esc:"Escape",Del:"Delete",Space:" ",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown"};function Zl(e){const n=[];e.ctrlKey&&n.push("Ctrl"),e.metaKey&&n.push("Cmd"),e.altKey&&n.push("Alt"),e.shiftKey&&n.push("Shift");let o=e.key;return o==="Meta"||o==="Control"?"":(o.length===1&&(o=o.toUpperCase()),o=oa[o]??o,n.push(o),n.join("-"))}function Xl(e,n){return e.replace(/\bMod\b/g,na).toLowerCase()===n.toLowerCase()}class jl{constructor(){_t(this,"bindings",[])}register(n){for(const o of n)this.bindings.push(o);this.bindings.sort((o,r)=>(o.priority??0)-(r.priority??0))}resolve(n){return this.bindings.find(o=>Xl(o.key,n))}}class Ql{constructor(){_t(this,"rules",[])}register(n){this.rules.push(n)}get all(){return this.rules}}class Jl{constructor(){_t(this,"commands",new Map)}register(n){if(this.commands.has(n.id))throw new Error(`BlockEditor: duplicate slash command "${n.id}"`);this.commands.set(n.id,n)}get all(){return[...this.commands.values()]}search(n){const o=n.trim().toLowerCase();return o?this.all.filter(r=>(r.title+" "+(r.keywords??[]).join(" ")).toLowerCase().includes(o)):this.all}}class ei{constructor(){_t(this,"toMarkdown",new Map);_t(this,"toHTML",new Map)}register(n,o){o.toMarkdown&&this.toMarkdown.set(n,o.toMarkdown),o.toHTML&&this.toHTML.set(n,o.toHTML)}markdownFor(n){var o;return(o=this.toMarkdown.get(n.type))==null?void 0:o(n)}htmlFor(n){var o;return(o=this.toHTML.get(n.type))==null?void 0:o(n)}}class ti{constructor(){_t(this,"fromMarkdown",[])}register(n){n.fromMarkdown&&this.fromMarkdown.push(n.fromMarkdown)}parseMarkdownLine(n){for(const o of this.fromMarkdown){const r=o(n);if(r)return r}return null}}function ra(e){var n;return((n=e.schema)==null?void 0:n.type)??null}class la{constructor(){_t(this,"map",new Map)}register(n,o){if(this.map.has(n))throw new Error(`BlockEditor: duplicate renderer for "${n}"`);this.map.set(n,o)}get(n){return this.map.get(n)}}class ia{constructor(){_t(this,"map",new Map)}register(n,o){const r=this.map.get(n)??[];this.map.set(n,[...r,...o])}get(n){return this.map.get(n)??[]}}const sa=Tr({type:"__fallback__",content:"text",nestable:!1});function ni(e){const n=new Map,o=r=>{if(r.uses)for(const l of r.uses)o(l);n.set(r.name,r)};for(const r of e)o(r);return[...n.values()]}function oi(e,n={}){const o=ni(e),r=new Map,l=new la,i=new Fl,s=new jl,c=new Ql,a=new Jl,d=new ia,m=new ei,f=new ti,p=[],u=[];for(const S of o){let M;if(S.schema){M=S.schema;const I=Tr(M);r.set(I.type,I)}if(S.renderer&&M&&l.register(M.type,S.renderer),S.commands)for(const I of S.commands)u.push(I);if(S.keymap&&s.register(S.keymap),S.inputRules)for(const I of S.inputRules)c.register(I);if(S.slashCommands)for(const I of S.slashCommands)a.register(I);if(S.toolbar&&M&&d.register(M.type,S.toolbar),S.serialize&&M&&m.register(M.type,S.serialize),S.deserialize&&f.register(S.deserialize),S.plugins)for(const I of S.plugins)p.push(I)}const b=n.defaultBlockType??"paragraph";return{schema:new Ll(r,sa),renderers:l,commands:i,keymap:s,inputRules:c,slash:a,toolbar:d,serializers:m,deserializers:f,plugins:p,extensionCommands:u,defaultBlockType:b}}class ri{constructor(n=500){_t(this,"undoStack",[]);_t(this,"redoStack",[]);_t(this,"limit");_t(this,"manualGroupStack",[]);_t(this,"groupCounter",0);this.limit=n}beginGroup(){const n=`g-${++this.groupCounter}`;return this.manualGroupStack.push(n),n}endGroup(){this.manualGroupStack.pop();const n=this.undoStack[this.undoStack.length-1];n&&n.open&&(n.open=!1)}get currentGroup(){const n=this.manualGroupStack;return n.length>0?n[n.length-1]:null}record(n,o,r){if(n.meta.addToHistory===!1||n.steps.length===0)return;const l={original:n.steps,inverse:Ul(n.steps,r),selectionBefore:o},i=this.currentGroup??n.meta.historyGroup??null,s=this.undoStack[this.undoStack.length-1];if(i!==null&&s&&s.open&&s.group===i)s.trs.push(l),s.selectionAfter=n.selectionAfter??o;else{const c={trs:[l],selectionAfter:n.selectionAfter??o,group:i,open:i!==null};this.undoStack.push(c),this.undoStack.length>this.limit&&this.undoStack.shift()}this.redoStack.length=0}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}reset(){this.undoStack.length=0,this.redoStack.length=0}undo(){const n=this.undoStack.pop();if(!n)return null;const o=[];for(let l=n.trs.length-1;l>=0;l--)o.push(...n.trs[l].inverse);const r=n.trs[0].selectionBefore;return this.redoStack.push({...n,open:!1}),et().setMeta({addToHistory:!1,source:"undo"}).setSelection(r).appendSteps(o).build()}redo(){const n=this.redoStack.pop();if(!n)return null;const o=[];for(const l of n.trs)o.push(...l.original);const r=n.selectionAfter;return this.undoStack.push({...n,open:!1}),et().setMeta({addToHistory:!1,source:"redo"}).setSelection(r).appendSteps(o).build()}}class li{constructor(n){_t(this,"registries");_t(this,"state");_t(this,"listeners",new Set);_t(this,"_history");_t(this,"commands");_t(this,"editable");_t(this,"focusBlockId",null);_t(this,"history");this.registries=oi(n.extensions,{defaultBlockType:n.defaultBlockType});for(const m of Yl(this.registries))this.registries.commands.register(m);for(const m of this.registries.extensionCommands)this.registries.commands.has(m.name)?this.registries.commands.override(m):this.registries.commands.register(m);const{doc:o}=xr(n.initialDocument??{blocks:[]}),r=o.root.length===0?this.seedEmptyDocument(o.id):o,l={},i=r.root[0]??null,s=n.initialSelection??(i?rt(i,0):{kind:"blocks",blockIds:[]}),c=Sr(r,s,l);for(const m of this.registries.plugins)m.init&&(l[m.name]=m.init(c));this.state=c,this._history=new ri(n.historyLimit);const a=this._history;this.history={canUndo:()=>a.canUndo(),canRedo:()=>a.canRedo(),beginGroup:()=>a.beginGroup(),endGroup:()=>a.endGroup()},this.editable=n.editable??!0,this.registries.commands.register({name:"undo",run:()=>(m,f)=>{if(!f)return this._history.canUndo();const p=this._history.undo();return p?(f(p),!0):!1}}),this.registries.commands.register({name:"redo",run:()=>(m,f)=>{if(!f)return this._history.canRedo();const p=this._history.redo();return p?(f(p),!0):!1}});const d=(m,f)=>{const p=this.registries.commands.get(m);return p?p.run(f)(this.state,u=>this.dispatch(u)):!1};this.commands=this.registries.commands.createProxy(d)}getState(){return this.state}toData(){return Dl(this.state.doc)}toMarkdown(){return ha(this.state.doc)}setDocFromMarkdown(n){this.adoptDoc(Ea(n))}setDocument(n){this.adoptDoc(xr(n).doc)}adoptDoc(n){const o=n.root.length===0?this.seedEmptyDocument(n.id):n,r=o.root[0]??null,l=r?rt(r,0):{kind:"blocks",blockIds:[]},i={},s=Sr(o,l,i);for(const c of this.registries.plugins)c.init&&(i[c.name]=c.init(s));this.state=s,this._history.reset(),this.notify({state:s,changed:new Set(_n(o)),removed:new Set})}dispatch(n){const o=this.state,r=Hl(o,n,this.registries.plugins);this.state=r.state,this._history.record(n,o.selection,o.doc),this.notify(r)}undo(){const n=this._history.undo();return n?(this.dispatch(n),!0):!1}redo(){const n=this._history.redo();return n?(this.dispatch(n),!0):!1}canUndo(){return this._history.canUndo()}canRedo(){return this._history.canRedo()}subscribe(n){return this.listeners.add(n),()=>this.listeners.delete(n)}notify(n){for(const o of this.listeners)o(n)}eventContext(){return{state:this.state,dispatch:n=>this.dispatch(n),focusBlockId:()=>this.focusBlockId}}handleKeyDown(n){var r;const o=this.eventContext();for(const l of this.registries.plugins)if((r=l.onKeyDown)!=null&&r.call(l,n,o))return!0;return!1}handleInput(n){var r;const o=this.eventContext();for(const l of this.registries.plugins)if((r=l.onInput)!=null&&r.call(l,n,o))return!0;return!1}handleCompositionStart(n){var r;const o=this.eventContext();for(const l of this.registries.plugins)(r=l.onCompositionStart)==null||r.call(l,n,o)}handleCompositionEnd(n){var r;const o=this.eventContext();for(const l of this.registries.plugins)(r=l.onCompositionEnd)==null||r.call(l,n,o)}destroy(){var n;for(const o of this.registries.plugins)(n=o.onDestroy)==null||n.call(o);this.listeners.clear()}seedEmptyDocument(n){const o=so(),r=this.registries.defaultBlockType,l={id:o,type:r,attrs:this.registries.schema.defaultAttrsFor(r),content:[],children:[]};return{id:n,root:[o],blocks:new Map([[o,l]]),parent:new Map([[o,null]])}}}const ca=/([\\`*_[\]])/g;function aa(e){return e.replace(ca,"\\$1")}function Io(e,n){var o;return!!((o=e.marks)!=null&&o.some(r=>r.type===n))}function ii(e){var o;let n="";for(const r of e){if(r.type!=="text")continue;const l=r.text;if(l.length===0)continue;const i=r.marks??[];let s=Io(r,"code")?`\`${l}\``:aa(l);Io(r,"bold")&&(s=`**${s}**`),Io(r,"italic")&&(s=`*${s}*`),Io(r,"strikethrough")&&(s=`~~${s}~~`),Io(r,"underline")&&(s=`++${s}++`);const c=i.find(d=>d.type==="link"),a=typeof((o=c==null?void 0:c.attrs)==null?void 0:o.href)=="string"?c.attrs.href:void 0;a&&(s=`[${s}](${a})`),n+=s}return n}function Bo(e){const n=[];let o=0,r="";const l=()=>{r.length>0&&(n.push({type:"text",text:r}),r="")};for(;o<e.length;){const i=e[o];if(i==="\\"&&o+1<e.length){r+=e[o+1],o+=2;continue}if(i==="["){const c=e.indexOf("]",o+1);if(c!==-1&&e.charAt(c+1)==="("){const a=e.indexOf(")",c+2);if(a!==-1){const d=e.slice(o+1,c),m=e.slice(c+2,a);if(m.length>0){l(),n.push({type:"link",text:d,href:m}),o=a+1;continue}}}}if(i==="`"){const c=e.indexOf("`",o+1);if(c!==-1){l(),n.push({type:"code",text:e.slice(o+1,c)}),o=c+1;continue}}const s=e.startsWith("***",o)?"***":e.startsWith("___",o)?"___":null;if(s){const c=e.indexOf(s,o+3);if(c!==-1){l(),n.push({type:"italic",text:`**${e.slice(o+3,c)}**`}),o=c+3;continue}}if(e.startsWith("**",o)||e.startsWith("__",o)){const c=e.charAt(o+1),a=e.indexOf(c+c,o+2);if(a!==-1){l(),n.push({type:"bold",text:e.slice(o+2,a)}),o=a+2;continue}}if(e.startsWith("~~",o)){const c=e.indexOf("~~",o+2);if(c!==-1){l(),n.push({type:"strikethrough",text:e.slice(o+2,c)}),o=c+2;continue}}if(e.startsWith("++",o)){const c=e.indexOf("++",o+2);if(c!==-1){l(),n.push({type:"underline",text:e.slice(o+2,c)}),o=c+2;continue}}if((i==="*"||i==="_")&&!(e.charAt(o+1)===i&&o+1<e.length)){const c=e.indexOf(i,o+1);if(c!==-1){l(),n.push({type:"italic",text:e.slice(o+1,c)}),o=c+1;continue}}r+=i,o+=1}return l(),n}function da(e,n){if(e===void 0&&n===void 0)return!0;if(e===void 0||n===void 0)return!1;const o=Object.keys(e),r=Object.keys(n);return o.length!==r.length?!1:o.every(l=>e[l]===n[l])}function ua(e,n){return e.length!==n.length?!1:e.every((o,r)=>o.type===n[r].type&&da(o.attrs,n[r].attrs))}function Zn(e){const n=[],o=(l,i)=>{if(l.length===0&&i.length===0)return;const s=n[n.length-1];if(s&&ua(s.marks??[],i)){n[n.length-1]={...s,text:s.text+l};return}n.push({type:"text",text:l,marks:i.length>0?[...i]:void 0})},r=(l,i)=>{for(const s of l)s.type==="text"?o(s.text,i):s.type==="link"?o(s.text,[...i,{type:"link",attrs:{href:s.href??""}}]):s.type==="code"?o(s.text,[...i,{type:"code"}]):s.type==="bold"?r(Bo(s.text),[...i,{type:"bold"}]):s.type==="italic"?r(Bo(s.text),[...i,{type:"italic"}]):s.type==="strikethrough"?r(Bo(s.text),[...i,{type:"strikethrough"}]):s.type==="underline"&&r(Bo(s.text),[...i,{type:"underline"}])};return r(Bo(e),[]),n}function fa(e){return e.content.reduce((n,o)=>o.type==="text"?n+o.text:n,"")}function ma(e){const n=typeof e.rows=="number"?e.rows:0,o=typeof e.cols=="number"?e.cols:0,r=Array.isArray(e.cells)&&e.cells.length>0?e.cells:[],l=e.headerRow===!0;if(n===0||o===0)return[];const i=(m,f)=>{const p=r[m],u=p==null?void 0:p[f];return!u||u.covered?"":pa(ii(u.content??[]))},s=Array.from({length:o},(m,f)=>i(0,f)),c=Array.from({length:o},()=>"---"),a=[],d=l?1:0;for(let m=d;m<n;m++)a.push(`| ${Array.from({length:o},(f,p)=>i(m,p)).join(" | ")} |`);return[`| ${s.join(" | ")} |`,`| ${c.join(" | ")} |`,...a]}function pa(e){return e.replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>")}function si(e){return e==="bulletList"||e==="orderedList"||e==="todoList"}function ci(e,n,o){var d,m,f,p;const r=e.blocks.get(n);if(!r)return[];const l=In(e,n),i=" ".repeat(l*2),s=u=>ii(u.content);let c=[];switch(r.type){case"heading":{const u=typeof((d=r.attrs)==null?void 0:d.level)=="number"?r.attrs.level:1,b=Math.max(1,Math.min(6,u));c=[`${i}${"#".repeat(b)} ${s(r)}`];break}case"quote":{const u=s(r);u.length>0&&(c=u.split(`
|
|
2
|
+
`).map(b=>`${i}> ${b}`));break}case"codeBlock":{const u=typeof((m=r.attrs)==null?void 0:m.language)=="string"&&r.attrs.language?r.attrs.language:"",b=fa(r),w=b.includes("```")?"````":"```";c=[`${i}${w}${u}`,...b.split(`
|
|
3
|
+
`).map(S=>`${i}${S}`),`${i}${w}`];break}case"bulletList":{c=[`${i}- ${s(r)}`];break}case"orderedList":{const u=typeof((f=r.attrs)==null?void 0:f.startNumber)=="number"?r.attrs.startNumber:1;c=[`${i}${u}. ${s(r)}`];break}case"todoList":{const u=((p=r.attrs)==null?void 0:p.checked)===!0;c=[`${i}- ${u?"[x]":"[ ]"} ${s(r)}`];break}case"divider":{c=[`${i}---`];break}case"image":{const u=r.attrs??{},b=typeof u.src=="string"?u.src:"";if(!b)break;const w=typeof u.alt=="string"?u.alt:"",S=typeof u.title=="string"?u.title:"",M=typeof u.caption=="string"?u.caption:"",I=S?``:``;c=M?[`${i}${I}`,`${i}*${M}*`]:[`${i}${I}`];break}case"table":{c=ma(r.attrs??{});break}case"tableOfContents":{c=[];break}default:{const u=s(r);u.length>0&&(c=[`${i}${u}`]);break}}const a=[];c.length>0&&a.push({lines:c,level:l,type:r.type});for(const u of r.children)a.push(...ci(e,u));return a}function ha(e){const n=[];for(const l of e.root)n.push(...ci(e,l));const o=[];for(let l=0;l<n.length;l++){const i=n[l];if(l>0){const s=n[l-1];!ga(s,i)&&o.push("")}for(const s of i.lines)o.push(s)}const r=[];for(const l of o)l===""&&(r.length===0||r[r.length-1]==="")||r.push(l);return r.join(`
|
|
4
|
+
`)}function ga(e,n){return e.level!==n.level?!0:si(e.type)&&si(n.type)&&e.type===n.type}function ba(e){const n=/^(#{1,6})\s+(.*)$/.exec(e);if(n)return{type:"heading",attrs:{level:n[1].length},content:Zn(n[2])};const o=/^>\s?(.*)$/.exec(e);if(o)return{type:"quote",content:Zn(o[1]??"")};const r=/^[-*+]\s+\[([ xX])\]\s+(.*)$/.exec(e);if(r)return{type:"todoList",attrs:{checked:r[1].toLowerCase()==="x"},content:Zn(r[2])};const l=/^(\d+)\.\s+(.*)$/.exec(e);if(l)return{type:"orderedList",attrs:{startNumber:Number(l[1])},content:Zn(l[2])};const i=/^[-*+]\s+(.*)$/.exec(e);if(i)return{type:"bulletList",content:Zn(i[1])};if(/^-{3,}$/.test(e)||/^\*{3,}$/.test(e)||/^_{3,}$/.test(e))return{type:"divider"};const s=/^!\[([^\]]*)\]\((\S+?)(?:\s+"([^"]*)")?\)$/.exec(e.trim());if(s){const c={src:s[2]??"",alt:s[1]??""};return s[3]&&(c.title=s[3]),{type:"image",attrs:c}}return e.trim().length===0?null:{type:"paragraph",content:Zn(e)}}function ka(e){const n=e.replace(/\r\n/g,`
|
|
5
|
+
`).split(`
|
|
6
|
+
`),o=[];let r=[],l=0;const i=()=>{r.length>0&&o.push({kind:"lines",lines:r}),r=[]};for(;l<n.length;){const s=n[l]??"",c=/^(\s*)(```+|~~~+)\s*(\S*)\s*$/.exec(s);if(c){i();const a=c[2][0],d=c[3]??"",m=[];for(l+=1;l<n.length;){const f=n[l];if(new RegExp(`^\\s*${a}{3,}\\s*$`).test(f))break;m.push(f),l+=1}o.push({kind:"fence",lang:d,body:m}),l+=1;continue}if(s.includes("|")&&l+1<n.length&&/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)+\|?\s*$/.test(n[l+1]??"")){i();const a=[s,n[l+1]];for(l+=2;l<n.length&&(n[l]??"").includes("|");)a.push(n[l]),l+=1;o.push({kind:"table",lines:a});continue}r.push(s),l+=1}return i(),o}function ya(e){const n=c=>c.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(d=>d.trim()),o=n(e[0]??""),r=e.slice(2).map(c=>n(c)),l=Math.max(o.length,...r.map(c=>c.length)),i=r.length+1,s=[];for(let c=0;c<i;c++){const a=[],d=c===0?o:r[c-1]??[];for(let m=0;m<l;m++)a.push({content:Zn(wa(d[m]??"")),covered:!1});s.push(a)}return{type:"table",attrs:{cells:s,rows:i,cols:l,headerRow:!0,colWidths:[]}}}function wa(e){return e.replace(/<br>/gi,`
|
|
7
|
+
`).replace(/\\\|/g,"|").replace(/\\\\/g,"\\")}function Ea(e){const n=[],o=ka(e);for(const f of o){if(f.kind==="fence"){n.push({indent:0,block:{type:"codeBlock",attrs:f.lang?{language:f.lang}:void 0,content:[{type:"text",text:f.body.join(`
|
|
8
|
+
`)}]}});continue}if(f.kind==="table"){n.push({indent:0,block:ya(f.lines)});continue}const p=[];let u=!1;for(const b of f.lines){if(b.trim().length===0){u=!0;continue}const w=b.length-b.trimStart().length,S=ba(b.trim());if(!S){u=!1;continue}p.push({indent:w,block:S,blankBefore:u}),u=!1}for(const b of p){const w=n[n.length-1];if(w&&!b.blankBefore&&w.indent===b.indent&&w.block.type===b.block.type&&(b.block.type==="quote"||b.block.type==="paragraph")){const S=w.block.content??[],M=b.block.content??[];n[n.length-1]={indent:w.indent,block:{type:w.block.type,...w.block.attrs?{attrs:w.block.attrs}:{},content:[...S,{type:"text",text:`
|
|
9
|
+
`},...M]}}}else n.push({indent:b.indent,block:b.block})}}const r=new Map,l=new Map,i=[],s=[],c=new Set(["paragraph","heading","bulletList","orderedList","todoList"]),a=10,d=(f,p,u)=>{if(r.set(p,u),l.set(p,f),f===null){i.push(p);return}const b=r.get(f);if(!b){i.push(p),l.set(p,null);return}r.set(f,{...b,children:[...b.children,p]})};for(const f of n){const p=so(),u=c.has(f.block.type);let b=Math.floor(f.indent/2);for(b<0&&(b=0),b>a&&(b=a);s.length>0&&s[s.length-1].indent>=b;)s.pop();const w=s.length>0?s[s.length-1].id:null,S={...f.block.attrs??{}},M={id:p,type:f.block.type,attrs:S,content:f.block.content??[],children:[]};d(w,p,M),u&&s.push({indent:b,id:p})}const m=10;for(const[f,p]of r){let u=0,b=l.get(f);const w=new Set;for(;b!=null&&!w.has(b);)w.add(b),u++,b=l.get(b);if(u=Math.min(m,u),(typeof p.attrs.indent=="number"?p.attrs.indent:0)===u)continue;const{indent:M,...I}=p.attrs,j=u>0?{...I,indent:u}:I;r.set(f,{...p,attrs:j})}return{id:"doc_"+Math.random().toString(36).slice(2,10),root:i,blocks:r,parent:l}}const ai=Symbol("block-editor-mobile"),Or=Symbol("block-editor-mobile-toolbar-bridge"),Dr=Symbol("block-editor"),di=Symbol("block-editor-editable"),ui=Symbol("block-editor-image-upload");function dn(){const e=t.inject(Dr);if(!e)throw new Error("useEditor(): must be called within a <BlockEditor> component tree");return e}function va(){return t.inject(ui,null)}function Kn(){return t.inject(di)??t.ref(!0)}function Ca(e,n){const o=Zl(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 _a=e=>`[data-block-id="${CSS.escape(e)}"]`;function Ro(e,n){const o=_a(n),r=e.querySelector(`${o}[contenteditable], ${o} [contenteditable]`);return r||e.querySelector(o)}function Ta(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 fi(e,n){const o=window.getSelection();if(!o||o.rangeCount===0)return null;const r=o.getRangeAt(0).endContainer,l=Qo(r,e);if(!l)return null;const i=l.dataset.blockId;if(!i)return null;const s=Ta(l),c=n.blocks.get(i);if(!c)return null;const a=Me(c.content).length,d=Math.min(s,a);if(!o.isCollapsed&&o.anchorNode===o.focusNode&&Qo(o.anchorNode,e)===l){const f=Math.min(o.anchorOffset,a);return{kind:"text",anchor:{blockId:i,offset:f},focus:{blockId:i,offset:d}}}return rt(i,d)}function Qo(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 xa(e,n,o){const r=document.createRange();r.selectNodeContents(e);try{r.setEnd(n,o)}catch{return 0}return r.toString().length}function mi(e,n,o){const r=pi(e,n),l=pi(e,o);if(!r||!l)return null;try{const i=document.createRange();return i.setStart(r.node,r.offset),i.setEnd(l.node,l.offset),i}catch{return null}}function pi(e,n){let o=0;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let l=null;for(;r.nextNode();){const i=r.currentNode;l=i;const s=(i.nodeValue??"").length;if(o+s>=n)return{node:i,offset:Math.max(0,n-o)};o+=s}return l?{node:l,offset:(l.nodeValue??"").length}:{node:e,offset:0}}function Jo(e,n,o,r){let l=null;const i=document;if(typeof i.caretRangeFromPoint=="function")l=i.caretRangeFromPoint(e,n);else if(typeof i.caretPositionFromPoint=="function"){const s=i.caretPositionFromPoint(e,n);s&&(l=document.createRange(),l.setStart(s.offsetNode,s.offset),l.collapse(!0))}if(l){const s=Qo(l.startContainer,o);if(s){const c=s.dataset.blockId;if(c){const a=r.blocks.get(c);if(a){const d=Me(a.content).length,m=Math.min(xa(s,l.startContainer,l.startOffset),d);return{blockEl:s,blockId:c,offset:m}}}}}return Ma(e,n,o,r)}function Ma(e,n,o,r){const l=document.elementFromPoint(e,n),i=l?Qo(l,o):null;if(!i)return null;const s=i.dataset.blockId;if(!s)return null;const c=r.blocks.get(s);if(!c)return null;const a=i.matches("[contenteditable]")?i:i.querySelector("[contenteditable]");if(!a)return null;const d=Me(c.content).length;let m=null,f=0;const p=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);let u;for(;u=p.nextNode();){const b=u,w=(b.nodeValue??"").length;if(w===0)continue;const S=document.createRange();S.setStart(b,0),S.setEnd(b,w);const M=S.getBoundingClientRect();if(M.width<=0&&M.height<=0)continue;const I=Math.max(M.left,Math.min(e,M.right)),j=Math.max(M.top,Math.min(n,M.bottom)),Q=Math.hypot(e-I,n-j),U=M.width>0?Math.round((e-M.left)/M.width*w):0,F=f+Math.max(0,Math.min(w,U));(!m||Q<m.dist)&&(m={offset:F,dist:Q}),f+=w}return m?{blockEl:i,blockId:s,offset:Math.min(m.offset,d)}:{blockEl:i,blockId:s,offset:0}}function $r(e,n){const o=document.createRange(),r=window.getSelection();if(!r)return;let l=0,i=!1;const s=c=>{var a;if(!i)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),i=!0),l+=d}else for(const d of c.childNodes)s(d)};s(e),i||(o.selectNodeContents(e),o.collapse(!1)),r.removeAllRanges(),r.addRange(o)}function hi(e,n){if(uo(n)){const r=Ro(e,n.blockId);if(!r)return;r.focus(),$r(r,n.offset);return}if(Fn(n)&&n.anchor.blockId===n.focus.blockId){const r=Ro(e,n.focus.blockId);if(!r)return;if(r.focus(),n.anchor.offset===n.focus.offset)$r(r,n.focus.offset);else{const l=Math.min(n.anchor.offset,n.focus.offset),i=Math.max(n.anchor.offset,n.focus.offset),s=mi(r,l,i),c=window.getSelection();s&&c?(c.removeAllRanges(),c.addRange(s)):$r(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 Pr(e,n,o){if(o.anchor.blockId===o.focus.blockId)return[];const r=_n(n),l=r.indexOf(o.anchor.blockId),i=r.indexOf(o.focus.blockId);if(l===-1||i===-1)return[];const[s,c]=l<=i?[o.anchor.blockId,o.focus.blockId,l<i]:[o.focus.blockId,o.anchor.blockId,l>i],a=r.indexOf(s),d=r.indexOf(c);if(a===-1||d===-1)return[];const m=[];for(let f=a;f<=d;f++){const p=r[f],u=n.blocks.get(p);if(!u)continue;const b=Ro(e,p);if(!b)continue;const w=Me(u.content).length;let S=0,M=w;if(f===a){const j=s===o.anchor.blockId?o.anchor.offset:o.focus.offset;S=Math.min(j,w)}if(f===d){const j=c===o.anchor.blockId?o.anchor.offset:o.focus.offset;M=Math.min(j,w)}const I=mi(b,S,Math.max(S,M));if(I)for(const j of I.getClientRects())j.width>0&&j.height>0&&m.push(j)}return m}function Na(e){var i;const{registry:n,blockId:o,text:r,editor:l}=e;for(const s of n.all){const c=s.pattern.exec(r);if(!c)continue;const a=(i=s.args)==null?void 0:i.call(s,c),d=a&&typeof a=="object"?a:{},m={...d};m.id==="__currentBlock__"&&(m.id=o);const f=typeof d.__stripPrefix=="number"?d.__stripPrefix:0,p=l.commands[s.command];if(p){l.history.beginGroup();try{if(f>0){const u=r.slice(f),b=l.commands.setText;b&&b({id:o,content:Un(u)})}p(m)}finally{l.history.endGroup()}return!0}}return!1}function Sa(e){return e.includes("/")?e.startsWith("/")||/^\s*\/\S*/.test(e):!1}const Aa=["http:","https:","mailto:","tel:"],Ia=["javascript:","vbscript:","data:","file:"];function Rn(e){const n=e.trim();if(!n)return null;const o=n.toLowerCase();for(const i of Ia)if(o.startsWith(i))return null;const r=n.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);if(r){const i=r[1].toLowerCase()+":";return Aa.includes(i)?n:null}const l=n[0];return l==="/"||l==="."||l==="#"||n.startsWith("//")||Hr(n)?n:null}function Hr(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 Xn(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(/^@/,"")}`:Hr(n)&&!n.startsWith("/")?`https://${n}`:n:""}const Lo=/(^|\s)((?:https?:\/\/|www\.)[^\s<]+|[\w-]+(?:\.[\w-]+)+\.[a-zA-Z]{2,}(?::\d+)?(?:\/[^\s<]*)?)/g;function er(e){var r,l;let n=!1;const o=[];for(const i of e){if(i.type!=="text"){o.push(i);continue}const s=(r=i.marks)==null?void 0:r.some(u=>u.type==="link"),c=(l=i.marks)==null?void 0:l.some(u=>u.type==="code");if(s||c){o.push(i);continue}const a=i.text,d=i.marks??[];if(Lo.lastIndex=0,!Lo.exec(a)){o.push(i);continue}n=!0;let f=0;Lo.lastIndex=0;let p;for(;(p=Lo.exec(a))!==null;){const u=p[0],b=p[2],w=p.index+u.length-b.length,S=w+b.length;if(w>f){const j=a.slice(f,w);j.length>0&&o.push({type:"text",text:j,marks:d.length>0?[...d]:void 0})}const M=Xn(b),I=Rn(M);if(I){const j={type:"link",attrs:{href:I}};o.push({type:"text",text:b,marks:[...d,j]})}else o.push({type:"text",text:b,marks:d.length>0?[...d]:void 0});f=S}if(f<a.length){const u=a.slice(f);u.length>0&&o.push({type:"text",text:u,marks:d.length>0?[...d]:void 0})}Lo.lastIndex=0}return n?o:e}const Ba={bold:["b","strong"],italic:["i","em"],underline:["u"],strikethrough:["s","strike","del"],code:["code"],link:["a"]},gi={};for(const[e,n]of Object.entries(Ba))for(const o of n)gi[o]=e;const Ra="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 La(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Oa(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function bi(e){return e.some(n=>n.type==="text"&&n.marks&&n.marks.length>0)}function Wn(e){return e.length===0?"":e.map(n=>{var m,f,p;if(n.type!=="text")return"";let o=La(n.text);const r=n.marks??[],l=r.find(u=>u.type==="color"),i=(m=l==null?void 0:l.attrs)==null?void 0:m.color;typeof i=="string"&&(o=`<span class="be-color-${i}">${o}</span>`);const s=r.find(u=>u.type==="bgColor"),c=(f=s==null?void 0:s.attrs)==null?void 0:f.bgColor;typeof c=="string"&&(o=`<span class="be-bg-${c}">${o}</span>`),r.some(u=>u.type==="strikethrough")&&(o=`<s>${o}</s>`),r.some(u=>u.type==="underline")&&(o=`<u>${o}</u>`),r.some(u=>u.type==="italic")&&(o=`<i>${o}</i>`),r.some(u=>u.type==="bold")&&(o=`<b>${o}</b>`),r.some(u=>u.type==="code")&&(o=`<code>${o}</code>`);const a=r.find(u=>u.type==="link"),d=(p=a==null?void 0:a.attrs)==null?void 0:p.href;if(typeof d=="string"){const u=Rn(d);u&&(o=`<a href="${Oa(u)}" target="_blank" rel="noopener noreferrer">${o}</a>`)}return o}).join("")}function Da(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 un(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 i=r,s=i.tagName.toLowerCase();if(s==="br")return;const c=gi[s];let a=l;if(c==="link"){const d=i.getAttribute("href")??"",m=Rn(d);m?a=[...l,{type:"link",attrs:{href:m}}]:a=l}else if(c)a=[...l,{type:c}];else if(s==="span"){const d=Da(i);d.length>0&&(a=[...l,...d])}for(const d of i.childNodes)o(d,a)}return o(e,[]),Ha(n)}function $a(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 Pa(e,n){return!e&&!n?!0:!e||!n||e.length!==n.length?!1:e.every(o=>n.some(r=>$a(o,r)))}function Ha(e){const n=[];for(const o of e){const r=n[n.length-1];r&&Pa(r.marks,o.marks)?n[n.length-1]={type:"text",text:r.text+o.text,marks:r.marks}:n.push({...o})}return n}function Va(e){return e.attrs?Object.entries(e.attrs).sort((n,o)=>n[0].localeCompare(o[0])).map(([n,o])=>`${n}=${String(o)}`).join(";"):""}function ki(e){return e.map(n=>n.type==="text"?`${n.text}\0${(n.marks??[]).map(o=>`${o.type}:${Va(o)}`).sort().join(",")}`:"").join("")}const Vr=["paragraph","heading","heading1","heading2","heading3","heading4","heading5","heading6","bulletList","orderedList","todoList","quote","codeBlock"],Oo=["todoList"],Do=["orderedList"],Ur=["left","center","right"],zr=["top","middle","bottom"],Fr=["gray","brown","orange","yellow","green","blue","purple","pink","red"],Kr=["bold","italic","underline","strikethrough","color","bgColor","link"],Ua=["bold","italic","underline","strikethrough","code","link","color","bgColor"];function jn(){return{content:[],rowspan:1,colspan:1,covered:!1}}function fo(e,n){const o=n==="codeBlock",r=n==="quote",l=[];for(const i of e){if(i.type!=="text"){l.push({...i});continue}if(o){l.push({type:"text",text:i.text});continue}let s=i.marks?i.marks.filter(c=>Ua.includes(c.type)):void 0;s&&s.some(c=>c.type==="code")&&(s=s.filter(c=>c.type==="code"||!Kr.includes(c.type))),r&&s&&(s=s.filter(c=>c.type!=="italic")),s&&(s=s.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:Rn(a)!==null})),s&&s.length===0&&(s=void 0),l.push(s?{...i,marks:s}:{type:"text",text:i.text})}return l}function gn(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 Ln(e,n,o,r,l){var m,f,p;let i=Math.max(0,Math.min(n,r)),s=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 u=i;u<=s;u++)for(let b=c;b<=a;b++){const w=(m=e.cells[u])==null?void 0:m[b];if(!w)continue;let S=u,M=b;if(w.covered){let U=!1;for(let F=u;F>=0&&!U;F--)for(let ue=b;ue>=0&&!U;ue--){const J=(f=e.cells[F])==null?void 0:f[ue];!J||J.covered||F+Math.max(1,J.rowspan)>u&&ue+Math.max(1,J.colspan)>b&&(S=F,M=ue,U=!0)}if(!U)continue}const I=(p=e.cells[S])==null?void 0:p[M];if(!I||I.covered)continue;const j=S+Math.max(1,I.rowspan)-1,Q=M+Math.max(1,I.colspan)-1;i>S&&(i=S,d=!0),s<j&&(s=j,d=!0),c>M&&(c=M,d=!0),a<Q&&(a=Q,d=!0)}}return{r1:i,c1:c,r2:s,c2:a}}function yi(e,n,o,r,l){var d;const i=Math.max(0,Math.min(n,r)),s=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 m=i;m<=s;m++)for(let f=c;f<=a;f++){const p=(d=e.cells[m])==null?void 0:d[f];if(!(!p||p.covered)&&(p.rowspan>1||p.colspan>1))return!0}return!1}function za(e,n,o,r,l){var m;const i=Math.max(0,Math.min(n,r)),s=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 f=i;f<=s;f++)for(let p=c;p<=a;p++){const u=(m=e.cells[f])==null?void 0:m[p];u&&!u.covered&&(d+=1)}return d}function mo(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 Fa(e,n){const o=[];for(let r=0;r<e;r++){const l=[];for(let i=0;i<n;i++)l.push(jn());o.push(l)}return o}function $o(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 i=[];const s=e.colWidths;if(Array.isArray(s))for(const m of s)i.push(typeof m=="number"&&Number.isFinite(m)&&m>=0?m:0);for(;i.length<l;)i.push(0);i.length>l&&(i=i.slice(0,l));const c=typeof e.headerRow=="boolean"?e.headerRow:!1;let a=[];const d=e.cells;if(Array.isArray(d))for(let m=0;m<r;m++){const f=d[m],p=[];if(Array.isArray(f))for(let u=0;u<l;u++){const b=f[u];p.push(Ka(b))}else for(let u=0;u<l;u++)p.push(jn());a.push(p)}for(;a.length<r;){const m=[];for(let f=0;f<l;f++)m.push(jn());a.push(m)}return a.length>r&&(a=a.slice(0,r)),a=On(a,r,l),{rows:r,cols:l,cells:a,colWidths:i,headerRow:c}}function Ka(e){if(!e||typeof e!="object")return jn();const n=e,o=Array.isArray(n.content)?n.content:[],r=typeof n.cellType=="string"?n.cellType:void 0,l=r&&Vr.includes(r)?r:void 0,i=fo(o,l),s=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,m=d&&Ur.includes(d)?d:void 0,f=typeof n.verticalAlign=="string"?n.verticalAlign:void 0,p=f&&zr.includes(f)?f:void 0,u=typeof n.bgColor=="string"?n.bgColor:void 0,b=u&&Fr.includes(u)?u:void 0,w=typeof n.checked=="boolean"?n.checked:!1,S=l&&Oo.includes(l)?w:void 0,M=typeof n.startNumber=="number"&&Number.isInteger(n.startNumber)&&n.startNumber>=1?n.startNumber:void 0,I=l&&Do.includes(l)?M:void 0;return{content:i,rowspan:s,colspan:c,covered:a,cellType:l,align:m,verticalAlign:p,bgColor:b,checked:S,startNumber:I}}function On(e,n,o){const r=e.map(l=>l.map(gn));for(let l=0;l<n;l++)for(let i=0;i<o;i++){const s=r[l][i];if(s.covered)continue;const c=Math.max(1,Math.min(s.rowspan,n-l)),a=Math.max(1,Math.min(s.colspan,o-i));if(s.rowspan=c,s.colspan=a,!(c===1&&a===1))for(let d=l;d<l+c;d++)for(let m=i;m<i+a;m++)d===l&&m===i||(r[d][m]={content:[],rowspan:1,colspan:1,covered:!0})}return r.map(l=>l.map(mo))}function wi(e,n){var f,p;const{rows:o,cols:r,cells:l,colWidths:i,headerRow:s}=e,c=Math.max(0,Math.min(n,o)),a=l.map(u=>u.map(gn)),d=[];for(let u=0;u<r;u++){if(c>0){const b=(f=a[c-1])==null?void 0:f[u];if(b&&!b.covered&&c-1+b.rowspan>c){d.push({content:[],rowspan:1,colspan:1,covered:!0});continue}}d.push(jn())}if(a.splice(c,0,d),c>0)for(let u=0;u<r;u++){const b=(p=a[c-1])==null?void 0:p[u];b&&!b.covered&&c-1+b.rowspan>c&&(b.rowspan=b.rowspan+1)}const m=On(a,o+1,r);return{rows:o+1,cols:r,cells:m,colWidths:[...i],headerRow:s}}function Wa(e,n){var m;const{rows:o,cols:r,colWidths:l,headerRow:i}=e;if(o<=1)return e;const s=Math.max(0,Math.min(n,o-1)),c=e.cells.map(f=>f.map(gn));for(let f=0;f<r;f++)for(let p=0;p<s;p++){const u=(m=c[p])==null?void 0:m[f];if(!u||u.covered)continue;p+u.rowspan>s&&(u.rowspan=Math.max(1,u.rowspan-1))}c.splice(s,1);let a=i;i&&s===0&&(a=!1);const d=On(c,o-1,r);return{rows:o-1,cols:r,cells:d,colWidths:[...l],headerRow:a}}function Ga(e,n){const{rows:o,cols:r,cells:l,colWidths:i,headerRow:s}=e,c=Math.max(0,Math.min(n,r)),a=l.map(u=>u.map(gn));for(let u=0;u<o;u++){let b=!1;if(c>0){const w=a[u][c-1];w&&!w.covered&&c-1+w.colspan>c&&(w.colspan=w.colspan+1,b=!0)}a[u].splice(c,0,b?{content:[],rowspan:1,colspan:1,covered:!0}:jn())}const d=[...i],m=d.filter(u=>u>0),f=m.length>0?Math.round(m.reduce((u,b)=>u+b,0)/m.length):120;d.splice(c,0,f);const p=On(a,o,r+1);return{rows:o,cols:r+1,cells:p,colWidths:d,headerRow:s}}function qa(e,n){const{rows:o,cols:r,cells:l,headerRow:i}=e;if(r<=1)return e;const s=Math.max(0,Math.min(n,r-1)),c=l.map(m=>m.map(gn));for(let m=0;m<o;m++){for(let f=0;f<s;f++){const p=c[m][f];if(!p||p.covered)continue;f+p.colspan>s&&(p.colspan=Math.max(1,p.colspan-1))}c[m].splice(s,1)}const a=[...e.colWidths];a.splice(s,1);const d=On(c,o,r-1);return{rows:o,cols:r-1,cells:d,colWidths:a,headerRow:i}}function Po(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 i=fo(r,l.cellType),s=e.cells.map((a,d)=>a.map((m,f)=>d===n&&f===o?mo({...gn(m),content:i}):m));return{...e,cells:s}}function Ho(e,n,o,r){var s;if(n<0||n>=e.rows||o<0||o>=e.cols)return e;const l=(s=e.cells[n])==null?void 0:s[o];if(!l||l.covered)return e;const i=e.cells.map((c,a)=>c.map((d,m)=>{if(a!==n||m!==o)return d;const f=gn(d);return r.cellType!==void 0&&(f.cellType=r.cellType==="paragraph"?void 0:Vr.includes(r.cellType)?r.cellType:void 0,f.content=fo(f.content,f.cellType),(!f.cellType||!Oo.includes(f.cellType))&&(f.checked=void 0),(!f.cellType||!Do.includes(f.cellType))&&(f.startNumber=void 0)),r.align!==void 0&&(f.align=r.align==="left"?void 0:Ur.includes(r.align)?r.align:void 0),r.verticalAlign!==void 0&&(f.verticalAlign=r.verticalAlign==="middle"?void 0:zr.includes(r.verticalAlign)?r.verticalAlign:void 0),r.bgColor!==void 0&&(f.bgColor=r.bgColor==="default"?void 0:Fr.includes(r.bgColor)?r.bgColor:void 0),r.checked!==void 0&&(f.checked=f.cellType&&Oo.includes(f.cellType)?r.checked:void 0),r.startNumber!==void 0&&(r.startNumber===null?f.startNumber=void 0:f.startNumber=f.cellType&&Do.includes(f.cellType)&&typeof r.startNumber=="number"&&Number.isInteger(r.startNumber)&&r.startNumber>=1?r.startNumber:void 0),mo(f)}));return{...e,cells:i}}function Qn(e,n,o){const r=new Set(n.map(i=>`${i.row}-${i.col}`)),l=e.cells.map((i,s)=>i.map((c,a)=>{if(!r.has(`${s}-${a}`)||c.covered)return c;const d=gn(c);return o.cellType!==void 0&&(d.cellType=o.cellType==="paragraph"?void 0:Vr.includes(o.cellType)?o.cellType:void 0,d.content=fo(d.content,d.cellType),(!d.cellType||!Oo.includes(d.cellType))&&(d.checked=void 0),(!d.cellType||!Do.includes(d.cellType))&&(d.startNumber=void 0)),o.align!==void 0&&(d.align=o.align==="left"?void 0:Ur.includes(o.align)?o.align:void 0),o.verticalAlign!==void 0&&(d.verticalAlign=o.verticalAlign==="middle"?void 0:zr.includes(o.verticalAlign)?o.verticalAlign:void 0),o.bgColor!==void 0&&(d.bgColor=o.bgColor==="default"?void 0:Fr.includes(o.bgColor)?o.bgColor:void 0),o.checked!==void 0&&(d.checked=d.cellType&&Oo.includes(d.cellType)?o.checked:void 0),o.startNumber!==void 0&&(o.startNumber===null?d.startNumber=void 0:d.startNumber=d.cellType&&Do.includes(d.cellType)&&typeof o.startNumber=="number"&&Number.isInteger(o.startNumber)&&o.startNumber>=1?o.startNumber:void 0),mo(d)}));return{...e,cells:l}}function Ei(e,n,o,r){const l=new Set(n.map(s=>`${s.row}-${s.col}`)),i=e.cells.map((s,c)=>s.map((a,d)=>{if(!l.has(`${c}-${d}`)||a.covered||a.cellType==="codeBlock"||a.cellType==="quote"&&o==="italic")return a;const m=gn(a);return m.content=m.content.map(f=>{if(f.type!=="text")return f;const p=f.marks?[...f.marks]:[],u=p.some(w=>w.type==="code");if(o==="code"&&r!==null){const w=p.filter(S=>S.type==="code"||!Kr.includes(S.type));return w.some(S=>S.type==="code")||w.push({type:"code"}),{...f,marks:w.length>0?w:void 0}}if(r!==null&&Kr.includes(o)&&u)return f;const b=p.filter(w=>w.type!==o);return r!==null&&b.push(r?{type:o,attrs:r}:{type:o}),{...f,marks:b.length>0?b:void 0}}),mo(m)}));return{...e,cells:i}}function Ya(e,n,o){var i,s;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=(i=e.cells[c.row])==null?void 0:i[c.col];if(!(!a||a.covered)&&a.content.length!==0){for(const d of a.content){if(d.type!=="text")continue;if(!(((s=d.marks)==null?void 0:s.some(f=>f.type===o))??!1)){l=!1;break}}if(!l)break}}return Ei(e,r,o,l?null:{})}function Za(e,n,o,r,l){var U,F,ue;const i=Math.max(0,Math.min(n,r)),s=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(i===s&&c===a)return e;const d=e.cells.map(J=>J.map(gn));for(let J=i;J<=s;J++)for(let ne=c;ne<=a;ne++)d[J][ne]={content:[],rowspan:1,colspan:1,covered:!1};let m=i,f=c;for(;m>=0&&((F=(U=e.cells[m])==null?void 0:U[f])!=null&&F.covered);){if(f>0){f-=1;continue}m-=1,f=e.cols-1}const p=m>=0?(ue=e.cells[m])==null?void 0:ue[f]:void 0,u=p?p.content.map(J=>({...J})):[],b=p==null?void 0:p.cellType,w=p==null?void 0:p.align,S=p==null?void 0:p.verticalAlign,M=p==null?void 0:p.bgColor,I=p==null?void 0:p.checked,j=p==null?void 0:p.startNumber;d[i][c]={content:fo(u,b),rowspan:s-i+1,colspan:a-c+1,covered:!1,cellType:b,align:w,verticalAlign:S,bgColor:M,checked:I,startNumber:j};const Q=On(d,e.rows,e.cols);return{...e,cells:Q}}function vi(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,i=o+r.colspan-1,s=e.cells.map(d=>d.map(gn));for(let d=n;d<=l;d++)for(let m=o;m<=i;m++)s[d][m]={content:d===n&&m===o?[...r.content]:[],rowspan:1,colspan:1,covered:!1};const c=On(s,e.rows,e.cols);return{...e,cells:c}}function Xa(e,n,o,r,l){var m;const i=Math.max(0,Math.min(n,r)),s=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 f=s;f>=i;f--)for(let p=a;p>=c;p--){const u=(m=d.cells[f])==null?void 0:m[p];!u||u.covered||u.rowspan===1&&u.colspan===1||(d=vi(d,f,p))}return d}function ja(e){return{...e,headerRow:!e.headerRow}}function Ci(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 tr(e){let n="";for(const o of e.content)o.type==="text"&&(n+=o.text);return n}function _i(e){return e.replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>")}function Qa(e){var i,s;const n=[];e.colWidths;const o=[],r=[];for(let c=0;c<e.cols;c++){const a=(i=e.cells[0])==null?void 0:i[c],d=a&&!a.covered?tr(a):"";o.push(_i(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 m=(s=e.cells[c])==null?void 0:s[d],f=m&&!m.covered?tr(m):"";a.push(_i(f))}n.push(`| ${a.join(" | ")} |`)}return n.join(`
|
|
10
|
+
`)}function Ja(e){var l,i;const n=["<table>"],o=[];for(let s=0;s<e.cols;s++){const c=e.colWidths[s]??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 s=0;s<e.cols;s++){const c=(l=e.cells[0])==null?void 0:l[s];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}>${Ti(tr(c))}</th>`)}n.push("</tr></thead>")}n.push("<tbody>");for(let s=r;s<e.rows;s++){n.push("<tr>");for(let c=0;c<e.cols;c++){const a=(i=e.cells[s])==null?void 0:i[c];if(!a||a.covered)continue;const d=a.rowspan>1?` rowspan="${a.rowspan}"`:"",m=a.colspan>1?` colspan="${a.colspan}"`:"";n.push(`<td${d}${m}>${Ti(tr(a))}</td>`)}n.push("</tr>")}return n.push("</tbody></table>"),n.join("")}function Ti(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ed(e){var m;const n=Array.from(e.querySelectorAll("tr"));if(n.length===0)return null;let o=0;const r=[];for(const f of n){const p=Array.from(f.children).filter(b=>b.tagName==="TH"||b.tagName==="TD");let u=0;for(const b of p)u+=b.colSpan||1;u>o&&(o=u),r.push(p)}o=Math.max(1,o);const l=n.length,i=[];for(let f=0;f<l;f++){const p=[];for(let u=0;u<o;u++)p.push(jn());i.push(p)}for(let f=0;f<l;f++){const p=r[f]??[];let u=0;for(const b of p){for(;u<o&&i[f][u].covered;)u++;if(u>=o)break;const w=Math.max(1,Math.min(b.rowSpan||1,l-f)),S=Math.max(1,Math.min(b.colSpan||1,o-u)),M=fo(un(b));i[f][u]={content:M,rowspan:w,colspan:S,covered:!1};for(let I=f;I<f+w;I++)for(let j=u;j<u+S;j++)I===f&&j===u||I<l&&j<o&&(i[I][j]={content:[],rowspan:1,colspan:1,covered:!0});u+=S}}const s=e.querySelectorAll("thead tr").length>0||((m=r[0])==null?void 0:m.every(f=>f.tagName==="TH"))===!0,c=[];for(let f=0;f<o;f++)c.push(0);const a=i.map(f=>f.map(mo)),d=On(a,l,o);return{rows:l,cols:o,cells:d,colWidths:c,headerRow:s}}function td(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 Jn(e){return $o(e)}function Wr(e,n,o){var l,i;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 s=n-1;s>=0;s--){const c=(i=e.cells[s])==null?void 0:i[o];if(!(!c||c.covered)){if(c.cellType!=="orderedList")break;return Wr(e,s,o)+1}}return 1}const xi=new Set(["p","h1","h2","h3","h4","h5","h6","li","pre","blockquote","hr","tr","table-row","table"]),nd=/^(?:-{3,}|\*{3,}|_{3,})\s*$/,Gr={h1:1,h2:2,h3:3,h4:4,h5:5,h6:6},Mi=new Set(["meta","style","script","head","title","link","object","embed"]);function od(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 nr(e){return xi.has(e)||e in Gr}function rd(e,n){if(e){const o=ld(e);if(o.length>0)return o}if(e){const o=cd(e);if(o.length>0)return o}return n?sd(n):[]}function ld(e){const n=e.match(/<!--\s*blockeditor:(.+?)\s*-->/);if(!n)return[];try{const o=JSON.parse(n[1]),r=o.type,l=o.attrs,i=o.text;if(!r)return[];const s=[];return i&&i.length>0?s.push({type:r,attrs:l??{},content:Un(i)}):s.push({type:r,attrs:l??{},content:[]}),s}catch{return[]}}function qr(e){let n=0;for(const o of e)o.type==="text"&&(n+=o.text.length);return n}function id(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 Ni(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:id(o.content)})}}function sd(e){const n=e.split(/\r?\n/),o=[];for(const r of n)nd.test(r)?o.push({type:"divider",attrs:{},content:[]}):o.push({type:"paragraph",attrs:{},content:Un(r)});return Ni(o),Si(o),o}function Si(e){const n=new Set(["image","table","divider","codeBlock"]),o=[];let r=!1;for(const l of e)!n.has(l.type)&&qr(l.content)===0?(r||o.push(l),r=!0):(o.push(l),r=!1);for(;o.length>1&&!n.has(o[0].type)&&qr(o[0].content)===0;)o.shift();for(;o.length>1&&!n.has(o[o.length-1].type)&&qr(o[o.length-1].content)===0;)o.pop();e.length=0;for(const l of o)e.push(l)}function cd(e){const n=new DOMParser().parseFromString(e,"text/html"),o=[];let r=n.body;for(;r.nodeType===Node.ELEMENT_NODE;){const l=r,i=Array.from(l.childNodes),s=i.filter(f=>f.nodeType===Node.ELEMENT_NODE&&!Mi.has(f.tagName.toLowerCase())),c=s.some(f=>nr(f.tagName.toLowerCase())||f.tagName.toLowerCase()==="br"),a=i.some(f=>f.nodeType===Node.TEXT_NODE&&(f.textContent??"").length>0),d=s.some(f=>!nr(f.tagName.toLowerCase())&&f.tagName.toLowerCase()!=="div");if(c||a||d||s.length!==1)break;const m=s[0];if(m&&(m.tagName.toLowerCase()==="div"||m.tagName.toLowerCase()==="span"))r=m;else break}if(Vo(r.childNodes,n,o),Ni(o),Si(o),o.length===0){const l=n.body.textContent??"";l.length>0&&o.push({type:"paragraph",attrs:{},content:Un(l)})}return o}function Vo(e,n,o){var s;let r=[],l=0;function i(c=!1){if(r.length===0&&!c){l=0;return}const a=n.createElement("div");for(const m of r)a.appendChild(m.cloneNode(!0));const d=un(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 m=c.textContent??"";if(m.length>0&&m.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(!Mi.has(d)){if(d==="br"){l+=1;const m=r.length>0;i(!1),m||(l>=2||o.length>0)&&o.push({type:"paragraph",attrs:{},content:[]});continue}if(d==="pre"){i();const m=(a.textContent??"").replace(/^\n+|\n+$/g,"");o.push({type:"codeBlock",attrs:{language:"plain"},content:Un(m)}),l=0;continue}if(d==="hr"){i(),o.push({type:"divider",attrs:{},content:[]}),l=0;continue}if(d in Gr){i(),o.push({type:"heading",attrs:{level:Gr[d]},content:un(a)}),l=0;continue}if(d==="blockquote"){i(),Vo(a.childNodes,n,o),l=0;continue}if(d==="li"){i();const m=a.parentElement,f=(m==null?void 0:m.tagName.toLowerCase())??"",p=un(a);f==="ol"?o.push({type:"orderedList",attrs:{},content:p}):f==="ul"?o.push({type:"bulletList",attrs:{},content:p}):o.push({type:"paragraph",attrs:{},content:p}),l=0;continue}if(xi.has(d)){i();const m=Array.from(a.children).some(p=>nr(p.tagName.toLowerCase())),f=!!a.querySelector("img");m||f?Vo(a.childNodes,n,o):a.querySelector("br")?ad(a,n,o):o.push({type:"paragraph",attrs:{},content:un(a)}),l=0;continue}if(d==="div"||d==="span"){const m=Array.from(a.children).some(p=>{const u=p.tagName.toLowerCase();return nr(u)||u==="div"}),f=!!a.querySelector("img");if(m||f)i(),Vo(a.childNodes,n,o),l=0;else{d==="div"&&r.length>0&&r.push(n.createTextNode(`
|
|
11
|
+
`));for(const p of Array.from(a.childNodes))r.push(p);l=0}continue}if(d==="img"){const m=od(a);m&&(i(),o.push({type:"image",attrs:{src:m.src,alt:m.alt,title:m.title},content:[]}),l=0);continue}if(d==="table"){const m=ed(a);m&&(i(),o.push({type:"table",attrs:m,content:[]}),l=0);continue}if((s=a.querySelector)!=null&&s.call(a,"img")){i(),Vo(a.childNodes,n,o),l=0;continue}r.push(c),l=0}}i()}function ad(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 i=n.createElement("div");for(const c of l)i.appendChild(c.cloneNode(!0));const s=un(i);o.push({type:"paragraph",attrs:{},content:s})}}const eo=new Map,or=new Set;function Ai(e,n){for(const o of or)o(e,n)}function Gn(e){return eo.get(e)??null}function bn(e,n){if(n===null){if(eo.has(e)){const o=eo.get(e);if(o!=null&&o.tempPreviewUrl&&URL.revokeObjectURL(o.tempPreviewUrl),o!=null&&o.controller)try{o.controller.abort()}catch{}eo.delete(e),Ai(e,null)}}else eo.set(e,n),Ai(e,n)}function Ii(e){return or.add(e),()=>{or.delete(e)}}const dd=Ii;function ud(){for(const[,e]of eo)if(e!=null&&e.tempPreviewUrl&&URL.revokeObjectURL(e.tempPreviewUrl),e!=null&&e.controller)try{e.controller.abort()}catch{}eo.clear();for(const e of or)e("",null)}const fd=ud,rr=new Set;function md(){for(const e of rr)try{URL.revokeObjectURL(e)}catch{}rr.clear()}function Yr(e){const n=URL.createObjectURL(e);return rr.add(n),n}function pd(e){for(const n of e)bn(n,null)}function hd(e){pd(e)}let Zr=null;function gd(e){Zr=e}const bd=gd;function Bi(e,n,o,r){if(!Zr){r.onError("Upload handler not registered");return}Zr(e,n,o,r)}function kd(e,n){return new Promise((o,r)=>{const l=Date.now(),i=500+Math.min(2500,Math.round(e.size/2e3));let s=!1;const c=()=>{if(s)return;const a=Date.now()-l,d=Math.min(1,a/i),m=1-Math.pow(1-d,2);if(n==null||n(m),d<1)requestAnimationFrame(c);else{const f=Yr(e);if(typeof document>"u"){o({url:f});return}const p=document.createElement("img");let u=!1;const b=(w,S)=>{u||(u=!0,o({url:f,width:w,height:S}))};p.onload=()=>b(p.naturalWidth||void 0,p.naturalHeight||void 0),p.onerror=()=>b(),p.src=f,setTimeout(()=>b(),5e3)}};requestAnimationFrame(c),e.type.startsWith("image/")||(s=!0,setTimeout(()=>r(new Error("Not an image file")),30))})}function yd(e,n){return new Promise(o=>{const r=Yr(n),l=new AbortController;bn(e,{status:"pending",progress:0,file:n,tempPreviewUrl:r,controller:l});let i,s;if(typeof document<"u"){const c=document.createElement("img");let a=!1;const d=()=>{a||(a=!0,i=c.naturalWidth||void 0,s=c.naturalHeight||void 0)};c.onload=d,c.onerror=d,c.src=r,setTimeout(d,4e3)}try{Bi(n.name,n,l,{onProgress:c=>{const a=Gn(e);if(!a)return;const d=Math.max(0,Math.min(1,Number.isFinite(c)?c:0));bn(e,{...a,progress:d})},onSuccess:c=>{const a=Gn(e);if(a!=null&&a.tempPreviewUrl&&a.tempPreviewUrl!==c.url){try{URL.revokeObjectURL(a.tempPreviewUrl)}catch{}rr.delete(a.tempPreviewUrl)}bn(e,null),o({ok:!0,value:{url:c.url,width:c.width??i,height:c.height??s,alt:c.alt,title:c.title,fileId:c.fileId}})},onError:c=>{const a=Gn(e);bn(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);bn(e,{status:"error",progress:0,error:a,file:n,tempPreviewUrl:r}),o({ok:!1,error:a})}})}async function Xr(e,n){if(!e)return null;try{if(e.startsWith("data:"))return wd(e,n);const o=await fetch(e);if(!o.ok)return null;const r=await o.blob(),l=Ri(r.type,e),i=n?Li(n,l):`image-${Date.now()}${l}`;return new File([r],i,{type:r.type||"image/png"})}catch{return null}}function wd(e,n){const o=e.match(/^data:([^;,]+)?(;base64)?,(.*)$/);if(!o)return null;const[,r,l,i]=o,s=r||"image/png",c=!!l;let a;if(c){const p=atob(i);a=new Uint8Array(p.length);for(let u=0;u<p.length;u++)a[u]=p.charCodeAt(u)}else{const p=decodeURIComponent(i);a=new TextEncoder().encode(p)}const d=Ri(s,e),m=n?Li(n,d):`image-${Date.now()}${d}`,f=new Blob([a],{type:s});return new File([f],m,{type:s})}function Ri(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 Li(e,n){return e.toLowerCase().endsWith(n.toLowerCase())?e:e+n}const Ed=["data-block-id","data-empty","data-placeholder","contenteditable"],Dn=t.defineComponent({__name:"BlockContent",props:{block:{},placeholder:{}},emits:["slashTrigger","inputChanged","linkClick","focusIn"],setup(e,{emit:n}){const o=e,r=n,l=dn(),i=Kn(),s=t.ref(null),c=t.shallowRef(!1);function a(){return Me(o.block.content).length===0}const d=t.ref(a());t.onMounted(()=>{const x=s.value;if(!x)return;const z=Me(o.block.content);bi(o.block.content)?x.innerHTML=Wn(o.block.content):x.textContent=z,d.value=z.length===0});function m(x){const z=window.getSelection();if(!z||z.rangeCount===0)return null;const A=z.getRangeAt(0);if(!x.contains(A.commonAncestorContainer))return null;const v=document.createRange();v.selectNodeContents(x),v.setEnd(A.startContainer,A.startOffset);const k=v.toString().length;v.setEnd(A.endContainer,A.endOffset);const E=v.toString().length;return{from:Math.min(k,E),to:Math.max(k,E)}}function f(x,z){const A=document.createTreeWalker(x,NodeFilter.SHOW_TEXT);let v=Math.max(0,z),k=null;for(;A.nextNode();){const E=A.currentNode;k=E;const D=(E.nodeValue??"").length;if(v<=D)return{node:E,offset:v};v-=D}return k?{node:k,offset:(k.nodeValue??"").length}:{node:x,offset:0}}function p(x,z,A){const v=window.getSelection();if(!v)return;const k=f(x,z),E=f(x,Math.max(z,A));try{const D=document.createRange();z<=A?(D.setStart(k.node,k.offset),D.setEnd(E.node,E.offset)):(D.setStart(E.node,E.offset),D.setEnd(k.node,k.offset)),v.removeAllRanges(),v.addRange(D)}catch{try{const D=document.createRange();D.setStart(E.node,E.offset),D.collapse(!0),v.removeAllRanges(),v.addRange(D)}catch{}}}t.watch(()=>o.block,x=>{if(c.value)return;const z=s.value;if(!z)return;const A=m(z),v=A&&A.from!==A.to,k=document.activeElement===z,E=Me(x.content),D=E.length===0;let P=!1;if(D)z.childNodes.length>0&&(z.textContent="",P=!0);else{const K=bi(x.content),te=!!z.querySelector(Ra);if(!K&&!te)z.textContent!==E&&(z.textContent=E,P=!0);else{const me=ki(un(z)),se=ki(x.content);me!==se&&(z.innerHTML=Wn(x.content),P=!0)}}d.value=D,P&&A&&(k||v)&&p(z,A.from,A.to)});function u(x){x.key==="Enter"&&!x.shiftKey&&!x.isComposing&&x.preventDefault()}function b(x){var P,K;if(!i.value)return;const z=s.value;if(!z)return;const A=un(z),v=Me(A);if(d.value=v.length===0,r("inputChanged",o.block.id,v),c.value||Na({editor:l,registry:l.registries.inputRules,blockId:o.block.id,text:v}))return;if(Sa(v)){const te=v.match(/\/([^/]*)$/),me=v.lastIndexOf("/"),se=te&&te[1]!==void 0?te[1]:me>=0?v.slice(me+1):"";r("slashTrigger",z,o.block.id,se)}let E=A;l.registries.schema.get(o.block.type).inlineMarks&&x.data&&/\s/.test(x.data)&&(E=er(A)),(K=(P=l.commands).setText)==null||K.call(P,{id:o.block.id,content:E})}function w(x){c.value=!0}function S(x){var D,P;if(c.value=!1,!i.value)return;const z=s.value;if(!z)return;const A=un(z),v=Me(A);d.value=v.length===0,r("inputChanged",o.block.id,v);const E=l.registries.schema.get(o.block.type).inlineMarks?er(A):A;(P=(D=l.commands).setText)==null||P.call(D,{id:o.block.id,content:E})}function M(){const x=s.value;if(!x)return null;const z=window.getSelection();if(!z||z.rangeCount===0)return null;const A=z.getRangeAt(0);if(!x.contains(A.commonAncestorContainer))return null;const v=Me(o.block.content),k=document.createRange();k.selectNodeContents(x),k.setEnd(A.startContainer,A.startOffset);const E=Math.min(k.toString().length,v.length);k.setEnd(A.endContainer,A.endOffset);const D=Math.min(k.toString().length,v.length);return[Math.min(E,D),Math.max(E,D)]}function I(x){var K,te;const z=M();if(!z)return;const[A,v]=z;if(A===v)return;const[,k]=Ft(o.block.content,A),[E]=Ft(k,v-A),D=Me(E),P=Wn(E);x.preventDefault(),(K=x.clipboardData)==null||K.setData("text/plain",D),(te=x.clipboardData)==null||te.setData("text/html",P)}function j(x){var me,se,De,ze;if(!i.value){x.preventDefault();return}const z=M();if(!z)return;const[A,v]=z;if(A===v)return;const[k,E]=Ft(o.block.content,A),[D,P]=Ft(E,v-A),K=Me(D),te=Wn(D);x.preventDefault(),(me=x.clipboardData)==null||me.setData("text/plain",K),(se=x.clipboardData)==null||se.setData("text/html",te),(ze=(De=l.commands).setText)==null||ze.call(De,{id:o.block.id,content:[...k,...P],selectionAfter:rt(o.block.id,A)})}const Q=va();function U(x){const z=[],A=new Set;if(x.items&&x.items.length>0)for(let v=0;v<x.items.length;v++){const k=x.items[v];if(k.kind!=="file")continue;const E=k.getAsFile();if(!E||!E.type.startsWith("image/"))continue;const D=`${E.name||""}:${E.size}:${E.type}`;A.has(D)||(A.add(D),z.push(E))}if(x.files&&x.files.length>0)for(let v=0;v<x.files.length;v++){const k=x.files[v];if(!k.type.startsWith("image/"))continue;const E=`${k.name||""}:${k.size}:${k.type}`;A.has(E)||(A.add(E),z.push(k))}return z}async function F(x){var nt,Pe,Dt,Kt,Pt,Ve,Tt,wt,Se,Et,he,At,ut,$e,Xe,Mt,V,N,$,ae,fe,pe,kt,ht,mn,Wt,yn,lt,gt,Zt,xn,Mn;if(!i.value){x.preventDefault();return}const z=x.clipboardData;if(!z)return;if(Q){const Ge=U(z);if(Ge.length>0){x.preventDefault();let Le=o.block.id;for(let Fe=0;Fe<Ge.length;Fe++){const Qe=Ge[Fe],qe=await Q(Qe,{relativeToBlockId:Le,convertIfEmpty:Fe===0,position:"after"});qe&&(Le=qe)}return}}const A=z.getData("text/html"),v=z.getData("text/plain"),k=rd(A||null,v||null);if(k.length===0)return;const E=k.some(Ge=>Ge.type==="image"),D=M(),P=Me(o.block.content).length,K=D?D[0]:P,te=D?D[1]:P,[me]=Ft(o.block.content,K),[,se]=Ft(o.block.content,te),De=l.registries.schema.get(o.block.type),ze=Ge=>De.inlineMarks?Ge:Ge.map(Le=>({type:"text",text:Le.text}));if(!E){if(k.length===1){const Fe=ze(k[0].content);if(De.inlineMarks&&K<te&&Fe.length===1&&Fe[0].type==="text"&&!Fe[0].marks){const Vt=Fe[0].text;if(Hr(Vt)){const Ut=Xn(Vt),sn=Rn(Ut);if(sn){(Pe=(nt=l.commands).setLink)==null||Pe.call(nt,{id:o.block.id,href:sn,from:K,to:te});return}}}const Qe=[...me,...Fe,...se],qe=De.inlineMarks?er(Qe):Qe,ft=Me(me).length,Nt=Me(Fe).length,It=ft+Nt;(Kt=(Dt=l.commands).setText)==null||Kt.call(Dt,{id:o.block.id,content:qe,selectionAfter:rt(o.block.id,It)});return}const Ge=[...me,...ze(k[0].content)];(Ve=(Pt=l.commands).setText)==null||Ve.call(Pt,{id:o.block.id,content:Ge});let Le=o.block.id;for(let Fe=1;Fe<k.length;Fe++){const Qe=k[Fe],qe=Fe===k.length-1,ft=ze(Qe.content),Nt=qe?[...ft,...se]:ft,It=l.registries.schema.coerceAttrsFor(Qe.type,Qe.attrs);(wt=(Tt=l.commands).insertBlock)==null||wt.call(Tt,{after:Le,type:Qe.type,attrs:It,content:Nt});const Vt=l.getState();if(Vt.selection.kind==="caret"&&(Le=Vt.selection.blockId),qe){const Ut=Me(ft).length,sn=se.length>0?Ut:Me(Nt).length;(Et=(Se=l.commands).setSelection)==null||Et.call(Se,{selection:rt(Le,sn)})}}return}if(!Q){const Ge=k.filter(Le=>Le.type!=="image");if(Ge.length===0)return;if(k.splice(0,k.length,...Ge),k.length===1){const Le=ze(k[0].content),Fe=[...me,...Le,...se];(At=(he=l.commands).setText)==null||At.call(he,{id:o.block.id,content:Fe,selectionAfter:rt(o.block.id,Me(me).length+Me(Le).length)})}return}let Ye=-1;for(let Ge=k.length-1;Ge>=0;Ge--)if(k[Ge].type!=="image"){Ye=Ge;break}let Ce=o.block.id;const dt=k[0];if(dt.type!=="image"){const Le=Ye===0?[...me,...ze(dt.content),...se]:[...me,...ze(dt.content)];($e=(ut=l.commands).setText)==null||$e.call(ut,{id:o.block.id,content:Le}),Ce=o.block.id}else{const Ge=me.length===0&&se.length===0,Le=dt.attrs.src,Fe=dt.attrs.alt??"";if(Ge){const Qe=await Xr(Le,Fe||void 0);if(Qe){const qe=await Q(Qe,{relativeToBlockId:Ce,position:"after",convertIfEmpty:!0});qe&&(Ce=qe)}else{const qe=l.registries.schema.coerceAttrsFor(dt.type,dt.attrs);(Mt=(Xe=l.commands).replaceBlock)==null||Mt.call(Xe,{id:o.block.id,type:dt.type,attrs:qe}),Ce=o.block.id}}else{(N=(V=l.commands).setText)==null||N.call(V,{id:o.block.id,content:me});const Qe=await Xr(Le,Fe||void 0);if(Qe){const qe=await Q(Qe,{relativeToBlockId:Ce,position:"after",convertIfEmpty:!1});qe&&(Ce=qe)}else{const qe=l.registries.schema.coerceAttrsFor(dt.type,dt.attrs);(ae=($=l.commands).insertBlock)==null||ae.call($,{after:Ce,type:dt.type,attrs:qe,content:[]});const ft=l.getState();ft.selection.kind==="caret"&&(Ce=ft.selection.blockId)}}}for(let Ge=1;Ge<k.length;Ge++){const Le=k[Ge],Fe=Ge===Ye;if(Le.type==="image"){const Qe=Le.attrs.src,qe=Le.attrs.alt??"",ft=await Xr(Qe,qe||void 0);if(ft){const Nt=await Q(ft,{relativeToBlockId:Ce,position:"after",convertIfEmpty:!1});Nt&&(Ce=Nt)}else{const Nt=l.registries.schema.coerceAttrsFor(Le.type,Le.attrs);(pe=(fe=l.commands).insertBlock)==null||pe.call(fe,{after:Ce,type:Le.type,attrs:Nt,content:[]});const It=l.getState();It.selection.kind==="caret"&&(Ce=It.selection.blockId)}}else{const Qe=ze(Le.content),qe=Fe?[...Qe,...se]:Qe,ft=l.registries.schema.coerceAttrsFor(Le.type,Le.attrs);(ht=(kt=l.commands).insertBlock)==null||ht.call(kt,{after:Ce,type:Le.type,attrs:ft,content:qe});const Nt=l.getState();if(Nt.selection.kind==="caret"&&(Ce=Nt.selection.blockId),Fe){const It=Me(Qe).length,Vt=se.length>0?It:Me(qe).length;(Wt=(mn=l.commands).setSelection)==null||Wt.call(mn,{selection:rt(Ce,Vt)})}}}if(Ye===-1&&se.length>0){(lt=(yn=l.commands).insertBlock)==null||lt.call(yn,{after:Ce,type:"paragraph",attrs:{},content:se});const Ge=l.getState();Ge.selection.kind==="caret"&&(Ce=Ge.selection.blockId,(Zt=(gt=l.commands).setSelection)==null||Zt.call(gt,{selection:rt(Ce,Me(se).length)}))}else Ye===-1&&(me.length>0||se.length>0)&&((Mn=(xn=l.commands).insertBlock)==null||Mn.call(xn,{after:Ce,type:"paragraph",attrs:{},content:[]}))}function ue(){r("focusIn",o.block.id)}function J(){}function ne(x){return document.createTreeWalker(x,NodeFilter.SHOW_TEXT).nextNode()}function q(x){var D;const z=x.target;if(!z)return;const A=z.closest("a");if(!A||!((D=s.value)!=null&&D.contains(A)))return;x.preventDefault();const v=window.getSelection();let k=0;if(v&&v.rangeCount>0&&!!A.contains(v.getRangeAt(0).commonAncestorContainer)){const P=v.getRangeAt(0),K=document.createRange();K.selectNodeContents(s.value),K.setEnd(P.startContainer,P.startOffset),k=K.toString().length}else{const P=ne(A);if(P){const K=document.createRange();K.selectNodeContents(s.value),K.setEnd(P,0),k=K.toString().length}}r("linkClick",o.block.id,k)}return(x,z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"el",ref:s,class:"block-content","data-block-id":e.block.id,"data-empty":d.value,"data-placeholder":e.placeholder,contenteditable:t.unref(i),spellcheck:"false",onInput:b,onCompositionstart:w,onCompositionend:S,onFocus:ue,onBlur:J,onKeydown:u,onClick:q,onPaste:t.withModifiers(F,["prevent"]),onCopy:I,onCut:j},null,40,Ed))}});function Oi(e){return e==="zh-CN"||e===null||e===void 0||e===""?"zh-CN":"en-US"}function Di(e){return e==="dark"?"dark":"light"}const vd={"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."}},$i=Symbol("be-locale"),Pi=Symbol("be-theme");function Cd(e,n){t.provide($i,e),t.provide(Pi,n)}function Qt(){const e=t.inject($i,t.ref("zh-CN")),n=t.inject(Pi,t.ref("light"));return{get locale(){return e.value},get theme(){return n.value},t(o){const l=vd[e.value][o];return typeof l=="string"?l:o}}}const _d=["title","aria-label","onKeydown"],Td=["title","aria-label","onKeydown"],xd=4,Md=300,Nd=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:i}=Qt(),s=Kn(),c=t.ref(null),a=t.ref(null),d=t.ref(null),m=t.ref(!1),f=t.ref(!1),p=t.ref(null);let u=null;const b=t.computed(()=>p.value===null?void 0:{top:`${p.value}px`});function w(){var v;const x=(v=c.value)==null?void 0:v.parentElement;if(!x)return null;const z=x.querySelector(".block-host-content");if(!z)return null;const A=z.firstElementChild;return A instanceof HTMLElement?A:z}function S(){var k;const x=(k=c.value)==null?void 0:k.parentElement,z=w();if(!x||!z)return;const A=x.getBoundingClientRect(),v=z.getBoundingClientRect();p.value=v.top-A.top+v.height/2}function M(){const x=w();x&&(I(),u=new ResizeObserver(()=>S()),u.observe(x))}function I(){u==null||u.disconnect(),u=null}t.watch(()=>r.visible,x=>{x?t.nextTick().then(()=>{S(),M()}):I()}),t.onMounted(S),t.onBeforeUnmount(I);function j(){s.value&&a.value&&l("openPlusMenu",a.value)}let Q=0,U=0,F=0,ue=!1;function J(x){s.value&&(F=Date.now(),Q=x.clientX,U=x.clientY,ue=!0,f.value=!1,l("gripPointerDown",r.blockId,Q,U,{thresholdPx:xd}))}function ne(x){f.value=x}function q(){s.value&&(f.value||ue&&Date.now()-F>Md||(ue=!1,d.value&&l("openSettingsMenu",d.value)))}return n({isOpen:m,insertBtn:a,gripBtn:d,setLocalDragging:ne}),(x,z)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"handleEl",ref:c,class:t.normalizeClass(["block-handle",{visible:e.visible,dragging:f.value}]),style:t.normalizeStyle(b.value)},[t.createElementVNode("div",{ref_key:"insertBtn",ref:a,class:"handle-btn handle-insert",role:"button",tabindex:"0",title:t.unref(i)("handle.plus.title"),"aria-label":t.unref(i)("handle.plus.ariaLabel"),onMousedown:t.withModifiers(j,["prevent","stop"]),onKeydown:[t.withKeys(t.withModifiers(j,["prevent","stop"]),["enter"]),t.withKeys(t.withModifiers(j,["prevent","stop"]),["space"])]},[...z[0]||(z[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,_d),t.createElementVNode("div",{ref_key:"gripBtn",ref:d,class:"handle-btn handle-grip",role:"button",tabindex:"0",title:t.unref(i)("handle.grip.title"),"aria-label":t.unref(i)("handle.grip.ariaLabel"),onMousedown:t.withModifiers(J,["prevent","stop"]),onClick:t.withModifiers(q,["stop"]),onKeydown:[t.withKeys(t.withModifiers(q,["prevent","stop"]),["enter"]),t.withKeys(t.withModifiers(q,["prevent","stop"]),["space"])]},[...z[1]||(z[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,Td)],6))}}),Sd=["data-block-id","data-block-type"],Ad={class:"block-host-content"},Hi=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,i=dn(),s=Kn(),c=t.ref(null),a=t.ref(null),d=t.computed(()=>!s.value||r.hasTextSelection?!1:r.hoveredBlockId===r.block.id||r.hoveredBlockId===null&&r.focusedBlockId===r.block.id),m=t.computed(()=>r.draggingBlockId===r.block.id),f=t.computed(()=>r.menuOpenBlockId===r.block.id),p=t.computed(()=>r.dropTargetBlockId===r.block.id),u=t.computed(()=>r.dropPosition??"after");function b(q,x,z,A){l("gripPointerDown",q,x,z,A)}function w(q){l("gripPointerUp",q)}function S(q){var x,z;(z=(x=a.value)==null?void 0:x.setLocalDragging)==null||z.call(x,q)}function M(){l("hoverChange",r.block.id)}function I(){l("hoverChange",null)}function j(q){l("openPlusMenu",r.block.id,q)}function Q(q){l("openSettingsMenu",r.block.id,q)}function U(q,x,z){l("slashTrigger",q,r.block.id,z)}function F(q,x){l("inputChanged",q,x)}function ue(q,x){l("linkClick",q,x)}function J(q){l("focusIn",q)}const ne=t.computed(()=>{const q=i.registries.renderers.get(r.block.type);return q!=null&&q.component?q.component:Dn});return n({setHandleDragging:S}),(q,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"hostEl",ref:c,class:t.normalizeClass(["block-host",{"block-dragging":m.value,"block-menu-active":f.value,"block-drop-target":p.value,"block-drop-before":p.value&&u.value==="before","block-drop-after":p.value&&u.value==="after","block-drop-into":p.value&&u.value==="into","block-host-readonly":!t.unref(s),"block-focused":e.focusedBlockId===e.block.id}]),"data-block-id":e.block.id,"data-block-type":e.block.type,onMouseenter:M,onMouseleave:I},[t.unref(s)?(t.openBlock(),t.createBlock(Nd,{key:0,ref_key:"handleRef",ref:a,"block-id":e.block.id,visible:d.value,onOpenPlusMenu:j,onOpenSettingsMenu:Q,onGripPointerDown:b,onGripPointerUp:w},null,8,["block-id","visible"])):t.createCommentVNode("",!0),t.createElementVNode("div",Ad,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(ne.value),{block:e.block,placeholder:e.placeholder,onSlashTrigger:U,onInputChanged:F,onLinkClick:ue,onFocusIn:J},null,40,["block","placeholder"]))])],42,Sd))}}),Vi=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,i=new Map;function s(U,F){F?i.set(U,F):i.delete(U)}function c(U,F){var ue,J;(J=(ue=i.get(U))==null?void 0:ue.setHandleDragging)==null||J.call(ue,F)}function a(U){const F=[];for(const ue of U.children){const J=r.blocksMap.get(ue);J&&F.push({id:ue,block:J})}return F}const d=t.computed(()=>!r.isNested&&!r.dropTargetBlockId&&r.dropPosition==="first"&&!!r.draggingBlockId),m=t.computed(()=>!r.isNested&&!r.dropTargetBlockId&&r.dropPosition==="last"&&!!r.draggingBlockId);function f(U,F){l("openSettingsMenu",U,F)}function p(U,F){l("openPlusMenu",U,F)}function u(U,F,ue){l("slashTrigger",U,F,ue)}function b(U,F){l("inputChanged",U,F)}function w(U){l("hoverChange",U)}function S(){r.isNested||l("hoverChange",null)}function M(U,F,ue,J){l("gripPointerDown",U,F,ue,J)}function I(U){l("gripPointerUp",U)}function j(U,F){l("linkClick",U,F)}function Q(U){l("focusIn",U)}return n({setBlockHandleDragging:c}),(U,F)=>{const ue=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":m.value}]),onMouseleave:S},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.items,(J,ne)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:J.id},[t.createVNode(Hi,{ref_for:!0,ref:q=>s(J.id,q),block:J.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:f,onOpenPlusMenu:p,onSlashTrigger:u,onInputChanged:b,onHoverChange:w,onGripPointerDown:M,onGripPointerUp:I,onLinkClick:j,onFocusIn:Q},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"]),J.block.children.length>0?(t.openBlock(),t.createBlock(ue,{key:"__nested_"+J.id,"is-nested":"",items:a(J.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:F[0]||(F[0]=(q,x)=>l("openSettingsMenu",q,x)),onOpenPlusMenu:F[1]||(F[1]=(q,x)=>l("openPlusMenu",q,x)),onSlashTrigger:F[2]||(F[2]=(q,x,z)=>l("slashTrigger",q,x,z)),onInputChanged:F[3]||(F[3]=(q,x)=>l("inputChanged",q,x)),onHoverChange:F[4]||(F[4]=q=>l("hoverChange",q)),onGripPointerDown:F[5]||(F[5]=(q,x,z,A)=>l("gripPointerDown",q,x,z,A)),onGripPointerUp:F[6]||(F[6]=q=>l("gripPointerUp",q)),onLinkClick:F[7]||(F[7]=(q,x)=>l("linkClick",q,x)),onFocusIn:F[8]||(F[8]=q=>l("focusIn",q))},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 Ui(e,n,o,r=6){const l=n instanceof HTMLElement?n.getBoundingClientRect():n,i=document.documentElement.clientHeight,s=Id(),c=Math.max(0,i-l.bottom-r),a=Math.max(0,l.top-r),d=c>=o.height+r,m=a>=o.height+r,f=!d&&(m||a>c);let p,u,b;const w=l.bottom+r,S=l.top-r;f?(p=Math.max(r,S-o.height),u=S,b=Math.max(120,a)):(p=w,u=p+o.height,b=Math.max(120,c));const M=s-o.width-r,I=Math.max(r,Math.min(M,l.left));return{top:p,left:I,above:f,availableHeight:b,bottom:u,topBaseline:w}}function zi(e,n,o,r=8){const l=document.documentElement.clientHeight,i=document.documentElement.clientWidth,s=n.left+(n.width-o.width)/2,c=Math.max(r,Math.min(i-o.width-r,s)),a=l-n.bottom-r,d=n.top-r,m=a>=o.height,f=d>=o.height,p=!m&&(f||d>a),u=n.bottom+r,b=n.top-r,w=p?Math.max(r,b-o.height):u,S=p?b:w+o.height,M=p?Math.max(120,d):Math.max(120,a);return{top:w,left:c,above:p,availableHeight:M,bottom:S,topBaseline:u}}function Fi(e,n,o,r=8){const l=document.documentElement.clientHeight,i=document.documentElement.clientWidth,s=n.left+(n.width-o.width)/2,c=Math.max(r,Math.min(i-o.width-r,s)),a=n.top-r,d=l-n.bottom-r,m=a>=o.height,f=d>=o.height,p=m||!f&&a>d||a>=d,u=n.bottom+r,b=n.top-r,w=p?Math.max(r,b-o.height):u,S=p?b:w+o.height,M=p?Math.max(120,a):Math.max(120,d);return{top:w,left:c,above:p,availableHeight:M,bottom:S,topBaseline:u}}function Id(){return document.documentElement.clientWidth}function lr(e,n){let o=0;function r(d){const m=e.value;if(!m)return;d.preventDefault();const f=d.deltaMode===WheelEvent.DOM_DELTA_LINE?d.deltaY*22:d.deltaY;m.scrollTop+=f,n()}function l(d){d.touches.length===1&&(o=d.touches[0].clientY)}function i(d){if(d.touches.length!==1)return;const m=e.value;if(!m)return;const f=d.touches[0].clientY;m.scrollTop-=f-o,o=f,d.preventDefault(),n()}function s(d){d&&(d.addEventListener("wheel",r,{passive:!1}),d.addEventListener("touchstart",l,{passive:!0}),d.addEventListener("touchmove",i,{passive:!1}))}function c(d){d&&(d.removeEventListener("wheel",r),d.removeEventListener("touchstart",l),d.removeEventListener("touchmove",i))}let a=null;t.watch(e,(d,m,f)=>{c(a),a=d,s(d),f(()=>{c(d),a===d&&(a=null)})},{immediate:!0}),t.onBeforeUnmount(()=>{c(a),a=null})}function Ki(e,n,o,r){function l(f){const p=e.value;if(!p||!f)return!1;if(f instanceof Node&&p.contains(f))return!0;if(r){const u=r(),b=Array.isArray(u)?u:[u];for(const w of b)if(w&&f instanceof Node&&w.contains(f))return!0}return!1}function i(f){n()&&(l(f.target)||o())}function s(f){n()&&(l(f.target)||o())}function c(){n()&&o()}function a(f){f&&f.addEventListener("mouseleave",c)}function d(f){f&&f.removeEventListener("mouseleave",c)}let m=null;t.watch(e,(f,p,u)=>{d(m),m=f,a(f),u(()=>{d(f),m===f&&(m=null)})},{immediate:!0}),t.onMounted(()=>{window.addEventListener("mousedown",i,!0),window.addEventListener("touchstart",i,!0),window.addEventListener("wheel",s,!0)}),t.onBeforeUnmount(()=>{window.removeEventListener("mousedown",i,!0),window.removeEventListener("touchstart",i,!0),window.removeEventListener("wheel",s,!0),d(m),m=null})}const Bd=["innerHTML"],fn=t.defineComponent({__name:"SafeHtml",props:{html:{default:""}},setup(e){return(n,o)=>(t.openBlock(),t.createElementBlock("span",{innerHTML:e.html},null,8,Bd))}}),Rd=["aria-label"],Ld={key:0,class:"slash-menu-empty"},Od={key:0,class:"slash-menu-group-label"},Dd=["aria-selected","onMousedown","onMouseenter"],$d={class:"slash-menu-text"},Pd={class:"slash-menu-title"},Hd={key:0,class:"slash-menu-desc"},Vd=["aria-label"],jr=300,Ud=80,Wi=24,zd=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:i}=Qt(),s=t.computed(()=>({basic:i("plus.category.basic"),list:i("plus.category.list"),other:i("plus.category.other")})),c=dn(),a=t.ref(null),d=t.ref(null),m=t.ref(0),f=t.ref({top:0,left:0,availableHeight:360,above:!1,bottom:0,topBaseline:0}),p=t.ref(!1),u=t.ref(!1),b=t.ref(!1),w=t.ref(!1);let S=null;t.watch(()=>r.visible,v=>{v?(S&&(clearTimeout(S),S=null),w.value=!0):S=setTimeout(()=>{w.value=!1,S=null},300)},{immediate:!0});function M(v){return typeof v=="string"?v:"•"}const I=t.computed(()=>{const v=r.query.trim().toLowerCase(),k=c.registries.slash.all;return v?k.filter(E=>(i(E.title)+" "+(E.keywords??[]).join(" ")).toLowerCase().includes(v)):k}),j=t.computed(()=>{const v=[],k=new Map;for(const D of I.value){const P=D.category??"other";k.has(P)||k.set(P,[]),k.get(P).push(D)}const E=["basic","list","other"];for(const D of E){const P=k.get(D);P&&P.length>0&&v.push({category:D,label:s.value[D]??D,items:P})}for(const[D,P]of k)E.includes(D)||v.push({category:D,label:s.value[D]??D,items:P});return v});function Q(v){return I.value.findIndex(k=>k.id===v)}t.watch([I,()=>r.visible],()=>{m.value=0,t.nextTick(()=>{d.value&&(d.value.scrollTop=0),U()})});function U(){const v=d.value;v&&(u.value=v.scrollTop>1,b.value=v.scrollTop+v.clientHeight<v.scrollHeight-1)}function F(){const v=d.value;v&&(v.scrollTop-=v.clientHeight*.8)}function ue(){const v=d.value;v&&(v.scrollTop+=v.clientHeight*.8)}lr(d,U),t.watch(()=>r.visible,v=>{v&&(p.value=!1,f.value={top:0,left:0,availableHeight:360,above:!1,bottom:0,topBaseline:0})}),t.watch([()=>r.visible,()=>r.anchorEl,a,I,u,b],async()=>{if(!r.visible||!r.anchorEl||!r.rootEl)return;await t.nextTick();const v=a.value;if(!v)return;const k=v.getBoundingClientRect(),E=Ui(r.rootEl,r.anchorEl,{width:jr,height:k.height});f.value=E,p.value=!0,t.nextTick(U)},{flush:"post"});const J=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 v=f.value.above,k=f.value.left,E=(u.value?Wi:0)+(b.value?Wi:0),D=f.value.availableHeight-E,P={left:`${k}px`,width:`${jr}px`,maxHeight:`${f.value.availableHeight}px`,"--scroll-max-height":`${Math.max(Ud,D)}px`};if(v){const K=document.documentElement.clientHeight;P.bottom=`${Math.max(0,K-f.value.bottom)}px`,P.top="auto"}else P.top=`${f.value.top}px`,P.bottom="auto";return P});function ne(v){if(I.value.length===0)return;const k=I.value.length;m.value=((m.value+v)%k+k)%k,q()}function q(){var E;const v=(E=d.value)==null?void 0:E.querySelectorAll(".slash-menu-item"),k=v==null?void 0:v[m.value];k&&k.scrollIntoView({block:"nearest"}),t.nextTick(U)}function x(v){switch(v.key){case"ArrowDown":return v.preventDefault(),ne(1),!0;case"ArrowUp":return v.preventDefault(),ne(-1),!0;case"PageDown":return v.preventDefault(),ne(5),!0;case"PageUp":return v.preventDefault(),ne(-5),!0;case"Home":return v.preventDefault(),m.value=0,q(),!0;case"End":return v.preventDefault(),m.value=Math.max(0,I.value.length-1),q(),!0;case"Enter":return v.preventDefault(),z(),!0;case"Escape":return v.preventDefault(),l("close"),!0;default:return!1}}function z(){const v=I.value[m.value];v&&l("commit",v,r.mode),l("close")}function A(v){const k=I.value.indexOf(v);k>=0&&(m.value=k),z()}return n({onKeyDown:x}),Ki(a,()=>r.visible,()=>l("close"),()=>r.anchorEl),t.onMounted(()=>{window.addEventListener("resize",U)}),t.onBeforeUnmount(()=>{window.removeEventListener("resize",U)}),(v,k)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[w.value&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:a,class:t.normalizeClass(["plus-menu slash-menu",{"menu-closing":!e.visible}]),style:t.normalizeStyle(J.value),role:"listbox"},[u.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(F,["prevent"])},[...k[0]||(k[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,Rd)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:d,class:"slash-menu-scroll",onScroll:U},[I.value.length===0?(t.openBlock(),t.createElementBlock("div",Ld,t.toDisplayString(t.unref(i)("plus.noMatch")),1)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(j.value,E=>(t.openBlock(),t.createElementBlock("div",{key:E.category,class:"slash-menu-group"},[E.label?(t.openBlock(),t.createElementBlock("div",Od,t.toDisplayString(E.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.items,D=>(t.openBlock(),t.createElementBlock("div",{key:D.id,class:t.normalizeClass(["slash-menu-item",{active:Q(D.id)===m.value}]),"aria-selected":Q(D.id)===m.value,role:"option",onMousedown:t.withModifiers(P=>A(D),["prevent"]),onMouseenter:P=>m.value=Q(D.id)},[t.createVNode(fn,{class:"slash-menu-icon",html:M(D.icon)},null,8,["html"]),t.createElementVNode("div",$d,[t.createElementVNode("div",Pd,t.toDisplayString(t.unref(i)(D.title)),1),D.description?(t.openBlock(),t.createElementBlock("div",Hd,t.toDisplayString(t.unref(i)(D.description)),1)):t.createCommentVNode("",!0)])],42,Dd))),128))]))),128))],544),b.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(ue,["prevent"])},[...k[1]||(k[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,Vd)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)]))}}),Fd=["left","center","right","justify"],Kd=10,Jt={align:{default:"left",validate:e=>Fd.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<=Kd}},Wd={align:Jt.align,color:Jt.color,bgColor:Jt.bgColor},Gd={indent:Jt.indent};function kn(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 i=e.indent;return typeof i=="number"&&i>0&&n.push(`be-indent-${i}`),n}const Gi=[{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}],qi=[{key:"default",label:"None",cssValue:"transparent",opacity:0},{key:"gray",label:"Gray",cssValue:"var(--be-swatch-bg-gray)",opacity:.15},{key:"brown",label:"Brown",cssValue:"var(--be-swatch-bg-brown)",opacity:.18},{key:"orange",label:"Orange",cssValue:"var(--be-swatch-bg-orange)",opacity:.18},{key:"yellow",label:"Yellow",cssValue:"var(--be-swatch-bg-yellow)",opacity:.18},{key:"green",label:"Green",cssValue:"var(--be-swatch-bg-green)",opacity:.18},{key:"blue",label:"Blue",cssValue:"var(--be-swatch-bg-blue)",opacity:.18},{key:"purple",label:"Purple",cssValue:"var(--be-swatch-bg-purple)",opacity:.18},{key:"pink",label:"Pink",cssValue:"var(--be-swatch-bg-pink)",opacity:.18},{key:"red",label:"Red",cssValue:"var(--be-swatch-bg-red)",opacity:.18}],Qr='<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>',po="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",Jr=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${po} 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>`,el=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${po} 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>`,tl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${po} 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>`,nl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${po} 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>`,ol=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${po} 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>`,rl=`<svg viewBox="0 0 1024 1024" width="16" height="16" aria-hidden="true"><path d="${po} 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>`,ll='<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>',il='<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>',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"><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>',cl='<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>',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"><path d="M5 4L2 8L5 12"/><path d="M11 4L14 8L11 12"/><line x1="10" y1="3" x2="6" y2="13"/></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"><line x1="2" y1="8" x2="14" y2="8"/></svg>',Yd='<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>',Zd='<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>',Xd='<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>',jd='<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>',Qd='<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>',Jd='<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>',eu='<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>',tu=["aria-label"],nu={class:"bsm-group"},ou={class:"bsm-icon-grid"},ru=["title","onMousedown","onMouseenter"],lu={key:1,class:"bsm-group"},iu={class:"bsm-collapse-title"},su={class:"bsm-collapse-body"},cu={class:"bsm-row"},au=["disabled","title","onMousedown"],du={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},uu={class:"bsm-row"},fu=["disabled","title"],mu=["disabled","title"],pu={key:2,class:"bsm-group"},hu={class:"bsm-collapse-title"},gu={class:"bsm-collapse-body"},bu={class:"bsm-row"},ku=["disabled","title"],yu=["disabled","title"],wu={key:3,class:"bsm-group bsm-colors"},Eu={class:"bsm-collapse-title"},vu={class:"bsm-collapse-body"},Cu={class:"bsm-swatches"},_u=["title","disabled","onMousedown"],Tu={key:4,class:"bsm-group bsm-colors"},xu={class:"bsm-collapse-title"},Mu={class:"bsm-collapse-body"},Nu={class:"bsm-swatches"},Su=["title","disabled","onMousedown"],Au={class:"bsm-group"},Iu=["onMousedown","onMouseenter"],Bu={class:"bsm-title"},Ru={key:1,class:"bsm-shortcut"},Lu=["aria-label"],dl=260,Ou=80,Yi=24,Du='<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>',$u='<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>',Pu='<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>',Hu='<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>',Vu='<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>',Uu='<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>',zu='<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>',Zi='<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>',Fu='<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>',Ku='<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>',Wu='<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>',Gu='<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>',qu='<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>',Yu='<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>',Zu='<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>',Xu=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:i}=Qt(),s=dn(),c=t.ref(null),a=t.ref(null),d=t.ref("paragraph"),m=t.ref({top:0,left:0,availableHeight:520,above:!1,bottom:0,topBaseline:0}),f=t.ref(!1),p=t.ref(!1),u=t.ref(!1),b=t.reactive({alignIndent:!1,indent:!1,textColor:!1,bgColor:!1}),w=t.ref(!1);let S=null;t.watch(()=>r.visible,V=>{V?(S&&(clearTimeout(S),S=null),w.value=!0):S=setTimeout(()=>{w.value=!1,S=null},300)},{immediate:!0});const M=t.shallowRef(s.getState());let I=null;const j=t.computed(()=>r.blockId!=null?M.value.doc.blocks.get(r.blockId):void 0),Q=t.ref(void 0),U=t.computed(()=>{var N;const V=(N=j.value)==null?void 0:N.attrs.align;return typeof V=="string"?V:"left"}),F=t.computed(()=>{const V=Q.value;return V?!("align"in s.registries.schema.get(V).attrs):!0}),ue=t.computed(()=>Q.value==="image"||Q.value==="table"),J=t.computed(()=>Q.value==="divider"||Q.value==="tableOfContents"),ne=t.computed(()=>Q.value==="divider"||Q.value==="table"||Q.value==="tableOfContents"),q=t.computed(()=>{const V=Q.value;if(!V)return!0;const N=s.registries.schema.get(V);return!("color"in N.attrs)||!("bgColor"in N.attrs)}),x=t.computed(()=>{const V=j.value;return V?In(M.value.doc,V.id):0});function z(V){return["paragraph","heading","orderedList","bulletList","todoList"].includes(V)}const A=t.computed(()=>!!Q.value),v=t.computed(()=>{const V=j.value;if(!V)return!0;const N=M.value.doc,$=Nr(N,V.id);return!$||!z($.type)||In(N,$.id)>=10}),k=t.computed(()=>x.value<=0),E=t.computed(()=>{var N;const V=(N=j.value)==null?void 0:N.attrs.color;return typeof V=="string"?V:"default"}),D=t.computed(()=>{var N;const V=(N=j.value)==null?void 0:N.attrs.bgColor;return typeof V=="string"?V:"default"}),P=t.computed(()=>[{id:"paragraph",iconHtml:Qr,title:i("turnInto.paragraph"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"paragraph"}))}},{id:"h1",iconHtml:Jr,title:i("turnInto.h1"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"heading",attrs:{level:1}}))}},{id:"h2",iconHtml:el,title:i("turnInto.h2"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"heading",attrs:{level:2}}))}},{id:"h3",iconHtml:tl,title:i("turnInto.h3"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"heading",attrs:{level:3}}))}},{id:"h4",iconHtml:nl,title:i("turnInto.h4"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"heading",attrs:{level:4}}))}},{id:"h5",iconHtml:ol,title:i("turnInto.h5"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"heading",attrs:{level:5}}))}},{id:"h6",iconHtml:rl,title:i("turnInto.h6"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"heading",attrs:{level:6}}))}},{id:"bullet",iconHtml:ll,title:i("turnInto.bullet"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"bulletList"}))}},{id:"ordered",iconHtml:il,title:i("turnInto.ordered"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"orderedList"}))}},{id:"todo",iconHtml:sl,title:i("turnInto.todo"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"todoList",attrs:{checked:!1}}))}},{id:"quote",iconHtml:cl,title:i("turnInto.quote"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"quote"}))}},{id:"code",iconHtml:al,title:i("turnInto.code"),kind:"turnInto",run:()=>{var V,N;return void((N=(V=s.commands).convertBlock)==null?void 0:N.call(V,{id:r.blockId,type:"codeBlock",attrs:{language:"plain"}}))}}]);function K(V){const N=j.value;if(!N)return!1;switch(V){case"paragraph":return N.type==="paragraph";case"h1":return N.type==="heading"&&Number(N.attrs.level)===1;case"h2":return N.type==="heading"&&Number(N.attrs.level)===2;case"h3":return N.type==="heading"&&Number(N.attrs.level)===3;case"h4":return N.type==="heading"&&Number(N.attrs.level)===4;case"h5":return N.type==="heading"&&Number(N.attrs.level)===5;case"h6":return N.type==="heading"&&Number(N.attrs.level)===6;case"bullet":return N.type==="bulletList";case"ordered":return N.type==="orderedList";case"todo":return N.type==="todoList";case"quote":return N.type==="quote";case"code":return N.type==="codeBlock";default:return!1}}function te(V){return K(V)}t.watch(()=>r.visible,V=>{var $;if(!V)return;Q.value=r.blockId!=null?($=M.value.doc.blocks.get(r.blockId))==null?void 0:$.type:void 0;const N=P.value.find(ae=>K(ae.id));d.value=N?N.id:"paragraph",b.alignIndent=!1,b.indent=!1,b.textColor=!1,b.bgColor=!1},{immediate:!0});const me=t.computed(()=>{const V=[{id:"align-left",value:"left",title:i("align.left"),run:()=>se("left")},{id:"align-center",value:"center",title:i("align.center"),run:()=>se("center")},{id:"align-right",value:"right",title:i("align.right"),run:()=>se("right")}];return ue.value||V.push({id:"align-justify",value:"justify",title:i("align.justify"),run:()=>se("justify")}),V});function se(V){var N,$;($=(N=s.commands).setBlockAlign)==null||$.call(N,{id:r.blockId,align:V})}function De(){var V,N;(N=(V=s.commands).indentBlock)==null||N.call(V,{id:r.blockId})}function ze(){var V,N;(N=(V=s.commands).outdentBlock)==null||N.call(V,{id:r.blockId})}const Ye=Gi,Ce=qi;function dt(V){var N,$;($=(N=s.commands).setBlockColor)==null||$.call(N,{id:r.blockId,color:V})}function nt(V){var N,$;($=(N=s.commands).setBlockBgColor)==null||$.call(N,{id:r.blockId,bgColor:V})}async function Pe(){var pe,kt;const V=j.value;if(!V)return;const N=Me(V.content),ae=`<meta charset="utf-8"><!-- blockeditor:${JSON.stringify({id:V.id,type:V.type,attrs:V.attrs,text:N}).replace(/--/g,"\\-\\-")} -->${Dt(N)}`;let fe=!1;try{if((pe=navigator.clipboard)!=null&&pe.write&&typeof ClipboardItem<"u"){const ht=new ClipboardItem({"text/plain":new Blob([N],{type:"text/plain"}),"text/html":new Blob([ae],{type:"text/html"})});await navigator.clipboard.write([ht]),fe=!0}}catch{fe=!1}if(!fe)try{(kt=navigator.clipboard)!=null&&kt.writeText&&(await navigator.clipboard.writeText(N),fe=!0)}catch{fe=!1}fe||(fe=Kt(N))}function Dt(V){return V.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Kt(V){const N=document.createElement("textarea");N.value=V,N.setAttribute("readonly",""),N.style.position="fixed",N.style.top="-9999px",N.style.left="-9999px",N.style.opacity="0",document.body.appendChild(N);const $=document.activeElement;N.focus(),N.select();try{return document.execCommand("copy")}catch{return!1}finally{if(document.body.removeChild(N),$&&typeof $.focus=="function")try{$.focus()}catch{}}}function Pt(){Pe().then(()=>{var V,N;return(N=(V=s.commands).removeBlock)==null?void 0:N.call(V,{id:r.blockId})})}const Ve=/Mac|iP(hone|[ao]d)/.test(navigator.platform)?Yu:Zu;function Tt(...V){return V.join("")}const wt=t.computed(()=>[{id:"dup",iconHtml:Du,title:i("action.duplicate"),shortcutHtml:Tt(Ve,Gu),run:()=>{var V,N;return void((N=(V=s.commands).duplicateBlock)==null?void 0:N.call(V,{id:r.blockId}))}},{id:"copy",iconHtml:$u,title:i("action.copy"),shortcutHtml:Tt(Ve,Wu),run:()=>void Pe()},{id:"cut",iconHtml:Pu,title:i("action.cut"),shortcutHtml:Tt(Ve,qu),run:()=>void Pt()},{id:"up",iconHtml:Hu,title:i("action.moveUp"),shortcutHtml:Tt(Ve,Zi,Fu),run:()=>{var V,N;return void((N=(V=s.commands).moveBlockUp)==null?void 0:N.call(V,{id:r.blockId}))}},{id:"down",iconHtml:Vu,title:i("action.moveDown"),shortcutHtml:Tt(Ve,Zi,Ku),run:()=>{var V,N;return void((N=(V=s.commands).moveBlockDown)==null?void 0:N.call(V,{id:r.blockId}))}},{id:"del",iconHtml:Uu,title:i("action.delete"),shortcutHtml:zu,danger:!0,run:()=>{var V,N;return void((N=(V=s.commands).removeBlock)==null?void 0:N.call(V,{id:r.blockId}))}}]);t.watch(()=>r.visible,V=>{V&&(f.value=!1,m.value={top:0,left:0,availableHeight:520,above:!1,bottom:0,topBaseline:0})});function Se(){const V=r.anchorEl,N=r.rootEl,$=c.value;!r.visible||!V||!N||!$||t.nextTick().then(()=>{const ae=c.value;if(!ae)return;const fe=ae.getBoundingClientRect(),pe=Ui(N,V,{width:Math.max(fe.width,dl),height:fe.height},8);m.value=pe,f.value=!0,t.nextTick(he)})}t.watch([()=>r.visible,()=>r.anchorEl,c,p,u],Se,{flush:"post"});function Et(V){b[V]=!b[V],t.nextTick(Se)}function he(){const V=a.value;V&&(p.value=V.scrollTop>1,u.value=V.scrollTop+V.clientHeight<V.scrollHeight-1)}function At(){const V=a.value;V&&(V.scrollTop-=V.clientHeight*.8)}function ut(){const V=a.value;V&&(V.scrollTop+=V.clientHeight*.8)}lr(a,he);const $e=t.computed(()=>{if(!r.rootEl)return{display:"none"};if(!f.value)return{visibility:"hidden",top:"0px",left:"0px",width:`${dl}px`,"--scroll-max-height":"100vh"};const V=m.value.above,N=m.value.left,$=(p.value?Yi:0)+(u.value?Yi:0),ae=m.value.availableHeight-$,fe={left:`${N}px`,width:`${dl}px`,maxHeight:`${m.value.availableHeight}px`,"--scroll-max-height":`${Math.max(Ou,ae)}px`};if(V){const pe=document.documentElement.clientHeight;fe.bottom=`${Math.max(0,pe-m.value.bottom)}px`,fe.top="auto"}else fe.top=`${m.value.top}px`,fe.bottom="auto";return fe});function Xe(V){if(V.kind==="turnInto"&&te(V.id)){const N=P.value.find($=>$.id==="paragraph");if(N){d.value="paragraph",N.run(),l("close");return}}d.value=V.id,V.run(),l("close")}function Mt(V){const N=[...P.value,...wt.value];if(N.length===0)return!1;const $=N.findIndex(fe=>fe.id===d.value),ae=fe=>(fe%N.length+N.length)%N.length;switch(V.key){case"ArrowDown":return V.preventDefault(),d.value=N[ae($+1)].id,!0;case"ArrowUp":return V.preventDefault(),d.value=N[ae($-1)].id,!0;case"Enter":return V.preventDefault(),Xe(N[ae($)]),!0;case"Escape":return V.preventDefault(),l("close"),!0;default:return!1}}return n({onKeyDown:Mt}),Ki(c,()=>r.visible,()=>l("close"),()=>r.anchorEl),t.onMounted(()=>{I=s.subscribe(V=>{M.value=V.state})}),t.onBeforeUnmount(()=>{I==null||I(),I=null}),(V,N)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[w.value&&e.rootEl?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"menuEl",ref:c,class:t.normalizeClass(["block-settings-menu",{"menu-closing":!e.visible}]),style:t.normalizeStyle($e.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(i)("ui.scrollUp"),onMousedown:t.withModifiers(At,["prevent"])},[...N[8]||(N[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,tu)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:a,class:"bsm-scroll",onScroll:he},[!ue.value&&!J.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createElementVNode("div",nu,[t.createElementVNode("div",ou,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(P.value,$=>(t.openBlock(),t.createElementBlock("button",{key:$.id,class:t.normalizeClass(["bsm-icon-cell",{active:te($.id)}]),title:$.title,role:"menuitem",onMousedown:t.withModifiers(ae=>Xe($),["prevent"]),onMouseenter:ae=>d.value=$.id},[t.createVNode(fn,{class:"bsm-icon-svg",html:$.iconHtml},null,8,["html"])],42,ru))),128))])]),N[9]||(N[9]=t.createElementVNode("div",{class:"bsm-sep"},null,-1))],64)):t.createCommentVNode("",!0),ne.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",lu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":F.value&&!A.value,expanded:b.alignIndent}]),role:"menuitem",onMousedown:N[0]||(N[0]=t.withModifiers($=>Et("alignIndent"),["prevent"]))},[t.createElementVNode("span",iu,t.toDisplayString(t.unref(i)("bsm.section.alignIndent")),1),N[10]||(N[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",su,[t.createElementVNode("div",cu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(me.value,$=>(t.openBlock(),t.createElementBlock("button",{key:$.id,class:t.normalizeClass(["bsm-icon-btn",{active:!F.value&&U.value===$.value,"bsm-disabled":F.value}]),disabled:F.value,title:$.title,role:"menuitem",onMousedown:t.withModifiers(ae=>!F.value&&Xe($),["prevent"])},[(t.openBlock(),t.createElementBlock("svg",du,[$.value==="left"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[N[11]||(N[11]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[12]||(N[12]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"10",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[13]||(N[13]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"12",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):$.value==="center"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[N[14]||(N[14]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[15]||(N[15]=t.createElementVNode("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[16]||(N[16]=t.createElementVNode("line",{x1:"3",y1:"12",x2:"13",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):$.value==="right"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[N[17]||(N[17]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[18]||(N[18]=t.createElementVNode("line",{x1:"6",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[19]||(N[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},[N[20]||(N[20]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[21]||(N[21]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),N[22]||(N[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,au))),128))]),t.createElementVNode("div",uu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":k.value}]),disabled:k.value,title:t.unref(i)("bsm.indent.decrease"),role:"menuitem",onMousedown:N[1]||(N[1]=t.withModifiers($=>!k.value&&Xe({id:"outdent",run:ze}),["prevent"]))},[...N[23]||(N[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,fu),t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":v.value}]),disabled:v.value,title:t.unref(i)("bsm.indent.increase"),role:"menuitem",onMousedown:N[2]||(N[2]=t.withModifiers($=>!v.value&&Xe({id:"indent",run:De}),["prevent"]))},[...N[24]||(N[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,mu)])],512),[[t.vShow,b.alignIndent]])])),ne.value?(t.openBlock(),t.createElementBlock("div",pu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":!A.value,expanded:b.indent}]),role:"menuitem",onMousedown:N[3]||(N[3]=t.withModifiers($=>Et("indent"),["prevent"]))},[t.createElementVNode("span",hu,t.toDisplayString(t.unref(i)("bsm.section.indent")),1),N[25]||(N[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",gu,[t.createElementVNode("div",bu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":k.value}]),disabled:k.value,title:t.unref(i)("bsm.indent.decrease"),role:"menuitem",onMousedown:N[4]||(N[4]=t.withModifiers($=>!k.value&&Xe({id:"outdent",run:ze}),["prevent"]))},[...N[26]||(N[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,ku),t.createElementVNode("button",{class:t.normalizeClass(["bsm-icon-btn",{"bsm-disabled":v.value}]),disabled:v.value,title:t.unref(i)("bsm.indent.increase"),role:"menuitem",onMousedown:N[5]||(N[5]=t.withModifiers($=>!v.value&&Xe({id:"indent",run:De}),["prevent"]))},[...N[27]||(N[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,yu)])],512),[[t.vShow,b.indent]])])):t.createCommentVNode("",!0),!ue.value&&!J.value?(t.openBlock(),t.createElementBlock("div",wu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":q.value,expanded:b.textColor}]),role:"menuitem",onMousedown:N[6]||(N[6]=t.withModifiers($=>!q.value&&Et("textColor"),["prevent"]))},[t.createElementVNode("span",Eu,t.toDisplayString(t.unref(i)("bsm.section.textColor")),1),N[28]||(N[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",vu,[t.createElementVNode("div",Cu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Ye),$=>(t.openBlock(),t.createElementBlock("button",{key:"tc-"+$.key,class:t.normalizeClass(["bsm-swatch",{active:E.value===$.key,"bsm-disabled":q.value}]),title:t.unref(i)($.key==="default"?"color.default":"color."+$.key),style:t.normalizeStyle({backgroundColor:$.cssValue}),disabled:q.value,onMousedown:t.withModifiers(ae=>!q.value&&Xe({id:`tc-${$.key}`,run:()=>dt($.key)}),["prevent"])},null,46,_u))),128))])],512),[[t.vShow,b.textColor]])])):t.createCommentVNode("",!0),!ue.value&&!J.value?(t.openBlock(),t.createElementBlock("div",Tu,[t.createElementVNode("button",{class:t.normalizeClass(["bsm-collapse-header",{"bsm-disabled":q.value,expanded:b.bgColor}]),role:"menuitem",onMousedown:N[7]||(N[7]=t.withModifiers($=>!q.value&&Et("bgColor"),["prevent"]))},[t.createElementVNode("span",xu,t.toDisplayString(t.unref(i)("bsm.section.bgColor")),1),N[29]||(N[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",Mu,[t.createElementVNode("div",Nu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Ce),$=>(t.openBlock(),t.createElementBlock("button",{key:"bc-"+$.key,class:t.normalizeClass(["bsm-swatch",{active:D.value===$.key,"bsm-disabled":q.value}]),title:t.unref(i)($.key==="default"?"color.none":"color."+$.key),style:t.normalizeStyle({backgroundColor:$.cssValue}),disabled:q.value,onMousedown:t.withModifiers(ae=>!q.value&&Xe({id:`bc-${$.key}`,run:()=>nt($.key)}),["prevent"])},null,46,Su))),128))])],512),[[t.vShow,b.bgColor]])])):t.createCommentVNode("",!0),N[30]||(N[30]=t.createElementVNode("div",{class:"bsm-sep"},null,-1)),t.createElementVNode("div",Au,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(wt.value,$=>(t.openBlock(),t.createElementBlock("button",{key:$.id,class:t.normalizeClass(["bsm-item bsm-action",{danger:$.danger}]),role:"menuitem",onMousedown:t.withModifiers(ae=>Xe($),["prevent"]),onMouseenter:ae=>d.value=$.id},[t.createVNode(fn,{class:"bsm-action-icon",html:$.iconHtml},null,8,["html"]),t.createElementVNode("span",Bu,t.toDisplayString($.title),1),$.shortcutHtml?(t.openBlock(),t.createBlock(fn,{key:0,class:"bsm-shortcut",html:$.shortcutHtml},null,8,["html"])):$.shortcut?(t.openBlock(),t.createElementBlock("span",Ru,t.toDisplayString($.shortcut),1)):t.createCommentVNode("",!0)],42,Iu))),128))])],544),u.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(ut,["prevent"])},[...N[31]||(N[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,Lu)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)]))}}),ju=["aria-hidden"],Qu=["aria-label"],Ju=["title","aria-label"],ef={class:"ht-dropdown-wrap"},tf=["title","disabled"],nf={class:"ht-type-label"},of=["aria-label"],rf=["onMousedown"],lf={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},sf=["aria-label"],cf={class:"ht-dropdown-wrap"},af=["title","disabled"],df={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},uf=["aria-label"],ff=["onMousedown"],mf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},pf={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},hf=["aria-label"],gf={key:0,class:"ht-dropdown-wrap"},bf=["title","disabled"],kf={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},yf=["aria-label"],wf=["onMousedown"],Ef={viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},vf={key:0,class:"ht-check",viewBox:"0 0 12 12",width:"14",height:"14","aria-hidden":"true"},Cf=["aria-label"],_f=["title","disabled","onMousedown","onTouchstart"],Tf=["title","disabled"],xf={class:"ht-dropdown-wrap"},Mf=["title","disabled"],Nf=["aria-label"],Sf={class:"ht-color-section"},Af={class:"ht-color-label"},If={class:"ht-swatches"},Bf=["title","onMousedown"],Rf={class:"ht-color-section"},Lf={class:"ht-color-label"},Of={class:"ht-swatches"},Df=["title","onMousedown"],$f=["aria-label"],Pf=["title","aria-label","disabled"],Hf={key:0,class:"ht-sep"},Vf=["title"],Uf=["title"],zf=["title"],Ff={key:0,class:"ht-sep"},Kf=["title"],Wf=["title","aria-label"],Gf=80,qf=24,ul=36,Yf=360,Xi=10,ji=200,ir=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","linkClick","delete","merge","split","tableHeaderRow","tableType","tableAlign","tableVerticalAlign","tableMark","tableTextColor","tableBgColor","tableCopy"],setup(e,{expose:n,emit:o}){const r=e,l=o,{t:i}=Qt(),s=dn(),c=t.ref(null),a=t.ref(null),d=t.ref(null),m=t.ref(null),f=t.ref(null),p=t.ref(null),u=t.ref(null),b=t.ref(null),w=t.ref(null),S=t.ref({top:0,left:0,above:!1}),M=t.ref(null),I=t.ref(!1),j=t.ref(null),Q=t.ref(null),U=t.ref(!1),F=t.ref(!1),ue=t.ref(null),J=t.ref(!1),ne=t.ref(!1),q=t.ref(!1),x=t.computed(()=>({maxHeight:j.value!==null?`${j.value}px`:void 0})),z=t.ref(null),A=t.computed(()=>{if(!r.mobile||!z.value)return;const L=z.value,g={position:"fixed",left:`${L.left}px`,bottom:`${L.bottom}px`};return L.right!==void 0&&(g.right=`${L.right}px`),g}),v=t.shallowRef(null);t.watch(()=>r.blockId,L=>{v.value=L},{immediate:!0});const k=t.shallowRef(s.getState());let E=null;const D=t.computed(()=>k.value.doc.blocks.get(v.value??"")),P=t.computed(()=>{var g;if(r.cellEditMode||r.tableMode){const O=r.blockAttrs.align;return typeof O=="string"?O:"left"}const L=(g=D.value)==null?void 0:g.attrs.align;return typeof L=="string"?L:"left"}),K=t.computed(()=>{if(r.tableMode){const L=r.tableActiveVerticalAlign;return typeof L=="string"?L:"middle"}if(r.cellEditMode){const L=r.blockAttrs.verticalAlign;return typeof L=="string"?L:"middle"}return"middle"}),te=t.ref(""),me=t.ref("");t.watch(()=>r.visible,L=>{L||(M.value=null)}),t.watch(()=>r.blockId,()=>{M.value=null});const se=t.ref(new Set),De=t.ref(0);function ze(){var L;if(!r.rootEl)return null;if(r.cellEditMode){const g=window.getSelection();if(!g||g.rangeCount===0)return null;const O=g.getRangeAt(0);return(L=O.commonAncestorContainer.nodeType===1?O.commonAncestorContainer:O.commonAncestorContainer.parentElement)==null?void 0:L.closest(".table-cell-inner")}return r.rootEl.querySelector(`[data-block-id="${r.blockId}"]`)}function Ye(){const L=new Set;if(!r.visible||!r.blockId||!r.rootEl){se.value=L;return}if(r.tableMode&&r.tableActiveMarks){se.value=new Set(r.tableActiveMarks);return}const g=ze();if(g){const y=window.getSelection();if(y&&y.rangeCount>0){const _=y.getRangeAt(0);if(!_.collapsed&&g.contains(_.commonAncestorContainer)){const T=[],B=document.createTreeWalker(g,NodeFilter.SHOW_TEXT);for(;B.nextNode();){const W=B.currentNode;(W.nodeValue??"").length!==0&&_.intersectsNode(W)&&T.push(W)}if(T.length>0){const W={bold:["B","STRONG"],italic:["I","EM"],underline:["U"],strikethrough:["S","STRIKE","DEL"],code:["CODE"],link:["A"]};for(const[ee,ce]of Object.entries(W))T.every(Ee=>{let ke=Ee.parentNode;for(;ke&&ke!==g;){if(ke.nodeType===Node.ELEMENT_NODE&&ce.includes(ke.nodeName))return!0;ke=ke.parentNode}return!1})&&L.add(ee);if(L.size>0){se.value=L;return}}}}}const O=k.value,de=r.blockId?O.doc.blocks.get(r.blockId):void 0;if(!de){se.value=L;return}const _e=O.selection;let Ae=0,Ne=Me(de.content).length;if(_e.kind==="text"&&_e.anchor.blockId===r.blockId&&_e.focus.blockId===r.blockId)Ae=Math.min(_e.anchor.offset,_e.focus.offset),Ne=Math.max(_e.anchor.offset,_e.focus.offset);else{const y=Fe();y&&(Ae=y.from,Ne=y.to)}if(Ae>=Ne){se.value=L;return}const we=["bold","italic","underline","strikethrough","code","link"];for(const y of we){let _=!0,T=!1,B=0;for(const W of de.content){if(W.type!=="text")continue;const ee=B,ce=B+W.text.length;if(ce>Ae&&ee<Ne&&(T=!0,!W.marks||!W.marks.some(Ee=>Ee.type===y))){_=!1;break}B=ce}T&&_&&L.add(y)}se.value=L}const Ce=t.computed(()=>r.mobile&&!r.tableMode&&!r.cellEditMode&&!r.selectionRect),dt=t.computed(()=>Ce.value||r.blockType==="codeBlock"),nt=t.computed(()=>{if(Ce.value)return!0;if(r.tableMode||r.cellEditMode)return r.blockType==="codeBlock";const L=r.blockType;return L?!("align"in s.registries.schema.get(L).attrs):!1});function Pe(L){if(r.tableMode||r.cellEditMode)return!!(r.blockType==="codeBlock"||r.blockType==="quote"&&L==="italic"||L!=="code"&&se.value.has("code"));if(dt.value)return!0;if(L==="italic"){const g=r.blockType;if(g&&s.registries.schema.isMarkDisallowed(g,"italic"))return!0}if(L==="link"){const g=s.getState().selection;return!!(g.kind==="text"&&Ht(g))}return!!(L!=="code"&&se.value.has("code"))}const Dt=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>'}]),Kt=t.computed(()=>{const L=r.blockType,g=r.blockAttrs,O=(_e,Ae)=>L===_e&&(Ae===void 0||Number(g.level)===Ae);return[{id:"text",label:i("turnInto.paragraph"),iconHtml:Qr,active:O("paragraph"),convertType:"paragraph"},{id:"h1",label:i("turnInto.h1"),iconHtml:Jr,active:O("heading",1),convertType:"heading",convertAttrs:{level:1}},{id:"h2",label:i("turnInto.h2"),iconHtml:el,active:O("heading",2),convertType:"heading",convertAttrs:{level:2}},{id:"h3",label:i("turnInto.h3"),iconHtml:tl,active:O("heading",3),convertType:"heading",convertAttrs:{level:3}},{id:"h4",label:i("turnInto.h4"),iconHtml:nl,active:O("heading",4),convertType:"heading",convertAttrs:{level:4}},{id:"h5",label:i("turnInto.h5"),iconHtml:ol,active:O("heading",5),convertType:"heading",convertAttrs:{level:5}},{id:"h6",label:i("turnInto.h6"),iconHtml:rl,active:O("heading",6),convertType:"heading",convertAttrs:{level:6}},{id:"bullet",label:i("turnInto.bullet"),iconHtml:ll,active:O("bulletList"),convertType:"bulletList"},{id:"ordered",label:i("turnInto.ordered"),iconHtml:il,active:O("orderedList"),convertType:"orderedList"},{id:"todo",label:i("turnInto.todo"),iconHtml:sl,active:O("todoList"),convertType:"todoList",convertAttrs:{checked:!1}},{id:"quote",label:i("turnInto.quote"),iconHtml:cl,active:O("quote"),convertType:"quote"},{id:"code",label:i("turnInto.code"),iconHtml:al,active:O("codeBlock"),convertType:"codeBlock",convertAttrs:{language:"plain"}}]}),Pt=t.computed(()=>{const L=Kt.value.find(g=>g.active);return L?L.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"}]),Tt=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"}]),wt=Gi,Se=qi;function Et(){var we;const L=c.value,g=ue.value;if(!L||!g){J.value=!1;return}const O=g.scrollLeft;g.style.maxWidth="",g.offsetWidth;const de=g.scrollWidth,_e=r.mobile?Math.max(120,(((we=L.parentElement)==null?void 0:we.clientWidth)??L.clientWidth)-8):Math.max(200,document.documentElement.clientWidth-32),Ae=qf*2,Ne=_e-Ae;if(de>Ne){J.value=!0,g.style.maxWidth=`${Ne}px`;const y=Math.max(0,g.scrollWidth-g.clientWidth);g.scrollLeft=Math.min(O,y),he()}else J.value=!1,g.style.maxWidth="",ne.value=!1,q.value=!1}function he(){const L=ue.value;L&&(ne.value=L.scrollLeft>0,q.value=L.scrollLeft+L.clientWidth<L.scrollWidth-1)}function At(L){const g=ue.value;g&&(g.scrollLeft+=L*Gf,he())}let ut=null,$e=0,Xe=0,Mt=!1,V=!1;function N(L){if(!Mt)return;const g=L.touches[0];if(!g)return;const O=Math.abs(g.clientX-$e),de=Math.abs(g.clientY-Xe);(O>Xi||de>Xi)&&(V=!0)}function $(L){if(!Mt)return;const g=ut;ut=null,Mt=!1;const O=V;V=!1,O||(L.cancelable&&L.preventDefault(),g&&g())}function ae(L,g){g.cancelable&&g.preventDefault(),At(L)}function fe(L,g){const O=g.touches[0];O&&($e=O.clientX,Xe=O.clientY),ut=L,Mt=!0,V=!1}t.watch([()=>r.visible,()=>r.selectionRect,c,()=>r.mobile],async()=>{if(r.mobile){r.visible&&Et();return}if(!r.visible||!r.selectionRect||!r.rootEl)return;const L=c.value;if(!L)return;Et(),await t.nextTick();const g=L.getBoundingClientRect(),O=g.width,de=Math.max(g.height,ul);S.value=r.tableMode?Fi(r.rootEl,r.selectionRect,{width:O,height:de}):zi(r.rootEl,r.selectionRect,{width:O,height:de})},{flush:"post",immediate:!0});const pe=t.computed(()=>({top:"0px",left:"0px",width:"100vw",height:"100vh"})),kt=t.computed(()=>{const L=c.value,g=(L==null?void 0:L.offsetWidth)??Yf,O=document.documentElement.clientWidth,de=8;let _e=S.value.left;const Ae=Math.max(de,O-g-de);_e=Math.max(de,Math.min(Ae,_e));const Ne={top:`${S.value.top}px`,left:`${_e}px`};if(r.selectionRect){const y=r.selectionRect.left+r.selectionRect.width/2-_e,_=Math.max(10,Math.min(g-10,y));Ne["--ht-arrow-x"]=`${_}px`}return Ne});async function ht(L){M.value=M.value===L?null:L,M.value&&(await t.nextTick(),mn())}function mn(){const L=M.value;if(!L)return;const g=L==="type"?a.value:L==="align"?d.value:L==="verticalAlign"?m.value:f.value,O=L==="type"?p.value:L==="align"?u.value:L==="verticalAlign"?b.value:w.value;if(!g||!O)return;const de=O.getBoundingClientRect(),_e=window.innerHeight,Ae=6,Ne=Math.floor(_e-de.bottom-Ae),we=Math.floor(de.top-Ae),y=g.scrollHeight;if(r.mobile){if(I.value=!0,j.value=Math.max(120,Math.min(we,360)),L==="color"){const W=document.documentElement.clientWidth;z.value={left:8,bottom:Math.max(8,_e-de.top+6),right:Math.max(8,W-de.right)}}else z.value={left:Math.max(8,de.left),bottom:Math.max(8,_e-de.top+6)};t.nextTick(Wt);return}z.value=null;let _=!1;if(r.rootEl&&c.value){const W=r.rootEl.getBoundingClientRect(),ee=c.value.getBoundingClientRect();W.bottom-ee.bottom<ji&&we>ji&&(_=!0)}let T=!1,B;_?(T=!0,B=we):y<=Ne?(T=!1,B=Ne):we>Ne?(T=!0,B=we):(T=!1,B=Ne),I.value=T,j.value=Math.max(120,Math.min(B,360)),t.nextTick(Wt)}function Wt(){const L=Q.value;if(!L){U.value=!1,F.value=!1;return}U.value=L.scrollTop>1,F.value=L.scrollTop+L.clientHeight<L.scrollHeight-1}function yn(){const L=Q.value;L&&(L.scrollTop-=L.clientHeight*.8)}function lt(){const L=Q.value;L&&(L.scrollTop+=L.clientHeight*.8)}lr(Q,Wt);function gt(L){var O,de,_e,Ae,Ne;if(r.tableMode||r.cellEditMode){L.convertType==="heading"&&((O=L.convertAttrs)!=null&&O.level)?l("tableType",`heading${L.convertAttrs.level}`):l("tableType",L.convertType),M.value=null,r.tableMode&&l("close");return}const g=Qe();if(g){for(const we of g.ranges)(_e=(de=s.commands).convertBlock)==null||_e.call(de,{id:we.id,type:L.convertType,attrs:L.convertAttrs??{}});M.value=null,l("close");return}v.value&&((Ne=(Ae=s.commands).convertBlock)==null||Ne.call(Ae,{id:v.value,type:L.convertType,attrs:L.convertAttrs??{}}),M.value=null,l("close"))}function Zt(L){var O,de,_e,Ae;if(r.tableMode||r.cellEditMode){l("tableAlign",L),M.value=null;return}const g=Qe();if(g){for(const Ne of g.ranges)(de=(O=s.commands).setBlockAlign)==null||de.call(O,{id:Ne.id,align:L});M.value=null;return}v.value&&((Ae=(_e=s.commands).setBlockAlign)==null||Ae.call(_e,{id:v.value,align:L}),M.value=null)}function xn(L){if(r.tableMode||r.cellEditMode){l("tableVerticalAlign",L),M.value=null;return}M.value=null}function Mn(L){var de,_e,Ae,Ne;if(r.tableMode){l("tableTextColor",L==="default"?null:L),M.value=null;return}if(r.cellEditMode){const we=window.getSelection();if(we&&we.rangeCount>0&&!we.isCollapsed){const y=we.getRangeAt(0);if(L==="default"){const _=y.extractContents();_.querySelectorAll('span[class*="be-color-"]').forEach(T=>{const B=T.className.replace(/be-color-\w+/g,"").trim();if(B)T.className=B;else{for(;T.firstChild;)T.parentNode.insertBefore(T.firstChild,T);T.parentNode.removeChild(T)}}),y.insertNode(_)}else{const _=document.createElement("span");_.className=`be-color-${L}`,_.appendChild(y.extractContents()),y.insertNode(_),we.removeAllRanges();const T=document.createRange();T.selectNodeContents(_),we.addRange(T)}}M.value=null,Le();return}const g=Qe();if(g){for(const we of g.ranges)(_e=(de=s.commands).setInlineMark)==null||_e.call(de,{id:we.id,markType:"color",attrs:L==="default"?null:{color:L},from:we.from,to:we.to});return}if(!v.value)return;const O=Fe();O&&((Ne=(Ae=s.commands).setInlineMark)==null||Ne.call(Ae,{id:v.value,markType:"color",attrs:L==="default"?null:{color:L},from:O.from,to:O.to}),t.nextTick(()=>{var ee;const we=window.getSelection(),y=(ee=r.rootEl)==null?void 0:ee.querySelector(`[data-block-id="${r.blockId}"]`),_=we&&we.rangeCount>0?we.getRangeAt(0):null,T=!!y,B=!!(_&&y&&y.contains(_.commonAncestorContainer)),W=!!(_&&!_.collapsed&&B);if(!T){l("close");return}if(!W&&!B){l("close");return}Le(),Ye()}))}function Ge(L){var de,_e,Ae,Ne;if(r.tableMode){l("tableBgColor",L==="default"?null:L),M.value=null;return}if(r.cellEditMode){const we=window.getSelection();if(we&&we.rangeCount>0&&!we.isCollapsed){const y=we.getRangeAt(0);if(L==="default"){const _=y.extractContents();_.querySelectorAll('span[class*="be-bg-"]').forEach(T=>{const B=T.className.replace(/be-bg-\w+/g,"").trim();if(B)T.className=B;else{for(;T.firstChild;)T.parentNode.insertBefore(T.firstChild,T);T.parentNode.removeChild(T)}}),y.insertNode(_)}else{const _=document.createElement("span");_.className=`be-bg-${L}`,_.appendChild(y.extractContents()),y.insertNode(_),we.removeAllRanges();const T=document.createRange();T.selectNodeContents(_),we.addRange(T)}}M.value=null,Le();return}const g=Qe();if(g){for(const we of g.ranges)(_e=(de=s.commands).setInlineMark)==null||_e.call(de,{id:we.id,markType:"bgColor",attrs:L==="default"?null:{bgColor:L},from:we.from,to:we.to});return}if(!v.value)return;const O=Fe();O&&((Ne=(Ae=s.commands).setInlineMark)==null||Ne.call(Ae,{id:v.value,markType:"bgColor",attrs:L==="default"?null:{bgColor:L},from:O.from,to:O.to}),t.nextTick(()=>{var ee;const we=window.getSelection(),y=(ee=r.rootEl)==null?void 0:ee.querySelector(`[data-block-id="${r.blockId}"]`),_=we&&we.rangeCount>0?we.getRangeAt(0):null,T=!!y,B=!!(_&&y&&y.contains(_.commonAncestorContainer)),W=!!(_&&!_.collapsed&&B);if(!T){l("close");return}if(!W&&!B){l("close");return}Le(),Ye()}))}function Le(){if(r.tableMode){te.value=r.tableActiveColor??"",me.value=r.tableActiveBgColor??"";return}if(r.visible&&r.blockId&&r.rootEl){const y=ze(),_=window.getSelection();if(y&&_&&_.rangeCount>0){const T=_.getRangeAt(0);if(!T.collapsed&&y.contains(T.commonAncestorContainer)){const B=new Set,W=new Set,ee=[],ce=document.createTreeWalker(y,NodeFilter.SHOW_TEXT);for(;ce.nextNode();){const ie=ce.currentNode;(ie.nodeValue??"").length!==0&&T.intersectsNode(ie)&&ee.push(ie)}for(const ie of ee){let Ee=ie.parentNode;for(;Ee&&Ee!==y;){if(Ee.nodeType===Node.ELEMENT_NODE){const ke=Ee.className;if(typeof ke=="string"){const Te=ke.match(/be-color-(\w+)/);Te&&B.add(Te[1]);const xe=ke.match(/be-bg-(\w+)/);xe&&W.add(xe[1])}}Ee=Ee.parentNode}}if(B.size>0||W.size>0){te.value=B.size===1?[...B][0]:"",me.value=W.size===1?[...W][0]:"";return}}}}const L=k.value,g=r.blockId?L.doc.blocks.get(r.blockId):void 0;if(!g){te.value="",me.value="";return}const O=L.selection;let de,_e;if(O.kind==="text"&&O.anchor.blockId===r.blockId&&O.focus.blockId===r.blockId)de=Math.min(O.anchor.offset,O.focus.offset),_e=Math.max(O.anchor.offset,O.focus.offset);else{const y=Fe();de=y?y.from:0,_e=y?y.to:Me(g.content).length}if(de>=_e){te.value="",me.value="";return}const Ae=new Set,Ne=new Set;let we=0;for(const y of g.content){if(y.type!=="text")continue;const _=we,T=we+y.text.length;if(T>de&&_<_e&&y.marks)for(const B of y.marks)B.type==="color"&&B.attrs&&typeof B.attrs.color=="string"&&Ae.add(B.attrs.color),B.type==="bgColor"&&B.attrs&&typeof B.attrs.bgColor=="string"&&Ne.add(B.attrs.bgColor);we=T}te.value=Ae.size===1?[...Ae][0]:"",me.value=Ne.size===1?[...Ne][0]:""}function Fe(){if(!r.blockId||!r.rootEl)return null;const L=r.rootEl.querySelector(`[data-block-id="${r.blockId}"]`);if(!L)return null;const g=window.getSelection();if(!g||g.rangeCount===0)return null;const O=g.getRangeAt(0);if(O.collapsed||!L.contains(O.commonAncestorContainer))return null;const de=document.createRange();de.selectNodeContents(L),de.setEnd(O.startContainer,O.startOffset);const _e=de.toString().length;de.setEnd(O.endContainer,O.endOffset);const Ae=de.toString().length;return{from:Math.min(_e,Ae),to:Math.max(_e,Ae)}}function Qe(){const L=k.value.selection;if(L.kind!=="text"||!Ht(L))return null;const g=k.value.doc,O=_n(g),de=O.indexOf(L.anchor.blockId),_e=O.indexOf(L.focus.blockId);if(de===-1||_e===-1)return null;const[Ae,Ne]=de<=_e?[L.anchor,L.focus]:[L.focus,L.anchor],we=O.indexOf(Ae.blockId),y=O.indexOf(Ne.blockId);if(we===-1||y===-1||we>y)return null;const _=[];for(let T=we;T<=y;T++){const B=O[T],W=g.blocks.get(B);if(!W)continue;const ee=Me(W.content).length;let ce=0,ie=ee;T===we&&(ce=Math.min(Ae.offset,ee)),T===y&&(ie=Math.min(Ne.offset,ee)),_.push({id:B,from:ce,to:ie})}return{ranges:_}}function qe(){const L=k.value.selection;if(L.kind!=="text"||!Ht(L))return null;const g=Qe();if(!g)return null;const O=k.value.doc,de=[],_e=[];for(const Ae of g.ranges){const Ne=O.blocks.get(Ae.id);if(!Ne)continue;const[,we]=Ft(Ne.content,Ae.from),[y]=Ft(we,Ae.to-Ae.from);de.push(Me(y)),_e.push(Wn(y))}return{text:de.join(`
|
|
12
|
+
`),html:_e.join("<br>")}}function ft(L){var de,_e,Ae,Ne;if(r.tableMode){l("tableMark",L);return}if(r.cellEditMode){const y={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikeThrough",code:"insertHTML"}[L];if(y==="insertHTML"){const _=window.getSelection();if(_&&_.rangeCount>0&&!_.isCollapsed){const T=_.getRangeAt(0),B=document.createElement("code");try{B.appendChild(T.extractContents()),T.insertNode(B),_.removeAllRanges();const W=document.createRange();W.selectNodeContents(B),_.addRange(W)}catch{}}}else y&&document.execCommand(y);Ye();return}const g=Qe();if(g){for(const we of g.ranges)(_e=(de=s.commands).toggleMark)==null||_e.call(de,{id:we.id,markType:L,from:we.from,to:we.to});return}if(!v.value)return;const O=Fe();O&&((Ne=(Ae=s.commands).toggleMark)==null||Ne.call(Ae,{id:v.value,markType:L,from:O.from,to:O.to}),t.nextTick(()=>{var ee;De.value++;const we=window.getSelection(),y=(ee=r.rootEl)==null?void 0:ee.querySelector(`[data-block-id="${r.blockId}"]`),_=we&&we.rangeCount>0?we.getRangeAt(0):null,T=!!y,B=!!(_&&y&&y.contains(_.commonAncestorContainer)),W=!!(_&&!_.collapsed&&B);if(!T){l("close");return}if(!W&&!B){l("close");return}Ye(),Le()}))}function Nt(){if(r.cellEditMode){l("linkClick",v.value??"",0,0);return}if(v.value){const L=Fe();L&&l("linkClick",v.value,L.from,L.to)}}function It(){var de,_e;if(r.tableMode){l("tableCopy"),l("close");return}const L=qe();if(L){(de=navigator.clipboard)==null||de.writeText(L.text),l("close");return}const g=window.getSelection(),O=g?g.toString():"";O&&((_e=navigator.clipboard)==null||_e.writeText(O)),l("close")}n({});async function Vt(){if(r.mobile){r.visible&&Et(),M.value&&mn(),Wt(),Ye(),Le();return}if(r.visible&&r.selectionRect&&r.rootEl&&c.value){Et(),await t.nextTick();const L=c.value.getBoundingClientRect();S.value=r.tableMode?Fi(r.rootEl,r.selectionRect,{width:L.width,height:Math.max(L.height,ul)}):zi(r.rootEl,r.selectionRect,{width:L.width,height:Math.max(L.height,ul)})}M.value&&mn(),Wt(),Ye(),Le()}function Ut(L){if(!M.value)return;const g=[a.value,d.value,m.value,f.value],O=[p.value,u.value,b.value,w.value];for(const de of g)if(de&&de.contains(L))return;for(const de of O)if(de&&de.contains(L))return;M.value=null}function sn(L){if(!r.visible)return;const g=c.value;if(g&&g.contains(L.target)){L.preventDefault();return}Ut(L.target)}function Nn(L){if(!r.visible||!L.touches[0])return;const O=L.target,de=c.value;if(de&&de.contains(O)){const _e=ue.value;if(_e&&_e.contains(O))return;L.preventDefault();return}Ut(O)}t.watch(()=>r.visible,L=>{L&&t.nextTick(()=>{Ye(),Le()})}),t.onMounted(()=>{window.addEventListener("scroll",Vt,!0),window.addEventListener("resize",Vt),window.addEventListener("mousedown",sn,!0),window.addEventListener("touchstart",Nn,!0),document.addEventListener("selectionchange",ro),E=s.subscribe(()=>{t.nextTick(()=>{const L=s.getState();k.value=L,De.value++,Ye(),Le()})})}),t.onBeforeUnmount(()=>{window.removeEventListener("scroll",Vt,!0),window.removeEventListener("resize",Vt),window.removeEventListener("mousedown",sn,!0),window.removeEventListener("touchstart",Nn,!0),document.removeEventListener("selectionchange",ro),E==null||E(),E=null});function ro(){r.visible&&Yn===null&&(Yn=requestAnimationFrame(()=>{Yn=null,r.visible&&(Ye(),Le())}))}let Yn=null;return(L,g)=>(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:pe.value),"aria-hidden":!e.visible},[t.createElementVNode("div",{ref_key:"toolbarEl",ref:c,class:t.normalizeClass(["hover-toolbar",{above:S.value.above,below:!S.value.above,"ht-overflow":J.value,"mobile-mode":e.mobile}]),style:t.normalizeStyle(e.mobile?void 0:kt.value),role:"toolbar","aria-label":t.unref(i)("hoverToolbar.label")},[J.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:t.normalizeClass(["ht-nav-btn ht-nav-left",{disabled:!ne.value}]),title:t.unref(i)("ui.scrollLeft"),"aria-label":t.unref(i)("ui.scrollLeft"),onMousedown:g[0]||(g[0]=t.withModifiers(O=>At(-1),["prevent","stop"])),onTouchstart:g[1]||(g[1]=t.withModifiers(()=>{},["stop"])),onTouchend:g[2]||(g[2]=t.withModifiers(O=>ae(-1,O),["stop"])),onClick:g[3]||(g[3]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[39]||(g[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,Ju)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"htContentEl",ref:ue,class:t.normalizeClass(["ht-content",{"dropdown-open":!e.mobile&&!!M.value}]),onScroll:he,onTouchmovePassive:N,onTouchend:t.withModifiers($,["stop"])},[t.createElementVNode("div",ef,[t.createElementVNode("button",{ref_key:"typeBtnEl",ref:p,class:t.normalizeClass(["ht-btn ht-type-btn",{open:M.value==="type",disabled:Ce.value}]),title:t.unref(i)("hoverToolbar.typeBtnTitle"),disabled:Ce.value,onMousedown:g[4]||(g[4]=t.withModifiers(O=>!Ce.value&&ht("type"),["prevent","stop"])),onTouchstart:g[5]||(g[5]=t.withModifiers(O=>{fe(()=>{Ce.value||ht("type")},O)},["stop"])),onClick:g[6]||(g[6]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createElementVNode("span",nf,t.toDisplayString(Pt.value),1),g[40]||(g[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,tf),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[M.value==="type"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"typeDropdownEl",ref:a,class:t.normalizeClass(["ht-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:I.value}]]),style:t.normalizeStyle([x.value,A.value])},[U.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(yn,["prevent"])},[...g[41]||(g[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,of)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:Q,class:"ht-dropdown-scroll",onScroll:Wt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Kt.value,O=>(t.openBlock(),t.createElementBlock("button",{key:O.id,class:t.normalizeClass(["ht-dropdown-item",{active:O.active}]),onMousedown:t.withModifiers(de=>gt(O),["prevent","stop"])},[t.createVNode(fn,{class:"ht-dropdown-icon",html:O.iconHtml},null,8,["html"]),t.createElementVNode("span",null,t.toDisplayString(O.label),1),O.active?(t.openBlock(),t.createElementBlock("svg",lf,[...g[42]||(g[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,rf))),128))],544),F.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(lt,["prevent"])},[...g[43]||(g[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,sf)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))]),t.createElementVNode("div",cf,[t.createElementVNode("button",{ref_key:"alignBtnEl",ref:u,class:t.normalizeClass(["ht-btn ht-icon-only",{open:M.value==="align",disabled:nt.value}]),title:t.unref(i)("hoverToolbar.alignBtnTitle"),disabled:nt.value,onMousedown:g[7]||(g[7]=t.withModifiers(O=>!nt.value&&ht("align"),["prevent","stop"])),onTouchstart:g[8]||(g[8]=t.withModifiers(O=>{fe(()=>{nt.value||ht("align")},O)},["stop"])),onClick:g[9]||(g[9]=t.withModifiers(()=>{},["prevent","stop"]))},[(t.openBlock(),t.createElementBlock("svg",df,[P.value==="left"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[g[44]||(g[44]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[45]||(g[45]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"10",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[46]||(g[46]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"12",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):P.value==="center"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[g[47]||(g[47]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[48]||(g[48]=t.createElementVNode("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[49]||(g[49]=t.createElementVNode("line",{x1:"3",y1:"12",x2:"13",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):P.value==="right"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[g[50]||(g[50]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[51]||(g[51]=t.createElementVNode("line",{x1:"6",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[52]||(g[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},[g[53]||(g[53]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[54]||(g[54]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[55]||(g[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,af),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[M.value==="align"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"alignDropdownEl",ref:d,class:t.normalizeClass(["ht-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:I.value}]]),style:t.normalizeStyle([x.value,A.value])},[U.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(yn,["prevent"])},[...g[56]||(g[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,uf)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:Q,class:"ht-dropdown-scroll",onScroll:Wt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ve.value,O=>(t.openBlock(),t.createElementBlock("button",{key:O.id,class:t.normalizeClass(["ht-dropdown-item ht-align-item",{active:P.value===O.value}]),onMousedown:t.withModifiers(de=>Zt(O.value),["prevent","stop"])},[(t.openBlock(),t.createElementBlock("svg",mf,[O.value==="left"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[g[57]||(g[57]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[58]||(g[58]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"10",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[59]||(g[59]=t.createElementVNode("line",{x1:"2",y1:"12",x2:"12",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):O.value==="center"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[g[60]||(g[60]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[61]||(g[61]=t.createElementVNode("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[62]||(g[62]=t.createElementVNode("line",{x1:"3",y1:"12",x2:"13",y2:"12",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):O.value==="right"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[g[63]||(g[63]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[64]||(g[64]=t.createElementVNode("line",{x1:"6",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[65]||(g[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},[g[66]||(g[66]=t.createElementVNode("line",{x1:"2",y1:"4",x2:"14",y2:"4",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[67]||(g[67]=t.createElementVNode("line",{x1:"2",y1:"8",x2:"14",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[68]||(g[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(O.label),1),P.value===O.value?(t.openBlock(),t.createElementBlock("svg",pf,[...g[69]||(g[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,ff))),128))],544),F.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(lt,["prevent"])},[...g[70]||(g[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,hf)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))]),e.tableMode||e.cellEditMode?(t.openBlock(),t.createElementBlock("div",gf,[t.createElementVNode("button",{ref_key:"verticalAlignBtnEl",ref:b,class:t.normalizeClass(["ht-btn ht-icon-only",{open:M.value==="verticalAlign",disabled:nt.value}]),title:t.unref(i)("hoverToolbar.verticalAlignBtnTitle"),disabled:nt.value,onMousedown:g[10]||(g[10]=t.withModifiers(O=>!nt.value&&ht("verticalAlign"),["prevent","stop"])),onTouchstart:g[11]||(g[11]=t.withModifiers(O=>{fe(()=>{nt.value||ht("verticalAlign")},O)},["stop"])),onClick:g[12]||(g[12]=t.withModifiers(()=>{},["prevent","stop"]))},[(t.openBlock(),t.createElementBlock("svg",kf,[K.value==="top"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[g[71]||(g[71]=t.createElementVNode("line",{x1:"2",y1:"3",x2:"14",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[72]||(g[72]=t.createElementVNode("line",{x1:"4",y1:"7",x2:"12",y2:"7",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[73]||(g[73]=t.createElementVNode("line",{x1:"5",y1:"11",x2:"11",y2:"11",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):K.value==="bottom"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[g[74]||(g[74]=t.createElementVNode("line",{x1:"5",y1:"5",x2:"11",y2:"5",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[75]||(g[75]=t.createElementVNode("line",{x1:"4",y1:"9",x2:"12",y2:"9",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[76]||(g[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},[g[77]||(g[77]=t.createElementVNode("line",{x1:"5",y1:"3",x2:"11",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[78]||(g[78]=t.createElementVNode("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[79]||(g[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,bf),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[M.value==="verticalAlign"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"verticalAlignDropdownEl",ref:m,class:t.normalizeClass(["ht-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:I.value}]]),style:t.normalizeStyle([x.value,A.value])},[U.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(yn,["prevent"])},[...g[80]||(g[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,yf)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:Q,class:"ht-dropdown-scroll",onScroll:Wt},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Tt.value,O=>(t.openBlock(),t.createElementBlock("button",{key:O.id,class:t.normalizeClass(["ht-dropdown-item ht-align-item",{active:K.value===O.value}]),onMousedown:t.withModifiers(de=>xn(O.value),["prevent","stop"])},[(t.openBlock(),t.createElementBlock("svg",Ef,[O.value==="top"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[g[81]||(g[81]=t.createElementVNode("line",{x1:"2",y1:"3",x2:"14",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[82]||(g[82]=t.createElementVNode("line",{x1:"4",y1:"7",x2:"12",y2:"7",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[83]||(g[83]=t.createElementVNode("line",{x1:"5",y1:"11",x2:"11",y2:"11",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1))],64)):O.value==="bottom"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[g[84]||(g[84]=t.createElementVNode("line",{x1:"5",y1:"5",x2:"11",y2:"5",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[85]||(g[85]=t.createElementVNode("line",{x1:"4",y1:"9",x2:"12",y2:"9",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[86]||(g[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},[g[87]||(g[87]=t.createElementVNode("line",{x1:"5",y1:"3",x2:"11",y2:"3",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[88]||(g[88]=t.createElementVNode("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor","stroke-width":"1.3","stroke-linecap":"round"},null,-1)),g[89]||(g[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(O.label),1),K.value===O.value?(t.openBlock(),t.createElementBlock("svg",vf,[...g[90]||(g[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,wf))),128))],544),F.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(lt,["prevent"])},[...g[91]||(g[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,Cf)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))])):t.createCommentVNode("",!0),g[100]||(g[100]=t.createElementVNode("div",{class:"ht-sep"},null,-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Dt.value,O=>(t.openBlock(),t.createElementBlock("button",{key:O.id,class:t.normalizeClass(["ht-btn ht-icon-only",{active:se.value.has(O.id),disabled:Pe(O.id)}]),title:O.title,disabled:Pe(O.id),onMousedown:t.withModifiers(de=>!Pe(O.id)&&ft(O.id),["prevent","stop"]),onTouchstart:t.withModifiers(de=>{fe(()=>{Pe(O.id)||ft(O.id)},de)},["stop"]),onClick:g[13]||(g[13]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createVNode(fn,{html:O.iconHtml},null,8,["html"])],42,_f))),128)),e.tableMode?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:1,class:t.normalizeClass(["ht-btn ht-icon-only",{active:se.value.has("link"),disabled:Pe("link")}]),title:t.unref(i)("hoverToolbar.linkBtnTitle"),disabled:Pe("link"),onMousedown:g[14]||(g[14]=t.withModifiers(O=>!Pe("link")&&Nt(),["prevent","stop"])),onTouchstart:g[15]||(g[15]=t.withModifiers(O=>{fe(()=>{Pe("link")||Nt()},O)},["stop"])),onClick:g[16]||(g[16]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[92]||(g[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,Tf)),g[101]||(g[101]=t.createElementVNode("div",{class:"ht-sep"},null,-1)),t.createElementVNode("div",xf,[t.createElementVNode("button",{ref_key:"colorBtnEl",ref:w,class:t.normalizeClass(["ht-btn ht-icon-only",{open:M.value==="color",disabled:Pe("color")}]),title:t.unref(i)("hoverToolbar.colorBtnTitle"),disabled:Pe("color"),onMousedown:g[17]||(g[17]=t.withModifiers(O=>!Pe("color")&&ht("color"),["prevent","stop"])),onTouchstart:g[18]||(g[18]=t.withModifiers(O=>{fe(()=>{Pe("color")||ht("color")},O)},["stop"])),onClick:g[19]||(g[19]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[93]||(g[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,Mf),(t.openBlock(),t.createBlock(t.Teleport,{to:"body",disabled:!e.mobile},[M.value==="color"?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"colorDropdownEl",ref:f,class:t.normalizeClass(["ht-dropdown ht-color-dropdown",[e.mobile?"ht-dropdown-mobile":"",{above:I.value}]]),style:t.normalizeStyle([x.value,A.value])},[U.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(yn,["prevent"])},[...g[94]||(g[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,Nf)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:Q,class:"ht-dropdown-scroll",onScroll:Wt},[t.createElementVNode("div",Sf,[t.createElementVNode("div",Af,t.toDisplayString(t.unref(i)("hoverToolbar.textColor")),1),t.createElementVNode("div",If,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(wt),O=>(t.openBlock(),t.createElementBlock("button",{key:"tc-"+O.key,class:t.normalizeClass(["ht-swatch",{active:te.value===O.key}]),title:t.unref(i)(O.key==="default"?"color.default":"color."+O.key),style:t.normalizeStyle({backgroundColor:O.cssValue}),onMousedown:t.withModifiers(de=>Mn(O.key),["prevent","stop"])},null,46,Bf))),128))])]),t.createElementVNode("div",Rf,[t.createElementVNode("div",Lf,t.toDisplayString(t.unref(i)("hoverToolbar.bgColor")),1),t.createElementVNode("div",Of,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Se),O=>(t.openBlock(),t.createElementBlock("button",{key:"bc-"+O.key,class:t.normalizeClass(["ht-swatch",{active:me.value===O.key}]),title:t.unref(i)(O.key==="default"?"color.none":"color."+O.key),style:t.normalizeStyle({backgroundColor:O.cssValue}),onMousedown:t.withModifiers(de=>Ge(O.key),["prevent","stop"])},null,46,Df))),128))])])],544),F.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(lt,["prevent"])},[...g[95]||(g[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,$f)):t.createCommentVNode("",!0)],6)):t.createCommentVNode("",!0)],8,["disabled"]))]),g[102]||(g[102]=t.createElementVNode("div",{class:"ht-sep"},null,-1)),t.createElementVNode("button",{class:t.normalizeClass(["ht-btn ht-icon-only",{disabled:Ce.value}]),title:t.unref(i)("hoverToolbar.copySelection"),"aria-label":t.unref(i)("hoverToolbar.copySelection"),disabled:Ce.value,onMousedown:g[20]||(g[20]=t.withModifiers(O=>!Ce.value&&It(),["prevent","stop"])),onTouchstart:g[21]||(g[21]=t.withModifiers(O=>{fe(()=>{Ce.value||It()},O)},["stop"])),onClick:g[22]||(g[22]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[96]||(g[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,Pf),e.tableMode?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.showMerge||e.showSplit||e.showHeaderRow||e.showDelete?(t.openBlock(),t.createElementBlock("div",Hf)):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:g[23]||(g[23]=t.withModifiers(O=>l("merge"),["prevent","stop"])),onTouchstart:g[24]||(g[24]=t.withModifiers(O=>fe(()=>l("merge"),O),["stop"])),onClick:g[25]||(g[25]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[97]||(g[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,Vf)):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:g[26]||(g[26]=t.withModifiers(O=>l("split"),["prevent","stop"])),onTouchstart:g[27]||(g[27]=t.withModifiers(O=>fe(()=>l("split"),O),["stop"])),onClick:g[28]||(g[28]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[98]||(g[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,Uf)):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:g[29]||(g[29]=t.withModifiers(O=>l("tableHeaderRow"),["prevent","stop"])),onTouchstart:g[30]||(g[30]=t.withModifiers(O=>fe(()=>l("tableHeaderRow"),O),["stop"])),onClick:g[31]||(g[31]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[99]||(g[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,zf)):t.createCommentVNode("",!0),e.showDelete?(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[e.showMerge||e.showSplit||e.showHeaderRow?(t.openBlock(),t.createElementBlock("div",Ff)):t.createCommentVNode("",!0),t.createElementVNode("button",{class:"ht-btn ht-danger ht-icon-only",title:e.deleteLabel||t.unref(i)("hoverToolbar.deleteBlock"),onMousedown:g[32]||(g[32]=t.withModifiers(O=>l("delete"),["prevent","stop"])),onTouchstart:g[33]||(g[33]=t.withModifiers(O=>fe(()=>l("delete"),O),["stop"])),onClick:g[34]||(g[34]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createVNode(fn,{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,Kf)],64)):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],34),J.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:t.normalizeClass(["ht-nav-btn ht-nav-right",{disabled:!q.value}]),title:t.unref(i)("ui.scrollRight"),"aria-label":t.unref(i)("ui.scrollRight"),onMousedown:g[35]||(g[35]=t.withModifiers(O=>At(1),["prevent","stop"])),onTouchstart:g[36]||(g[36]=t.withModifiers(()=>{},["stop"])),onTouchend:g[37]||(g[37]=t.withModifiers(O=>ae(1,O),["stop"])),onClick:g[38]||(g[38]=t.withModifiers(()=>{},["prevent","stop"]))},[...g[103]||(g[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,Wf)):t.createCommentVNode("",!0)],14,Qu)],14,ju)],8,["disabled"]))}}),Zf=["aria-label"],Xf={class:"mt-left"},jf=["disabled","title","aria-label"],Qf=["disabled","title","aria-label"],Jf={key:0,class:"mt-sep"},em=t.defineComponent({__name:"MobileToolbar",props:{rootEl:{},focusBlockId:{},hoverVisible:{type:Boolean},hoverSelectionRect:{},hoverBlockId:{},hoverBlockType:{},hoverBlockAttrs:{}},emits:["openPlusMenu","openSettingsMenu","linkClick","hoverClose"],setup(e,{emit:n}){const o=e,r=n,{t:l}=Qt(),i=Kn(),s=dn(),c=t.inject(Or,t.ref(null)),a=t.computed(()=>{const M=c.value;if(M&&M.visible)return M;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:(j,Q,U)=>r("linkClick",j,Q,U)};const I=o.focusBlockId;if(I){const j=s.getState().doc.blocks.get(I);return{visible:!0,selectionRect:null,blockId:I,blockType:(j==null?void 0:j.type)??null,blockAttrs:(j==null?void 0:j.attrs)??{},rootEl:o.rootEl,onClose:()=>r("hoverClose"),onLinkClick:(Q,U,F)=>r("linkClick",Q,U,F)}}return{visible:!1,selectionRect:null,blockId:null,blockType:null,blockAttrs:{},rootEl:o.rootEl}}),d=t.computed(()=>{const M=c.value;return M&&M.visible?M.blockId:o.hoverVisible&&o.hoverBlockId?o.hoverBlockId:o.focusBlockId}),m=t.ref(null),f=t.ref(null);function p(){const M=d.value,I=m.value;!M||!I||r("openPlusMenu",M,I)}function u(){const M=d.value,I=f.value;!M||!I||r("openSettingsMenu",M,I)}const b=t.ref(0);function w(){const M=window.visualViewport;if(!M){b.value=0;return}const I=Math.max(0,window.innerHeight-M.height-M.offsetTop);b.value=I}const S=t.computed(()=>({bottom:`${b.value}px`}));return t.onMounted(()=>{const M=window.visualViewport;M&&(M.addEventListener("resize",w),M.addEventListener("scroll",w),w())}),t.onBeforeUnmount(()=>{const M=window.visualViewport;M&&(M.removeEventListener("resize",w),M.removeEventListener("scroll",w))}),(M,I)=>t.unref(i)?(t.openBlock(),t.createElementBlock("div",{key:0,ref:"toolbarRoot",class:"mobile-toolbar",style:t.normalizeStyle(S.value),role:"toolbar","aria-label":t.unref(l)("hoverToolbar.label")},[t.createElementVNode("div",Xf,[t.createElementVNode("button",{ref_key:"plusBtnEl",ref:m,class:t.normalizeClass(["mt-btn mt-plus",{disabled:!d.value}]),disabled:!d.value,title:t.unref(l)("handle.plus.title"),"aria-label":t.unref(l)("handle.plus.ariaLabel"),onMousedown:t.withModifiers(p,["prevent","stop"]),onTouchstart:I[0]||(I[0]=t.withModifiers(()=>{},["stop"]))},[...I[2]||(I[2]=[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,jf),t.createElementVNode("button",{ref_key:"handleBtnEl",ref:f,class:t.normalizeClass(["mt-btn mt-handle",{disabled:!d.value}]),disabled:!d.value,title:t.unref(l)("handle.grip.title"),"aria-label":t.unref(l)("handle.grip.ariaLabel"),onMousedown:t.withModifiers(u,["prevent","stop"]),onTouchstart:I[1]||(I[1]=t.withModifiers(()=>{},["stop"]))},[...I[3]||(I[3]=[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,Qf)]),a.value.visible?(t.openBlock(),t.createElementBlock("div",Jf)):t.createCommentVNode("",!0),t.createVNode(ir,t.mergeProps({mobile:""},a.value),null,16)],12,Zf)):t.createCommentVNode("",!0)}}),tm={class:"olm-label"},nm={class:"olm-label"},om={class:"olm-label"},sr=6,Qi=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}=Qt(),i=t.ref(null),s=t.ref({top:0,left:0,above:!1});t.watch([()=>o.visible,()=>o.anchor,i],async()=>{if(!o.visible||!o.anchor)return;await t.nextTick();const f=i.value;if(!f)return;const p=o.anchor.getBoundingClientRect(),u=f.getBoundingClientRect(),w=window.innerHeight-p.bottom-sr,S=p.top-sr,M=Math.max(u.height,10);let I=!1;w>=M?I=!1:S>=M?I=!0:I=S>w,s.value={top:I?p.top-(u.height+sr):p.bottom+sr,left:p.left,above:I}},{flush:"post",immediate:!0});const c=t.computed(()=>({top:`${s.value.top}px`,left:`${s.value.left}px`}));function a(){o.canContinue&&r("continue")}function d(){o.canStartNew&&r("startNew")}function m(){r("modify",o.currentNumber)}return(f,p)=>(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(["ordered-list-menu",{above:s.value.above}]),style:t.normalizeStyle(c.value),role:"menu",onMousedown:p[0]||(p[0]=t.withModifiers(()=>{},["prevent","stop"]))},[t.createElementVNode("button",{class:t.normalizeClass(["olm-item",{disabled:!e.canContinue}]),role:"menuitem",onClick:a},[p[1]||(p[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",tm,t.toDisplayString(t.unref(l)("ol.continue")),1)],2),t.createElementVNode("button",{class:t.normalizeClass(["olm-item",{disabled:!e.canStartNew}]),role:"menuitem",onClick:d},[p[2]||(p[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",nm,t.toDisplayString(t.unref(l)("ol.startNew")),1)],2),t.createElementVNode("button",{class:"olm-item",role:"menuitem",onClick:m},[p[3]||(p[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",om,t.toDisplayString(t.unref(l)("ol.modify")),1)])],38)):t.createCommentVNode("",!0)]))}}),rm=["aria-label"],lm=["aria-label"],im={class:"np-ok",type:"submit"},cr=6,Ji=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}=Qt(),i=t.ref(null),s=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;s.value=o.initialValue,await t.nextTick();const m=o.anchor.getBoundingClientRect(),f=window.innerHeight,p=52;let u=!1;f-m.bottom-cr<p&&m.top-cr>p&&(u=!0),c.value={top:u?m.top-(p+cr):m.bottom+cr,left:m.left},t.nextTick(()=>{var b,w;(b=i.value)==null||b.focus(),(w=i.value)==null||w.select()})},{flush:"post",immediate:!0});const a=t.computed(()=>({top:`${c.value.top}px`,left:`${c.value.left}px`}));function d(){let m=s.value;Number.isFinite(m)||(m=o.initialValue),m=Math.max(1,Math.floor(m)),r("confirm",m)}return(m,f)=>(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:f[2]||(f[2]=t.withModifiers(()=>{},["stop"])),onTouchstart:f[3]||(f[3]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("form",{class:"np-form",onSubmit:t.withModifiers(d,["prevent"])},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:i,"onUpdate:modelValue":f[0]||(f[0]=p=>s.value=p),type:"number",class:"np-input",min:"1",step:"1","aria-label":t.unref(l)("numberPicker.inputLabel"),onKeydown:f[1]||(f[1]=t.withKeys(p=>r("close"),["escape"]))},null,40,lm),[[t.vModelText,s.value,void 0,{number:!0}]]),t.createElementVNode("button",im,t.toDisplayString(t.unref(l)("numberPicker.confirm")),1)],32)],44,rm)):t.createCommentVNode("",!0)]))}}),sm=["aria-label"],cm={key:0,class:"clp-custom"},am=["placeholder","aria-label"],dm={class:"clp-actions"},um={class:"clp-ok",type:"submit"},fm=["aria-label"],mm=["onClick"],pm={class:"clp-item-name"},hm={key:0,class:"clp-item-check","aria-hidden":"true"},gm={class:"clp-item-name"},bm=["aria-label"],to=6,es=200,km=120,ym=360,wm=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}=Qt(),i=["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"],s=t.ref(null),c=t.ref(null),a=t.ref(null),d=t.ref(!1),m=t.ref(""),f=t.ref(o.initialValue),p=t.ref({top:0,left:0,above:!1,maxHeight:360}),u=t.ref(!1),b=t.ref(!1);function w(ne){return ne==="plain"?l("codeLang.plain"):ne}function S(){if(!o.visible||!o.anchor||!o.rootEl)return;const ne=s.value;if(!ne)return;const q=o.anchor.getBoundingClientRect(),x=window.innerHeight,z=Math.floor(x-q.bottom-to),A=Math.floor(q.top-to),v=ne.scrollHeight;let k=!1;o.rootEl.getBoundingClientRect().bottom-q.bottom<es&&A>es&&(k=!0);let P,K;k?(P=!0,K=A):v<=z?(P=!1,K=z):A>z?(P=!0,K=A):(P=!1,K=z);const te=Math.max(km,Math.min(K,ym)),me=document.documentElement.clientWidth,se=Math.max(ne.clientWidth,200),De=Math.max(to,Math.min(me-se-to,q.left)),ze=P?Math.max(to,q.top-to-Math.min(v,te)):q.bottom+to;p.value={top:ze,left:De,above:P,maxHeight:te},t.nextTick(M)}t.watch([()=>o.visible,()=>o.anchor,()=>o.initialValue],async()=>{o.visible&&(d.value=!1,f.value=o.initialValue??"plain",m.value=f.value==="plain"?"":f.value,await t.nextTick(),S())},{flush:"post",immediate:!0});function M(){const ne=a.value;ne&&(u.value=ne.scrollTop>1,b.value=ne.scrollTop+ne.clientHeight<ne.scrollHeight-1)}function I(){const ne=a.value;ne&&(ne.scrollTop-=ne.clientHeight*.8)}function j(){const ne=a.value;ne&&(ne.scrollTop+=ne.clientHeight*.8)}lr(a,M);function Q(){d.value=!0,m.value=f.value==="plain"?"":f.value,t.nextTick(()=>{var ne,q;(ne=c.value)==null||ne.focus(),(q=c.value)==null||q.select(),S()})}function U(){d.value=!1,t.nextTick(S)}function F(){const ne=m.value.replace(/[^a-zA-Z]/g,"").slice(0,20);ne!==m.value&&(m.value=ne)}function ue(){const ne=(m.value??"").replace(/[^a-zA-Z]/g,"").slice(0,20);r("confirm",ne.length===0?"plain":ne)}const J=t.computed(()=>({top:`${p.value.top}px`,left:`${p.value.left}px`,maxHeight:`${p.value.maxHeight}px`}));return(ne,q)=>(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(["code-lang-picker",{above:p.value.above}]),style:t.normalizeStyle(J.value),role:"menu","aria-label":t.unref(l)("codeLang.title"),onMousedown:q[1]||(q[1]=t.withModifiers(()=>{},["stop"])),onTouchstart:q[2]||(q[2]=t.withModifiers(()=>{},["stop"])),onWheel:q[3]||(q[3]=t.withModifiers(()=>{},["prevent"])),onTouchmove:q[4]||(q[4]=t.withModifiers(()=>{},["prevent"]))},[d.value?(t.openBlock(),t.createElementBlock("div",cm,[t.createElementVNode("form",{class:"clp-form",onSubmit:t.withModifiers(ue,["prevent"])},[t.withDirectives(t.createElementVNode("input",{ref_key:"inputEl",ref:c,"onUpdate:modelValue":q[0]||(q[0]=x=>m.value=x),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:F,onKeydown:t.withKeys(U,["escape"])},null,40,am),[[t.vModelText,m.value]]),t.createElementVNode("div",dm,[t.createElementVNode("button",um,t.toDisplayString(t.unref(l)("codeLang.confirm")),1),t.createElementVNode("button",{class:"clp-cancel",type:"button",onClick:U},t.toDisplayString(t.unref(l)("codeLang.cancel")),1)])],32)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[u.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(I,["prevent"])},[...q[5]||(q[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,fm)):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"scrollEl",ref:a,class:"clp-list",onScroll:M},[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,x=>t.createElementVNode("button",{key:x,class:t.normalizeClass(["clp-item",{active:x===f.value}]),role:"menuitem",onClick:z=>r("confirm",x)},[t.createElementVNode("span",pm,t.toDisplayString(w(x)),1),x===f.value?(t.openBlock(),t.createElementBlock("span",hm,"✓")):t.createCommentVNode("",!0)],10,mm)),64)),t.createElementVNode("button",{class:"clp-item clp-item-custom",role:"menuitem",onClick:Q},[t.createElementVNode("span",gm,t.toDisplayString(t.unref(l)("codeLang.custom")),1)])],544),b.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(j,["prevent"])},[...q[6]||(q[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,bm)):t.createCommentVNode("",!0)],64))],46,sm)):t.createCommentVNode("",!0)]))}}),Em=["aria-label"],vm={key:0,class:"link-popover-view"},Cm=["href","title"],_m={class:"link-popover-actions"},Tm=["title","aria-label"],xm=["title","aria-label"],Mm=["title","aria-label"],Nm=["title","aria-label"],Sm={key:1,class:"link-popover-edit"},Am=["placeholder"],Im={key:0,class:"link-popover-error",role:"alert"},Bm=["placeholder"],Rm={class:"link-popover-edit-actions"},Lm=["title"],Om=["title"],ts=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:i}=Qt(),s=dn(),c=t.ref(null),a=t.ref(null),d=t.ref(!1),m=t.ref(!1),f=t.ref("view"),p=t.ref(""),u=t.ref(""),b=t.ref({top:0,left:0}),w=t.ref(""),S=t.computed(()=>r.showTextInput??!1),M=t.computed(()=>f.value==="edit"?p.value:r.href),I=t.computed(()=>{const A=Xn(M.value);return Rn(A)??"#"}),j=t.computed(()=>{const A=M.value;return A?A.length>60?A.slice(0,57)+"...":A:i("link.emptyUrl")}),Q=t.computed(()=>({top:`${b.value.top}px`,left:`${b.value.left}px`,visibility:m.value?"visible":"hidden"}));async function U(){if(!r.visible||!r.anchorRect||!c.value)return;await t.nextTick();const v=c.value.getBoundingClientRect(),k=8,E=document.documentElement.clientWidth,P=document.documentElement.clientHeight-r.anchorRect.bottom-k,K=r.anchorRect.top-k,me=P<v.height+k&&K>P?Math.max(k,r.anchorRect.top-v.height-k):r.anchorRect.bottom+k,se=r.anchorRect.left+(r.anchorRect.width-v.width)/2,De=Math.max(k,E-v.width-k),ze=Math.max(k,Math.min(De,se));b.value={top:me,left:ze},m.value=!0}t.watch(()=>r.visible,A=>{A?(d.value=!0,f.value=r.readonly?"view":r.initialMode??(r.href?"view":"edit"),p.value=r.href,u.value=r.text,m.value=!1,t.nextTick(()=>{var v,k;U(),f.value==="edit"&&((v=a.value)==null||v.focus(),(k=a.value)==null||k.select())})):(m.value=!1,setTimeout(()=>{r.visible||(d.value=!1)},200))},{immediate:!0}),t.watch(()=>r.anchorRect,()=>{r.visible&&U()});function F(){r.readonly||(f.value="edit",p.value=r.href,u.value=r.text,w.value="",t.nextTick(()=>{var A,v;(A=a.value)==null||A.focus(),(v=a.value)==null||v.select()}))}function ue(){const A=p.value;if(!A.trim()){w.value="";return}const v=Xn(A);Rn(v)?w.value="":w.value=i("link.invalidUrl")}function J(){var E,D,P;if(!r.blockId&&!r.onSaveLink)return;const A=Xn(p.value),v=Rn(A);if(!v){w.value=i("link.invalidUrl"),(E=a.value)==null||E.focus();return}w.value="";const k=S.value&&u.value!==r.text;r.onSaveLink?r.onSaveLink(v,k?u.value:void 0):(P=(D=s.commands).setLink)==null||P.call(D,{id:r.blockId,href:v,from:r.from,to:r.to,text:k?u.value:void 0}),r.href?(f.value="view",t.nextTick(()=>{U()})):l("close")}function ne(){r.href?(f.value="view",p.value=r.href,u.value=r.text):l("close")}function q(){var A,v;!r.blockId&&!r.onRemoveLinkMark||(r.onRemoveLinkMark?r.onRemoveLinkMark():(v=(A=s.commands).unsetLink)==null||v.call(A,{id:r.blockId,from:r.from,to:r.to}),l("close"))}function x(){var v;const A=Xn(r.href);A&&((v=navigator.clipboard)==null||v.writeText(A))}function z(){const A=Xn(r.href),v=Rn(A);v&&v!=="#"&&window.open(v,"_blank","noopener,noreferrer")}return t.onBeforeUnmount(()=>{d.value=!1}),n({isEditing:()=>f.value==="edit",save:J,cancel:ne}),(A,v)=>(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:m.value}]),style:t.normalizeStyle(Q.value),role:"dialog","aria-label":t.unref(i)("link.popoverLabel"),onMousedown:v[2]||(v[2]=t.withModifiers(()=>{},["stop"])),onTouchstart:v[3]||(v[3]=t.withModifiers(()=>{},["stop"]))},[f.value==="view"?(t.openBlock(),t.createElementBlock("div",vm,[t.createElementVNode("a",{href:I.value,target:"_blank",rel:"noopener noreferrer",class:"link-popover-url",title:M.value,onClick:z},t.toDisplayString(j.value),9,Cm),t.createElementVNode("div",_m,[t.createElementVNode("button",{class:"link-popover-btn",title:t.unref(i)("link.open"),"aria-label":t.unref(i)("link.open"),onMousedown:t.withModifiers(z,["prevent","stop"])},[...v[4]||(v[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,Tm),t.createElementVNode("button",{class:"link-popover-btn",title:t.unref(i)("link.copy"),"aria-label":t.unref(i)("link.copy"),onMousedown:t.withModifiers(x,["prevent","stop"])},[...v[5]||(v[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,xm),e.readonly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,class:"link-popover-btn",title:t.unref(i)("link.edit"),"aria-label":t.unref(i)("link.edit"),onMousedown:t.withModifiers(F,["prevent","stop"])},[...v[6]||(v[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,Mm)),e.readonly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:1,class:"link-popover-btn link-popover-danger",title:t.unref(i)("link.remove"),"aria-label":t.unref(i)("link.remove"),onMousedown:t.withModifiers(q,["prevent","stop"])},[...v[7]||(v[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,Nm))])])):(t.openBlock(),t.createElementBlock("div",Sm,[t.withDirectives(t.createElementVNode("input",{ref_key:"urlInputEl",ref:a,"onUpdate:modelValue":v[0]||(v[0]=k=>p.value=k),class:t.normalizeClass(["link-popover-input",{"link-popover-input-error":w.value}]),type:"text",placeholder:t.unref(i)("link.urlPlaceholder"),onKeydown:[t.withKeys(J,["enter"]),t.withKeys(ne,["escape"])],onInput:ue},null,42,Am),[[t.vModelText,p.value]]),w.value?(t.openBlock(),t.createElementBlock("div",Im,t.toDisplayString(w.value),1)):t.createCommentVNode("",!0),S.value?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,"onUpdate:modelValue":v[1]||(v[1]=k=>u.value=k),class:"link-popover-input",type:"text",placeholder:t.unref(i)("link.textPlaceholder"),onKeydown:[t.withKeys(J,["enter"]),t.withKeys(ne,["escape"])]},null,40,Bm)),[[t.vModelText,u.value]]):t.createCommentVNode("",!0),t.createElementVNode("div",Rm,[t.createElementVNode("button",{class:"link-popover-btn link-popover-save",title:t.unref(i)("link.save"),onMousedown:t.withModifiers(J,["prevent","stop"])},t.toDisplayString(t.unref(i)("link.save")),41,Lm),t.createElementVNode("button",{class:"link-popover-btn link-popover-cancel",title:t.unref(i)("link.cancel"),onMousedown:t.withModifiers(ne,["prevent","stop"])},t.toDisplayString(t.unref(i)("link.cancel")),41,Om)])]))],46,Em)):t.createCommentVNode("",!0)]))}}),Dm={default:null,validate:e=>e==null?!0:Number.isInteger(e)&&e>=1};function ns(e,n){const o=co(e,n),r=ln(e,n);if(r<0)return 1;const l=e.blocks.get(n);if(!l)return 1;const i=l.attrs.startNumber;if(typeof i=="number")return i;let s=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 m=d.attrs.startNumber;if(typeof m=="number"){s=m;break}c++}return s!==null?s+c+1:1+c}const $m=t.defineComponent({name:"OrderedListBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){const n=dn(),o=Kn(),r=t.ref(null),l=t.useAttrs(),i={...typeof l.onLinkClick=="function"?{onLinkClick:l.onLinkClick}:{},...typeof l.onSlashTrigger=="function"?{onSlashTrigger:l.onSlashTrigger}:{},...typeof l.onInputChanged=="function"?{onInputChanged:l.onInputChanged}:{}},s=t.ref(0),c=n.subscribe(()=>{s.value++});return t.onBeforeUnmount(c),()=>{s.value;const a=n.getState().doc,d=ns(a,e.block.id),m=t.h("div",{ref:r,class:"ol-marker","data-ol-number":String(d),onMousedown:w=>{w.preventDefault(),w.stopPropagation()},onClick:w=>{if(w.stopPropagation(),!o.value)return;const S=new CustomEvent("ordered-list-marker-click",{bubbles:!0,detail:{blockId:e.block.id,anchor:r.value}});w.currentTarget.dispatchEvent(S)}},[`${d}.`]),f=kn(e.block.attrs),p=f.filter(w=>w.startsWith("be-indent-")),u=f.filter(w=>!w.startsWith("be-indent-")),b=t.h(Dn,{block:e.block,placeholder:e.placeholder,class:["block-ordered-list-content",...u],...i});return t.h("div",{class:["block-ordered-list-wrapper",...p],"data-block-type":"orderedList"},[m,b])}}}),Pm={name:"orderedList",schema:{type:"orderedList",content:"text",nestable:!0,listLike:!0,attrs:{...Jt,startNumber:Dm}},renderer:{component:$m},slashCommands:[{id:"ordered-list",title:"slash.orderedList.title",keywords:["list","numbered","ordered","有序列表","编号列表","ol","1"],description:"slash.orderedList.description",icon:il,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})}]},Hm=t.defineComponent({name:"ParagraphBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return()=>t.h(Dn,{block:e.block,placeholder:e.placeholder,class:["block-paragraph",...kn(e.block.attrs)]})}}),os={name:"paragraph",schema:{type:"paragraph",content:"text",nestable:!0,attrs:{...Jt}},renderer:{component:Hm},slashCommands:[{id:"paragraph",title:"slash.paragraph.title",keywords:["text","paragraph","normal","正文","段落"],description:"slash.paragraph.description",icon:Qr,command:"convertBlock",category:"basic",args:e=>({id:"__currentBlock__",type:"paragraph"})}],inputRules:[{name:"paragraph-noop",pattern:/^$/,command:"setText",args:e=>({id:"__currentBlock__",content:[]})}]},Vm=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(Dn,{block:e.block,placeholder:e.placeholder,class:["block-heading",`block-heading-h${n}`,...kn(e.block.attrs)]})}}});function ho(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 go=(e,n,o,r,l,i)=>({id:e,title:o,keywords:i,description:r,icon:l,command:"convertBlock",category:"basic",args:()=>({id:"__currentBlock__",type:"heading",attrs:{level:n}})}),rs={name:"heading",schema:{type:"heading",content:"text",nestable:!0,attrs:{level:{default:1,validate:e=>typeof e=="number"&&e>=1&&e<=6},...Jt}},renderer:{component:Vm},slashCommands:[go("heading-1",1,"slash.heading1.title","slash.heading1.description",Jr,["h1","标题1","大标题","title"]),go("heading-2",2,"slash.heading2.title","slash.heading2.description",el,["h2","标题2","小标题"]),go("heading-3",3,"slash.heading3.title","slash.heading3.description",tl,["h3","标题3","section"]),go("heading-4",4,"slash.heading4.title","slash.heading4.description",nl,["h4","标题4"]),go("heading-5",5,"slash.heading5.title","slash.heading5.description",ol,["h5","标题5"]),go("heading-6",6,"slash.heading6.title","slash.heading6.description",rl,["h6","标题6"])],inputRules:[ho(1),ho(2),ho(3),ho(4),ho(5),ho(6)]},ls={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"}]},is={name:"history-keymap",keymap:[{key:"Mod-z",command:"undo"},{key:"Mod-Shift-z",command:"redo"},{key:"Mod-y",command:"redo"}]},Um=t.defineComponent({name:"BulletListBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return()=>t.h(Dn,{block:e.block,placeholder:e.placeholder,class:["block-bullet-list",...kn(e.block.attrs)]})}}),zm={name:"bulletList",schema:{type:"bulletList",content:"text",nestable:!0,listLike:!0,attrs:{...Jt}},renderer:{component:Um},slashCommands:[{id:"bullet-list",title:"slash.bulletList.title",keywords:["list","bullet","unordered","项目符号","无序列表","ul","-","*"],description:"slash.bulletList.description",icon:ll,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})}]},Fm=t.defineComponent({name:"TodoListBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){const n=dn(),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(i){var c,a;const s=i.target;(a=(c=n.commands).setAttrs)==null||a.call(c,{id:e.block.id,attrs:{...e.block.attrs,checked:s.checked}})}return()=>{const i=!!e.block.attrs.checked,s=kn(e.block.attrs),c=s.filter(m=>m.startsWith("be-indent-")),a=s.filter(m=>!m.startsWith("be-indent-")),d=["block-todo-list",i?"todo-checked":"todo-unchecked",...a];return t.h("div",{class:["block-todo-wrapper",...c]},[t.h("input",{type:"checkbox",class:"block-todo-checkbox",checked:i,onchange:l}),t.h(Dn,{block:e.block,placeholder:e.placeholder,class:d,...r})])}}}),Km={name:"todoList",schema:{type:"todoList",content:"text",nestable:!0,listLike:!0,attrs:{...Jt,checked:{default:!1,validate:e=>typeof e=="boolean"}}},renderer:{component:Fm},slashCommands:[{id:"todo-list",title:"slash.todoList.title",keywords:["todo","task","checkbox","待办","任务","复选框","[]","[ ]"],description:"slash.todoList.description",icon:sl,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})}]},Wm=t.defineComponent({name:"QuoteBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return()=>t.h(Dn,{block:e.block,placeholder:e.placeholder,class:["block-quote",...kn(e.block.attrs)]})}}),Gm={name:"quote",schema:{type:"quote",content:"text",nestable:!1,disallowedMarks:["italic"],attrs:{...Wd,indent:Jt.indent}},renderer:{component:Wm},slashCommands:[{id:"quote",title:"slash.quote.title",keywords:["quote","blockquote","引用",">","引言"],description:"slash.quote.description",icon:cl,command:"convertBlock",category:"other",args:()=>({id:"__currentBlock__",type:"quote"})}],inputRules:[{name:"quote-gt",pattern:/^> $/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"quote",__stripPrefix:2})}]};function qm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ss(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)&&ss(o)}),e}class cs{constructor(n){n.data===void 0&&(n.data={}),this.data=n.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function as(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function qn(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 Ym="</span>",ds=e=>!!e.scope,Zm=(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 Xm{constructor(n,o){this.buffer="",this.classPrefix=o.classPrefix,n.walk(this)}addText(n){this.buffer+=as(n)}openNode(n){if(!ds(n))return;const o=Zm(n.scope,{prefix:this.classPrefix});this.span(o)}closeNode(n){ds(n)&&(this.buffer+=Ym)}value(){return this.buffer}span(n){this.buffer+=`<span class="${n}">`}}const us=(e={})=>{const n={children:[]};return Object.assign(n,e),n};class fl{constructor(){this.rootNode=us(),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=us({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=>{fl._collapse(o)}))}}class jm extends fl{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 Xm(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Uo(e){return e?typeof e=="string"?e:e.source:null}function fs(e){return no("(?=",e,")")}function Qm(e){return no("(?:",e,")*")}function Jm(e){return no("(?:",e,")?")}function no(...e){return e.map(o=>Uo(o)).join("")}function ep(e){const n=e[e.length-1];return typeof n=="object"&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}function ml(...e){return"("+(ep(e).capture?"":"?:")+e.map(r=>Uo(r)).join("|")+")"}function ms(e){return new RegExp(e.toString()+"|").exec("").length-1}function tp(e,n){const o=e&&e.exec(n);return o&&o.index===0}const np=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function pl(e,{joinWith:n}){let o=0;return e.map(r=>{o+=1;const l=o;let i=Uo(r),s="";for(;i.length>0;){const c=np.exec(i);if(!c){s+=i;break}s+=i.substring(0,c.index),i=i.substring(c.index+c[0].length),c[0][0]==="\\"&&c[1]?s+="\\"+String(Number(c[1])+l):(s+=c[0],c[0]==="("&&o++)}return s}).map(r=>`(${r})`).join(n)}const op=/\b\B/,ps="[a-zA-Z]\\w*",hl="[a-zA-Z_]\\w*",hs="\\b\\d+(\\.\\d+)?",gs="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",bs="\\b(0b[01]+)",rp="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",lp=(e={})=>{const n=/^#![ ]*\//;return e.binary&&(e.begin=no(n,/.*\b/,e.binary,/\b.*/)),qn({scope:"meta",begin:n,end:/$/,relevance:0,"on:begin":(o,r)=>{o.index!==0&&r.ignoreMatch()}},e)},zo={begin:"\\\\[\\s\\S]",relevance:0},ip={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[zo]},sp={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[zo]},cp={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/},ar=function(e,n,o={}){const r=qn({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=ml("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:no(/[ ]+/,"(",l,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},ap=ar("//","$"),dp=ar("/\\*","\\*/"),up=ar("#","$"),fp={scope:"number",begin:hs,relevance:0},mp={scope:"number",begin:gs,relevance:0},pp={scope:"number",begin:bs,relevance:0},hp={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[zo,{begin:/\[/,end:/\]/,relevance:0,contains:[zo]}]},gp={scope:"title",begin:ps,relevance:0},bp={scope:"title",begin:hl,relevance:0},kp={begin:"\\.\\s*"+hl,relevance:0};var dr=Object.freeze({__proto__:null,APOS_STRING_MODE:ip,BACKSLASH_ESCAPE:zo,BINARY_NUMBER_MODE:pp,BINARY_NUMBER_RE:bs,COMMENT:ar,C_BLOCK_COMMENT_MODE:dp,C_LINE_COMMENT_MODE:ap,C_NUMBER_MODE:mp,C_NUMBER_RE:gs,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:up,IDENT_RE:ps,MATCH_NOTHING_RE:op,METHOD_GUARD:kp,NUMBER_MODE:fp,NUMBER_RE:hs,PHRASAL_WORDS_MODE:cp,QUOTE_STRING_MODE:sp,REGEXP_MODE:hp,RE_STARTERS_RE:rp,SHEBANG:lp,TITLE_MODE:gp,UNDERSCORE_IDENT_RE:hl,UNDERSCORE_TITLE_MODE:bp});function yp(e,n){e.input[e.index-1]==="."&&n.ignoreMatch()}function wp(e,n){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Ep(e,n){n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=yp,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function vp(e,n){Array.isArray(e.illegal)&&(e.illegal=ml(...e.illegal))}function Cp(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 _p(e,n){e.relevance===void 0&&(e.relevance=1)}const Tp=(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=no(o.beforeMatch,fs(o.begin)),e.starts={relevance:0,contains:[Object.assign(o,{endsParent:!0})]},e.relevance=0,delete o.beforeMatch},xp=["of","and","for","in","not","or","if","then","parent","list","value"],Mp="keyword";function ks(e,n,o=Mp){const r=Object.create(null);return typeof e=="string"?l(o,e.split(" ")):Array.isArray(e)?l(o,e):Object.keys(e).forEach(function(i){Object.assign(r,ks(e[i],n,i))}),r;function l(i,s){n&&(s=s.map(c=>c.toLowerCase())),s.forEach(function(c){const a=c.split("|");r[a[0]]=[i,Np(a[0],a[1])]})}}function Np(e,n){return n?Number(n):Sp(e)?0:1}function Sp(e){return xp.includes(e.toLowerCase())}const ys={},oo=e=>{console.error(e)},ws=(e,...n)=>{console.log(`WARN: ${e}`,...n)},bo=(e,n)=>{ys[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),ys[`${e}/${n}`]=!0)},ur=new Error;function Es(e,n,{key:o}){let r=0;const l=e[o],i={},s={};for(let c=1;c<=n.length;c++)s[c+r]=l[c],i[c+r]=!0,r+=ms(n[c-1]);e[o]=s,e[o]._emit=i,e[o]._multi=!0}function Ap(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw oo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ur;if(typeof e.beginScope!="object"||e.beginScope===null)throw oo("beginScope must be object"),ur;Es(e,e.begin,{key:"beginScope"}),e.begin=pl(e.begin,{joinWith:""})}}function Ip(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw oo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ur;if(typeof e.endScope!="object"||e.endScope===null)throw oo("endScope must be object"),ur;Es(e,e.end,{key:"endScope"}),e.end=pl(e.end,{joinWith:""})}}function Bp(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Rp(e){Bp(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),Ap(e),Ip(e)}function Lp(e){function n(s,c){return new RegExp(Uo(s),"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+=ms(c)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const c=this.regexes.map(a=>a[1]);this.matcherRe=n(pl(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((f,p)=>p>0&&f!==void 0),m=this.matchIndexes[d];return a.splice(0,d),Object.assign(a,m)}}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,m])=>a.addRule(d,m)),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 m=this.getMatcher(0);m.lastIndex=this.lastIndex+1,d=m.exec(c)}return d&&(this.regexIndex+=d.position+1,this.regexIndex===this.count&&this.considerAll()),d}}function l(s){const c=new r;return s.contains.forEach(a=>c.addRule(a.begin,{rule:a,type:"begin"})),s.terminatorEnd&&c.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&c.addRule(s.illegal,{type:"illegal"}),c}function i(s,c){const a=s;if(s.isCompiled)return a;[wp,Cp,Rp,Tp].forEach(m=>m(s,c)),e.compilerExtensions.forEach(m=>m(s,c)),s.__beforeBegin=null,[Ep,vp,_p].forEach(m=>m(s,c)),s.isCompiled=!0;let d=null;return typeof s.keywords=="object"&&s.keywords.$pattern&&(s.keywords=Object.assign({},s.keywords),d=s.keywords.$pattern,delete s.keywords.$pattern),d=d||/\w+/,s.keywords&&(s.keywords=ks(s.keywords,e.case_insensitive)),a.keywordPatternRe=n(d,!0),c&&(s.begin||(s.begin=/\B|\b/),a.beginRe=n(a.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(a.endRe=n(a.end)),a.terminatorEnd=Uo(a.end)||"",s.endsWithParent&&c.terminatorEnd&&(a.terminatorEnd+=(s.end?"|":"")+c.terminatorEnd)),s.illegal&&(a.illegalRe=n(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(m){return Op(m==="self"?s:m)})),s.contains.forEach(function(m){i(m,a)}),s.starts&&i(s.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=qn(e.classNameAliases||{}),i(e)}function vs(e){return e?e.endsWithParent||vs(e.starts):!1}function Op(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(n){return qn(e,{variants:null},n)})),e.cachedVariants?e.cachedVariants:vs(e)?qn(e,{starts:e.starts?qn(e.starts):null}):Object.isFrozen(e)?qn(e):e}var Dp="11.11.0";class $p extends Error{constructor(n,o){super(n),this.name="HTMLInjectionError",this.html=o}}const gl=as,Cs=qn,_s=Symbol("nomatch"),Pp=7,Ts=function(e){const n=Object.create(null),o=Object.create(null),r=[];let l=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",s={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:jm};function a(E){return c.noHighlightRe.test(E)}function d(E){let D=E.className+" ";D+=E.parentNode?E.parentNode.className:"";const P=c.languageDetectRe.exec(D);if(P){const K=J(P[1]);return K||(ws(i.replace("{}",P[1])),ws("Falling back to no-highlight mode for this block.",E)),K?P[1]:"no-highlight"}return D.split(/\s+/).find(K=>a(K)||J(K))}function m(E,D,P){let K="",te="";typeof D=="object"?(K=E,P=D.ignoreIllegals,te=D.language):(bo("10.7.0","highlight(lang, code, ...args) has been deprecated."),bo("10.7.0",`Please use highlight(code, options) instead.
|
|
13
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),te=E,K=D),P===void 0&&(P=!0);const me={code:K,language:te};v("before:highlight",me);const se=me.result?me.result:f(me.language,me.code,P);return se.code=me.code,v("after:highlight",se),se}function f(E,D,P,K){const te=Object.create(null);function me($,ae){return $.keywords[ae]}function se(){if(!he.keywords){ut.addText($e);return}let $=0;he.keywordPatternRe.lastIndex=0;let ae=he.keywordPatternRe.exec($e),fe="";for(;ae;){fe+=$e.substring($,ae.index);const pe=wt.case_insensitive?ae[0].toLowerCase():ae[0],kt=me(he,pe);if(kt){const[ht,mn]=kt;if(ut.addText(fe),fe="",te[pe]=(te[pe]||0)+1,te[pe]<=Pp&&(Xe+=mn),ht.startsWith("_"))fe+=ae[0];else{const Wt=wt.classNameAliases[ht]||ht;Ye(ae[0],Wt)}}else fe+=ae[0];$=he.keywordPatternRe.lastIndex,ae=he.keywordPatternRe.exec($e)}fe+=$e.substring($),ut.addText(fe)}function De(){if($e==="")return;let $=null;if(typeof he.subLanguage=="string"){if(!n[he.subLanguage]){ut.addText($e);return}$=f(he.subLanguage,$e,!0,At[he.subLanguage]),At[he.subLanguage]=$._top}else $=u($e,he.subLanguage.length?he.subLanguage:null);he.relevance>0&&(Xe+=$.relevance),ut.__addSublanguage($._emitter,$.language)}function ze(){he.subLanguage!=null?De():se(),$e=""}function Ye($,ae){$!==""&&(ut.startScope(ae),ut.addText($),ut.endScope())}function Ce($,ae){let fe=1;const pe=ae.length-1;for(;fe<=pe;){if(!$._emit[fe]){fe++;continue}const kt=wt.classNameAliases[$[fe]]||$[fe],ht=ae[fe];kt?Ye(ht,kt):($e=ht,se(),$e=""),fe++}}function dt($,ae){return $.scope&&typeof $.scope=="string"&&ut.openNode(wt.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(Ye($e,wt.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),$e=""):$.beginScope._multi&&(Ce($.beginScope,ae),$e="")),he=Object.create($,{parent:{value:he}}),he}function nt($,ae,fe){let pe=tp($.endRe,fe);if(pe){if($["on:end"]){const kt=new cs($);$["on:end"](ae,kt),kt.isMatchIgnored&&(pe=!1)}if(pe){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return nt($.parent,ae,fe)}function Pe($){return he.matcher.regexIndex===0?($e+=$[0],1):(N=!0,0)}function Dt($){const ae=$[0],fe=$.rule,pe=new cs(fe),kt=[fe.__beforeBegin,fe["on:begin"]];for(const ht of kt)if(ht&&(ht($,pe),pe.isMatchIgnored))return Pe(ae);return fe.skip?$e+=ae:(fe.excludeBegin&&($e+=ae),ze(),!fe.returnBegin&&!fe.excludeBegin&&($e=ae)),dt(fe,$),fe.returnBegin?0:ae.length}function Kt($){const ae=$[0],fe=D.substring($.index),pe=nt(he,$,fe);if(!pe)return _s;const kt=he;he.endScope&&he.endScope._wrap?(ze(),Ye(ae,he.endScope._wrap)):he.endScope&&he.endScope._multi?(ze(),Ce(he.endScope,$)):kt.skip?$e+=ae:(kt.returnEnd||kt.excludeEnd||($e+=ae),ze(),kt.excludeEnd&&($e=ae));do he.scope&&ut.closeNode(),!he.skip&&!he.subLanguage&&(Xe+=he.relevance),he=he.parent;while(he!==pe.parent);return pe.starts&&dt(pe.starts,$),kt.returnEnd?0:ae.length}function Pt(){const $=[];for(let ae=he;ae!==wt;ae=ae.parent)ae.scope&&$.unshift(ae.scope);$.forEach(ae=>ut.openNode(ae))}let Ve={};function Tt($,ae){const fe=ae&&ae[0];if($e+=$,fe==null)return ze(),0;if(Ve.type==="begin"&&ae.type==="end"&&Ve.index===ae.index&&fe===""){if($e+=D.slice(ae.index,ae.index+1),!l){const pe=new Error(`0 width match regex (${E})`);throw pe.languageName=E,pe.badRule=Ve.rule,pe}return 1}if(Ve=ae,ae.type==="begin")return Dt(ae);if(ae.type==="illegal"&&!P){const pe=new Error('Illegal lexeme "'+fe+'" for mode "'+(he.scope||"<unnamed>")+'"');throw pe.mode=he,pe}else if(ae.type==="end"){const pe=Kt(ae);if(pe!==_s)return pe}if(ae.type==="illegal"&&fe==="")return $e+=`
|
|
14
|
+
`,1;if(V>1e5&&V>ae.index*3)throw new Error("potential infinite loop, way more iterations than matches");return $e+=fe,fe.length}const wt=J(E);if(!wt)throw oo(i.replace("{}",E)),new Error('Unknown language: "'+E+'"');const Se=Lp(wt);let Et="",he=K||Se;const At={},ut=new c.__emitter(c);Pt();let $e="",Xe=0,Mt=0,V=0,N=!1;try{if(wt.__emitTokens)wt.__emitTokens(D,ut);else{for(he.matcher.considerAll();;){V++,N?N=!1:he.matcher.considerAll(),he.matcher.lastIndex=Mt;const $=he.matcher.exec(D);if(!$)break;const ae=D.substring(Mt,$.index),fe=Tt(ae,$);Mt=$.index+fe}Tt(D.substring(Mt))}return ut.finalize(),Et=ut.toHTML(),{language:E,value:Et,relevance:Xe,illegal:!1,_emitter:ut,_top:he}}catch($){if($.message&&$.message.includes("Illegal"))return{language:E,value:gl(D),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:Mt,context:D.slice(Mt-100,Mt+100),mode:$.mode,resultSoFar:Et},_emitter:ut};if(l)return{language:E,value:gl(D),illegal:!1,relevance:0,errorRaised:$,_emitter:ut,_top:he};throw $}}function p(E){const D={value:gl(E),illegal:!1,relevance:0,_top:s,_emitter:new c.__emitter(c)};return D._emitter.addText(E),D}function u(E,D){D=D||c.languages||Object.keys(n);const P=p(E),K=D.filter(J).filter(q).map(ze=>f(ze,E,!1));K.unshift(P);const te=K.sort((ze,Ye)=>{if(ze.relevance!==Ye.relevance)return Ye.relevance-ze.relevance;if(ze.language&&Ye.language){if(J(ze.language).supersetOf===Ye.language)return 1;if(J(Ye.language).supersetOf===ze.language)return-1}return 0}),[me,se]=te,De=me;return De.secondBest=se,De}function b(E,D,P){const K=D&&o[D]||P;E.classList.add("hljs"),E.classList.add(`language-${K}`)}function w(E){let D=null;const P=d(E);if(a(P))return;if(v("before:highlightElement",{el:E,language:P}),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 $p("One of your code blocks includes unescaped HTML.",E.innerHTML);D=E;const K=D.textContent,te=P?m(K,{language:P,ignoreIllegals:!0}):u(K);E.innerHTML=te.value,E.dataset.highlighted="yes",b(E,P,te.language),E.result={language:te.language,re:te.relevance,relevance:te.relevance},te.secondBest&&(E.secondBest={language:te.secondBest.language,relevance:te.secondBest.relevance}),v("after:highlightElement",{el:E,result:te,text:K})}function S(E){c=Cs(c,E)}const M=()=>{Q(),bo("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function I(){Q(),bo("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let j=!1;function Q(){function E(){Q()}if(document.readyState==="loading"){j||window.addEventListener("DOMContentLoaded",E,!1),j=!0;return}document.querySelectorAll(c.cssSelector).forEach(w)}function U(E,D){let P=null;try{P=D(e)}catch(K){if(oo("Language definition for '{}' could not be registered.".replace("{}",E)),l)oo(K);else throw K;P=s}P.name||(P.name=E),n[E]=P,P.rawDefinition=D.bind(null,e),P.aliases&&ne(P.aliases,{languageName:E})}function F(E){delete n[E];for(const D of Object.keys(o))o[D]===E&&delete o[D]}function ue(){return Object.keys(n)}function J(E){return E=(E||"").toLowerCase(),n[E]||n[o[E]]}function ne(E,{languageName:D}){typeof E=="string"&&(E=[E]),E.forEach(P=>{o[P.toLowerCase()]=D})}function q(E){const D=J(E);return D&&!D.disableAutodetect}function x(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=D=>{E["before:highlightBlock"](Object.assign({block:D.el},D))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=D=>{E["after:highlightBlock"](Object.assign({block:D.el},D))})}function z(E){x(E),r.push(E)}function A(E){const D=r.indexOf(E);D!==-1&&r.splice(D,1)}function v(E,D){const P=E;r.forEach(function(K){K[P]&&K[P](D)})}function k(E){return bo("10.7.0","highlightBlock will be removed entirely in v12.0"),bo("10.7.0","Please use highlightElement now."),w(E)}Object.assign(e,{highlight:m,highlightAuto:u,highlightAll:Q,highlightElement:w,highlightBlock:k,configure:S,initHighlighting:M,initHighlightingOnLoad:I,registerLanguage:U,unregisterLanguage:F,listLanguages:ue,getLanguage:J,registerAliases:ne,autoDetection:q,inherit:Cs,addPlugin:z,removePlugin:A}),e.debugMode=function(){l=!1},e.safeMode=function(){l=!0},e.versionString=Dp,e.regex={concat:no,lookahead:fs,either:ml,optional:Jm,anyNumberOfTimes:Qm};for(const E in dr)typeof dr[E]=="object"&&ss(dr[E]);return Object.assign(e,dr),e},ko=Ts({});ko.newInstance=()=>Ts({});var Hp=ko;ko.HighlightJS=ko,ko.default=ko;const xs=qm(Hp),Ms="[A-Za-z$_][0-9A-Za-z$_]*",Vp=["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"],Up=["true","false","null","undefined","NaN","Infinity"],Ns=["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"],Ss=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],As=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],zp=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Fp=[].concat(As,Ns,Ss);function Kp(e){const n=e.regex,o=(P,{after:K})=>{const te="</"+P[0].slice(1);return P.input.indexOf(te,K)!==-1},r=Ms,l={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,K)=>{const te=P[0].length+P.index,me=P.input[te];if(me==="<"||me===","){K.ignoreMatch();return}me===">"&&(o(P,{after:te})||K.ignoreMatch());let se;const De=P.input.substring(te);if(se=De.match(/^\s*=/)){K.ignoreMatch();return}if((se=De.match(/^\s+extends\s+/))&&se.index===0){K.ignoreMatch();return}}},c={$pattern:Ms,keyword:Vp,literal:Up,built_in:Fp,"variable.language":zp},a="[0-9](_?[0-9])*",d=`\\.(${a})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${m})((${d})|\\.)?|(${d}))[eE][+-]?(${a})\\b`},{begin:`\\b(${m})\\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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},u={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,p]},I={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]},j=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,b,w,S,{match:/\$\d+/},f];p.contains=j.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(j)});const Q=[].concat(I,p.contains),U=Q.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(Q)}]),F={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:U},ue={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"}}]},J={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:{_:[...Ns,...Ss]}},ne={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},q={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[F],illegal:/%/},x={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(P){return n.concat("(?!",P.join("|"),")")}const A={match:n.concat(/\b/,z([...As,"super","import"].map(P=>`${P}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},v={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},k={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},F]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[F]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:U,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ne,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,b,w,S,I,{match:/\$\d+/},f,J,{scope:"attr",match:r+n.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[I,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:U}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[F,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},v,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[F]},A,x,ue,k,{match:/\$[(.]/}]}}const fr="[A-Za-z$_][0-9A-Za-z$_]*",Is=["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"],Bs=["true","false","null","undefined","NaN","Infinity"],Rs=["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"],Ls=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Os=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ds=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],$s=[].concat(Os,Rs,Ls);function Wp(e){const n=e.regex,o=(P,{after:K})=>{const te="</"+P[0].slice(1);return P.input.indexOf(te,K)!==-1},r=fr,l={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,s={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(P,K)=>{const te=P[0].length+P.index,me=P.input[te];if(me==="<"||me===","){K.ignoreMatch();return}me===">"&&(o(P,{after:te})||K.ignoreMatch());let se;const De=P.input.substring(te);if(se=De.match(/^\s*=/)){K.ignoreMatch();return}if((se=De.match(/^\s+extends\s+/))&&se.index===0){K.ignoreMatch();return}}},c={$pattern:fr,keyword:Is,literal:Bs,built_in:$s,"variable.language":Ds},a="[0-9](_?[0-9])*",d=`\\.(${a})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${m})((${d})|\\.)?|(${d}))[eE][+-]?(${a})\\b`},{begin:`\\b(${m})\\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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},u={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,p]},I={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]},j=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,b,w,S,{match:/\$\d+/},f];p.contains=j.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(j)});const Q=[].concat(I,p.contains),U=Q.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(Q)}]),F={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:U},ue={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"}}]},J={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:{_:[...Rs,...Ls]}},ne={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},q={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[F],illegal:/%/},x={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function z(P){return n.concat("(?!",P.join("|"),")")}const A={match:n.concat(/\b/,z([...Os,"super","import"].map(P=>`${P}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},v={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},k={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},F]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[F]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:U,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),ne,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,u,b,w,S,I,{match:/\$\d+/},f,J,{scope:"attr",match:r+n.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[I,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:U}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:l.begin,end:l.end},{match:i},{begin:s.begin,"on:begin":s.isTrulyOpeningTag,end:s.end}],subLanguage:"xml",contains:[{begin:s.begin,end:s.end,skip:!0,contains:["self"]}]}]},q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[F,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},v,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[F]},A,x,ue,k,{match:/\$[(.]/}]}}function Gp(e){const n=e.regex,o=Wp(e),r=fr,l=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},s={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:fr,keyword:Is.concat(a),literal:Bs,built_in:$s.concat(l),"variable.language":Ds},m={className:"meta",begin:"@"+r},f=(w,S,M)=>{const I=w.contains.findIndex(j=>j.label===S);if(I===-1)throw new Error("can not find mode to replace");w.contains.splice(I,1,M)};Object.assign(o.keywords,d),o.exports.PARAMS_CONTAINS.push(m);const p=o.contains.find(w=>w.scope==="attr"),u=Object.assign({},p,{match:n.concat(r,n.lookahead(/\s*\?:/))});o.exports.PARAMS_CONTAINS.push([o.exports.CLASS_REFERENCE,p,u]),o.contains=o.contains.concat([m,i,s,u]),f(o,"shebang",e.SHEBANG()),f(o,"use_strict",c);const b=o.contains.find(w=>w.label==="func.def");return b.relevance=0,Object.assign(o,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),o}function qp(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:/#/},m={begin:/\{\{/,relevance:0},f={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,m,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,m,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,m,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,m,d]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},p="[0-9](_?[0-9])*",u=`(\\b(${p}))?\\.(${p})|\\b(${p})\\.`,b=`\\b|${r.join("|")}`,w={className:"number",relevance:0,variants:[{begin:`(\\b(${p})|(${u}))[eE][+-]?(${p})[jJ]?(?=${b})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${b})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${b})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${b})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${b})`},{begin:`\\b(${p})[jJ](?=${b})`}]},S={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},M={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",a,w,f,e.HASH_COMMENT_MODE]}]};return d.contains=[f,w,a],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[a,w,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,S,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[M]},{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:[w,M,f]}]}}var yo="[0-9](_*[0-9])*",mr=`\\.(${yo})`,pr="[0-9a-fA-F](_*[0-9a-fA-F])*",Ps={className:"number",variants:[{begin:`(\\b(${yo})((${mr})|\\.)?|(${mr}))[eE][+-]?(${yo})[fFdD]?\\b`},{begin:`\\b(${yo})((${mr})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${mr})[fFdD]?\\b`},{begin:`\\b(${yo})[fFdD]\\b`},{begin:`\\b0[xX]((${pr})\\.?|(${pr})?\\.(${pr}))[pP][+-]?(${yo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${pr})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Hs(e,n,o){return o===-1?"":e.replace(n,r=>Hs(e,n,o-1))}function Yp(e){const n=e.regex,o="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=o+Hs("(?:<"+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"]}]},m={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:[m,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,Ps,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Ps,d]}}function Zp(e){const n=e.regex,o=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",s="("+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})"/})]},m={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},f={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]},p={className:"title",begin:n.optional(l)+e.IDENT_RE,relevance:0},u=n.optional(l)+e.IDENT_RE+"\\s*\\(",S={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"},M=[f,c,o,e.C_BLOCK_COMMENT_MODE,m,d],I={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:S,contains:M.concat([{begin:/\(/,end:/\)/,keywords:S,contains:M.concat(["self"]),relevance:0}]),relevance:0},j={begin:"("+s+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:S,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:S,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(p,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[o,e.C_BLOCK_COMMENT_MODE,d,m,c,{begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:["self",o,e.C_BLOCK_COMMENT_MODE,d,m,c]}]},c,o,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:S,disableAutodetect:!0,illegal:"</",contains:[].concat(I,j,M,[f,{begin:e.IDENT_RE+"::",keywords:S},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:d,keywords:S}}}function Xp(e){const n=e.regex,o=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",s="(?!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})"/})]},m={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},f={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]},p={className:"title",begin:n.optional(l)+e.IDENT_RE,relevance:0},u=n.optional(l)+e.IDENT_RE+"\\s*\\(",b=["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"],w=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],S=["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"],M=["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"],Q={type:w,keyword:b,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:S},U={className:"function.dispatch",relevance:0,keywords:{_hint:M},begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))},F=[U,f,c,o,e.C_BLOCK_COMMENT_MODE,m,d],ue={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:Q,contains:F.concat([{begin:/\(/,end:/\)/,keywords:Q,contains:F.concat(["self"]),relevance:0}]),relevance:0},J={className:"function",begin:"("+s+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:Q,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:Q,relevance:0},{begin:u,returnBegin:!0,contains:[p],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,m]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:Q,relevance:0,contains:[o,e.C_BLOCK_COMMENT_MODE,d,m,c,{begin:/\(/,end:/\)/,keywords:Q,relevance:0,contains:["self",o,e.C_BLOCK_COMMENT_MODE,d,m,c]}]},c,o,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:Q,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(ue,J,U,F,[f,{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:Q,contains:["self",c]},{begin:e.IDENT_RE+"::",keywords:Q},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function jp(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"],i=["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"],s={keyword:l.concat(i),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},m={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(m,{illegal:/\n/}),p={className:"subst",begin:/\{/,end:/\}/,keywords:s},u=e.inherit(p,{illegal:/\n/}),b={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,u]},w={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]},S=e.inherit(w,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},u]});p.contains=[w,b,m,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE],u.contains=[S,b,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const M={variants:[d,w,b,m,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},I={begin:"<",end:">",contains:[{beginKeywords:"in out"},c]},j=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",Q={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:s,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"}},M,a,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},c,I,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,I,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:"("+j+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:s,contains:[{beginKeywords:o.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,I],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,relevance:0,contains:[M,a,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Q]}}function Qp(e){const i={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:i,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:i,illegal:/["']/}]}]}}function Jp(e){const n=e.regex,o=/(r#)?/,r=n.concat(o,e.UNDERSCORE_IDENT_RE),l=n.concat(o,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,n.lookahead(/\s*\(/))},s="([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!"],m=["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:m,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_]+)"+s},{begin:"\\b0o([0-7_]+)"+s},{begin:"\\b0x([A-Fa-f0-9_]+)"+s},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+s}],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:m}},{className:"punctuation",begin:"->"},i]}}function eh(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+)*/),s={"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)],m={className:"subst",begin:/#\{/,end:/\}/,keywords:s},f={className:"string",contains:[e.BACKSLASH_ESCAPE,m],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,m]})]}]},p="[1-9](_?[0-9])*|0",u="[0-9](_?[0-9])*",b={className:"number",relevance:0,variants:[{begin:`\\b(${p})(\\.(${u}))?([eE][+-]?(${u})|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"}]},w={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:s}]},F=[f,{variants:[{match:[/class\s+/,l,/\s+<\s+/,l]},{match:[/\b(class|module)\s+/,l]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:s},{match:[/(include|extend)\s+/,l],scope:{2:"title.class"},keywords:s},{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:[w]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:o}],relevance:0},b,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:s},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,m],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);m.contains=F,w.contains=F;const q=[{begin:/^\s*=>/,starts:{end:"$",contains:F}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:s,contains:F}}];return d.unshift(a),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:s,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(q).concat(d).concat(F)}}function th(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),i=n.concat(/[A-Z]+/,o),s={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}),m=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(a)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(a),"on:begin":(v,k)=>{k.data._beginMatch=v[1]||v[2]},"on:end":(v,k)=>{k.data._beginMatch!==v[1]&&k.ignoreMatch()}},p=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),u=`[
|
|
15
|
+
]`,b={scope:"string",variants:[m,d,f,p]},w={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},S=["false","null","true"],M=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],I=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],Q={keyword:M,literal:(v=>{const k=[];return v.forEach(E=>{k.push(E),E.toLowerCase()===E?k.push(E.toUpperCase()):k.push(E.toLowerCase())}),k})(S),built_in:I},U=v=>v.map(k=>k.replace(/\|\d+$/,"")),F={variants:[{match:[/new/,n.concat(u,"+"),n.concat("(?!",U(I).join("\\b|"),"\\b)"),l],scope:{1:"keyword",4:"title.class"}}]},ue=n.concat(r,"\\b(?!\\()"),J={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),ue],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[l,n.concat(/::/,n.lookahead(/(?!class\b)/)),ue],scope:{1:"title.class",3:"variable.constant"}},{match:[l,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[l,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},ne={scope:"attr",match:n.concat(r,n.lookahead(":"),n.lookahead(/(?!::)/))},q={relevance:0,begin:/\(/,end:/\)/,keywords:Q,contains:[ne,s,J,e.C_BLOCK_COMMENT_MODE,b,w,F]},x={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",U(M).join("\\b|"),"|",U(I).join("\\b|"),"\\b)"),r,n.concat(u,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[q]};q.contains.push(x);const z=[ne,J,e.C_BLOCK_COMMENT_MODE,b,w,F],A={begin:n.concat(/#\[\s*\\?/,n.either(l,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:S,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:S,keyword:["new","array"]},contains:["self",...z]},...z,{scope:"meta",variants:[{match:l},{match:i}]}]};return{case_insensitive:!1,keywords:Q,contains:[A,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},c,{scope:"variable.language",match:/\$this\b/},s,x,J,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},F,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:Q,contains:["self",A,s,J,e.C_BLOCK_COMMENT_MODE,b,w]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},b,w]}}function Vs(e){return e?typeof e=="string"?e:e.source:null}function Fo(e){return yt("(?=",e,")")}function yt(...e){return e.map(o=>Vs(o)).join("")}function nh(e){const n=e[e.length-1];return typeof n=="object"&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}function en(...e){return"("+(nh(e).capture?"":"?:")+e.map(r=>Vs(r)).join("|")+")"}const bl=e=>yt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),oh=["Protocol","Type"].map(bl),Us=["init","self"].map(bl),rh=["Any","Self"],kl=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],zs=["false","nil","true"],lh=["assignment","associativity","higherThan","left","lowerThan","none","right"],ih=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Fs=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Ks=en(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Ws=en(Ks,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),yl=yt(Ks,Ws,"*"),Gs=en(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),hr=en(Gs,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Tn=yt(Gs,hr,"*"),gr=yt(/[A-Z]/,hr,"*"),sh=["attached","autoclosure",yt(/convention\(/,en("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",yt(/objc\(/,Tn,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],ch=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function ah(e){const n={match:/\s+/,relevance:0},o=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,o],l={match:[/\./,en(...oh,...Us)],className:{2:"keyword"}},i={match:yt(/\./,en(...kl)),relevance:0},s=kl.filter(Se=>typeof Se=="string").concat(["_|0"]),c=kl.filter(Se=>typeof Se!="string").concat(rh).map(bl),a={variants:[{className:"keyword",match:en(...c,...Us)}]},d={$pattern:en(/\b\w+/,/#\w+/),keyword:s.concat(ih),literal:zs},m=[l,i,a],f={match:yt(/\./,en(...Fs)),relevance:0},p={className:"built_in",match:yt(/\b/,en(...Fs),/(?=\()/)},u=[f,p],b={match:/->/,relevance:0},w={className:"operator",relevance:0,variants:[{match:yl},{match:`\\.(\\.|${Ws})+`}]},S=[b,w],M="([0-9]_*)+",I="([0-9a-fA-F]_*)+",j={className:"number",relevance:0,variants:[{match:`\\b(${M})(\\.(${M}))?([eE][+-]?(${M}))?\\b`},{match:`\\b0x(${I})(\\.(${I}))?([pP][+-]?(${M}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},Q=(Se="")=>({className:"subst",variants:[{match:yt(/\\/,Se,/[0\\tnr"']/)},{match:yt(/\\/,Se,/u\{[0-9a-fA-F]{1,8}\}/)}]}),U=(Se="")=>({className:"subst",match:yt(/\\/,Se,/[\t ]*(?:[\r\n]|\r\n)/)}),F=(Se="")=>({className:"subst",label:"interpol",begin:yt(/\\/,Se,/\(/),end:/\)/}),ue=(Se="")=>({begin:yt(Se,/"""/),end:yt(/"""/,Se),contains:[Q(Se),U(Se),F(Se)]}),J=(Se="")=>({begin:yt(Se,/"/),end:yt(/"/,Se),contains:[Q(Se),F(Se)]}),ne={className:"string",variants:[ue(),ue("#"),ue("##"),ue("###"),J(),J("#"),J("##"),J("###")]},q=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],x={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:q},z=Se=>{const Et=yt(Se,/\//),he=yt(/\//,Se);return{begin:Et,end:he,contains:[...q,{scope:"comment",begin:`#(?!.*${he})`,end:/$/}]}},A={scope:"regexp",variants:[z("###"),z("##"),z("#"),x]},v={match:yt(/`/,Tn,/`/)},k={className:"variable",match:/\$\d+/},E={className:"variable",match:`\\$${hr}+`},D=[v,k,E],P={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:ch,contains:[...S,j,ne]}]}},K={scope:"keyword",match:yt(/@/,en(...sh),Fo(en(/\(/,/\s+/)))},te={scope:"meta",match:yt(/@/,Tn)},me=[P,K,te],se={match:Fo(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:yt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,hr,"+")},{className:"type",match:gr,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:yt(/\s+&\s+/,Fo(gr)),relevance:0}]},De={begin:/</,end:/>/,keywords:d,contains:[...r,...m,...me,b,se]};se.contains.push(De);const ze={match:yt(Tn,/\s*:/),keywords:"_|0",relevance:0},Ye={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",ze,...r,A,...m,...u,...S,j,ne,...D,...me,se]},Ce={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,se]},dt={begin:en(Fo(yt(Tn,/\s*:/)),Fo(yt(Tn,/\s+/,Tn,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Tn}]},nt={begin:/\(/,end:/\)/,keywords:d,contains:[dt,...r,...m,...S,j,ne,...me,se,Ye],endsParent:!0,illegal:/["']/},Pe={match:[/(func|macro)/,/\s+/,en(v.match,Tn,yl)],className:{1:"keyword",3:"title.function"},contains:[Ce,nt,n],illegal:[/\[/,/%/]},Dt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Ce,nt,n],illegal:/\[|%/},Kt={match:[/operator/,/\s+/,yl],className:{1:"keyword",3:"title"}},Pt={begin:[/precedencegroup/,/\s+/,gr],className:{1:"keyword",3:"title"},contains:[se],keywords:[...lh,...zs],end:/}/},Ve={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Tt={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},wt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Tn,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[Ce,...m,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:gr},...m],relevance:0}]};for(const Se of ne.variants){const Et=Se.contains.find(At=>At.label==="interpol");Et.keywords=d;const he=[...m,...u,...S,j,ne,...D];Et.contains=[...he,{begin:/\(/,end:/\)/,contains:["self",...he]}]}return{name:"Swift",keywords:d,contains:[...r,Pe,Dt,Ve,Tt,wt,Kt,Pt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},A,...m,...u,...S,j,ne,...D,...me,se,Ye]}}var wo="[0-9](_*[0-9])*",br=`\\.(${wo})`,kr="[0-9a-fA-F](_*[0-9a-fA-F])*",dh={className:"number",variants:[{begin:`(\\b(${wo})((${br})|\\.)?|(${br}))[eE][+-]?(${wo})[fFdD]?\\b`},{begin:`\\b(${wo})((${br})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${br})[fFdD]?\\b`},{begin:`\\b(${wo})[fFdD]\\b`},{begin:`\\b0[xX]((${kr})\\.?|(${kr})?\\.(${kr}))[pP][+-]?(${wo})[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 uh(e){const n={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},o={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},l={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},s={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,l]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,l]}]};l.contains.push(s);const c={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},a={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(s,{className:"string"}),"self"]}]},d=dh,m=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},p=f;return p.variants[1].contains=[f],f.variants[1].contains=[p],{name:"Kotlin",aliases:["kt","kts"],keywords:n,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,m,o,r,c,a,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,m],relevance:0},e.C_LINE_COMMENT_MODE,m,c,a,s,e.C_NUMBER_MODE]},m]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},c,a]},s,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
16
|
+
`},d]}}function fh(e){const n=e.regex,o=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,l={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},s=e.inherit(i,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{className:"string"}),a=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[l]},{begin:/'/,end:/'/,contains:[l]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,a,c,s,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,s,a,c]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},l,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[a]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:n.concat(/</,n.lookahead(n.concat(o,n.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:o,relevance:0,starts:d}]},{className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(o,/>/))),contains:[{className:"name",begin:o,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}const mh=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ph=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],hh=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],gh=[...ph,...hh],bh=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),kh=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),yh=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),wh=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Eh(e){const n=e.regex,o=mh(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},l="and or not only",i=/@-?\w[\w]*(-\w+)*/,s="[a-zA-Z-][a-zA-Z0-9_-]*",c=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[o.BLOCK_COMMENT,r,o.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+s,relevance:0},o.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+kh.join("|")+")"},{begin:":(:)?("+yh.join("|")+")"}]},o.CSS_VARIABLE,{className:"attribute",begin:"\\b("+wh.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[o.BLOCK_COMMENT,o.HEXCOLOR,o.IMPORTANT,o.CSS_NUMBER_MODE,...c,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...c,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},o.FUNCTION_DISPATCH]},{begin:n.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:l,attribute:bh.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...c,o.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+gh.join("|")+")\\b"}]}}function vh(e){const n={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},o={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],l={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[n,o,e.QUOTE_STRING_MODE,l,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function Ch(e){const n="true false yes no null",o="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},s={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,l]},c=e.inherit(s,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),p={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},u={end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},b={begin:/\{/,end:/\}/,contains:[u],illegal:"\\n",relevance:0},w={begin:"\\[",end:"\\]",contains:[u],illegal:"\\n",relevance:0},S=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+o},{className:"type",begin:"!<"+o+">"},{className:"type",begin:"!"+o},{className:"type",begin:"!!"+o},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},p,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},b,w,i,s],M=[...S];return M.pop(),M.push(c),u.contains=M,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:S}}function _h(e){const n=e.regex,o={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},l={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},s={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},c=/[A-Za-z][A-Za-z0-9+.-]*/,a={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:n.concat(/\[.+?\]\(/,c,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},m={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(d,{contains:[]}),p=e.inherit(m,{contains:[]});d.contains.push(p),m.contains.push(f);let u=[o,a];return[d,m,f,p].forEach(M=>{M.contains=M.contains.concat(u)}),u=u.concat(d,m),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:u},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:u}]}]},o,i,d,m,{className:"quote",begin:"^>\\s+",contains:u,end:"$"},l,r,a,s,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Th(e){const n="\\[=*\\[",o="\\]=*\\]",r={begin:n,end:o,contains:["self"]},l=[e.COMMENT("--(?!"+n+")","$"),e.COMMENT("--"+n,o,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:l.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:l}].concat(l)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:n,end:o,contains:[r],relevance:5}])}}function xh(e){const n=e.regex,o={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[o]}]};Object.assign(o,{className:"variable",variants:[{begin:n.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const l={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,o,l]};l.contains.push(c);const a={match:/\\"/},d={className:"string",begin:/'/,end:/'/},m={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,o]},p=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],u=e.SHEBANG({binary:`(${p.join("|")})`,relevance:10}),b={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},w=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],S=["true","false"],M={match:/(\/[a-z._-]+)+/},I=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],j=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],Q=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],U=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:w,literal:S,built_in:[...I,...j,"set","shopt",...Q,...U]},contains:[u,e.SHEBANG(),b,f,i,s,M,c,a,d,m,o]}}function Mh(e){const n=["string","char","byte","int","long","bool","decimal","single","double","DateTime","xml","array","hashtable","void"],o="Add|Clear|Close|Copy|Enter|Exit|Find|Format|Get|Hide|Join|Lock|Move|New|Open|Optimize|Pop|Push|Redo|Remove|Rename|Reset|Resize|Search|Select|Set|Show|Skip|Split|Step|Switch|Undo|Unlock|Watch|Backup|Checkpoint|Compare|Compress|Convert|ConvertFrom|ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|Limit|Merge|Mount|Out|Publish|Restore|Save|Sync|Unpublish|Update|Approve|Assert|Build|Complete|Confirm|Deny|Deploy|Disable|Enable|Install|Invoke|Register|Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|Unregister|Wait|Debug|Measure|Ping|Repair|Resolve|Test|Trace|Connect|Disconnect|Read|Receive|Send|Write|Block|Grant|Protect|Revoke|Unblock|Unprotect|Use|ForEach|Sort|Tee|Where",r="-and|-as|-band|-bnot|-bor|-bxor|-casesensitive|-ccontains|-ceq|-cge|-cgt|-cle|-clike|-clt|-cmatch|-cne|-cnotcontains|-cnotlike|-cnotmatch|-contains|-creplace|-csplit|-eq|-exact|-f|-file|-ge|-gt|-icontains|-ieq|-ige|-igt|-ile|-ilike|-ilt|-imatch|-in|-ine|-inotcontains|-inotlike|-inotmatch|-ireplace|-is|-isnot|-isplit|-join|-le|-like|-lt|-match|-ne|-not|-notcontains|-notin|-notlike|-notmatch|-or|-regex|-replace|-shl|-shr|-split|-wildcard|-xor",l={$pattern:/-?[A-z\.\-]+\b/,keyword:"if else foreach return do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch hidden static parameter",built_in:"ac asnp cat cd CFS chdir clc clear clhy cli clp cls clv cnsn compare copy cp cpi cpp curl cvpa dbp del diff dir dnsn ebp echo|0 epal epcsv epsn erase etsn exsn fc fhx fl ft fw gal gbp gc gcb gci gcm gcs gdr gerr ghy gi gin gjb gl gm gmo gp gps gpv group gsn gsnp gsv gtz gu gv gwmi h history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp ls man md measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh popd ps pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rujb rv rvpa rwmi sajb sal saps sasv sbp sc scb select set shcm si sl sleep sls sort sp spjb spps spsv start stz sujb sv swmi tee trcm type wget where wjb write"},i=/\w[\w\d]*((-)[\w\d]+)*/,s={begin:"`[\\s\\S]",relevance:0},c={className:"variable",variants:[{begin:/\$\B/},{className:"keyword",begin:/\$this/},{begin:/\$[\w\d][\w\d_:]*/}]},a={className:"literal",begin:/\$(null|true|false)\b/},d={className:"string",variants:[{begin:/"/,end:/"/},{begin:/@"/,end:/^"@/}],contains:[s,c,{className:"variable",begin:/\$[A-z]/,end:/[^A-z]/}]},m={className:"string",variants:[{begin:/'/,end:/'/},{begin:/@'/,end:/^'@/}]},f={className:"doctag",variants:[{begin:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/},{begin:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/}]},p=e.inherit(e.COMMENT(null,null),{variants:[{begin:/#/,end:/$/},{begin:/<#/,end:/#>/}],contains:[f]}),u={className:"built_in",variants:[{begin:"(".concat(o,")+(-)[\\w\\d]+")}]},b={className:"class",beginKeywords:"class enum",end:/\s*[{]/,excludeEnd:!0,relevance:0,contains:[e.TITLE_MODE]},w={className:"function",begin:/function\s+/,end:/\s*\{|$/,excludeEnd:!0,returnBegin:!0,relevance:0,contains:[{begin:"function",relevance:0,className:"keyword"},{className:"title",begin:i,relevance:0},{begin:/\(/,end:/\)/,className:"params",relevance:0,contains:[c]}]},S={begin:/using\s/,end:/$/,returnBegin:!0,contains:[d,m,{className:"keyword",begin:/(using|assembly|command|module|namespace|type)/}]},M={variants:[{className:"operator",begin:"(".concat(r,")\\b")},{className:"literal",begin:/(-){1,2}[\w\d-]+/,relevance:0}]},I={className:"selector-tag",begin:/@\B/,relevance:0},j={className:"function",begin:/\[.*\]\s*[\w]+[ ]??\(/,end:/$/,returnBegin:!0,relevance:0,contains:[{className:"keyword",begin:"(".concat(l.keyword.toString().replace(/\s/g,"|"),")\\b"),endsParent:!0,relevance:0},e.inherit(e.TITLE_MODE,{endsParent:!0})]},Q=[j,p,s,e.NUMBER_MODE,d,m,u,c,a,I],U={begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0,relevance:0,contains:[].concat("self",Q,{begin:"("+n.join("|")+")",className:"built_in",relevance:0},{className:"type",begin:/[\.\w\d]+/,relevance:0})};return j.contains.unshift(U),{name:"PowerShell",aliases:["pwsh","ps","ps1"],case_insensitive:!0,keywords:l,contains:Q.concat(b,w,S,M,U)}}function Nh(e){const n=e.COMMENT(/^\s*@?rem\b/,/$/,{relevance:10});return{name:"Batch file (DOS)",aliases:["bat","cmd"],case_insensitive:!0,illegal:/\/\*/,keywords:{keyword:["if","else","goto","for","in","do","call","exit","not","exist","errorlevel","defined","equ","neq","lss","leq","gtr","geq"],built_in:["prn","nul","lpt3","lpt2","lpt1","con","com4","com3","com2","com1","aux","shift","cd","dir","echo","setlocal","endlocal","set","pause","copy","append","assoc","at","attrib","break","cacls","cd","chcp","chdir","chkdsk","chkntfs","cls","cmd","color","comp","compact","convert","date","dir","diskcomp","diskcopy","doskey","erase","fs","find","findstr","format","ftype","graftabl","help","keyb","label","md","mkdir","mode","more","move","path","pause","print","popd","pushd","promt","rd","recover","rem","rename","replace","restore","rmdir","shift","sort","start","subst","time","title","tree","type","ver","verify","vol","ping","net","ipconfig","taskkill","xcopy","ren","del"]},contains:[{className:"variable",begin:/%%[^ ]|%[^ ]+?%|![^ ]+?!/},{className:"function",begin:{begin:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)"}.begin,end:"goto:eof",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),n]},{className:"number",begin:"\\b\\d+",relevance:0},n]}}function Sh(e){const n=e.regex,o=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],s=["double precision","large object","with timezone","without timezone"],c=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],a=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],m=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],p=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],u=m,b=[...d,...a].filter(U=>!m.includes(U)),w={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},S={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},M={match:n.concat(/\b/,n.either(...u),/\s*\(/),relevance:0,keywords:{built_in:u}};function I(U){return n.concat(/\b/,n.either(...U.map(F=>F.replace(/\s+/,"\\s+"))),/\b/)}const j={scope:"keyword",match:I(p),relevance:0};function Q(U,{exceptions:F,when:ue}={}){const J=ue;return F=F||[],U.map(ne=>ne.match(/\|\d+$/)||F.includes(ne)?ne:J(ne)?`${ne}|0`:ne)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:Q(b,{when:U=>U.length<3}),literal:i,type:c,built_in:f},contains:[{scope:"type",match:I(s)},j,M,w,r,l,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,o,S]}}function Ah(e){const n={className:"subst",variants:[{begin:"\\$[A-Za-z0-9_]+"}]},o={className:"subst",variants:[{begin:/\$\{/,end:/\}/}],keywords:"true false null this is new super"},r={className:"number",relevance:0,variants:[{match:/\b[0-9][0-9_]*(\.[0-9][0-9_]*)?([eE][+-]?[0-9][0-9_]*)?\b/},{match:/\b0[xX][0-9A-Fa-f][0-9A-Fa-f_]*\b/}]},l={className:"string",variants:[{begin:"r'''",end:"'''"},{begin:'r"""',end:'"""'},{begin:"r'",end:"'",illegal:"\\n"},{begin:'r"',end:'"',illegal:"\\n"},{begin:"'''",end:"'''",contains:[e.BACKSLASH_ESCAPE,n,o]},{begin:'"""',end:'"""',contains:[e.BACKSLASH_ESCAPE,n,o]},{begin:"'",end:"'",illegal:"\\n",contains:[e.BACKSLASH_ESCAPE,n,o]},{begin:'"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE,n,o]}]};o.contains=[r,l];const i=["Comparable","DateTime","Duration","Function","Iterable","Iterator","List","Map","Match","Object","Pattern","RegExp","Set","Stopwatch","String","StringBuffer","StringSink","Symbol","Type","Uri","bool","double","int","num","Element","ElementList"],s=i.map(d=>`${d}?`);return{name:"Dart",keywords:{keyword:["abstract","as","assert","async","await","base","break","case","catch","class","const","continue","covariant","default","deferred","do","dynamic","else","enum","export","extends","extension","external","factory","false","final","finally","for","Function","get","hide","if","implements","import","in","interface","is","late","library","mixin","new","null","on","operator","part","required","rethrow","return","sealed","set","show","static","super","switch","sync","this","throw","true","try","typedef","var","void","when","while","with","yield"],built_in:i.concat(s).concat(["Never","Null","dynamic","print","document","querySelector","querySelectorAll","window"]),$pattern:/[A-Za-z][A-Za-z0-9_]*\??/},contains:[l,e.COMMENT(/\/\*\*(?!\/)/,/\*\//,{subLanguage:"markdown",relevance:0}),e.COMMENT(/\/{3,} ?/,/$/,{contains:[{subLanguage:"markdown",begin:".",end:"$",relevance:0}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"class",beginKeywords:"class interface",end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},r,{className:"meta",begin:"@[A-Za-z]+"},{begin:"=>"}]}}const Ih=[["javascript",Kp],["typescript",Gp],["python",qp],["java",Yp],["c",Zp],["cpp",Xp],["csharp",jp],["go",Qp],["rust",Jp],["ruby",eh],["php",th],["swift",ah],["kotlin",uh],["xml",fh],["css",Eh],["json",vh],["yaml",Ch],["markdown",_h],["lua",Th],["bash",xh],["powershell",Mh],["dos",Nh],["sql",Sh],["dart",Ah]];for(const[e,n]of Ih)xs.registerLanguage(e,n);const Bh={javascript:"javascript",typescript:"typescript",python:"python",java:"java",c:"c",cpp:"cpp",csharp:"csharp",go:"go",rust:"rust",ruby:"ruby",php:"php",swift:"swift",kotlin:"kotlin",html:"xml",css:"css",json:"json",xml:"xml",yaml:"yaml",markdown:"markdown",lua:"lua",bash:"bash",shell:"bash",powershell:"powershell",cmd:"dos",bat:"dos",sql:"sql",dart:"dart"};function qs(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Rh(e,n){const o=Bh[n];if(!o||e.length===0)return qs(e);try{return xs.highlight(e,{language:o,ignoreIllegals:!0}).value}catch{return qs(e)}}const Lh=t.defineComponent({name:"CodeBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){const n=t.ref(null),o=Qt(),r=Kn(),l=t.computed(()=>Rh(Me(e.block.content),e.block.attrs.language??"plain"));return()=>{const i=e.block.attrs.language??"plain",s=t.h("div",{ref:n,class:"block-code-lang",onMousedown:d=>{d.preventDefault(),d.stopPropagation()},onClick:d=>{if(d.stopPropagation(),!r.value)return;const m=new CustomEvent("code-lang-click",{bubbles:!0,detail:{blockId:e.block.id,anchor:n.value}});d.currentTarget.dispatchEvent(m)}},i.toUpperCase()),c=t.h("div",{class:"block-code-title"},o.t("codeBlock.title")),a=t.h("pre",{class:"block-code-highlight","aria-hidden":"true"},[t.h("code",{class:"hljs",innerHTML:l.value})]);return t.h("div",{class:["block-code-wrapper","block-focus-root",...kn(e.block.attrs)],"data-lang":i},[c,s,a,t.h(Dn,{block:e.block,placeholder:e.placeholder,class:"block-code"})])}}}),Oh={name:"codeBlock",schema:{type:"codeBlock",content:"text",nestable:!1,isolating:!0,inlineMarks:!1,attrs:{...Gd,language:{default:"plain",validate:e=>typeof e=="string"&&e.length>0}}},renderer:{component:Lh},slashCommands:[{id:"code-block",title:"slash.codeBlock.title",keywords:["code","fence","pre","代码","代码块","```","codeblock"],description:"slash.codeBlock.description",icon:al,command:"convertBlock",category:"other",args:()=>({id:"__currentBlock__",type:"codeBlock",attrs:{language:"plain"}})}],inputRules:[{name:"code-fence",pattern:/^``` ?$/,command:"convertBlock",args:e=>(e==null||e.input,{id:"__currentBlock__",type:"codeBlock",attrs:{language:"plain"},__stripPrefix:3})}]},Dh={align:Jt.align,indent:Jt.indent,src:{default:"",validate:e=>typeof e=="string"},alt:{default:"",validate:e=>typeof e=="string"},title:{default:"",validate:e=>typeof e=="string"},width:{default:0,validate:e=>typeof e=="number"&&Number.isFinite(e)&&e>=0},height:{default:0,validate:e=>typeof e=="number"&&Number.isFinite(e)&&e>=0},caption:{default:"",validate:e=>typeof e=="string"},fileId:{default:0,validate:e=>typeof e=="number"&&Number.isFinite(e)&&Number.isInteger(e)&&e>=0}},$h=t.defineComponent({name:"ImageBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){e.placeholder;const n=dn(),o=Kn(),r=Qt(),l=e.block.id,i=t.ref(Gn(l)),s=Ii((x,z)=>{x===l&&(i.value=z)});t.onBeforeUnmount(()=>{s()});const c=t.ref(null),a=t.ref(null),d=t.ref(!1);let m=0,f=0,p=0,u=1;function b(){var A,v;const x=a.value;if(!x)return;c.value={w:x.naturalWidth,h:x.naturalHeight};const z=e.block.attrs;(!z.width||z.width===0)&&(!z.height||z.height===0)&&((v=(A=n.commands).setAttrs)==null||v.call(A,{id:l,attrs:{...z,width:x.naturalWidth,height:x.naturalHeight}}))}function w(x){var D,P,K;x.preventDefault(),x.stopPropagation();const z=e.block.attrs,A=(D=a.value)==null?void 0:D.closest(".block-image-container"),v=A?A.clientWidth-8:0;let k=z.width||((P=c.value)==null?void 0:P.w)||200,E=z.height||((K=c.value)==null?void 0:K.h)||150;if(E>S){const te=k/Math.max(1,E);E=S,k=Math.round(E*te)}if(v>0&&k>v){const te=k/Math.max(1,E);k=v,E=Math.round(k/te)}m=k,f=E,p=x.clientX,u=m/Math.max(1,f),d.value=!0,document.addEventListener("mousemove",M,!0),document.addEventListener("mouseup",I,!0),document.addEventListener("selectstart",j,!0)}const S=600;function M(x){var E,D,P;if(!d.value)return;const z=x.clientX-p;let A=Math.max(40,Math.round(m+z)),v=Math.max(40,Math.round(A/u));v>S&&(v=S,A=Math.max(40,Math.round(v*u)));const k=(E=a.value)==null?void 0:E.closest(".block-image-container");if(k){const K=k.clientWidth-8;A>K&&(A=Math.max(40,K),v=Math.max(40,Math.round(A/u)))}(P=(D=n.commands).setAttrs)==null||P.call(D,{id:l,attrs:{...e.block.attrs,width:A,height:v}})}function I(){d.value=!1,document.removeEventListener("mousemove",M,!0),document.removeEventListener("mouseup",I,!0),document.removeEventListener("selectstart",j,!0)}function j(x){x.preventDefault()}const Q=t.ref(null);function U(){if(!Q.value){const x=document.createElement("input");x.type="file",x.accept="image/*",x.multiple=!1,Q.value=x,x.addEventListener("change",()=>{var A;const z=(A=x.files)==null?void 0:A[0];z&&F(z),x.value=""})}Q.value.click()}function F(x){const z=Yr(x),A=new AbortController;bn(l,{status:"pending",progress:0,file:x,tempPreviewUrl:z,controller:A}),Bi(x.name,x,A,{onProgress:v=>{const k=Gn(l);k&&bn(l,{...k,progress:Math.max(0,Math.min(1,v))})},onSuccess:v=>{var P,K;const k=Gn(l);if(k!=null&&k.tempPreviewUrl&&k.tempPreviewUrl!==v.url)try{URL.revokeObjectURL(k.tempPreviewUrl)}catch{}const E={...e.block.attrs,src:v.url},D={...E,width:v.width??E.width,height:v.height??E.height,alt:v.alt??E.alt,title:v.title??E.title,fileId:v.fileId??E.fileId};(K=(P=n.commands).setAttrs)==null||K.call(P,{id:l,attrs:D}),bn(l,null)},onError:v=>{const k=Gn(l);k&&bn(l,{...k,status:"error",progress:0,error:v})}})}function ue(){const x=Gn(l);!x||!x.file||F(x.file)}function J(){var x,z;(z=(x=n.commands).removeBlock)==null||z.call(x,{id:l})}function ne(){const x=i.value;return x!=null&&x.tempPreviewUrl?x.tempPreviewUrl:e.block.attrs.src??""}function q(x){var z,A;x.stopPropagation(),o.value&&((A=(z=n.commands).selectBlock)==null||A.call(z,{id:l}))}return()=>{const x=e.block.attrs,z=ne(),A=i.value,v=x.width,k=x.height;let E=v;v>0&&k>S&&(E=Math.max(1,Math.round(v*S/k)));const D={},P=(A==null?void 0:A.status)==="error";v&&v>0&&!P&&(D.width=`${E}px`);const K=[],te=!!A&&A.status!=="success",me=n.getState().selection,se=me.kind==="blocks"&&me.blockIds.includes(l);if(o.value&&K.push(t.h("div",{class:["image-block-toolbar",{"image-block-toolbar-visible":te||se}]},[t.h("button",{class:"image-block-btn",title:r.t("image.replace"),onClick:Ce=>{Ce.stopPropagation(),U()}},[t.h(fn,{html:Jd})]),t.h("button",{class:"image-block-btn",title:r.t("image.remove"),onClick:Ce=>{Ce.stopPropagation(),J()}},[t.h(fn,{html:Qd})])])),(A==null?void 0:A.status)==="pending"){const Ce=Math.round(A.progress*100);K.push(t.h("div",{class:"image-block-upload-overlay"},[t.h(fn,{html:Xd,class:"image-block-spinner"}),t.h("div",{class:"image-block-upload-label"},r.t("image.uploading")),t.h("div",{class:"image-block-progress-track"},[t.h("div",{class:"image-block-progress-bar",style:{width:`${Ce}%`}})]),t.h("div",{class:"image-block-progress-pct"},`${Ce}%`)]))}if((A==null?void 0:A.status)==="error"&&K.push(t.h("div",{class:"image-block-error-overlay"},[t.h("div",{class:"image-block-error-icon"},"!"),t.h("div",{class:"image-block-error-title"},r.t("image.uploadFailed")),t.h("div",{class:"image-block-error-msg"},A.error??""),t.h("button",{class:"image-block-retry-btn",onClick:Ce=>{Ce.stopPropagation(),ue()}},[t.h(fn,{html:jd})," ",r.t("image.retry")])])),!z&&(!A||A.status==="success")&&K.push(t.h("div",{class:"image-block-empty",onClick:Ce=>{Ce.stopPropagation(),o.value&&U()}},[t.h(fn,{html:eu,class:"image-block-empty-icon"}),t.h("div",{class:"image-block-empty-title"},r.t("image.emptyTitle")),t.h("div",{class:"image-block-empty-sub"},r.t("image.emptySub"))])),z&&(A==null?void 0:A.status)!=="error"){const Ce={};v&&v>0&&(Ce.width=`${E}px`);const dt=[t.h("img",{ref:a,class:"image-block-img",src:z,alt:x.alt||"",title:x.title||"",style:Ce,draggable:!1,onLoad:b,onError:()=>{(!A||A.status!=="pending"&&A.status!=="error")&&bn(l,{status:"error",progress:0,error:r.t("image.loadFailed"),tempPreviewUrl:void 0})}})];c.value&&o.value&&dt.push(t.h("div",{class:"image-block-resize-handle",onMousedown:w,title:r.t("image.resize")})),K.push(t.h("div",{class:"image-block-main"},dt))}const De=x.caption||"";!((A==null?void 0:A.status)==="error")&&(De||z)&&K.push(t.h("div",{class:"image-block-caption",contenteditable:o.value?"true":"false","data-placeholder":r.t("image.captionPlaceholder"),onBlur:Ce=>{var nt,Pe;const dt=Ce.currentTarget.textContent??"";dt!==De&&((Pe=(nt=n.commands).setAttrs)==null||Pe.call(nt,{id:l,attrs:{...e.block.attrs,caption:dt}}))},onInput:()=>{},onMousedown:Ce=>{Ce.stopPropagation()},onClick:Ce=>{Ce.stopPropagation()}},De));const Ye=["block-image-wrapper"];return(A==null?void 0:A.status)==="error"&&Ye.push("image-block-wrapper-error"),(A==null?void 0:A.status)==="pending"&&!z&&!A.tempPreviewUrl&&Ye.push("image-block-wrapper-loading"),t.h("div",{class:["block-image-container","block-focus-root",...kn(x)]},[t.h("div",{class:Ye,style:D,onClick:q},K)])}}}),Ys={name:"image",schema:{type:"image",content:"none",nestable:!1,attrs:{...Dh},empty:e=>{const n=e.attrs.src;return typeof n!="string"||n.length===0}},renderer:{component:$h,editable:!1},slashCommands:[{id:"image",title:"slash.image.title",keywords:["image","picture","photo","img","图片","图像","照片"],description:"slash.image.description",icon:Zd,command:"convertBlock",category:"other",args:()=>({id:"__currentBlock__",type:"image",attrs:{}})}],serialize:{toHTML:e=>{const n=e.attrs,o=n.src;if(!o)return"";const r=n.alt||"",l=n.title||"",i=n.width,s=n.height,c=n.caption||"",a=[];i&&i>0&&a.push(`width:${i}px`),s&&s>0&&a.push(`height:${s}px`);const d=a.length?` style="${a.join(";")}"`:"",m=l?` title="${wl(l)}"`:"",f=`<img src="${wl(o)}" alt="${wl(r)}"${m}${d}>`;return c?`<figure>${f}<figcaption>${Ph(c)}</figcaption></figure>`:f},toMarkdown:e=>{const n=e.attrs,o=n.src;if(!o)return"";const r=n.alt||"",l=n.title||"",i=n.caption||"",s=l?``:``;return i?`${s}
|
|
17
|
+
*${i}*`:s}}};function wl(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ph(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const yr='<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"><rect x="2" y="3" width="12" height="10" rx="1"/><path d="M2 7h12M2 10h12M6 3v10M10 3v10"/></svg>',Hh='<svg viewBox="0 0 1024 1024" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M160 85.333333a32 32 0 0 0-32 32v42.666667A138.666667 138.666667 0 0 0 266.666667 298.666667h490.666666A138.666667 138.666667 0 0 0 896 160v-42.666667a32 32 0 0 0-64 0v42.666667a74.666667 74.666667 0 0 1-74.666667 74.666667H661.333333V117.333333a32 32 0 0 0-64 0V234.666667h-170.666666V117.333333a32 32 0 0 0-64 0V234.666667H266.666667A74.666667 74.666667 0 0 1 192 160v-42.666667A32 32 0 0 0 160 85.333333zM160 938.666667a32 32 0 0 1-32-32v-42.666667A138.666667 138.666667 0 0 1 266.666667 725.333333h490.666666A138.666667 138.666667 0 0 1 896 864v42.666667a32 32 0 0 1-64 0v-42.666667a74.666667 74.666667 0 0 0-74.666667-74.666667H661.333333v117.333334a32 32 0 0 1-64 0V789.333333h-170.666666v117.333334a32 32 0 0 1-64 0V789.333333H266.666667a74.666667 74.666667 0 0 0-74.666667 74.666667v42.666667a32 32 0 0 1-32 32zM512 557.226667l62.72 62.72a32 32 0 1 0 45.226667-45.226667L557.226667 512l62.72-62.72a32 32 0 1 0-45.226667-45.226667L512 466.773333l-62.72-62.72a32 32 0 1 0-45.226667 45.226667L466.773333 512l-62.72 62.72a32 32 0 1 0 45.226667 45.226667L512 557.226667z"/><path d="M372.352 544c0.981333-1.109333 2.005333-2.176 3.072-3.242667L404.181333 512l-28.757333-28.757333a78.72 78.72 0 0 1-3.072-3.242667H117.333333a32 32 0 0 0 0 64h255.018667zM662.314667 544h244.352a32 32 0 0 0 0-64h-244.352a77.909333 77.909333 0 0 1-3.072 3.242667l-28.757334 28.757333 28.757334 28.757333 3.072 3.242667z"/></svg>',Vh='<svg viewBox="0 0 1024 1024" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M938.666667 160a32 32 0 0 0-32-32h-42.666667A138.666667 138.666667 0 0 0 725.333333 266.666667v490.666666A138.666667 138.666667 0 0 0 864 896h42.666667a32 32 0 0 0 0-64h-42.666667a74.666667 74.666667 0 0 1-74.666667-74.666667V661.333333h117.333334a32 32 0 0 0 0-64H789.333333v-170.666666h117.333334a32 32 0 0 0 0-64H789.333333V266.666667c0-41.216 33.450667-74.666667 74.666667-74.666667h42.666667a32 32 0 0 0 32-32zM85.333333 160A32 32 0 0 1 117.333333 128h42.666667A138.666667 138.666667 0 0 1 298.666667 266.666667v490.666666A138.666667 138.666667 0 0 1 160 896h-42.666667a32 32 0 0 1 0-64h42.666667a74.666667 74.666667 0 0 0 74.666667-74.666667V661.333333H117.333333a32 32 0 0 1 0-64H234.666667v-170.666666H117.333333a32 32 0 0 1 0-64H234.666667V266.666667A74.666667 74.666667 0 0 0 160 192h-42.666667A32 32 0 0 1 85.333333 160zM466.773333 512l-62.72 62.72a32 32 0 1 0 45.226667 45.226667L512 557.226667l62.72 62.72a32 32 0 1 0 45.226667-45.226667L557.226667 512l62.72-62.72a32 32 0 1 0-45.226667-45.226667L512 466.773333l-62.72-62.72a32 32 0 1 0-45.226667 45.226667L466.773333 512z"/><path d="M480 372.352c1.109333 0.981333 2.176 2.005333 3.242667 3.072l28.757333 28.757333 28.757333-28.757333c1.066667-1.066667 2.133333-2.090667 3.242667-3.072V117.333333a32 32 0 0 0-64 0v255.018667zM480 662.314667v244.352a32 32 0 0 0 64 0v-244.352a77.909333 77.909333 0 0 1-3.242667-3.072L512 630.485333l-28.757333 28.757334-3.242667 3.072z"/></svg>',Zs='<svg viewBox="0 0 1024 1024" width="14" height="14" 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>',Uh={indent:Jt.indent,rows:{default:3,validate:e=>typeof e=="number"&&Number.isInteger(e)&&e>=1},cols:{default:3,validate:e=>typeof e=="number"&&Number.isInteger(e)&&e>=1},cells:{default:[],validate:td},colWidths:{default:[],validate:e=>Array.isArray(e)},headerRow:{default:!1,validate:e=>typeof e=="boolean"}},zh=t.defineComponent({name:"TableBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e,{expose:n}){e.placeholder;const o=dn(),r=Kn(),l=Qt(),i=e.block.id,s=t.inject(ai,t.ref(!1)),c=t.inject(Or,null),a=t.computed(()=>Jn(e.block.attrs)),d=new Map,m=t.ref(null),f=t.ref(null),p=t.ref(null);let u=0;const b=500;function w(){return Date.now()-u<b}function S(y){var B;const _=y.target;!!(_&&(_.nodeType===1?_.closest(".hover-toolbar"):(B=_.parentElement)!=null&&B.closest(".hover-toolbar")))&&(u=Date.now())}function M(){u=Date.now()}const I=t.ref(null);let j=0,Q=0;const U=t.ref({kind:"none"}),F=t.ref(null);let ue=!1;const J=t.ref(null);let ne=null,q=null,x=!1,z=!1;const A=t.reactive({blockType:"paragraph",blockAttrs:{align:"left"},marks:new Set,textColor:"",bgColor:"",verticalAlign:"middle",showDelete:!1,deleteLabel:"",deleteIcon:Zs,showMerge:!1,showSplit:!1,showHeaderRow:!1,headerRowActive:!1}),v=t.ref(null),k=t.reactive({visible:!1,selectionRect:null}),E=t.reactive({visible:!1,anchorRect:null,href:"",text:"",initialMode:"edit",showTextInput:!1});let D=null,P=null,K=!1;const te=t.reactive({visible:!1,row:-1,col:-1,anchor:null,canContinue:!1,canStartNew:!1,currentNumber:1});function me(){te.visible=!1,te.anchor=null,te.row=-1,te.col=-1}const se=t.reactive({visible:!1,row:-1,col:-1,anchor:null,initialValue:1});function De(){se.visible=!1,se.anchor=null,se.row=-1,se.col=-1}function ze(y,_,T){var ke,Te;if(!r.value)return;const B=(ke=a.value.cells[y])==null?void 0:ke[_];if(!B||B.covered||B.cellType!=="orderedList")return;const W=Wr(a.value,y,_),ee=typeof B.startNumber=="number";let ce=!1;for(let xe=y-1;xe>=0;xe--){const Ke=(Te=a.value.cells[xe])==null?void 0:Te[_];if(!(!Ke||Ke.covered)){ce=Ke.cellType==="orderedList";break}}const ie=ee&&ce,Ee=W!==1;Pe(),k.visible=!1,k.selectionRect=null,De(),te.visible=!0,te.row=y,te.col=_,te.anchor=T,te.canContinue=ie,te.canStartNew=Ee,te.currentNumber=W}function Ye(){var _,T;if(te.row<0||te.col<0)return;const y=Ho(a.value,te.row,te.col,{startNumber:null});(T=(_=o.commands).setAttrs)==null||T.call(_,{id:i,attrs:y}),me()}function Ce(){var _,T;if(te.row<0||te.col<0)return;const y=Ho(a.value,te.row,te.col,{startNumber:1});(T=(_=o.commands).setAttrs)==null||T.call(_,{id:i,attrs:y}),me()}function dt(){if(te.row<0||te.col<0)return;const y=te.anchor,_=te.row,T=te.col,B=te.currentNumber;me(),y&&(se.visible=!0,se.initialValue=B,se.anchor=y,se.row=_,se.col=T)}function nt(y){var T,B;if(se.row<0||se.col<0){De();return}const _=Ho(a.value,se.row,se.col,{startNumber:y});(B=(T=o.commands).setAttrs)==null||B.call(T,{id:i,attrs:_}),De()}function Pe(){if(!E.visible)return;if(E.visible=!1,D=null,P=null,k.visible=!1,k.selectionRect=null,K){K=!1;return}const y=p.value;if(y){const _=d.get(`${y.row}-${y.col}`);_&&$(y.row,y.col,_),p.value=null}}function Dt(){const y=window.getSelection();if(!y||y.rangeCount===0)return null;const T=y.getRangeAt(0).commonAncestorContainer,B=T.nodeType===1?T:T.parentElement;return B?B.closest("a"):null}function Kt(){const y=window.getSelection();if(!y||y.rangeCount===0)return;const _=y.getRangeAt(0),T=_.getBoundingClientRect();if(T.width===0&&T.height===0)return;D=_.cloneRange();const B=Dt(),W=(B==null?void 0:B.getAttribute("href"))??"",ee=y.toString();E.anchorRect=T,E.href=W,E.text=ee,E.initialMode=W?"view":"edit",E.showTextInput=!ee&&!W,E.visible=!0,k.visible=!1}function Pt(y){const _=y.getAttribute("href")||"",T=y.textContent||"",B=y.getBoundingClientRect();E.anchorRect=B,E.href=_,E.text=T,E.initialMode="view",E.showTextInput=!1,E.visible=!0,K=!0,P=y,k.visible=!1,k.selectionRect=null}function Ve(y){const _=y.closest(".table-cell-inner");if(!_)return;const T=_.closest(".table-cell");if(!T)return;const B=Number(T.getAttribute("data-row")),W=Number(T.getAttribute("data-col"));!Number.isFinite(B)||!Number.isFinite(W)||$(B,W,_)}function Tt(y,_){if(P&&P.isConnected){P.setAttribute("href",y),P.setAttribute("target","_blank"),P.setAttribute("rel","noopener noreferrer"),_!==void 0&&_!==P.textContent&&(P.textContent=_),Ve(P);return}const T=window.getSelection();if(!T)return;if(D){const W=p.value,ee=W?d.get(`${W.row}-${W.col}`):null;ee&&ee.isConnected&&(T.removeAllRanges(),T.addRange(D))}const B=Dt();if(B)B.setAttribute("href",y),B.setAttribute("target","_blank"),B.setAttribute("rel","noopener noreferrer"),_!==void 0&&_!==B.textContent&&(B.textContent=_);else{if(T.rangeCount===0)return;const W=T.getRangeAt(0),ee=document.createElement("a");ee.setAttribute("href",y),ee.setAttribute("target","_blank"),ee.setAttribute("rel","noopener noreferrer");try{ee.appendChild(W.extractContents()),W.insertNode(ee),T.removeAllRanges();const ce=document.createRange();ce.selectNodeContents(ee),T.addRange(ce),D=ce.cloneRange()}catch{}}Se()}function wt(){if(P&&P.isConnected){const B=P,W=B.parentElement;if(W){for(;B.firstChild;)W.insertBefore(B.firstChild,B);W.removeChild(B)}Ve(B);return}const y=window.getSelection();if(!y)return;if(D){const B=p.value,W=B?d.get(`${B.row}-${B.col}`):null;W&&W.isConnected&&(y.removeAllRanges(),y.addRange(D))}const _=Dt();if(!_)return;const T=_.parentElement;if(T){for(;_.firstChild;)T.insertBefore(_.firstChild,_);T.removeChild(_);try{y.removeAllRanges(),D&&D.startContainer!==_&&y.addRange(D)}catch{}Se()}}function Se(){const y=p.value;if(!y)return;const _=d.get(`${y.row}-${y.col}`);_&&$(y.row,y.col,_)}let Et=!1;function he(){var ee,ce;if(!r.value){k.visible=!1,k.selectionRect=null;return}if(k.visible&&w())return;if(!p.value){const ie=window.getSelection();if(!ie||ie.rangeCount===0||ie.isCollapsed){k.visible=!1,k.selectionRect=null;return}const Ee=ie.getRangeAt(0);if(!((ee=Ee.commonAncestorContainer.nodeType===1?Ee.commonAncestorContainer:Ee.commonAncestorContainer.parentElement)==null?void 0:ee.closest(".table-cell-inner"))){k.visible=!1,k.selectionRect=null;return}return}const _=window.getSelection();if(!_||_.rangeCount===0||_.isCollapsed){k.visible=!1,k.selectionRect=null;return}const T=_.getRangeAt(0);if(!((ce=T.commonAncestorContainer.nodeType===1?T.commonAncestorContainer:T.commonAncestorContainer.parentElement)==null?void 0:ce.closest(".table-cell-inner"))){k.visible=!1,k.selectionRect=null;return}const W=T.getBoundingClientRect();if(W.width===0&&W.height===0){k.visible=!1,k.selectionRect=null;return}Et||(k.visible=!0,k.selectionRect=W,ne&&(clearTimeout(ne),ne=null),J.value=null)}function At(){Et&&(Et=!1,he())}function ut(y){const _=qe.value;if(!_)return y;const T=_.getBoundingClientRect();return new DOMRect(T.left+y.left-_.scrollLeft,T.top+y.top,y.width,y.height)}function $e(y){r.value&&(ne&&(clearTimeout(ne),ne=null),q&&(clearTimeout(q),q=null),k.visible=!1,k.selectionRect=null,x=!1,J.value=ut(y))}function Xe(y=150){q&&(clearTimeout(q),q=null),x=!1,ne=setTimeout(()=>{J.value=null,ne=null},y)}function Mt(){const y=v.value;y&&y.focus()}function V(y){var T,B;const _=y.target;if(_.closest("a")&&_.closest(".table-cell-inner")){y.preventDefault();return}_.closest(".table-cell, .table-wrapper, table, .table-row-strip, .table-col-strip, .table-insert-dot, .table-corner-handle")||(y.stopPropagation(),U.value={kind:"none"},f.value=null,Xe(0),(B=(T=o.commands).selectBlock)==null||B.call(T,{id:i}))}function N(y,_){if(y.length!==_.length)return!1;for(let T=0;T<y.length;T++){const B=y[T],W=_[T];if(B.type!==W.type||"text"in B&&B.text!==W.text)return!1;const ee=B.marks??[],ce=W.marks??[];if(ee.length!==ce.length)return!1;for(let ie=0;ie<ee.length;ie++){const Ee=ee[ie],ke=ce[ie];if(Ee.type!==ke.type)return!1;const Te=Ee.attrs??{},xe=ke.attrs??{},Ke=Object.keys(Te),tt=Object.keys(xe);if(Ke.length!==tt.length)return!1;for(const ct of Ke)if(Te[ct]!==xe[ct])return!1}}return!0}function $(y,_,T){var Ee,ke,Te;const B=un(T),W=er(B),ee=a.value,ce=(Ee=ee.cells[y])==null?void 0:Ee[_];if(ce&&N(ce.content,W))return;const ie=Po(ee,y,_,W);if((Te=(ke=o.commands).setAttrs)==null||Te.call(ke,{id:i,attrs:ie}),W!==B){const xe=Wn(W);T.innerHTML!==xe&&(T.innerHTML=xe)}}function ae(y,_,T,B){var ee,ce,ie;if(k.visible&&w())return;const W=B==null?void 0:B.relatedTarget;if(!(W!=null&&W.closest(".link-popover"))&&!(W!=null&&W.closest(".hover-toolbar"))){if(k.visible){const Ee=window.getSelection();if(Ee&&Ee.rangeCount>0&&!Ee.isCollapsed){const ke=Ee.getRangeAt(0);if((ee=ke.commonAncestorContainer.nodeType===1?ke.commonAncestorContainer:ke.commonAncestorContainer.parentElement)==null?void 0:ee.closest(".table-cell-inner"))return}}((ce=p.value)==null?void 0:ce.row)===y&&((ie=p.value)==null?void 0:ie.col)===_&&(p.value=null),k.visible=!1,k.selectionRect=null,Pe(),$(y,_,T)}}function fe(y){var B;if(k.visible&&w()){f.value&&(f.value=null),U.value.kind!=="none"&&(U.value={kind:"none"},Xe(0)),me(),De();return}const _=y.currentTarget,T=y.relatedTarget;if(!(T&&_.contains(T))&&!(T!=null&&T.closest(".link-popover"))&&!(T!=null&&T.closest(".hover-toolbar"))){if(k.visible){const W=window.getSelection();if(W&&W.rangeCount>0&&!W.isCollapsed){const ee=W.getRangeAt(0);if((B=ee.commonAncestorContainer.nodeType===1?ee.commonAncestorContainer:ee.commonAncestorContainer.parentElement)==null?void 0:B.closest(".table-cell-inner")){f.value&&(f.value=null),U.value.kind!=="none"&&(U.value={kind:"none"},Xe(0)),me(),De();return}}}f.value&&(f.value=null),U.value.kind!=="none"&&(U.value={kind:"none"},Xe(0)),p.value&&(p.value=null),Pe(),me(),De()}}function pe(y,_,T,B){var W,ee,ce,ie,Ee,ke,Te,xe,Ke,tt,ct,Gt,jt;if(B.key==="Enter"&&!B.shiftKey&&!B.ctrlKey&&!B.metaKey){const it=(W=a.value.cells[y])==null?void 0:W[_];if((it==null?void 0:it.cellType)==="codeBlock"){B.preventDefault(),B.stopPropagation();const Ue=window.getSelection();let xt=((ee=T.textContent)==null?void 0:ee.length)??0;if(Ue&&Ue.rangeCount>0){const mt=Ue.getRangeAt(0);if(T.contains(mt.startContainer)){const bt=document.createRange();bt.selectNodeContents(T);try{bt.setEnd(mt.startContainer,mt.startOffset),xt=bt.toString().length}catch{xt=((ce=T.textContent)==null?void 0:ce.length)??0}}}if(Ue&&Ue.rangeCount>0){const mt=Ue.getRangeAt(0);if(T.contains(mt.commonAncestorContainer)){mt.collapsed||mt.deleteContents();const bt=document.createTextNode(`
|
|
18
|
+
`);mt.insertNode(bt),mt.setStartAfter(bt),mt.collapse(!0),Ue.removeAllRanges(),Ue.addRange(mt)}}$(y,_,T);const qt=xt+1;t.nextTick(()=>{const mt=d.get(`${y}-${_}`);if(!mt)return;mt.focus();const bt=window.getSelection();if(!bt)return;const zt=document.createRange();let pn=0,Yt=!1;const wn=vt=>{var Pn;if(!Yt)if(vt.nodeType===Node.TEXT_NODE){const Sn=((Pn=vt.textContent)==null?void 0:Pn.length)??0;pn+Sn>=qt&&(zt.setStart(vt,Math.max(0,qt-pn)),zt.collapse(!0),Yt=!0),pn+=Sn}else for(const Sn of vt.childNodes)wn(Sn)};wn(mt),Yt||(zt.selectNodeContents(mt),zt.collapse(!1)),bt.removeAllRanges(),bt.addRange(zt)});return}B.preventDefault(),B.stopPropagation(),$(y,_,T),p.value=null,k.visible=!1,k.selectionRect=null,Pe(),T.blur(),U.value={kind:"cell",rect:{r1:y,c1:_,r2:y,c2:_}},f.value={anchor:{row:y,col:_},focus:{row:y,col:_}},Mt(),t.nextTick(()=>{const Ue=Ge(y,_,y,_);Ue&&$e(Ue)});return}if(B.key==="Tab"){B.preventDefault(),B.stopPropagation(),Pe();const it=Fh(a.value,y,_,B.shiftKey);if(!it){if(Kh(a.value,y,_)&&!B.shiftKey){const Yt=un(T),wn=a.value,vt=Po(wn,y,_,Yt),Pn=wi(vt,vt.rows);(Ee=(ie=o.commands).setAttrs)==null||Ee.call(ie,{id:i,attrs:Pn}),t.nextTick(()=>{const Sn=`${Pn.rows-1}-0`,$t=d.get(Sn);$t==null||$t.focus(),El($t)});return}return}const{r:Ue,c:xt}=it,qt=un(T),mt=a.value,bt=(ke=mt.cells[y])==null?void 0:ke[_];let zt=mt;bt&&(N(bt.content,qt)||(zt=Po(mt,y,_,qt))),zt!==mt&&((xe=(Te=o.commands).setAttrs)==null||xe.call(Te,{id:i,attrs:zt})),t.nextTick(()=>{const pn=`${Ue}-${xt}`,Yt=d.get(pn);Yt==null||Yt.focus(),B.shiftKey?Xs(Yt):El(Yt)});return}if(B.key==="Backspace"){const it=(Ke=a.value.cells[y])==null?void 0:Ke[_],Ue=it==null?void 0:it.cellType;if(Ue&&Ue!=="paragraph"){const xt=window.getSelection();let qt=((tt=T.textContent)==null?void 0:tt.length)??0;if(xt&&xt.rangeCount>0){const mt=xt.getRangeAt(0);if(T.contains(mt.startContainer)){const bt=document.createRange();bt.selectNodeContents(T);try{bt.setEnd(mt.startContainer,mt.startOffset),qt=bt.toString().length}catch{qt=((ct=T.textContent)==null?void 0:ct.length)??0}}}if(qt===0&&(!T.textContent||T.textContent.trim()===""||(Ue==="bulletList"||Ue==="orderedList"||Ue==="todoList"))){B.preventDefault(),B.stopPropagation(),Pe(),me(),De();const zt=un(T),pn=a.value,Yt=Po(pn,y,_,zt),wn=Ho(Yt,y,_,{cellType:"paragraph"});(jt=(Gt=o.commands).setAttrs)==null||jt.call(Gt,{id:i,attrs:wn}),t.nextTick(()=>{const vt=d.get(`${y}-${_}`);vt&&(vt.focus(),Xs(vt))});return}}}B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),$(y,_,T),p.value=null,k.visible=!1,k.selectionRect=null,Pe(),T.blur())}function kt(y,_,T){p.value={row:y,col:_},f.value&&(f.value=null),U.value.kind!=="none"&&(U.value={kind:"none"},Xe(0))}function ht(y){const _=y.target;if(!_)return null;const T=_.closest(".table-cell");if(!T)return null;const B=Number(T.getAttribute("data-row")??T.dataset.row),W=Number(T.getAttribute("data-col")??T.dataset.col);return!Number.isFinite(B)||!Number.isFinite(W)?null:{r:B,c:W,el:T}}function mn(y){if(!r.value)return;const _=y.target;if(!_)return;const T=_.closest(".table-cell-inner");if(!T)return;const B=T.closest(".table-cell");if(!B)return;const W=Number(B.getAttribute("data-row")),ee=Number(B.getAttribute("data-col"));!Number.isFinite(W)||!Number.isFinite(ee)||pe(W,ee,T,y)}function Wt(y){var ke,Te;const _=y.target;if(_.closest(".table-row-strip, .table-col-strip, .table-insert-dot, .table-corner-handle, .table-col-resizer")||_.tagName==="INPUT"&&_.classList.contains("table-cell-todo-checkbox")||_.classList.contains("table-cell-ol-marker"))return;const T=_.closest("a");if(T&&T.closest(".table-cell-inner")){y.preventDefault(),y.stopPropagation(),Pt(T);return}E.visible&&Pe();const B=ht(y);if(!B||y.button!==0)return;const W=p.value;if(W&&W.row===B.r&&W.col===B.c){Et=!0,document.addEventListener("mouseup",At,{once:!0,capture:!0});return}y.preventDefault(),y.stopPropagation();const{r:ee,c:ce}=B,ie=document.activeElement;ie&&ie.closest(".table-cell-inner")&&ie.blur(),p.value=null,(Te=(ke=o.commands).selectBlock)==null||Te.call(ke,{id:i}),Mt(),z=J.value!==null,z&&(x=!0,ne&&(clearTimeout(ne),ne=null),q&&(clearTimeout(q),q=null)),U.value={kind:"none"},ue=!0;const Ee={row:ee,col:ce};F.value={start:Ee,current:Ee},f.value={anchor:Ee,focus:Ee},document.addEventListener("mouseup",gt,!0)}function yn(y){if(!ue||!F.value)return;const _=ht(y);if(!_)return;const{r:T,c:B}=_,W=F.value.current;if(T===W.row&&B===W.col)return;F.value={...F.value,current:{row:T,col:B}};const ee=F.value.start;f.value={anchor:ee,focus:{row:T,col:B}}}function lt(y){if(!r.value)return;const _=y.target;if(_.tagName==="INPUT"&&_.classList.contains("table-cell-todo-checkbox")||_.classList.contains("table-cell-ol-marker"))return;const T=ht(y);if(!T)return;const{r:B,c:W}=T,ee=p.value;ee&&ee.row===B&&ee.col===W||(y.preventDefault(),y.stopPropagation(),q&&(clearTimeout(q),q=null),x=!1,ue=!1,F.value=null,f.value=null,U.value={kind:"none"},Xe(0),document.removeEventListener("mouseup",gt,!0),p.value={row:B,col:W},t.nextTick(()=>{const ce=`${B}-${W}`,ie=d.get(ce);ie&&(ie.focus(),El(ie))}))}function gt(y){if(ue&&F.value){const _=F.value.start,T=F.value.current,B=Math.min(_.row,T.row),W=Math.min(_.col,T.col),ee=Math.max(_.row,T.row),ce=Math.max(_.col,T.col),ie=Ln(a.value,B,W,ee,ce),{r1:Ee,c1:ke,r2:Te,c2:xe}=ie;if(U.value={kind:"cell",rect:{r1:Ee,c1:ke,r2:Te,c2:xe}},f.value={anchor:{row:Ee,col:ke},focus:{row:Te,col:xe}},Ee!==Te||ke!==xe)t.nextTick(()=>{const tt=Ge(Ee,ke,Te,xe);tt&&$e(tt)});else if(z){const tt=Ge(Ee,ke,Te,xe);tt&&$e(tt)}else q&&clearTimeout(q),q=setTimeout(()=>{q=null;const tt=Ge(Ee,ke,Te,xe);tt&&$e(tt)},250)}ue=!1,F.value=null,document.removeEventListener("mouseup",gt,!0)}function Zt(y){if(U.value.kind==="row"&&U.value.row===y){U.value={kind:"none"},f.value=null,Xe(0);return}J.value!==null&&(x=!0);const _=a.value,T=_.cols,B=y,W=0,ee=y,ce=Math.max(0,T-1),ie=T>0?Ln(_,B,W,ee,ce):{r1:B,c1:W,r2:ee,c2:ce};U.value={kind:"row",row:y},f.value=T>0?{anchor:{row:ie.r1,col:ie.c1},focus:{row:ie.r2,col:ie.c2}}:null,p.value=null;const Ee=document.activeElement;Ee&&Ee.closest(".table-cell-inner")&&Ee.blur(),Mt(),t.nextTick(()=>{const ke=ft.value,Te=ke.rowTops[ie.r1]??0,xe=ke.rowTops[ie.r2]??0,Ke=ke.rowHeights[ie.r2]??32,tt=xe+Ke-Te,ct=ke.colWidths.length>0?ke.colWidths.reduce((it,Ue)=>it+Ue,0):_.colWidths.reduce((it,Ue)=>it+Ue,0),Gt=ke.colLefts[0]??0,jt=new DOMRect(Gt,Te,ct,tt);$e(jt)})}function xn(y){if(U.value.kind==="col"&&U.value.col===y){U.value={kind:"none"},f.value=null,Xe(0);return}J.value!==null&&(x=!0);const _=a.value,T=_.rows,B=0,W=y,ee=Math.max(0,T-1),ce=y,ie=T>0?Ln(_,B,W,ee,ce):{r1:B,c1:W,r2:ee,c2:ce};U.value={kind:"col",col:y},f.value=T>0?{anchor:{row:ie.r1,col:ie.c1},focus:{row:ie.r2,col:ie.c2}}:null,p.value=null;const Ee=document.activeElement;Ee&&Ee.closest(".table-cell-inner")&&Ee.blur(),Mt(),t.nextTick(()=>{const ke=ft.value,Te=ke.colLefts[ie.c1]??0,xe=ke.colLefts[ie.c2]??0,Ke=ke.colWidths[ie.c2]??80,tt=xe+Ke-Te,ct=ke.rowTops[0]??0,Gt=T>0?(ke.rowTops[T-1]??0)+(ke.rowHeights[T-1]??32)-ct:32,jt=new DOMRect(Te,ct,tt,Gt);$e(jt)})}function Mn(){if(U.value.kind==="all"){U.value={kind:"none"},f.value=null,Xe(0);return}J.value!==null&&(x=!0);const y=a.value;if(y.rows===0||y.cols===0)return;U.value={kind:"all"};const _=Ln(y,0,0,y.rows-1,y.cols-1);f.value={anchor:{row:_.r1,col:_.c1},focus:{row:_.r2,col:_.c2}},p.value=null;const T=document.activeElement;T&&T.closest(".table-cell-inner")&&T.blur(),Mt(),t.nextTick(()=>{const B=ft.value,W=B.rowTops[0]??0,ee=B.colLefts[0]??0,ce=B.colWidths.length>0?B.colWidths.reduce((Te,xe)=>Te+xe,0):y.colWidths.reduce((Te,xe)=>Te+xe,0),ie=B.rowTops[y.rows-1]??0,Ee=B.rowHeights[y.rows-1]??32,ke=new DOMRect(ee,W,ce,ie+Ee-W);$e(ke)})}function Ge(y,_,T,B){const W=ft.value,ee=W.rowTops[y]??0,ce=W.rowTops[T]??0,ie=W.rowHeights[T]??32,Ee=ce+ie,ke=W.colLefts[_]??0,Te=W.colLefts[B]??0,xe=W.colWidths[B]??80,Ke=Te+xe;return new DOMRect(ke,ee,Ke-ke,Ee-ee)}t.onBeforeUnmount(()=>{document.removeEventListener("mouseup",gt,!0),document.removeEventListener("mouseup",At,!0),document.removeEventListener("mousemove",Ut,!0),document.removeEventListener("mouseup",sn,!0),document.removeEventListener("keydown",Le,!0),document.removeEventListener("selectionchange",he),document.removeEventListener("mousedown",Fe,!0),window.removeEventListener("scroll",Qe,!0),document.removeEventListener("touchmove",Qe,!0),document.removeEventListener("mousedown",S,!0),document.removeEventListener("mouseup",M,!0),q&&(clearTimeout(q),q=null)});function Le(y){var W,ee;if(!r.value)return;const _=U.value;if(_.kind==="none")return;const T=document.activeElement;if(T!=null&&T.closest(".table-cell-inner"))return;if(y.key==="Escape"){y.preventDefault(),y.stopPropagation(),U.value={kind:"none"},f.value=null,Xe(0);return}if(y.key==="Delete"||y.key==="Backspace"){if(y.preventDefault(),y.stopPropagation(),_.kind==="row")Ne("tableRemoveRow",{row:_.row});else if(_.kind==="col")Ne("tableRemoveCol",{col:_.col});else if(_.kind==="all")Ne("tableDelete");else if(_.kind==="cell"){const{r1:ce,c1:ie,r2:Ee,c2:ke}=_.rect,Te=[];let xe=a.value;for(let Ke=ce;Ke<=Ee;Ke++)for(let tt=ie;tt<=ke;tt++)xe=Po(xe,Ke,tt,Te);(ee=(W=o.commands).setAttrs)==null||ee.call(W,{id:i,attrs:xe})}}}function Fe(y){if(!E.visible&&!te.visible&&!se.visible)return;const _=y.target;_.closest(".link-popover")||_.closest(".ordered-list-menu")||_.closest(".number-picker")||v.value&&v.value.contains(_)||(E.visible&&Pe(),te.visible&&me(),se.visible&&De())}function Qe(){if(E.visible&&Pe(),te.visible&&me(),se.visible&&De(),J.value!==null&&f.value){const y=Ko(f.value);if(y){const _=Ln(a.value,y.r1,y.c1,y.r2,y.c2),T=Ge(_.r1,_.c1,_.r2,_.c2);T&&(J.value=ut(T))}}}t.onMounted(()=>{document.addEventListener("keydown",Le,!0),document.addEventListener("selectionchange",he),document.addEventListener("mousedown",Fe,!0),document.addEventListener("mousedown",S,!0),document.addEventListener("mouseup",M,!0),window.addEventListener("scroll",Qe,!0),document.addEventListener("touchmove",Qe,{passive:!0,capture:!0})});const qe=t.ref(null),ft=t.ref({rowTops:[],rowHeights:[],colLefts:[],colWidths:[],wrapperOffsetLeft:0,wrapperOffsetTop:0,tableTotalWidth:0,tableTotalHeight:0});function Nt(){const y=m.value,_=qe.value,T=v.value;if(!y||!_||!T)return;const B=a.value.rows,W=a.value.cols,ee=_.getBoundingClientRect(),ce=T.getBoundingClientRect(),ie=Math.round(ee.left-ce.left),Ee=Math.round(ee.top-ce.top),ke=Array.from(y.querySelectorAll("tr")),Te=[],xe=[];for(const Ue of ke){const xt=Ue.getBoundingClientRect();Te.push(Math.round(xt.top-ee.top)),xe.push(Math.round(xt.height))}for(;Te.length<B;){const Ue=Te.length>0?Te[Te.length-1]+xe[xe.length-1]:0;Te.push(Ue),xe.push(xe.length>0?xe[xe.length-1]:32)}const Ke=_.scrollLeft,tt=[],ct=[],Gt=Array.from(y.querySelectorAll("colgroup > col"));if(Gt.length>0)for(const Ue of Gt){const xt=Ue.getBoundingClientRect();tt.push(Math.round(xt.left-ee.left+Ke)),ct.push(Math.round(xt.width))}for(;tt.length<W;){const Ue=tt.length>0?tt[tt.length-1]+ct[ct.length-1]:0;tt.push(Ue),ct.push(ct.length>0?ct[ct.length-1]:80)}const jt=ct.reduce((Ue,xt)=>Ue+xt,0),it=xe.reduce((Ue,xt)=>Ue+xt,0);ft.value={rowTops:Te,rowHeights:xe,colLefts:tt,colWidths:ct,wrapperOffsetLeft:ie,wrapperOffsetTop:Ee,tableTotalWidth:jt,tableTotalHeight:it},de()}t.watchEffect(()=>{var y,_;a.value.rows,a.value.cols,a.value.headerRow,(y=p.value)==null||y.row,(_=p.value)==null||_.col,t.nextTick(()=>{I.value===null&&Nt()})});let It=null;t.onMounted(()=>{var _;It=new ResizeObserver(()=>{I.value===null&&(Nt(),de())}),qe.value&&It.observe(qe.value),m.value&&It.observe(m.value);const y=(_=v.value)==null?void 0:_.closest(".block-editor");y&&It.observe(y),qe.value&&qe.value.addEventListener("scroll",_e,{passive:!0}),de()}),t.onBeforeUnmount(()=>{var y;It==null||It.disconnect(),qe.value&&qe.value.removeEventListener("scroll",_e),g&&cancelAnimationFrame(g),O&&clearTimeout(O),c&&((y=c.value)==null?void 0:y.blockId)===i&&(c.value=null)});function Vt(y,_){if(!r.value)return;_.preventDefault(),_.stopPropagation(),I.value=y,Q=ft.value.colWidths[y]??80,j=_.clientX,document.addEventListener("mousemove",Ut,!0),document.addEventListener("mouseup",sn,!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}function Ut(y){var ee,ce;if(I.value===null)return;const _=y.clientX-j;let T=Math.max(40,Math.round(Q+_));const B=qe.value;if(B){const ie=B.clientWidth-4,Ee=a.value.colWidths.reduce((Te,xe,Ke)=>Ke===I.value?Te:Te+xe,0);if(Ee+T<=ie){const Te=Math.max(40,ie-Ee);T=Math.min(T,Te)}}const W=Ci(a.value,I.value,T);(ce=(ee=o.commands).setAttrs)==null||ce.call(ee,{id:i,attrs:W})}function sn(){I.value=null,document.removeEventListener("mousemove",Ut,!0),document.removeEventListener("mouseup",sn,!0),document.body.style.cursor="",document.body.style.userSelect="",t.nextTick(()=>{Nt(),de()})}const Nn=t.ref(0),ro=t.ref(0),Yn=t.ref(0),L=t.ref(!1);let g=0,O;function de(){const y=qe.value;y&&(Nn.value=y.scrollLeft,ro.value=y.clientWidth,Yn.value=y.scrollWidth)}function _e(){L.value||(L.value=!0),g&&cancelAnimationFrame(g),g=requestAnimationFrame(()=>{g=0,de()}),O&&clearTimeout(O),O=setTimeout(()=>{L.value=!1,de()},130)}const Ae=t.computed(()=>{if(!r.value)return[];const y=ft.value,_=a.value.cols,T=y.colLefts,B=y.colWidths;if(_===0||T.length<_||B.length<_)return[];const W=Nn.value,ee=ro.value,ce=Yn.value;if(ee<=0)return[];const ie=W<=0,Ee=W+ee>=ce-1,ke=ce<=ee+1,Te=6,xe=[];for(let Ke=0;Ke<=_;Ke++){const ct=(Ke===0?T[0]??0:Ke===_?(T[_-1]??0)+(B[_-1]??0):T[Ke]??0)-W;let Gt=ct>=-1&&ct<=ee+1;if(Ke===0&&(ie||ke)&&(Gt=!0),Ke===_&&(Ee||ke)&&(Gt=!0),!Gt)continue;const jt=Math.max(Te,Math.min(ct,ee-Te))+(Ke>0?2:-2);xe.push({c:Ke,left:jt})}return xe});function Ne(y,_){var B,W;const T={id:i,..._};(W=(B=o.commands)[y])==null||W.call(B,T)}function we(){p.value=null,f.value=null,U.value.kind!=="none"&&(U.value={kind:"none"}),Xe(0),me(),De()}return n({clearInnerFocus:we}),()=>{var _o,tc,nc,oc,rc,lc,ic,sc,cc,ac,dc;const y=a.value,_=y.rows,T=y.cols,B=Ko(f.value),W=B?Ln(y,B.r1,B.c1,B.r2,B.c2):null,ee=ft.value,ce=U.value,ie=[],Ee=t.h("div",{class:"table-toolbar"},[t.h("div",{class:"table-toolbar-title"},[t.h(fn,{html:yr,class:"table-toolbar-icon"}),t.h("span",l.t("table.title"))])]),ke=[];for(let G=0;G<T;G++){const ye=y.colWidths[G]??0,ve={};ye&&ye>0&&(ve.width=`${ye}px`),ke.push(t.h("col",{"data-col":G,style:ve}))}const Te=t.h("colgroup",{},ke),xe=[],Ke=[],tt=y.headerRow?0:-1;for(let G=0;G<_;G++){const ye=[];for(let ve=0;ve<T;ve++){const ge=(_o=y.cells[G])==null?void 0:_o[ve];if(!ge||ge.covered)continue;const Je=`${G}-${ve}`,vn=tt===0&&G===0,To=!!W&&Wh(G,ve,W),xo=ce.kind==="row"&&ce.row===G,Mo=ce.kind==="col"&&ce.col===ve,Go=ce.kind==="all",fg=To||xo||Mo||Go;let _l=Wn(ge.content);ge.cellType==="codeBlock"&&_l.endsWith(`
|
|
19
|
+
`)&&(_l+="<br>");const lo=["table-cell"];vn&&lo.push("table-cell-header"),To&&lo.push("table-cell-selected"),(xo||Mo||Go)&&lo.push("table-cell-selected"),typeof ge.align=="string"&&ge.align!=="left"&&lo.push(`be-align-${ge.align}`),typeof ge.bgColor=="string"&&ge.bgColor!=="default"&&lo.push(`be-bg-${ge.bgColor}`);const uc=ge.verticalAlign??"middle";let fc;uc!=="top"&&(fc={verticalAlign:uc});const mc=!fg&&((tc=p.value)==null?void 0:tc.row)===G&&((nc=p.value)==null?void 0:nc.col)===ve;mc&&lo.push("table-cell-focused");const hn=["table-cell-inner"],on=ge.cellType;on==="heading"||on==="heading1"?hn.push("table-cell-heading","table-cell-h1"):on==="heading2"?hn.push("table-cell-heading","table-cell-h2"):on==="heading3"?hn.push("table-cell-heading","table-cell-h3"):on==="heading4"?hn.push("table-cell-heading","table-cell-h4"):on==="heading5"?hn.push("table-cell-heading","table-cell-h5"):on==="heading6"?hn.push("table-cell-heading","table-cell-h6"):on==="bulletList"?hn.push("table-cell-bullet"):on==="orderedList"?hn.push("table-cell-ordered"):on==="todoList"?(hn.push("table-cell-todo"),ge.checked&&hn.push("todo-checked")):on==="quote"?hn.push("table-cell-quote"):on==="codeBlock"&&hn.push("table-cell-code");const pc=on==="orderedList"?Wr(y,G,ve):-1,Tl=t.h("div",{class:hn,contenteditable:mc&&r.value?"true":"false","data-placeholder":l.t("table.cellPlaceholder"),innerHTML:_l,ref:Cn=>{Cn instanceof HTMLDivElement?d.set(Je,Cn):d.delete(Je)},onBlur:Cn=>ae(G,ve,Cn.currentTarget,Cn),onFocus:Cn=>kt(G,ve,Cn.currentTarget)});let _r;if(on==="todoList"){const Cn=t.h("input",{type:"checkbox",class:"table-cell-todo-checkbox",checked:!!ge.checked,onClick:Vn=>{Vn.stopPropagation()},onchange:Vn=>{var hc,gc;if(!r.value)return;const xl=Vn.target,pg=Ho(a.value,G,ve,{checked:xl.checked});(gc=(hc=o.commands).setAttrs)==null||gc.call(hc,{id:i,attrs:pg})}});_r=[t.h("div",{class:"table-cell-todo-wrapper"},[Cn,Tl])]}else if(on==="orderedList"&&pc>=1){const Cn=t.h("div",{class:"ol-marker table-cell-ol-marker",onMousedown:Vn=>{Vn.preventDefault(),Vn.stopPropagation()},onClick:Vn=>{Vn.stopPropagation();const xl=Vn.currentTarget;ze(G,ve,xl)}},`${pc}.`);_r=[t.h("div",{class:"block-ordered-list-wrapper"},[Cn,Tl])]}else _r=[Tl];const mg=t.h(vn?"th":"td",{rowspan:ge.rowspan>1?ge.rowspan:void 0,colspan:ge.colspan>1?ge.colspan:void 0,class:lo,style:fc,"data-row":G,"data-col":ve},_r);ye.push(mg)}tt===0&&G===0?xe.push(t.h("tr",{class:"table-row table-row-head"},ye)):Ke.push(t.h("tr",{class:"table-row"},ye))}const ct=[Te];xe.length>0&&ct.push(t.h("thead",{},xe)),ct.push(t.h("tbody",{},Ke));const Gt=t.h("table",{ref:m,class:"block-table-grid"},ct),jt=[];for(let G=0;G<_;G++){const ye=ee.rowTops[G],ve=ee.rowHeights[G]??32,ge=ce.kind==="row"&&ce.row===G;jt.push(t.h("div",{class:`table-row-strip${ge?" is-selected":""}`,"data-row":G,style:{top:`${ye}px`,height:`${ve}px`},title:l.t("table.selectRow"),onClick:Je=>{Je.preventDefault(),Zt(G)}}))}const it=I.value!==null,Ue=[],xt=[];let qt;if(it){const G=y.colWidths;let ye=0;for(let ve=0;ve<T;ve++){Ue.push(ye);const ge=G[ve]??80;xt.push(ge),ye+=ge}qt=ye}else{for(let G=0;G<T;G++)Ue.push(ee.colLefts[G]??0),xt.push(ee.colWidths[G]??0);qt=ee.tableTotalWidth}const mt=[];for(let G=0;G<T;G++){const ye=Ue[G],ve=xt[G]??0,ge=ce.kind==="col"&&ce.col===G;mt.push(t.h("div",{class:`table-col-strip${ge?" is-selected":""}`,"data-col":G,style:{left:`${ye}px`,width:`${ve}px`},title:l.t("table.selectCol"),onClick:Je=>{Je.preventDefault(),xn(G)}}))}const bt=[];if(r.value)for(let G=0;G<=_;G++){let ye;if(G===0)ye=(ee.rowTops[0]??0)+3;else if(G===_){const ve=ee.rowTops[G-1]??0,ge=ee.rowHeights[G-1]??32;ye=ve+ge+2}else{const ve=(ee.rowTops[G-1]??0)+(ee.rowHeights[G-1]??32),ge=ee.rowTops[G]??0;ye=Math.round((ve+ge)/2)}bt.push(t.h("div",{class:"table-insert-dot table-insert-dot-row",style:{top:`${ye}px`},title:G<_?l.t("table.insertRowAbove"):l.t("table.insertRowBelow"),onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),Ne("tableInsertRow",{beforeRow:G})}}))}const zt=[];for(let G=0;G<T;G++){const ye=Ue[G]??0,ve=xt[G]??0;zt.push(t.h("div",{class:"table-col-resize-item",style:{left:`${ye}px`,width:`${ve}px`}},[t.h("div",{class:"table-col-resizer",title:l.t("table.resizeCol"),onMousedown:ge=>Vt(G,ge)})]))}const pn=t.h("div",{class:"table-corner-handle",title:l.t("table.selectAll"),onClick:G=>{G.preventDefault(),Mn()}});ie.push(Ee,pn),ie.push(t.h("div",{class:"table-row-handles",style:{height:`${ee.tableTotalHeight}px`}},[...jt,...bt])),ie.push(t.h("div",{class:"table-wrapper",ref:qe},[t.h("div",{class:"table-col-handles",style:{width:`${qt}px`}},[...mt]),t.h("div",{class:"table-col-resizers"},zt),Gt])),ie.push(t.h("div",{class:["table-col-insert-dots",L.value||I.value!==null?"is-scrolling":""]},Ae.value.map(G=>t.h("div",{class:"table-insert-dot table-insert-dot-col",style:{left:`${G.left}px`},title:G.c<T?l.t("table.insertColLeft"):l.t("table.insertColRight"),onClick:ye=>{ye.preventDefault(),ye.stopPropagation(),Ne("tableInsertCol",{beforeCol:G.c})}}))));const Yt=J.value,wn=ce.kind==="row"||ce.kind==="col"||ce.kind==="all",vt=Ko(f.value),Pn=vt?Ln(a.value,vt.r1,vt.c1,vt.r2,vt.c2):null,Sn=p.value?{r1:p.value.row,c1:p.value.col,r2:p.value.row,c2:p.value.col}:null,$t=Pn??Sn,vl=($t?za(a.value,$t.r1,$t.c1,$t.r2,$t.c2):0)>=2,wr=$t?yi(a.value,$t.r1,$t.c1,$t.r2,$t.c2):!1,Hn=ce.kind==="row"?l.t("table.deleteRow"):ce.kind==="col"?l.t("table.deleteCol"):ce.kind==="all"?l.t("table.deleteTable"):"",Cl=ce.kind==="row"?Hh:ce.kind==="col"?Vh:Zs,Eo=()=>{ce.kind==="row"?Ne("tableRemoveRow",{row:ce.row}):ce.kind==="col"?Ne("tableRemoveCol",{col:ce.col}):Ne("tableDelete")},vo=()=>{$t&&Ne("tableMergeCells",$t)},Er=()=>{$t&&Ne("tableSplitCellsInRect",$t)},vr=()=>{Ne("tableToggleHeaderRow")},Cr=()=>{U.value={kind:"none"},f.value=null,Xe(0)};function h(){var ve;const G=Ko(f.value);if(!G)return[];const ye=[];for(let ge=G.r1;ge<=G.r2;ge++)for(let Je=G.c1;Je<=G.c2;Je++){const vn=(ve=a.value.cells[ge])==null?void 0:ve[Je];vn&&!vn.covered&&ye.push({row:ge,col:Je})}return ye}const R=h().map(G=>{var ye;return(ye=a.value.cells[G.row])==null?void 0:ye[G.col]}).filter(G=>!!G&&!G.covered),H=new Set(R.map(G=>G.cellType??"paragraph"));let Z="paragraph",Y;if(H.size===1){const G=[...H][0];G==="heading"||G==="heading1"?(Z="heading",Y=1):G==="heading2"?(Z="heading",Y=2):G==="heading3"?(Z="heading",Y=3):G==="heading4"?(Z="heading",Y=4):G==="heading5"?(Z="heading",Y=5):G==="heading6"?(Z="heading",Y=6):G==="bulletList"?Z="bulletList":G==="orderedList"?Z="orderedList":G==="todoList"?Z="todoList":G==="quote"?Z="quote":G==="codeBlock"&&(Z="codeBlock")}const oe=new Set(R.map(G=>G.align??"left")),X={align:oe.size===1?[...oe][0]:"left"},be=new Set(R.map(G=>G.verticalAlign??"middle")),Be=be.size===1?[...be][0]:"middle";X.verticalAlign=Be,Y!==void 0&&(X.level=Y);const Re=["bold","italic","underline","strikethrough","code"],pt=new Set;for(const G of Re){let ye=!0,ve=!1;for(const ge of R){for(const Je of ge.content)if(Je.type==="text"&&(ve=!0,!((oc=Je.marks)!=null&&oc.some(vn=>vn.type===G)))){ye=!1;break}if(!ye)break}ve&&ye&&pt.add(G)}const We=new Set;for(const G of R)for(const ye of G.content){if(ye.type!=="text")continue;const ve=(rc=ye.marks)==null?void 0:rc.find(Je=>Je.type==="color"),ge=(lc=ve==null?void 0:ve.attrs)==null?void 0:lc.color;typeof ge=="string"&&We.add(ge)}const je=We.size===1?[...We][0]:"",He=new Set(R.map(G=>G.bgColor??"")),st=He.size===1?[...He][0]:"";if((ce.kind==="row"||ce.kind==="col"||ce.kind==="all"||R.length>0)&&!x){A.blockType=Z,A.blockAttrs={...X},A.marks.clear();for(const G of pt)A.marks.add(G);A.textColor=je,A.bgColor=st,A.verticalAlign=Be,A.showDelete=wn,A.deleteLabel=Hn,A.deleteIcon=Cl,A.showMerge=vl,A.showSplit=wr,A.showHeaderRow=ce.kind==="all",A.headerRowActive=!!a.value.headerRow}const Ct=G=>{var ge,Je;const ye=h();if(ye.length===0)return;const ve=Qn(a.value,ye,{cellType:G});(Je=(ge=o.commands).setAttrs)==null||Je.call(ge,{id:i,attrs:ve})},Ze=G=>{var ge,Je;const ye=h();if(ye.length===0)return;const ve=Qn(a.value,ye,{align:G});(Je=(ge=o.commands).setAttrs)==null||Je.call(ge,{id:i,attrs:ve})},at=G=>{var ge,Je;const ye=h();if(ye.length===0)return;const ve=Qn(a.value,ye,{verticalAlign:G});(Je=(ge=o.commands).setAttrs)==null||Je.call(ge,{id:i,attrs:ve})},Bt=G=>{var ge,Je;const ye=h();if(ye.length===0)return;const ve=Ya(a.value,ye,G);(Je=(ge=o.commands).setAttrs)==null||Je.call(ge,{id:i,attrs:ve})},Xt=G=>{var ge,Je;const ye=h();if(ye.length===0)return;const ve=Ei(a.value,ye,"color",G?{color:G}:null);(Je=(ge=o.commands).setAttrs)==null||Je.call(ge,{id:i,attrs:ve})},cn=G=>{var ge,Je;const ye=h();if(ye.length===0)return;const ve=Qn(a.value,ye,{bgColor:G??"default"});(Je=(ge=o.commands).setAttrs)==null||Je.call(ge,{id:i,attrs:ve})},tn=()=>{var ge,Je;const G=Ko(f.value);if(!G)return;const ye=[];for(let vn=G.r1;vn<=G.r2;vn++){const To=[];for(let xo=G.c1;xo<=G.c2;xo++){const Mo=(ge=a.value.cells[vn])==null?void 0:ge[xo];Mo&&!Mo.covered?To.push(Mo.content.map(Go=>Go.type==="text"?Go.text:"").join("")):To.push("")}ye.push(To.join(" "))}const ve=ye.join(`
|
|
20
|
+
`);ve&&((Je=navigator.clipboard)==null||Je.writeText(ve))},En={visible:!!Yt,selectionRect:Yt,blockId:i,blockType:A.blockType,blockAttrs:A.blockAttrs,rootEl:document.querySelector(".block-editor"),tableMode:!0,tableActiveMarks:A.marks,tableActiveColor:A.textColor,tableActiveBgColor:A.bgColor,tableActiveVerticalAlign:A.verticalAlign,showDelete:A.showDelete,deleteLabel:A.deleteLabel,deleteIcon:A.deleteIcon,showMerge:A.showMerge,showSplit:A.showSplit,showHeaderRow:A.showHeaderRow,headerRowActive:A.headerRowActive,onDelete:Eo,onMerge:vo,onSplit:Er,onTableHeaderRow:vr,onClose:Cr,onTableType:Ct,onTableAlign:Ze,onTableVerticalAlign:at,onTableMark:Bt,onTableTextColor:Xt,onTableBgColor:cn,onTableCopy:tn};s.value?c&&(En.visible?c.value=En:((ic=c.value)==null?void 0:ic.blockId)===i&&!((sc=c.value)!=null&&sc.cellEditMode)&&(c.value=null)):ie.push(t.h(ir,En));const Oe=p.value,ot=Oe?(cc=a.value.cells[Oe.row])==null?void 0:cc[Oe.col]:void 0,Rt=ot==null?void 0:ot.cellType;let Lt="paragraph";const nn={};Rt==="heading"||Rt==="heading1"?(Lt="heading",nn.level=1):Rt==="heading2"?(Lt="heading",nn.level=2):Rt==="heading3"?(Lt="heading",nn.level=3):Rt==="heading4"?(Lt="heading",nn.level=4):Rt==="heading5"?(Lt="heading",nn.level=5):Rt==="heading6"?(Lt="heading",nn.level=6):Rt==="bulletList"?Lt="bulletList":Rt==="orderedList"?Lt="orderedList":Rt==="todoList"?Lt="todoList":Rt==="quote"?Lt="quote":Rt==="codeBlock"&&(Lt="codeBlock"),typeof(ot==null?void 0:ot.align)=="string"&&(nn.align=ot.align),typeof(ot==null?void 0:ot.verticalAlign)=="string"&&(nn.verticalAlign=ot.verticalAlign);const Co={visible:k.visible&&!!k.selectionRect,selectionRect:k.selectionRect,blockId:i,blockType:Lt,blockAttrs:nn,rootEl:document.querySelector(".block-editor"),cellEditMode:!0,onClose:()=>{k.visible=!1,k.selectionRect=null},onTableType:G=>{var ve,ge;if(!Oe)return;const ye=Qn(a.value,[{row:Oe.row,col:Oe.col}],{cellType:G});(ge=(ve=o.commands).setAttrs)==null||ge.call(ve,{id:i,attrs:ye})},onTableAlign:G=>{var ve,ge;if(!Oe)return;const ye=Qn(a.value,[{row:Oe.row,col:Oe.col}],{align:G});(ge=(ve=o.commands).setAttrs)==null||ge.call(ve,{id:i,attrs:ye})},onTableVerticalAlign:G=>{var ve,ge;if(!Oe)return;const ye=Qn(a.value,[{row:Oe.row,col:Oe.col}],{verticalAlign:G});(ge=(ve=o.commands).setAttrs)==null||ge.call(ve,{id:i,attrs:ye})},onLinkClick:()=>{Kt()}};return s.value?c&&(Co.visible?c.value=Co:((ac=c.value)==null?void 0:ac.blockId)===i&&((dc=c.value)!=null&&dc.cellEditMode)&&(c.value=null)):ie.push(t.h(ir,Co)),ie.push(t.h(ts,{visible:E.visible,anchorRect:E.anchorRect,blockId:null,from:0,to:0,href:E.href,text:E.text,initialMode:E.initialMode,showTextInput:E.showTextInput,readonly:!r.value,onSaveLink:(G,ye)=>{Tt(G,ye),E.href=G,ye!==void 0&&(E.text=ye)},onRemoveLinkMark:()=>{wt()},onClose:()=>{Pe()}})),ie.push(t.h(Qi,{visible:te.visible,blockId:null,anchor:te.anchor,rootEl:document.querySelector(".block-editor"),canContinue:te.canContinue,canStartNew:te.canStartNew,currentNumber:te.currentNumber,onContinue:Ye,onStartNew:Ce,onModify:dt,onClose:me})),ie.push(t.h(Ji,{visible:se.visible,initialValue:se.initialValue,anchor:se.anchor,rootEl:document.querySelector(".block-editor"),onConfirm:nt,onClose:De})),t.h("div",{class:["block-table-container","block-focus-root",...kn(e.block.attrs)],ref:v,tabindex:"-1",onClick:V,onMousedown:Wt,onMouseover:yn,onDblclick:lt,onFocusout:fe,onKeydown:mn},ie)}}});function Fh(e,n,o,r){var s;const l=[];for(let c=0;c<e.rows;c++)for(let a=0;a<e.cols;a++){const d=(s=e.cells[c])==null?void 0:s[a];d&&!d.covered&&l.push({r:c,c:a})}const i=l.findIndex(c=>c.r===n&&c.c===o);return i===-1?null:r?i===0?null:l[i-1]??null:i===l.length-1?null:l[i+1]??null}function Kh(e,n,o){var l;let r=null;for(let i=0;i<e.rows;i++)for(let s=0;s<e.cols;s++){const c=(l=e.cells[i])==null?void 0:l[s];c&&!c.covered&&(r={r:i,c:s})}return r!==null&&r.r===n&&r.c===o}function El(e){if(!e)return;e.focus();const n=document.createRange();n.selectNodeContents(e),n.collapse(!1);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(n)}function Xs(e){if(!e)return;e.focus();const n=document.createRange();n.selectNodeContents(e),n.collapse(!0);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(n)}function Ko(e){if(!e)return null;const n=e.anchor,o=e.focus,r=Math.min(n.row,o.row),l=Math.max(n.row,o.row),i=Math.min(n.col,o.col),s=Math.max(n.col,o.col);return{r1:r,c1:i,r2:l,c2:s}}function Wh(e,n,o){return e>=o.r1&&e<=o.r2&&n>=o.c1&&n<=o.c2}function Wo(e,n){return null}function $n(e,n,o,r){const l=e.doc.blocks.get(n);if(!l||l.type!=="table")return!1;const i=$o(l.attrs),s=r(i),c=et();return c.setAttrs(n,s),o==null||o(c.build()),!0}function Gh(){return{name:"tableInsertRow",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);if(!r||r.type!=="table")return!1;const l=Jn(r.attrs);Wo(n,e.id);const i=e.beforeRow??l.rows;return $n(n,e.id,o,s=>wi(s,i))}}}function qh(){return{name:"tableRemoveRow",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);if(!r||r.type!=="table")return!1;const l=Jn(r.attrs);Wo(n,e.id);const i=e.row??l.rows-1;return $n(n,e.id,o,s=>Wa(s,i))}}}function Yh(){return{name:"tableInsertCol",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);if(!r||r.type!=="table")return!1;const l=Jn(r.attrs);Wo(n,e.id);const i=e.beforeCol??l.cols;return $n(n,e.id,o,s=>Ga(s,i))}}}function Zh(){return{name:"tableRemoveCol",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);if(!r||r.type!=="table")return!1;const l=Jn(r.attrs);Wo(n,e.id);const i=e.col??l.cols-1;return $n(n,e.id,o,s=>qa(s,i))}}}function Xh(){return{name:"tableToggleHeaderRow",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);return!r||r.type!=="table"?!1:$n(n,e.id,o,ja)}}}function jh(){return{name:"tableMergeCells",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);if(!r||r.type!=="table")return!1;const l=Jn(r.attrs);Wo(n,e.id);const i=e.r1??0,s=e.c1??0;let c=e.r2??0,a=e.c2??0;if(i===c&&s===a&&(c+1<l.rows&&(c=i+1),a+1<l.cols&&(a=s+1),i===c&&s===a))return!1;const d=Ln(l,i,s,c,a);return d.r1===d.r2&&d.c1===d.c2?!1:$n(n,e.id,o,m=>Za(m,d.r1,d.c1,d.r2,d.c2))}}}function Qh(){return{name:"tableSplitCell",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);return!r||r.type!=="table"?!1:$n(n,e.id,o,l=>vi(l,e.row,e.col))}}}function Jh(){return{name:"tableSplitCellsInRect",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);if(!r||r.type!=="table")return!1;const l=Jn(r.attrs),i=Ln(l,e.r1,e.c1,e.r2,e.c2);return yi(l,i.r1,i.c1,i.r2,i.c2)?$n(n,e.id,o,s=>Xa(s,i.r1,i.c1,i.r2,i.c2)):!1}}}function eg(){return{name:"tableSetColWidth",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);return!r||r.type!=="table"?!1:$n(n,e.id,o,l=>Ci(l,e.col,e.width))}}}function tg(){return{name:"tableDelete",run:e=>(n,o)=>{const r=n.doc.blocks.get(e.id);if(!r||r.type!=="table")return!1;const l=et();return l.removeBlock(e.id),o==null||o(l.build()),!0}}}function ng(){return{name:"insertTable",run:e=>(n,o)=>{const r=e.rows??3,l=e.cols??3,i=Math.max(1,Math.min(50,Number.isInteger(r)?r:3)),s=Math.max(1,Math.min(20,Number.isInteger(l)?l:3)),c=Fa(i,s),d={rows:i,cols:s,cells:On(c,i,s),colWidths:new Array(s).fill(120),headerRow:!0};let m=null,f=n.doc.root.length,p=null;if(e.replaceCurrent){const U=n.selection,F=U.kind==="caret"?U.blockId:U.kind==="text"?U.focus.blockId:U.blockIds[0]??null;F&&(p=F)}if(p&&(n.doc.blocks.get(p)?(m=Ot(n.doc,p),f=ln(n.doc,p)):p=null),!p)if(e.after){if(!n.doc.blocks.get(e.after))return!1;m=Ot(n.doc,e.after),f=ln(n.doc,e.after)+1}else{const U=n.selection,F=U.kind==="caret"?U.blockId:U.kind==="text"?U.focus.blockId:U.blockIds[0]??null;F&&(m=Ot(n.doc,F),f=ln(n.doc,F)+1)}const u=et();p&&u.removeBlock(p);const b=m===null?0:In(n.doc,m)+1,w=b>0?{...d,indent:b}:d,S=u.insertBlock({parent:m,index:f,type:"table",attrs:w,content:[]}),M=Yo(n.doc,u.peek()),I=ao(M.doc,S),j=Bn(M.doc,S),Q=I??j;return Q?u.setSelection(rt(Q.id,0)):u.setSelection(rt(S,0)),o==null||o(u.build()),!0}}}const js={name:"table",schema:{type:"table",content:"none",nestable:!1,isolating:!0,inlineMarks:!1,attrs:{...Uh},empty:e=>{var o;const n=$o(e.attrs);for(let r=0;r<n.rows;r++)for(let l=0;l<n.cols;l++){const i=(o=n.cells[r])==null?void 0:o[l];if(!(!i||i.covered)){for(const s of i.content)if(s.type==="text"&&s.text.length>0)return!1}}return!0}},renderer:{component:zh,editable:!1},commands:[Gh(),qh(),Yh(),Zh(),Xh(),jh(),Qh(),Jh(),eg(),tg(),ng()],slashCommands:[{id:"table-3x3",title:"slash.table3x3.title",keywords:["table","grid","spreadsheet","表格","数据表","网格"],description:"slash.table3x3.description",icon:yr,command:"insertTable",category:"other",args:()=>({rows:3,cols:3,replaceCurrent:!0})},{id:"table-2x2",title:"slash.table2x2.title",keywords:["table","grid","表格","2行2列"],description:"slash.table2x2.description",icon:yr,command:"insertTable",category:"other",args:()=>({rows:2,cols:2,replaceCurrent:!0})},{id:"table-4x4",title:"slash.table4x4.title",keywords:["table","grid","表格","4行4列"],description:"slash.table4x4.description",icon:yr,command:"insertTable",category:"other",args:()=>({rows:4,cols:4,replaceCurrent:!0})}],serialize:{toHTML:e=>{if(e.type!=="table")return"";const n=$o(e.attrs);return Ja(n)},toMarkdown:e=>{if(e.type!=="table")return"";const n=$o(e.attrs);return Qa(n)}}},og=t.defineComponent({name:"DividerBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){return e.placeholder,()=>t.h("div",{class:["block-divider","block-focus-root",...kn(e.block.attrs)],"data-block-divider":!0})}}),Qs={name:"divider",schema:{type:"divider",content:"none",nestable:!1,inlineMarks:!1,attrs:{indent:Jt.indent},empty:()=>!1},renderer:{component:og,editable:!1},slashCommands:[{id:"divider",title:"slash.divider.title",keywords:["divider","separator","hr","horizontal","line","分隔符","分割线","水平线","横线"],description:"slash.divider.description",icon:qd,command:"convertBlock",category:"basic",args:()=>({id:"__currentBlock__",type:"divider"})}],inputRules:[{name:"divider-md-thematic-break",pattern:/^(?:-{3,}|\*{3,}|_{3,})\s*$/,command:"convertBlock",args:()=>({id:"__currentBlock__",type:"divider"})}],serialize:{toHTML:()=>"<hr/>",toMarkdown:()=>"---"},deserialize:{fromMarkdown:e=>{const n=e.trim();return/^-{3,}$/.test(n)||/^\*{3,}$/.test(n)||/^_{3,}$/.test(n)?{type:"divider"}:null}}};function rg(e){const n=[];for(const o of e.root){const r=e.blocks.get(o);if(!r||r.type!=="heading")continue;const l=Me(r.content).trim();if(l.length===0)continue;const i=typeof r.attrs.level=="number"?r.attrs.level:1;n.push({id:o,level:Math.max(1,Math.min(6,Math.floor(i))),text:l})}return n}const lg=t.defineComponent({name:"TableOfContentsBlock",props:{block:{type:Object,required:!0},placeholder:{type:String,default:void 0}},setup(e){e.block,e.placeholder;const n=dn(),o=Qt(),r=t.ref(null),l=t.ref(0),i=t.computed(()=>(l.value,rg(n.getState().doc)));let s=null;t.onMounted(()=>{s=n.subscribe(()=>{l.value++})}),t.onBeforeUnmount(()=>{s==null||s()});function c(a){var d,m;(m=(d=n.commands).setSelection)==null||m.call(d,{selection:rt(a,0)}),t.nextTick(()=>{var u,b;const f=(b=(u=r.value)==null?void 0:u.closest)==null?void 0:b.call(u,".block-editor"),p=f?Ro(f,a):null;p==null||p.scrollIntoView({block:"center",behavior:"smooth"})})}return()=>{const a=i.value,d=[t.h("div",{class:"toc-title"},o.t("toc.title"))];if(a.length===0)d.push(t.h("div",{class:"toc-empty"},o.t("toc.empty")));else for(const m of a)d.push(t.h("button",{type:"button",class:["toc-item",`toc-level-${m.level}`],style:{paddingLeft:`${(m.level-1)*16}px`},"data-toc-target":m.id,onClick:()=>c(m.id)},m.text));return t.h("div",{ref:r,class:["block-table-of-contents","block-focus-root",...kn(e.block.attrs)]},d)}}}),Js={name:"tableOfContents",schema:{type:"tableOfContents",content:"none",nestable:!1,inlineMarks:!1,attrs:{indent:Jt.indent},empty:()=>!1},renderer:{component:lg,editable:!1},slashCommands:[{id:"tableOfContents",title:"slash.tableOfContents.title",keywords:["toc","contents","table of contents","outline","目录","标题","大纲"],description:"slash.tableOfContents.description",icon:Yd,command:"convertBlock",category:"basic",args:()=>({id:"__currentBlock__",type:"tableOfContents"})}],serialize:{toHTML:()=>"",toMarkdown:()=>""}},ec=[os,rs,zm,Pm,Km,Gm,Oh,Ys,js,Qs,Js,ls,is],ig={key:0,class:"cross-block-selection-overlay","aria-hidden":"true"},sg=200,cg=.25,ag=.75,dg=400,ug=t.defineComponent({__name:"BlockEditor",props:{extensions:{default:()=>ec},modelValue:{default:()=>({blocks:[]})},editable:{type:Boolean,default:!0},placeholder:{default:""},theme:{default:"light"},locale:{default:"zh-CN"},uploadImage:{type:Function,default:void 0}},emits:["update:modelValue","cleanup:image-file"],setup(e,{expose:n,emit:o}){const r=e,l=r.placeholder!=="",i=o,s=t.computed(()=>Oi(r.locale)),c=t.computed(()=>Di(r.theme)),a=t.ref(s.value),d=t.ref(c.value);Cd(a,d),t.watch([s,c],([h,C])=>{a.value=h,d.value=C});const m=Qt(),f=t.computed(()=>`theme-${c.value}`);t.watch(c,h=>{if(typeof document>"u")return;const C=document.body;C.classList.toggle("theme-dark",h==="dark"),C.classList.toggle("theme-light",h==="light")},{immediate:!0});const p=t.computed(()=>l?r.placeholder??"":m.t("editor.placeholder")),u=new li({extensions:r.extensions,initialDocument:r.modelValue,editable:r.editable}),b=t.ref(r.editable);t.provide(di,b),t.provide(Dr,u);const w=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null,S=t.ref(!!(w!=null&&w.matches));function M(){S.value=!!(w!=null&&w.matches)}const I=t.ref(null);t.provide(ai,S),t.provide(Or,I),t.watch(()=>r.editable,h=>{var C,R;b.value=h,u.editable=h,h||(k.visible=!1,k.selectionRect=null,k.blockId=null,k.blockType=null,k.blockAttrs={},vt(),An(),Hn(),te(),ie(),B(),Pt(null,{clearNativeSelection:!0}),(R=(C=u.commands).clearSelection)==null||R.call(C))}),bd((h,C,R,H)=>{const{onProgress:Z,onSuccess:Y,onError:oe}=H,re=r.uploadImage;typeof re=="function"?re(h,C,R,X=>{const be=Number.isFinite(X)?Math.max(0,Math.min(1,X/100)):0;Z(be)}).then(X=>{Y({url:X.url,width:X.width,height:X.height,alt:X.alt,title:X.title,fileId:X.fileId})}).catch(X=>{R.signal.aborted||oe(X instanceof Error?X.message:String(X))}):kd(C,Z).then(X=>Y({url:X.url,width:X.width,height:X.height}),X=>oe(X instanceof Error?X.message:String(X)))});const j=t.ref(0),Q=dd(()=>{j.value++}),U=async(h,C={})=>{var X,be,Be,Re,pt,We,je,He,st,Ie,Ct,Ze,at,Bt,Xt,cn,tn,En;const{relativeToBlockId:R=null,position:H="after",convertIfEmpty:Z=!0}=C;j.value;let Y=null,oe=R??null;if(!oe){const Oe=u.getState().selection;Oe.kind==="caret"?oe=Oe.blockId:Oe.kind==="text"&&(oe=Oe.anchor.blockId)}if(oe||(oe=F.value.doc.root[0]??null),H==="replace"&&oe){const Oe=u.registries.schema.get("image");Oe&&((be=(X=u.commands).replaceBlock)==null||be.call(X,{id:oe,type:"image",attrs:zn(Oe)}),Y=oe)}if(!Y&&oe&&Z&&H!=="before"){const ot=u.getState().doc.blocks.get(oe);if(ot&&ot.type==="paragraph"&&Me(ot.content).length===0){const Rt=u.registries.schema.get("image");Rt&&((Re=(Be=u.commands).replaceBlock)==null||Re.call(Be,{id:oe,type:"image",attrs:zn(Rt)}),Y=oe)}}if(!Y&&oe&&H==="before"){const Oe=u.registries.schema.get("image");if(Oe){(We=(pt=u.commands).insertBlock)==null||We.call(pt,{before:oe,type:"image",attrs:zn(Oe)});const ot=u.getState().selection;ot.kind==="caret"?Y=ot.blockId:ot.kind==="text"&&(Y=ot.anchor.blockId)}}if(!Y&&oe){const Oe=u.registries.schema.get("image");if(Oe){(He=(je=u.commands).insertBlock)==null||He.call(je,{after:oe,type:"image",attrs:zn(Oe)});const ot=u.getState().selection;ot.kind==="caret"?Y=ot.blockId:ot.kind==="text"&&(Y=ot.anchor.blockId)}}if(!Y){const Oe=u.registries.schema.get("image");if(!Oe)return null;const ot=u.getState().doc,Rt=ot.root[ot.root.length-1]??null;Rt?(Ie=(st=u.commands).insertBlock)==null||Ie.call(st,{after:Rt,type:"image",attrs:zn(Oe)}):(Ze=(Ct=u.commands).insertBlock)==null||Ze.call(Ct,{after:null,type:"image",attrs:zn(Oe)});const Lt=u.getState().selection;Lt.kind==="caret"?Y=Lt.blockId:Lt.kind==="text"&&(Y=Lt.anchor.blockId)}if(!Y)return null;if(typeof h=="string"){const Oe=h;try{const ot=await new Promise(Lt=>{if(typeof document>"u")return Lt({});const nn=document.createElement("img");let Co=!1;const _o=()=>{Co||(Co=!0,Lt({width:nn.naturalWidth||void 0,height:nn.naturalHeight||void 0}))};nn.onload=_o,nn.onerror=_o,nn.src=Oe,setTimeout(_o,4e3)}),Rt={src:Oe,width:ot.width,height:ot.height};(Bt=(at=u.commands).setAttrs)==null||Bt.call(at,{id:Y,attrs:Rt})}catch{(cn=(Xt=u.commands).setAttrs)==null||cn.call(Xt,{id:Y,attrs:{src:Oe}})}return Y}const re=await yd(Y,h);if(re.ok){const Oe=re.value,ot={src:Oe.url,alt:Oe.alt,title:Oe.title,width:Oe.width,height:Oe.height,fileId:Oe.fileId};(En=(tn=u.commands).setAttrs)==null||En.call(tn,{id:Y,attrs:ot})}return Y};t.provide(ui,U);const F=t.shallowRef(u.getState());let ue=u.getState().selection,J=!1,ne=!1;const q=t.computed(()=>{const h=F.value.doc,C=[];for(const R of h.root){const H=h.blocks.get(R);H&&C.push({id:R,block:H})}return C}),x=t.reactive({visible:!1,anchorEl:null,blockId:"",query:"",mode:"slash"}),z=t.ref(null),A=t.reactive({visible:!1,anchorEl:null,blockId:null}),v=t.ref(null),k=t.reactive({visible:!1,selectionRect:null,blockId:null,blockType:null,blockAttrs:{}}),E=t.reactive({visible:!1,blockId:null,anchor:null,canContinue:!1,canStartNew:!1,currentNumber:1}),D=t.reactive({visible:!1,initialValue:1,anchor:null,blockId:null}),P=t.reactive({visible:!1,initialValue:"plain",anchor:null,blockId:null}),K=t.reactive({visible:!1,anchorRect:null,blockId:null,from:0,to:0,href:"",text:"",initialMode:"view",showTextInput:!1});function te(){K.visible=!1}t.watch(()=>K.visible,h=>{h&&(k.visible=!1)});function me(h,C){var Z,Y;const R=u.getState().doc.blocks.get(h);if(!R)return null;let H=0;for(const oe of R.content){if(oe.type!=="text")continue;const re=H,X=H+oe.text.length;if(C>=re&&C<=X){const be=(Z=oe.marks)==null?void 0:Z.find(Be=>Be.type==="link");if(be&&typeof((Y=be.attrs)==null?void 0:Y.href)=="string")return{from:re,to:X,href:be.attrs.href,text:oe.text};if(C<X)return null}H=X}return null}function se(h,C,R){var Be,Re,pt;const H=u.getState().doc.blocks.get(h);if(!H)return;let Z="",Y="",oe=0;for(const We of H.content){if(We.type!=="text")continue;const je=oe,He=oe+We.text.length;if(He>C&&je<R){const st=(Be=We.marks)==null?void 0:Be.find(Ie=>Ie.type==="link");if(st&&typeof((Re=st.attrs)==null?void 0:Re.href)=="string"){Z=st.attrs.href,Y=We.text;break}}oe=He}let re=null;const X=(pt=pe.value)==null?void 0:pt.querySelector(`[data-block-id="${h}"]`);if(X){const We=window.getSelection();if(We&&We.rangeCount>0){const je=We.getRangeAt(0);X.contains(je.commonAncestorContainer)&&(re=je.getBoundingClientRect())}re||(re=X.getBoundingClientRect())}const be=C<R;ie(),B(),vt(),An(),Hn(),K.blockId=h,K.from=C,K.to=R,K.href=Z,K.text=Y,K.anchorRect=re,K.initialMode=Z||!b.value?"view":"edit",K.showTextInput=!be&&!Z,K.visible=!0}function De(){var C;if(!b.value)return;mn();const h=u.getState().selection;if(h.kind==="caret"){const R=me(h.blockId,h.offset);if(R){K.blockId=h.blockId,K.from=R.from,K.to=R.to,K.href=R.href,K.text=R.text;const H=(C=pe.value)==null?void 0:C.querySelector(`[data-block-id="${h.blockId}"]`),Z=H==null?void 0:H.querySelector("a");K.anchorRect=(Z==null?void 0:Z.getBoundingClientRect())??(H==null?void 0:H.getBoundingClientRect())??null,K.initialMode="view",K.showTextInput=!1,K.visible=!0}}else h.kind==="text"&&!Ht(h)&&se(h.focus.blockId,h.anchor.offset,h.focus.offset)}function ze(h,C,R){se(h,C,R)}function Ye(h,C){var Y;const R=me(h,C);if(!R)return;const H=(Y=pe.value)==null?void 0:Y.querySelector(`[data-block-id="${h}"]`),Z=H==null?void 0:H.querySelector("a");K.blockId=h,K.from=R.from,K.to=R.to,K.href=R.href,K.text=R.text,K.anchorRect=(Z==null?void 0:Z.getBoundingClientRect())??(H==null?void 0:H.getBoundingClientRect())??null,K.initialMode="view",K.showTextInput=!1,K.visible=!0}function Ce(h){Pt(h)}const dt=t.ref(null),nt=t.ref(null),Pe=t.ref(null);let Dt=!1,Kt=!1;function Pt(h,C={}){const{clearNativeSelection:R=!1}=C;if(R)try{const H=window.getSelection();H&&H.removeAllRanges()}catch{}nt.value=h}let Ve=null,Tt=0,wt=null;const Se=t.ref([]);function Et(h){dt.value=h}function he(){const h=pe.value;if(!h){Se.value=[];return}const C=u.getState().selection;if(C.kind!=="text"||!Ht(C)){Se.value=[];return}Se.value=Pr(h,u.getState().doc,C)}function At(h){h.preventDefault()}function ut(h){var oe,re;const C=pe.value;if(!C||!Ve)return;const R=Jo(h.clientX,h.clientY,C,u.getState().doc);if(!R)return;const H=Ve.start;if(R.blockId===H.blockId){if(Ve.crossBlock){Ve.crossBlock=!1,Se.value=[],document.removeEventListener("selectstart",At,!0);const X=window.getSelection();X&&X.removeAllRanges()}return}if(!Ve.crossBlock){Ve.crossBlock=!0,document.addEventListener("selectstart",At,!0);const X=window.getSelection();X&&X.removeAllRanges()}const Z={blockId:R.blockId,offset:R.offset},Y=Ar(H,Z);J=!0,(re=(oe=u.commands).setSelection)==null||re.call(oe,{selection:Y}),J=!1,he()}function $e(h){Ve&&(wt=h,!Tt&&(Tt=requestAnimationFrame(()=>{Tt=0,wt&&ut(wt)})))}function Xe(){if(!Ve)return;Ve=null,Tt&&(cancelAnimationFrame(Tt),Tt=0),wt=null,document.removeEventListener("mousemove",$e,!0),document.removeEventListener("mouseup",Xe,!0),document.removeEventListener("selectstart",At,!0),he();const h=u.getState().selection;h.kind==="text"&&Ht(h)&&ct(h)}const Mt=new Set(["image","divider","table","toc","tableOfContents","codeBlock"]),V=new Map;let N=u.getState().doc.blocks;{const h=u.getState().doc;for(const C of h.root){const R=h.blocks.get(C);if(!R||R.type!=="image")continue;const H=R.attrs.fileId;typeof H=="number"&&Number.isFinite(H)&&H>0&&V.set(H,(V.get(H)??0)+1)}}let $=!1;const ae=u.subscribe(h=>{if(F.value=h.state,h.removed.size>0&&hd(h.removed),h.changed.size>0||h.removed.size>0){const Z=new Map;for(const oe of h.state.doc.root){const re=h.state.doc.blocks.get(oe);if(!re||re.type!=="image")continue;const X=re.attrs.fileId;typeof X=="number"&&Number.isFinite(X)&&X>0&&Z.set(X,(Z.get(X)??0)+1)}const Y=new Set;for(const oe of h.changed){const re=oe?N.get(oe):void 0;if(re&&re.type==="image"){const X=re.attrs.fileId;typeof X=="number"&&Number.isFinite(X)&&X>0&&Y.add(X)}}for(const oe of h.removed){const re=oe?N.get(oe):void 0;if(re&&re.type==="image"){const X=re.attrs.fileId;typeof X=="number"&&Number.isFinite(X)&&X>0&&Y.add(X)}}for(const oe of Z.keys())Y.add(oe);for(const oe of Y){const re=Z.get(oe)??0,X=V.get(oe)??0;V.set(oe,re),re===0&&X>0&&i("cleanup:image-file",oe)}N=h.state.doc.blocks,$=!0,i("update:modelValue",u.toData()),Promise.resolve().then(()=>{$=!1})}const C=h.state.selection;let H=C.kind==="caret"?C.blockId:C.kind==="text"?C.focus.blockId:C.kind==="blocks"?C.blockIds[0]??null:null;if(nt.value!==null&&H!==nt.value){const Z=h.state.doc.blocks.get(nt.value);Z&&Mt.has(Z.type)&&(C.kind!=="blocks"||C.blockIds.length===0)&&(H=nt.value)}Pt(H),!J&&C!==ue&&(ne?ne=!1:t.nextTick(()=>{const Z=pe.value;Z&&hi(Z,C)})),C.kind==="text"&&Ht(C)?t.nextTick(()=>{he(),!Ve&&!Dt&&ct(C)}):Se.value.length>0&&(Se.value=[]),ue=C});function fe(h,C){if(Object.is(h,C))return!0;if(typeof h!=typeof C||h===null||C===null||typeof h!="object"||Array.isArray(h)!==Array.isArray(C))return!1;if(Array.isArray(h)){if(h.length!==C.length)return!1;for(let Z=0;Z<h.length;Z++)if(!fe(h[Z],C[Z]))return!1;return!0}const R=Object.keys(h),H=Object.keys(C);if(R.length!==H.length)return!1;for(const Z of R)if(!Object.prototype.hasOwnProperty.call(C,Z)||!fe(h[Z],C[Z]))return!1;return!0}t.watch(()=>r.modelValue,h=>{if($||h===void 0)return;const C=u.toData();fe(C,h)||u.setDocument(h)},{deep:!0});const pe=t.ref(null),kt=t.ref(null),ht=()=>kt.value;function mn(){const h=pe.value;if(!h)return;const C=fi(h,u.getState().doc);if(!C)return;const R={steps:[],selectionAfter:C,meta:{addToHistory:!1}};J=!0,u.dispatch(R),J=!1}function Wt(h){var Y,oe,re,X,be,Be,Re,pt,We,je,He,st;if(x.visible&&((Y=z.value)!=null&&Y.onKeyDown(h))||A.visible&&((oe=v.value)!=null&&oe.onKeyDown(h)))return;if(!b.value){const Ie=h.key,Ct=h.ctrlKey||h.metaKey,Ze=Ie.length===1&&!Ct&&!h.altKey&&!h.isComposing,at=Ie==="Enter"||Ie==="Backspace"||Ie==="Delete",Bt=Ie.toLowerCase();if(Ze||at||Ct&&(Bt==="x"||Bt==="v"||Bt==="z"||Bt==="y"||Bt==="d")){h.preventDefault();return}if(Ct&&Bt==="a"){h.preventDefault(),(X=(re=u.commands).selectAll)==null||X.call(re);return}if(Ct&&Bt==="c"){const cn=u.getState().selection;if(cn.kind==="text"&&Ht(cn)){const tn=zt(cn);if(tn){h.preventDefault();const En=window.ClipboardItem;if(En){const Oe=new En({"text/plain":new Blob([tn.text],{type:"text/plain"}),"text/html":new Blob([tn.html],{type:"text/html"})});navigator.clipboard.write([Oe]).catch(()=>{navigator.clipboard.writeText(tn.text).catch(()=>{})})}else navigator.clipboard.writeText(tn.text).catch(()=>{})}}return}return}if((h.metaKey||h.ctrlKey)&&h.key.toLowerCase()==="k"&&!h.isComposing){h.preventDefault(),De();return}const C=h.target;if(C&&C.classList.contains("image-block-caption")||C&&C.closest(".table-cell-inner"))return;const R=u.getState().selection;R.kind==="text"&&Ht(R)||mn();const H=u.getState().selection;if(H.kind==="text"&&Ht(H)&&!h.isComposing){const Ie=h.key,Ct=Ie.length===1&&!h.ctrlKey&&!h.metaKey&&!h.altKey;if(Ct||Ie==="Enter"||Ie==="Tab"){if(h.preventDefault(),(Be=(be=u.commands).backspace)==null||Be.call(be),Ct){const Ze=u.getState().selection;if(Ze.kind==="caret"){const at=u.getState().doc.blocks.get(Ze.blockId);if(at){const[Bt,Xt]=Ft(at.content,Ze.offset),cn=[...Bt,{type:"text",text:Ie},...Xt];(pt=(Re=u.commands).setText)==null||pt.call(Re,{id:Ze.blockId,content:cn,selectionAfter:rt(Ze.blockId,Ze.offset+1)})}}}return}if((h.ctrlKey||h.metaKey)&&(Ie==="c"||Ie==="C"||Ie==="x"||Ie==="X")){const Ze=zt(H);if(Ze){h.preventDefault();const at=window.ClipboardItem;if(at){const Bt=new at({"text/plain":new Blob([Ze.text],{type:"text/plain"}),"text/html":new Blob([Ze.html],{type:"text/html"})});navigator.clipboard.write([Bt]).catch(()=>{navigator.clipboard.writeText(Ze.text).catch(()=>{})})}else navigator.clipboard.writeText(Ze.text).catch(()=>{});(Ie==="x"||Ie==="X")&&((je=(We=u.commands).backspace)==null||je.call(We))}return}if(Ie==="ArrowLeft"||Ie==="ArrowUp"||Ie==="ArrowRight"||Ie==="ArrowDown"){h.preventDefault();const Ze=_n(u.getState().doc),at=Ze.indexOf(H.anchor.blockId),Bt=Ze.indexOf(H.focus.blockId),[Xt,cn]=at<=Bt?[H.anchor,H.focus]:[H.focus,H.anchor],tn=Ie==="ArrowLeft"||Ie==="ArrowUp"?Xt:cn;Se.value=[],(st=(He=u.commands).setSelection)==null||st.call(He,{selection:rt(tn.blockId,tn.offset)});return}}if((h.key==="ArrowUp"||h.key==="ArrowDown")&&!h.shiftKey&&!h.isComposing){const Ie=u.getState().selection;if(Ie.kind==="caret"||Ie.kind==="text"){const Ct=Ie.kind==="caret"?Ie.blockId:Ie.focus.blockId,Ze=Ie.kind==="caret"?Ie.offset:Ie.focus.offset,at=u.getState().doc.blocks.get(Ct);if(at&&u.registries.schema.get(at.type).isolating){const Xt=Me(at.content),cn=Xt.slice(0,Ze),tn=Xt.slice(Ze),En=cn.lastIndexOf(`
|
|
21
|
+
`)+1,Oe=tn.indexOf(`
|
|
22
|
+
`),ot=Oe===-1?Xt.length:Ze+Oe,Rt=En===0,Lt=ot===Xt.length;if(h.key==="ArrowUp"&&!Rt||h.key==="ArrowDown"&&!Lt)return}}}if(Ca(u,h)){h.preventDefault();return}if(h.key==="Enter"&&!h.shiftKey&&!h.isComposing){const Ie=u.getState().selection;if(Ie.kind==="caret"||Ie.kind==="text"){const Ct=Ie.kind==="caret"?Ie.blockId:Ie.focus.blockId,Ze=Ie.kind==="caret"?Ie.offset:Ie.focus.offset,at=u.getState().doc.blocks.get(Ct);at&&u.registries.schema.get(at.type).isolating&&(h.preventDefault(),yn(Ct,Ze))}}}function yn(h,C){const R=u.getState().doc.blocks.get(h);if(!R)return;const[H,Z]=Ft(R.content,C),Y=[...H,{type:"text",text:`
|
|
23
|
+
`},...Z],oe=Me(Y),re=pe.value,X=re?Ro(re,h):null,be=window.getSelection();if(X&&be&&be.rangeCount>0){const Re=be.getRangeAt(0);if(X.contains(Re.commonAncestorContainer)){Re.collapsed||Re.deleteContents();const pt=document.createTextNode(`
|
|
24
|
+
`);if(Re.insertNode(pt),Re.setStartAfter(pt),Re.collapse(!0),be.removeAllRanges(),be.addRange(Re),oe.endsWith(`
|
|
25
|
+
`)){const je=X.lastChild;je&&je.nodeType===Node.ELEMENT_NODE&&je.tagName==="BR"&&X.removeChild(je),X.appendChild(document.createElement("br"))}ne=!0}else X.textContent=oe}else X&&(X.textContent=oe);const Be={steps:[{op:"setText",id:h,content:Y}],selectionAfter:rt(h,C+1),meta:{source:"input",addToHistory:!0}};u.dispatch(Be)}const lt=t.ref(null),gt=t.ref("after");let Zt="idle",xn=0,Mn=0,Ge=4,Le=null,Fe=null,Qe=0,qe=0,ft=null,Nt=null,It=null,Vt=null;function Ut(){Vt!==null&&(clearTimeout(Vt),Vt=null),It=null}function sn(){var h;ft&&(ft.classList.remove("block-being-dragged"),ft=null),Fe&&(Fe.remove(),Fe=null),Nt!==null&&((h=ht())==null||h.setBlockHandleDragging(Nt,!1)),Nt=null,Le=null,Zt="idle",Pe.value=null,lt.value=null,gt.value="after",Ut()}function Nn(){document.removeEventListener("mousemove",g,!0),document.removeEventListener("mouseup",O,!0),document.removeEventListener("selectstart",L,!0)}function ro(h,C,R,H){b.value&&(Zt!=="idle"&&(Nn(),sn()),Zt="pending",Le=h,xn=C,Mn=R,Ge=H.thresholdPx,document.addEventListener("selectstart",L,!0),document.addEventListener("mousemove",g,!0),document.addEventListener("mouseup",O,!0))}function Yn(h){}function L(h){h.preventDefault()}function g(h){if(Zt==="pending"){const He=h.clientX-xn,st=h.clientY-Mn;if(Math.sqrt(He*He+st*st)<=Ge)return;de()}if(Zt!=="active")return;try{const He=window.getSelection();He&&He.rangeCount>0&&He.removeAllRanges()}catch{}Fe&&(Fe.style.left=`${h.clientX+Qe}px`,Fe.style.top=`${h.clientY+qe}px`);const C=Nt;if(!C)return;const R=Array.from(document.querySelectorAll(".block-host"));if(R.length<=1){lt.value=null;return}const H=R[0].getBoundingClientRect(),Z=R[R.length-1].getBoundingClientRect();if(h.clientY<H.top+H.height/2){Ut(),lt.value=null,gt.value="first";return}if(h.clientY>Z.bottom-Z.height/2){Ut(),lt.value=null,gt.value="last";return}const Y=document.elementFromPoint(h.clientX,h.clientY);if(!Y){Ut(),lt.value=null;return}const oe=Y.closest(".block-host");if(!oe){Ut(),lt.value=null;return}const re=oe.dataset.blockId;if(!re||re===C){Ut(),lt.value=null;return}const X=oe.getBoundingClientRect(),be=X.height===0?0:(h.clientY-X.top)/X.height;let Be=!1;const Re=u.getState().doc,pt=Re.blocks.get(re);if(pt){const He=u.registries.schema.get(pt.type);if(He!=null&&He.nestable){let st=re;for(Be=!0;st!==null;){if(st===C){Be=!1;break}st=Ot(Re,st)}}}if(be>cg&&be<ag&&Be){lt.value=re;const He=be<.5;It!==re&&(Ut(),It=re,Vt=setTimeout(()=>{It===re&&(lt.value=re,gt.value="into")},sg)),gt.value!=="into"&&(gt.value=He?"before":"after")}else Ut(),lt.value=re,gt.value=be<.5?"before":"after"}function O(h){if(Nn(),Zt==="pending"){Zt="idle",Le=null;return}const C=Nt,R=lt.value,H=gt.value;sn(),C&&(H==="into"&&!R||!R&&H!=="first"&&H!=="last"||_e(C,R,H))}function de(){var be,Be;const h=Le;if(!h)return;const C=xn,R=Mn;try{const Re=window.getSelection();Re&&Re.removeAllRanges()}catch{}Ve&&(Ve=null,Tt&&(cancelAnimationFrame(Tt),Tt=0),wt=null,document.removeEventListener("mousemove",$e,!0),document.removeEventListener("mouseup",Xe,!0),document.removeEventListener("selectstart",At,!0),Se.value=[]),Pt(null);const H=document.querySelector(`.block-host[data-block-id="${h}"]`);if(!H){Nn(),Zt="idle",Le=null;return}H.classList.add("block-being-dragged"),ft=H;const Z=H.querySelector(".block-host-content");if(!Z){H.classList.remove("block-being-dragged"),ft=null,Nn(),Zt="idle",Le=null;return}const Y=Z.getBoundingClientRect(),oe=((be=Z.firstElementChild)==null?void 0:be.getBoundingClientRect())??Y;Qe=oe.left-C,qe=oe.top-R;const re=document.createElement("div");re.className="drag-ghost";const X=Z.firstElementChild;X&&re.appendChild(X.cloneNode(!0)),re.style.width=`${oe.width}px`,re.style.left=`${C+Qe}px`,re.style.top=`${R+qe}px`,document.body.appendChild(re),Fe=re,Pe.value=h,Nt=h,lt.value=null,gt.value="after",(Be=ht())==null||Be.setBlockHandleDragging(h,!0),Zt="active"}function _e(h,C,R){var Re,pt,We;Pe.value=null;const H=u.getState().doc;if(!H.blocks.get(h))return;if(C){let je=C;for(;je!==null;){if(je===h)return;je=Ot(H,je)}}const Y=Ot(H,h),oe=ln(H,h);if(oe===-1)return;let re=null,X;if(R==="first")re=null,X=0;else if(R==="last")re=null,X=H.root.length;else if(R==="into"&&C){const je=H.blocks.get(C);if(!je)return;const He=u.registries.schema.get(je.type);if(!(He!=null&&He.nestable))return;let st=C;for(;st!==null;){if(st===h)return;st=Ot(H,st)}re=C,X=0}else if((R==="before"||R==="after")&&C){const je=Ot(H,C),He=ln(H,C);if(He===-1)return;re=je,X=R==="before"?He:He+1}else return;Y===re&&oe<X&&X--,X=Math.max(0,X);const Be=re===null?H.root:(Re=H.blocks.get(re))==null?void 0:Re.children;Be&&(X=Math.min(X,Be.length)),(We=(pt=u.commands).moveBlock)==null||We.call(pt,{id:h,toParent:re,toIndex:X})}const Ae=t.ref(!1);function Ne(h){const C=[];if(!h||!h.types||!Array.from(h.types).includes("Files"))return C;const R=new Set;if(h.items&&h.items.length>0)for(let H=0;H<h.items.length;H++){const Z=h.items[H];if(Z.kind!=="file")continue;const Y=Z.getAsFile();if(!Y||!Y.type.startsWith("image/"))continue;const oe=`${Y.name||""}:${Y.size}:${Y.type}`;R.has(oe)||(R.add(oe),C.push(Y))}if(h.files&&h.files.length>0)for(let H=0;H<h.files.length;H++){const Z=h.files[H];if(!Z.type.startsWith("image/"))continue;const Y=`${Z.name||""}:${Z.size}:${Z.type}`;R.has(Y)||(R.add(Y),C.push(Z))}return C}function we(h){if(Pe.value)return;const C=h.dataTransfer;if(!C||Ne(C).length===0)return;Ae.value||(Ae.value=!0);const H=Array.from(document.querySelectorAll(".block-host"));if(H.length===0){lt.value=null,gt.value="last";return}const Z=H[0].getBoundingClientRect(),Y=H[H.length-1].getBoundingClientRect(),oe=h.clientY;if(oe<Z.top+Z.height/2){lt.value=null,gt.value="first";return}if(oe>Y.bottom-Y.height/2){lt.value=null,gt.value="last";return}const re=document.elementFromPoint(h.clientX,h.clientY);if(!re){lt.value=null,gt.value="last";return}const X=re.closest(".block-host");if(!X){lt.value=null,gt.value="last";return}const be=X.getBoundingClientRect(),Be=X.dataset.blockId;if(!Be){lt.value=null,gt.value="last";return}lt.value=Be,gt.value=oe<be.top+be.height/2?"before":"after"}function y(h){const C=h.relatedTarget,R=pe.value;R&&C&&R.contains(C)||Ae.value&&(Ae.value=!1,lt.value=null,gt.value="after")}async function _(h){if(Pe.value)return;const C=h.dataTransfer;if(!C)return;const R=Ne(C);if(R.length===0)return;const H=lt.value,Z=gt.value;Ae.value=!1,lt.value=null,gt.value="after";let Y=H,oe=Z==="before"?"before":"after";const re=u.getState().doc;Z==="first"?(Y=re.root[0]??null,oe="before"):Z==="last"&&(Y=re.root[re.root.length-1]??null,oe="after");let X=Y;for(let be=0;be<R.length;be++){const Be=R[be],Re=await U(Be,{relativeToBlockId:X,position:be===0?oe:"after",convertIfEmpty:be===0});Re&&(X=Re)}}function T(h,C){ie(),B(),A.visible=!0,A.anchorEl=C,A.blockId=h}function B(){A.visible=!1,A.anchorEl=null}function W(h,C){var X,be;if(!b.value)return;B(),ie();const R=u.getState().doc.blocks.get(h);if(!R)return;const H=u.registries.schema.get(R.type);if((H==null?void 0:H.content)==="text"&&Me(R.content).length===0){x.visible=!0,x.anchorEl=C,x.blockId=h,x.query="",x.mode="slash",x.sourceBlockId=void 0;return}(be=(X=u.commands).insertBlock)==null||be.call(X,{type:u.registries.defaultBlockType,after:h,content:[]});const oe=u.getState().selection,re=oe.kind==="caret"?oe.blockId:h;x.visible=!0,x.anchorEl=C,x.blockId=re,x.query="",x.mode="insert",x.sourceBlockId=h}function ee(h,C,R){b.value&&(B(),x.visible=!0,x.anchorEl=h,x.blockId=C,x.query=R,x.mode="slash",x.sourceBlockId=void 0)}function ce(h,C){if(!x.visible)return;if(h!==x.blockId){ie();return}const R=C.match(/\/([^/]*)$/);if(!R){ie();return}x.query=R[1]??""}function ie(){x.visible=!1,x.anchorEl=null,x.query="",x.sourceBlockId=void 0}t.watch(()=>k.visible,h=>{h&&(x.visible||ie(),A.visible||B())});function Ee(h,C){var Y,oe,re,X;const R=x.blockId,H=ke(R),Z=Te(H);u.history.beginGroup();try{H!==Z&&((oe=(Y=u.commands).setText)==null||oe.call(Y,{id:R,content:Un(Z)}));const be=u.registries.slash.all.find(Be=>Be.id===h.id);if(be){const Be=typeof be.args=="function"?be.args(null):be.args,Re=Be&&typeof Be=="object"?{...Be}:{};Re.id==="__currentBlock__"&&(Re.id=R),Re.after==="__currentBlock__"&&(Re.after=R);const pt=u.commands[be.command];pt==null||pt(Re),(X=(re=u.commands).setSelection)==null||X.call(re,{selection:{kind:"caret",blockId:R,offset:0}}),h.id==="image"&&t.nextTick(()=>{const We=document.createElement("input");We.type="file",We.accept="image/*",We.multiple=!1,We.addEventListener("change",()=>{var He;const je=(He=We.files)==null?void 0:He[0];je&&U(je,{relativeToBlockId:R,position:"replace",convertIfEmpty:!0})}),We.click()})}}finally{u.history.endGroup()}ie()}function ke(h){const C=pe.value;if(!C)return"";const R=C.querySelector(`.block-content[data-block-id="${h}"]`);return(R==null?void 0:R.textContent)??""}function Te(h){const C=h.lastIndexOf("/");return C<0?h:h.slice(0,C)}function xe(){var We,je,He,st,Ie;const h=pe.value;if(h){const Ct=window.getSelection();let Ze=null;if(Ct&&Ct.rangeCount>0){const at=Ct.focusNode,Bt=(at==null?void 0:at.nodeType)===1?at.closest(".block-content"):(We=at==null?void 0:at.parentElement)==null?void 0:We.closest(".block-content");if(Bt&&h.contains(Bt)){const Xt=Bt.getAttribute("data-block-id");Xt&&(Ze=Xt)}}if(Ze!==null&&nt.value!==null&&Ze!==nt.value){const at=u.getState().doc.blocks.get(nt.value);at&&Mt.has(at.type)&&(Ze=null)}Ze!==null&&Pt(Ze)}if(!b.value){k.visible=!1,k.selectionRect=null,k.blockId=null,k.blockType=null,k.blockAttrs={};return}const C=pe.value;if(!C)return;const R=u.getState().selection;if(R.kind==="text"&&Ht(R)&&!Ve)return;if(Ao(R)&&R.blockIds.length>0){const Ct=window.getSelection();if(Ct&&Ct.rangeCount>0&&Ct.getRangeAt(0).collapsed){const Ze=fi(C,u.getState().doc);Ze&&Ze.kind==="caret"&&(J=!0,(He=(je=u.commands).setSelection)==null||He.call(je,{selection:Ze}),J=!1)}}const H=window.getSelection();if(!H||H.rangeCount===0){k.visible=!1,k.selectionRect=null,k.blockId=null,k.blockType=null,k.blockAttrs={};return}const Z=H.getRangeAt(0);if(Z.collapsed){k.visible=!1,k.selectionRect=null,k.blockId=null;return}if(!C.contains(Z.commonAncestorContainer)){k.visible=!1,k.selectionRect=null,k.blockId=null;return}if(Dt)return;const Y=H.anchorNode;if((Y==null?void 0:Y.nodeType)===1?Y.closest(".table-cell-inner"):(st=Y==null?void 0:Y.parentElement)==null?void 0:st.closest(".table-cell-inner")){k.visible=!1,k.selectionRect=null,k.blockId=null,k.blockType=null,k.blockAttrs={};return}const re=(Y==null?void 0:Y.nodeType)===1?Y.closest(".block-content"):(Ie=Y==null?void 0:Y.parentElement)==null?void 0:Ie.closest(".block-content");if(!re){k.visible=!1,k.selectionRect=null,k.blockId=null;return}const X=re.getAttribute("data-block-id");if(!X){k.visible=!1,k.selectionRect=null,k.blockId=null;return}const Be=u.getState().doc.blocks.get(X),Re=Z.getBoundingClientRect(),pt=Re.width===0&&Re.height===0?re.getBoundingClientRect():Re;k.visible=!0,k.selectionRect=pt,k.blockId=X,k.blockType=(Be==null?void 0:Be.type)??null,k.blockAttrs=(Be==null?void 0:Be.attrs)??{}}function Ke(){const h=u.getState().selection;if(h.kind==="text"&&Ht(h)){if(he(),k.visible){const Z=pe.value;if(Z){const Y=Pr(Z,u.getState().doc,h);Y.length>0&&(k.selectionRect=tt(Y))}}return}if(!k.visible)return;const C=window.getSelection();if(!C||C.rangeCount===0)return;const R=C.getRangeAt(0);if(R.collapsed)return;const H=R.getBoundingClientRect();H.width===0&&H.height===0||(k.selectionRect=H)}function tt(h){if(h.length===0)return new DOMRect(0,0,0,0);let C=1/0,R=1/0,H=-1/0,Z=-1/0;for(const Y of h)C=Math.min(C,Y.left),R=Math.min(R,Y.top),H=Math.max(H,Y.right),Z=Math.max(Z,Y.bottom);return new DOMRect(C,R,H-C,Z-R)}function ct(h){if(!b.value)return;const C=pe.value;if(!C)return;const R=Pr(C,u.getState().doc,h);if(R.length===0)return;const H=tt(R),Y=u.getState().doc.blocks.get(h.focus.blockId);k.visible=!0,k.selectionRect=H,k.blockId=h.focus.blockId,k.blockType=(Y==null?void 0:Y.type)??null,k.blockAttrs=(Y==null?void 0:Y.attrs)??{}}function Gt(h){var Z,Y;const C=pe.value;if(!C||S.value||!C.contains(h.target))return;const R=h.target;if(R&&R.closest(".block-handle"))return;Dt=!0,k.visible=!1;const H=u.getState().selection;if(H.kind==="text"&&Ht(H)&&(Se.value=[]),h.button===0&&!h.shiftKey){const oe=h.target;if(oe&&(oe.closest(".table-cell-inner, .block-table-container, .block-table-of-contents")||oe.closest(".block-focus-root")&&!oe.closest('[contenteditable="true"]'))){Kt=!0;try{const X=window.getSelection();X&&X.removeAllRanges()}catch{}return}else Kt=!1;const re=Jo(h.clientX,h.clientY,C,u.getState().doc);re&&(H.kind==="text"&&Ht(H)&&(J=!0,(Y=(Z=u.commands).setSelection)==null||Y.call(Z,{selection:rt(re.blockId,re.offset)}),J=!1),Ve={start:{blockId:re.blockId,offset:re.offset},crossBlock:!1},document.addEventListener("mousemove",$e,!0),document.addEventListener("mouseup",Xe,!0))}}function jt(){if(!Dt)return;if(S.value){Dt=!1;return}if(Dt=!1,Kt){Kt=!1;return}const h=u.getState().selection;h.kind==="text"&&Ht(h)||xe()}let it=null,Ue=!1;function xt(h){if(!S.value)return;const C=pe.value;if(!C||!C.contains(h.target))return;const R=h.target;if(!R||!R.closest(".block-content")||R.closest(".block-handle, .mt-btn, .ht-btn, a[href]"))return;const Z=h.touches[0];Z&&(Ue=!1,it={longPressTimer:window.setTimeout(()=>{it&&mt(C,it.startTouch)},dg),startTouch:Z},document.addEventListener("touchmove",qt,{passive:!1,capture:!0}),document.addEventListener("touchend",bt,!0),document.addEventListener("touchcancel",bt,!0))}function qt(h){var re,X;if(!it)return;Ue=!0;const C=pe.value;if(!C)return;if(!Ve){const be=h.touches[0];if(!be)return;const Be=be.clientX-it.startTouch.clientX,Re=be.clientY-it.startTouch.clientY;if(Math.hypot(Be,Re)>10){it.longPressTimer&&clearTimeout(it.longPressTimer),it=null;return}return}const R=h.touches[0];if(!R)return;const H=Jo(R.clientX,R.clientY,C,u.getState().doc);if(!H)return;const Z=Ve.start;if(H.blockId===Z.blockId){if(Ve.crossBlock){Ve.crossBlock=!1,Se.value=[],document.removeEventListener("selectstart",At,!0);const be=window.getSelection();be&&be.removeAllRanges()}return}if(h.preventDefault(),!Ve.crossBlock){Ve.crossBlock=!0,document.addEventListener("selectstart",At,!0);const be=window.getSelection();be&&be.removeAllRanges()}const Y={blockId:H.blockId,offset:H.offset},oe=Ar(Z,Y);J=!0,(X=(re=u.commands).setSelection)==null||X.call(re,{selection:oe}),J=!1,he()}function mt(h,C){const R=Jo(C.clientX,C.clientY,h,u.getState().doc);if(!R){it=null;return}k.visible=!1;const H=u.getState().selection;H.kind==="text"&&Ht(H)&&(Se.value=[]),Ve={start:{blockId:R.blockId,offset:R.offset},crossBlock:!1}}function bt(){if(it&&(it.longPressTimer&&clearTimeout(it.longPressTimer),it=null),!Ve){document.removeEventListener("touchmove",qt,!0),document.removeEventListener("touchend",bt,!0),document.removeEventListener("touchcancel",bt,!0);return}if(Ve=null,document.removeEventListener("touchmove",qt,!0),document.removeEventListener("touchend",bt,!0),document.removeEventListener("touchcancel",bt,!0),document.removeEventListener("selectstart",At,!0),!Ue)return;he();const h=u.getState().selection;h.kind==="text"&&Ht(h)&&ct(h)}function zt(h){const C=u.getState().doc,R=_n(C),H=R.indexOf(h.anchor.blockId),Z=R.indexOf(h.focus.blockId);if(H===-1||Z===-1)return null;const[Y,oe]=H<=Z?[h.anchor,h.focus]:[h.focus,h.anchor],re=R.indexOf(Y.blockId),X=R.indexOf(oe.blockId);if(re===-1||X===-1)return null;const be=[],Be=[];for(let Re=re;Re<=X;Re++){const pt=R[Re],We=C.blocks.get(pt);if(!We)continue;const je=Me(We.content).length;let He=0,st=je;Re===re&&(He=Math.min(Y.offset,je)),Re===X&&(st=Math.min(oe.offset,je)),He>st&&([He,st]=[st,He]);const[,Ie]=Ft(We.content,He),[Ct]=Ft(Ie,st-He);be.push(Me(Ct)),Be.push(Wn(Ct))}return{text:be.join(`
|
|
26
|
+
`),html:Be.join("<br>")}}function pn(h){var H,Z;const C=u.getState().selection;if(C.kind!=="text"||!Ht(C))return;const R=zt(C);R&&(h.preventDefault(),(H=h.clipboardData)==null||H.setData("text/plain",R.text),(Z=h.clipboardData)==null||Z.setData("text/html",R.html))}function Yt(h){var H,Z,Y,oe;if(!b.value){h.preventDefault();return}const C=u.getState().selection;if(C.kind!=="text"||!Ht(C))return;const R=zt(C);R&&(h.preventDefault(),(H=h.clipboardData)==null||H.setData("text/plain",R.text),(Z=h.clipboardData)==null||Z.setData("text/html",R.html),(oe=(Y=u.commands).backspace)==null||oe.call(Y))}function wn(h){if(!b.value)return;const C=h.detail;if(!(C!=null&&C.blockId)||!(C!=null&&C.anchor))return;const R=C.blockId,H=u.getState().doc,Z=H.blocks.get(R),Y=Bn(H,R),re=typeof(Z==null?void 0:Z.attrs).startNumber=="number"&&!!Y&&Y.type==="orderedList",X=ns(H,R),be=X!==1;ie(),B(),An(),te(),k.visible=!1,E.visible=!0,E.blockId=R,E.anchor=C.anchor,E.canContinue=re,E.canStartNew=be,E.currentNumber=X}function vt(){E.visible=!1,E.anchor=null,E.blockId=null}function Pn(){var h,C;E.blockId&&((C=(h=u.commands).setStartNumber)==null||C.call(h,{id:E.blockId,startNumber:null}),vt())}function Sn(){var h,C;E.blockId&&((C=(h=u.commands).setStartNumber)==null||C.call(h,{id:E.blockId,startNumber:1}),vt())}function $t(h){if(!E.blockId)return;const C=E.anchor,R=E.blockId;vt(),C&&(D.visible=!0,D.initialValue=h,D.anchor=C,D.blockId=R)}function An(){D.visible=!1,D.anchor=null,D.blockId=null}function vl(h){var C,R;if(!D.blockId){An();return}(R=(C=u.commands).setStartNumber)==null||R.call(C,{id:D.blockId,startNumber:h}),An(),vt()}function wr(h){if(!b.value)return;const C=h.detail;if(!(C!=null&&C.blockId)||!(C!=null&&C.anchor))return;const R=C.blockId,Z=u.getState().doc.blocks.get(R);if(!Z)return;const Y=Z.attrs.language??"plain";ie(),B(),An(),vt(),te(),k.visible=!1,P.visible=!0,P.blockId=R,P.anchor=C.anchor,P.initialValue=Y}function Hn(){P.visible=!1,P.anchor=null,P.blockId=null}function Cl(h){var C,R;if(!P.blockId){Hn();return}(R=(C=u.commands).setAttrs)==null||R.call(C,{id:P.blockId,attrs:{language:h}}),Hn()}function Eo(h){var re,X,be,Be,Re;const C=h.target,R=document.querySelector(".ordered-list-menu"),H=document.querySelector(".number-picker"),Z=document.querySelector(".code-lang-picker"),Y=document.querySelector(".link-popover");if(R&&R.contains(C)||H&&H.contains(C)||Z&&Z.contains(C)||Y&&Y.contains(C)||C instanceof Node&&((re=C.closest)!=null&&re.call(C,".ol-marker"))||C instanceof Node&&((X=C.closest)!=null&&X.call(C,".block-code-lang"))||C instanceof Node&&((be=C.closest)!=null&&be.call(C,"a[href]")))return;vt(),An(),Hn(),te();const oe=u.getState().selection;if(oe.kind==="blocks"&&oe.blockIds.length>0){const pt=pe.value;if(pt&&pt.contains(C)){const We=C.nodeType===1?C:C.parentElement??null;if(We&&(We.closest("[contenteditable]")||We.closest(".block-image-wrapper, .block-image-container, .block-table-container, .block-code-wrapper, .block-divider, .block-todo-checkbox, .block-ordered-list-wrapper, .block-video, .block-file, .block-embed, .block-callout")))return}(Re=(Be=u.commands).clearSelection)==null||Re.call(Be)}}function vo(h){const C=h.target;C instanceof Element&&(C.closest(".code-lang-picker")||C.closest(".ordered-list-menu")||C.closest(".number-picker")||C.closest(".link-popover"))||(E.visible&&vt(),D.visible&&An(),P.visible&&Hn(),K.visible&&te())}function Er(h){var R,H;if(h.key!=="Escape")return;const C=u.getState().selection;C.kind==="blocks"&&C.blockIds.length>0&&(h.preventDefault(),(H=(R=u.commands).clearSelection)==null||H.call(R))}function vr(h){const C=h.target;if(!C||C.closest(".block-handle")||C.closest('[contenteditable="true"]'))return;const R=C.closest(".block-focus-root");if(!R)return;const H=R.closest(".block-host");if(!H)return;const Z=pe.value;if(!Z||!Z.contains(H))return;const Y=H.getAttribute("data-block-id");Y&&Pt(Y,{clearNativeSelection:!0})}function Cr(h){h.target===pe.value&&Pt(null,{clearNativeSelection:!0})}return t.onMounted(()=>{t.nextTick(()=>{const h=pe.value;if(!h)return;const C=u.getState().selection;hi(h,C),h.addEventListener("ordered-list-marker-click",wn),h.addEventListener("code-lang-click",wr),h.addEventListener("click",vr),h.addEventListener("click",Cr)}),document.addEventListener("selectionchange",xe),document.addEventListener("mousedown",Gt,!0),document.addEventListener("mouseup",jt,!0),document.addEventListener("mousedown",Eo,!0),document.addEventListener("touchstart",Eo,!0),window.addEventListener("scroll",Ke,!0),window.addEventListener("resize",Ke),window.addEventListener("scroll",vo,!0),document.addEventListener("touchmove",vo,{passive:!0,capture:!0}),document.addEventListener("keydown",Er,!0),w==null||w.addEventListener("change",M),document.addEventListener("touchstart",xt,{passive:!1,capture:!0})}),t.onBeforeUnmount(()=>{const h=pe.value;h&&(h.removeEventListener("ordered-list-marker-click",wn),h.removeEventListener("code-lang-click",wr),h.removeEventListener("click",vr),h.removeEventListener("click",Cr)),document.removeEventListener("selectionchange",xe),document.removeEventListener("mousedown",Gt,!0),document.removeEventListener("mouseup",jt,!0),document.removeEventListener("mousedown",Eo,!0),document.removeEventListener("touchstart",Eo,!0),window.removeEventListener("scroll",Ke,!0),window.removeEventListener("resize",Ke),window.removeEventListener("scroll",vo,!0),document.removeEventListener("touchmove",vo,!0),document.removeEventListener("keydown",Er,!0),w==null||w.removeEventListener("change",M),document.removeEventListener("touchstart",xt,!0),document.removeEventListener("touchmove",qt,!0),document.removeEventListener("touchend",bt,!0),document.removeEventListener("touchcancel",bt,!0),ae(),u.destroy(),Q(),fd(),md()}),n({editor:u}),(h,C)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"rootEl",ref:pe,class:t.normalizeClass(["block-editor",[f.value,{"block-editor-dragging":Pe.value!==null,"is-mobile":S.value}]]),contenteditable:!1,onKeydown:Wt,onCopy:pn,onCut:Yt,onDragover:t.withModifiers(we,["prevent"]),onDragleave:y,onDrop:t.withModifiers(_,["prevent"])},[t.createVNode(Vi,{ref_key:"blockListRef",ref:kt,items:q.value,"blocks-map":F.value.doc.blocks,"first-block-placeholder":p.value,"hovered-block-id":dt.value,"focused-block-id":nt.value,"has-text-selection":k.visible,"dragging-block-id":Pe.value,"drop-target-block-id":lt.value,"drop-position":gt.value,"menu-open-block-id":A.visible?A.blockId:null,onOpenSettingsMenu:T,onOpenPlusMenu:W,onSlashTrigger:ee,onInputChanged:ce,onHoverChange:Et,onGripPointerDown:ro,onGripPointerUp:Yn,onLinkClick:Ye,onFocusIn:Ce},null,8,["items","blocks-map","first-block-placeholder","hovered-block-id","focused-block-id","has-text-selection","dragging-block-id","drop-target-block-id","drop-position","menu-open-block-id"]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[Se.value.length>0?(t.openBlock(),t.createElementBlock("div",ig,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Se.value,(R,H)=>(t.openBlock(),t.createElementBlock("div",{key:H,class:"cross-block-selection-rect",style:t.normalizeStyle({left:R.left+"px",top:R.top+"px",width:R.width+"px",height:R.height+"px"})},null,4))),128))])):t.createCommentVNode("",!0)])),t.createVNode(zd,{ref_key:"plusMenuRef",ref:z,visible:x.visible,"anchor-el":x.anchorEl,"block-id":x.blockId,query:x.query,"root-el":pe.value,mode:x.mode,onClose:ie,onCommit:Ee},null,8,["visible","anchor-el","block-id","query","root-el","mode"]),t.createVNode(Xu,{ref_key:"settingsMenuRef",ref:v,visible:A.visible,"anchor-el":A.anchorEl,"block-id":A.blockId,"root-el":pe.value,onClose:B},null,8,["visible","anchor-el","block-id","root-el"]),S.value?(t.openBlock(),t.createBlock(em,{key:1,"root-el":pe.value,"focus-block-id":nt.value,"hover-visible":k.visible,"hover-selection-rect":k.selectionRect,"hover-block-id":k.blockId,"hover-block-type":k.blockType,"hover-block-attrs":k.blockAttrs,onOpenPlusMenu:W,onOpenSettingsMenu:T,onLinkClick:ze,onHoverClose:C[1]||(C[1]=R=>k.visible=!1)},null,8,["root-el","focus-block-id","hover-visible","hover-selection-rect","hover-block-id","hover-block-type","hover-block-attrs"])):(t.openBlock(),t.createBlock(ir,{key:0,visible:k.visible,"selection-rect":k.selectionRect,"block-id":k.blockId,"block-type":k.blockType,"block-attrs":k.blockAttrs,"root-el":pe.value,onClose:C[0]||(C[0]=R=>k.visible=!1),onLinkClick:ze},null,8,["visible","selection-rect","block-id","block-type","block-attrs","root-el"])),t.createVNode(Qi,{visible:E.visible,"block-id":E.blockId,anchor:E.anchor,"root-el":pe.value,"can-continue":E.canContinue,"can-start-new":E.canStartNew,"current-number":E.currentNumber,onContinue:Pn,onStartNew:Sn,onModify:$t,onClose:vt},null,8,["visible","block-id","anchor","root-el","can-continue","can-start-new","current-number"]),t.createVNode(Ji,{visible:D.visible,"initial-value":D.initialValue,anchor:D.anchor,"root-el":pe.value,onConfirm:vl,onClose:An},null,8,["visible","initial-value","anchor","root-el"]),t.createVNode(wm,{visible:P.visible,"initial-value":P.initialValue,anchor:P.anchor,"root-el":pe.value,onConfirm:Cl,onClose:Hn},null,8,["visible","initial-value","anchor","root-el"]),t.createVNode(ts,{visible:K.visible,"anchor-rect":K.anchorRect,"block-id":K.blockId,from:K.from,to:K.to,href:K.href,text:K.text,"initial-mode":K.initialMode,"show-text-input":K.showTextInput,readonly:!b.value,onClose:te},null,8,["visible","anchor-rect","block-id","from","to","href","text","initial-mode","show-text-input","readonly"])],34))}});le.BlockContent=Dn,le.BlockEditor=ug,le.BlockHost=Hi,le.BlockList=Vi,le.BuiltinExtensions=ec,le.CommandRegistry=Fl,le.DeserializerRegistry=ti,le.DividerExtension=Qs,le.Editor=li,le.HeadingExtension=rs,le.HistoryExtension=is,le.HistoryManager=ri,le.ImageExtension=Ys,le.InputRuleRegistry=Ql,le.KeymapExtension=ls,le.KeymapRegistry=jl,le.ParagraphExtension=os,le.SchemaRegistry=Ll,le.SerializerRegistry=ei,le.SlashCommandRegistry=Jl,le.TableExtension=js,le.TableOfContentsExtension=Js,le.TransactionBuilder=Vl,le.applySteps=Yo,le.applyTransaction=Hl,le.asBlockId=yc,le.blockAfter=ao,le.blockBefore=Bn,le.blocksSelection=Sc,le.buildRegistries=oi,le.canContain=Al,le.caretSelection=rt,le.coerceAttrs=Sl,le.collectIndentSyncPatches=Pl,le.createBlockId=so,le.createPrimitiveCommands=Yl,le.createState=Sr,le.createTransaction=et,le.defaultAttrs=zn,le.defineSchema=Tr,le.depthOf=In,le.docFromData=xr,le.docToData=Dl,le.editorKey=Dr,le.extensionBlockType=ra,le.flatten=_n,le.flattenExtensions=ni,le.focusOffset=Ac,le.getBlock=St,le.hasText=Il,le.indexOf=ln,le.inlineFromString=Un,le.inlineText=Me,le.invertSteps=Ul,le.isBlockId=io,le.isBlocks=Ao,le.isCaret=uo,le.isCollapsed=Ir,le.isEmpty=Rl,le.isIsolating=Bl,le.isText=Fn,le.isTextRun=bc,le.keyMatches=Xl,le.keyNameFromEvent=Zl,le.lastDescendant=$l,le.nextSibling=vc,le.normalizeLocale=Oi,le.normalizeTheme=Di,le.orderedAnchors=Ic,le.parentOf=Ot,le.prevSibling=Nr,le.primaryBlock=zl,le.requireBlock=rn,le.siblingList=co,le.splitInline=Ft,le.textSelection=Ar,le.useEditor=dn,le.useI18n=Qt,le.withAttrs=_c,le.withContent=Cc,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|