@henryx/pagely 0.1.0 → 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.
@@ -101,46 +101,8 @@ declare const _default: import('vue').DefineComponent<NodeViewProps, {}, {}, {},
101
101
  };
102
102
  }) | null;
103
103
  inlineWrap: HTMLDivElement;
104
- inlineRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<Record<string, any>>>, {
105
- getData: () => unknown;
106
- setData: (data: unknown) => void;
107
- fitView?: () => void;
108
- }, unknown, import('vue').ComputedOptions, import('vue').MethodOptions, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
109
- [x: string]: any;
110
- }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
111
- P: {};
112
- B: {};
113
- D: {};
114
- C: {};
115
- M: {};
116
- Defaults: {};
117
- }, Readonly<import('vue').ExtractPropTypes<Record<string, any>>>, {
118
- getData: () => unknown;
119
- setData: (data: unknown) => void;
120
- fitView?: () => void;
121
- }, {}, import('vue').ComputedOptions, import('vue').MethodOptions, {
122
- [x: string]: any;
123
- }> | null;
104
+ inlineRef: any;
124
105
  fullscreenWrap: HTMLDivElement;
125
- fullscreenRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<Record<string, any>>>, {
126
- getData: () => unknown;
127
- setData: (data: unknown) => void;
128
- fitView?: () => void;
129
- }, unknown, import('vue').ComputedOptions, import('vue').MethodOptions, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
130
- [x: string]: any;
131
- }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
132
- P: {};
133
- B: {};
134
- D: {};
135
- C: {};
136
- M: {};
137
- Defaults: {};
138
- }, Readonly<import('vue').ExtractPropTypes<Record<string, any>>>, {
139
- getData: () => unknown;
140
- setData: (data: unknown) => void;
141
- fitView?: () => void;
142
- }, {}, import('vue').ComputedOptions, import('vue').MethodOptions, {
143
- [x: string]: any;
144
- }> | null;
106
+ fullscreenRef: any;
145
107
  }, any>;
146
108
  export default _default;
package/dist/pagely.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Pc=Object.create;var Wa=Object.defineProperty;var Hc=Object.getOwnPropertyDescriptor;var Vc=Object.getOwnPropertyNames;var Fc=Object.getPrototypeOf,$c=Object.prototype.hasOwnProperty;var qc=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Vc(e))!$c.call(r,o)&&o!==t&&Wa(r,o,{get:()=>e[o],enumerable:!(n=Hc(e,o))||n.enumerable});return r};var lt=(r,e,t)=>(t=r!=null?Pc(Fc(r)):{},qc(e||!r||!r.__esModule?Wa(t,"default",{value:r,enumerable:!0}):t,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),_e=require("@tiptap/vue-3"),L=require("lucide-vue-next"),Me=require("@tiptap/core"),Vn=require("@tiptap/pm/model"),Uc=require("markdown-it"),Wc=require("turndown"),_c=require("@tiptap/starter-kit"),Kr=require("@tiptap/extension-table"),Gc=require("@tiptap/extension-task-list"),Kc=require("@tiptap/extension-task-item"),Yc=require("@tiptap/extension-color"),Jc=require("@tiptap/extension-highlight"),Xc=require("@tiptap/extension-text-style"),mr=require("@tiptap/pm/state");require("@fontsource/jetbrains-mono/400.css");require("@fontsource/jetbrains-mono/500.css");const rt=require("@codemirror/view"),tr=require("@codemirror/state"),yn=require("@codemirror/commands"),_r=require("@codemirror/language"),_a=require("@codemirror/autocomplete"),Ni=require("@tiptap/extension-mathematics"),Ga=require("dot-flow-pad"),jc=require("mermaid-smart-editor"),Qc=require("mermaid"),gl=require("@tiptap/pm/tables"),no=new Set(["P","H1","H2","H3","H4","H5","H6","PRE"]),Zc=new Set(["BLOCKQUOTE"]);function Lt(r,e){switch(e){case"P":r.setParagraph();break;case"H1":r.setHeading({level:1});break;case"H2":r.setHeading({level:2});break;case"H3":r.setHeading({level:3});break;case"H4":r.setHeading({level:4});break;case"H5":r.setHeading({level:5});break;case"H6":r.setHeading({level:6});break;case"UL":r.toggleBulletList();break;case"OL":r.toggleOrderedList();break;case"LI_TASK":r.toggleTaskList();break;case"PRE":r.setCodeBlock();break;case"BLOCKQUOTE":r.toggleBlockquote();break}}function ed(r,e,t,n){if(e!==t){if(no.has(e)){Lt(r,e);return}if(Zc.has(e)){n(),Lt(r,e);return}n(),Lt(r,e)}}function td(r,e){ed(r,e,"BLOCKQUOTE",()=>r.toggleBlockquote())}function rd(r,e){if(e!=="PRE"){if(no.has(e)){Lt(r,e);return}r.unsetCodeBlock(),Lt(r,e)}}function Li(r,e,t,n){e.forEach((o,l)=>{const i=t+1+l;(o.type.name==="bulletList"||o.type.name==="orderedList")&&(r.setNodeMarkup(i,n,o.attrs),o.forEach((s,u)=>{s.type.name==="listItem"&&Li(r,s,i+1+u,n)}))})}function nd(r,e){if(no.has(e)){r.liftListItem("listItem"),e!=="P"&&Lt(r,e);return}if(e==="LI_TASK"){r.liftListItem("listItem"),r.toggleTaskList();return}const t=e==="UL"?"bulletList":"orderedList";r.command(({tr:n,state:o})=>{const{$from:l}=o.selection,i=o.schema.nodes[t];if(!i)return!1;let s=-1;for(let p=l.depth;p>=0;p-=1)if(l.node(p).type.name==="listItem"){s=p;break}if(s<1)return!1;const u=l.before(s),d=l.node(s),m=l.node(s-1),h=l.before(s-1);return(m.type.name==="bulletList"||m.type.name==="orderedList")&&n.setNodeMarkup(h,i,m.attrs),Li(n,d,u,i),!0})}function od(r,e){if(e!=="LI_TASK"){if(no.has(e)){r.liftListItem("taskItem"),e!=="P"&&Lt(r,e);return}r.toggleTaskList(),e!=="P"&&Lt(r,e)}}const ld={text:Lt,blockquote:td,pre:rd,listItem:nd,taskItem:od},Kl={P:{id:"P",label:"正文",icon:L.Type},H1:{id:"H1",label:"一级标题",icon:L.Heading1},H2:{id:"H2",label:"二级标题",icon:L.Heading2},H3:{id:"H3",label:"三级标题",icon:L.Heading3},H4:{id:"H4",label:"四级标题",icon:L.Heading4},H5:{id:"H5",label:"五级标题",icon:L.Heading5},H6:{id:"H6",label:"六级标题",icon:L.Heading6},UL:{id:"UL",label:"无序列表",icon:L.List},OL:{id:"OL",label:"有序列表",icon:L.ListOrdered},LI_TASK:{id:"LI_TASK",label:"任务列表",icon:L.SquareCheckBig},PRE:{id:"PRE",label:"代码块",icon:L.CodeXml},BLOCKQUOTE:{id:"BLOCKQUOTE",label:"引用",icon:L.Quote},CUT_BLOCK:{id:"CUT_BLOCK",label:"剪切",icon:L.Scissors,action:"op",op:"cutBlock"},COPY_BLOCK:{id:"COPY_BLOCK",label:"复制",icon:L.Copy,action:"op",op:"copyBlock"},DELETE_BLOCK:{id:"DELETE_BLOCK",label:"删除",icon:L.Trash2,danger:!0,action:"op",op:"deleteBlock"},COPY_CODE:{id:"COPY_CODE",label:"复制代码",icon:L.Copy,action:"op",op:"copyCode"},DELETE_CODE_BLOCK:{id:"DELETE_CODE_BLOCK",label:"删除代码块",icon:L.Trash2,danger:!0,action:"op",op:"deleteCodeBlock"},COPY_CANVAS_CODE:{id:"COPY_CANVAS_CODE",label:"复制画板代码",icon:L.FileCode,action:"op",op:"copyCanvasCode"},COPY_CANVAS_IMAGE:{id:"COPY_CANVAS_IMAGE",label:"复制图片",icon:L.Image,action:"op",op:"copyCanvasImage"},CUT_TABLE:{id:"CUT_TABLE",label:"剪切",icon:L.Scissors,action:"op",op:"cutTable"},COPY_TABLE:{id:"COPY_TABLE",label:"复制",icon:L.Copy,action:"op",op:"copyTable"},TOGGLE_TABLE_HEADER_ROW:{id:"TOGGLE_TABLE_HEADER_ROW",label:"标题行",icon:L.Rows3,action:"op",op:"toggleTableHeaderRow",toggle:!0},TOGGLE_TABLE_HEADER_COL:{id:"TOGGLE_TABLE_HEADER_COL",label:"标题列",icon:L.Columns3,action:"op",op:"toggleTableHeaderColumn",toggle:!0},DELETE_TABLE:{id:"DELETE_TABLE",label:"删除",icon:L.Trash2,danger:!0,action:"op",op:"deleteTable"},INDENT_INC:{id:"INDENT_INC",label:"增加缩进",icon:L.Indent,action:"indent",indentDir:"inc"},INDENT_DEC:{id:"INDENT_DEC",label:"减少缩进",icon:L.Outdent,action:"indent",indentDir:"dec"},SUBMENU_INDENT_LIST:{id:"SUBMENU_INDENT_LIST",label:"缩进",icon:L.Indent,children:["INDENT_DEC","INDENT_INC"]},COLOR:{id:"COLOR",label:"颜色",icon:L.Palette,panel:"color"},CANVAS:{id:"CANVAS",label:"画板",icon:L.Workflow,description:"在文档中轻松画出清晰好看的示意图、结构图、流程图"},MERMAID:{id:"MERMAID",label:"Mermaid 图表",icon:L.GitBranch,description:"用文本语法描述流程图、时序图、甘特图等"}},ad={CONVERT_TILES:{style:"tiles",items:["P","H1","H2","H3","H4","H5","H6","UL","OL","LI_TASK","PRE","BLOCKQUOTE"]},DRAW:{style:"list",label:"绘图",items:["CANVAS","MERMAID"]},OPS:{style:"list",items:["COPY_BLOCK","DELETE_BLOCK"]},CODE_OPS:{style:"list",items:["COPY_CODE","DELETE_CODE_BLOCK"]},TABLE_OPS:{style:"list",items:["CUT_TABLE","COPY_TABLE","TOGGLE_TABLE_HEADER_ROW","TOGGLE_TABLE_HEADER_COL","DELETE_TABLE"]},INDENT_LIST:{style:"list",items:["SUBMENU_INDENT_LIST"]},COLOR_SECTION:{style:"list",items:["COLOR"]},CANVAS_OPS:{style:"list",items:["CUT_BLOCK","COPY_CANVAS_CODE","COPY_CANVAS_IMAGE","DELETE_BLOCK"]},IMAGE_OPS:{style:"list",items:["CUT_BLOCK","COPY_BLOCK","DELETE_BLOCK"]},EMBED_VIEW_OPS:{style:"list",items:["CUT_BLOCK","DELETE_BLOCK"]}},Ka=r=>r.firstElementChild??r,id={TEXT_LIKE:{sections:["CONVERT_TILES","COLOR_SECTION"],convert:"text"},HEADING:{sections:["CONVERT_TILES","COLOR_SECTION"],convert:"text"},BLOCKQUOTE:{sections:["CONVERT_TILES","OPS"],convert:"blockquote",isWrapper:!0,getPMDomTarget:r=>r.firstElementChild??r},TASK_ITEM:{sections:["CONVERT_TILES","INDENT_LIST","COLOR_SECTION"],currentTypeId:"LI_TASK",getRectEl:r=>r.querySelector(":scope > div")??r.firstElementChild??r,getPMDomTarget:r=>r.querySelector(":scope > div")??r.firstElementChild??r,convert:"taskItem"},LI:{sections:["CONVERT_TILES","INDENT_LIST","COLOR_SECTION"],getCurrentTypeId:r=>{var e;return((e=r.parentElement)==null?void 0:e.tagName.toUpperCase())??"UL"},getRectEl:Ka,getPMDomTarget:Ka,convert:"listItem"},PRE:{sections:["CONVERT_TILES","CODE_OPS"],convert:"pre"},TABLE:{sections:["TABLE_OPS"]},TABLE_CELL:{sections:["OPS"]},MINIMAL:{sections:["OPS"]},MERMAID:{sections:["CODE_OPS"]},CANVAS:{sections:["CANVAS_OPS"]},IMAGE:{sections:["IMAGE_OPS"]},EMBED_VIEW:{sections:["EMBED_VIEW_OPS"]}},sd={P:"TEXT_LIKE",H1:"HEADING",H2:"HEADING",H3:"HEADING",H4:"HEADING",H5:"HEADING",H6:"HEADING",BLOCKQUOTE:"BLOCKQUOTE",TASK_ITEM:"TASK_ITEM",LI:"LI",PRE:"PRE",TABLE:"TABLE",TD:"TABLE_CELL",TH:"TABLE_CELL",HR:"MINIMAL",DOT_FLOW_PAD_BLOCK:"CANVAS",MERMAID_BLOCK:"MERMAID",IMG:"IMAGE",BLOCK_MATH:"MINIMAL",EMBED_VIEW:"EMBED_VIEW"},Ii={P:{label:"正文",icon:L.Type,pillVariant:"text"},H1:{label:"标题 1",icon:L.Heading1,pillVariant:"text"},H2:{label:"标题 2",icon:L.Heading2,pillVariant:"text"},H3:{label:"标题 3",icon:L.Heading3,pillVariant:"text"},H4:{label:"标题 4",icon:L.Heading4,pillVariant:"text"},H5:{label:"标题 5",icon:L.Heading5,pillVariant:"text"},H6:{label:"标题 6",icon:L.Heading6,pillVariant:"text"},PRE:{label:"代码块",icon:L.CodeXml,pillVariant:"text"},BLOCKQUOTE:{label:"引用",icon:L.Quote,pillVariant:"text"},TASK_ITEM:{label:"任务项",icon:L.SquareCheckBig,pillVariant:"text"},LI:{label:"列表项",icon:L.List,pillVariant:"text"},TABLE:{label:"表格",icon:L.Grid2x2,pillVariant:"table"},TD:{label:"单元格",icon:L.Grid2x2,pillVariant:"minimal"},TH:{label:"表头格",icon:L.Grid2x2,pillVariant:"minimal"},HR:{label:"分割线",icon:L.Minus,pillVariant:"minimal"},MERMAID_BLOCK:{label:"Mermaid 图表",icon:L.GitBranch,pillVariant:"minimal"},DOT_FLOW_PAD_BLOCK:{label:"画板",icon:L.Workflow,pillVariant:"minimal"},IMG:{label:"图片",icon:L.Image,pillVariant:"minimal"},BLOCK_MATH:{label:"公式",icon:L.Type,pillVariant:"minimal"},EMBED_VIEW:{label:"预览",icon:L.FileText,pillVariant:"text"}};function ud(r){return{label:r.label,style:r.style,items:r.items.map(e=>Kl[e])}}function zr(r){const e=r.toUpperCase(),t=Ii[e]??cd,n=id[sd[e]??"MINIMAL"];return{...t,sections:n.sections.map(o=>ud(ad[o])),getRectEl:n.getRectEl,getPMDomTarget:n.getPMDomTarget,applyConvert:n.convert?ld[n.convert]:void 0,currentTypeId:n.currentTypeId,getCurrentTypeId:n.getCurrentTypeId,isWrapper:n.isWrapper}}const cd={label:"块",icon:L.Type,pillVariant:"text"},ur=Object.fromEntries(Object.keys(Ii).map(r=>[r,zr(r)]));ur.P??(ur.P=zr("P"));const dd=8,fd=[r=>r.closest("td, th"),(r,e)=>{const t=r.closest(".tableWrapper"),n=t==null?void 0:t.querySelector("table");return n&&e.contains(n)?n:null},(r,e)=>{if(r.tagName==="UL"||r.tagName==="OL")return null;const t=r.closest("li");return t&&e.contains(t)?t:null},(r,e)=>{let t=r;for(;t&&t.parentElement!==e;){if(t===e)return null;t=t.parentElement}return!t||t===e||t.tagName==="UL"||t.tagName==="OL"?null:t}];function md(r,e){if(r===e)return null;for(const t of fd){const n=t(r,e);if(n)return n}return null}function hd(r,e){var n;let t=e;for(;t&&t.parentElement!==r;)t=t.parentElement;return((n=t??r.firstElementChild)==null?void 0:n.tagName.toUpperCase())??null}function Ya(r){var n;const e=r.dataset.type;if(e==="code-block")return"PRE";if(e==="mermaid-block")return"MERMAID_BLOCK";if(e==="dot-flow-pad")return"DOT_FLOW_PAD_BLOCK";if(e==="block-math")return"BLOCK_MATH";if(e==="image-block")return"IMG";if(e==="embed-view")return"EMBED_VIEW";const t=r.tagName.toUpperCase();return t==="LI"&&((n=r.parentElement)==null?void 0:n.dataset.type)==="taskList"?"TASK_ITEM":t}function zi(r,e){const t=a.ref(!1),n=a.reactive({}),o=a.reactive({tag:"P",label:"正文",currentTypeIds:["P"]});let l=null;function i(h){var W,H,A;const p=r.value;if(!p)return;const v=p.querySelector(".ProseMirror");if(!v)return;const b=h.target;if((W=b.closest)!=null&&W.call(b,".block-btn-overlay")||!v.contains(b))return;const w=md(b,v);if(!w)return;l=w;const k=Ya(w),T=zr(k),M=(((H=T.getRectEl)==null?void 0:H.call(T,w))??w).getBoundingClientRect(),B=w.closest("td, th"),D=B?B.getBoundingClientRect().left:M.left;n.top=`${M.top+M.height/2}px`,n.left=`${D-dd}px`,o.tag=k,o.label=T.label;const z=T.currentTypeId??((A=T.getCurrentTypeId)==null?void 0:A.call(T,w))??k;if(T.isWrapper){const R=hd(w,b);o.currentTypeIds=R?[z,R]:[z]}else o.currentTypeIds=[z];t.value=!0}function s(){u()}function u(){t.value=!1,l=null}function d(){var h;if(!l||!e.value)return null;try{const p=Ya(l),v=zr(p),b=((h=v.getPMDomTarget)==null?void 0:h.call(v,l))??l,w=e.value.view.posAtDOM(b,0);if(b!==l)return w;const k=w-1;return k>=0&&e.value.state.doc.nodeAt(k)?k:e.value.state.doc.nodeAt(w)?w:k}catch{return null}}function m(){if(!l||!e.value)return null;try{const h=e.value.view.posAtDOM(l,0),p=h-1;return p>=0&&e.value.state.doc.nodeAt(p)?p:e.value.state.doc.nodeAt(h)?h:p>=0?p:null}catch{return null}}return{overlayVisible:t,overlayStyle:n,blockInfo:o,onMouseMove:i,onMouseLeave:s,getCurrentBlockEl:()=>l,getCurrentBlockPMPos:d,getCurrentBlockRootPMPos:m}}function wn(r,e,t){return Math.max(e,Math.min(r,t))}function Yl(r,e,t,n=4,o=0){const l=window.innerWidth,i=window.innerHeight,s=8,u=Math.max(s,l-e-s),d=Math.max(s,i-o-s),m=M=>M>=s&&M+e<=l-s,h=M=>o<=0||M>=s&&M+o<=i-s,p=r.left-n-e,v=r.left+r.width+n,b=r.top+r.height+n,w=r.top-o-n;function k(M){const B=M==="left"?p:v;return m(B)?{top:wn(r.top,s,d),left:B,placement:M}:null}function T(M){const B=M==="below"?b:w;return h(B)?{top:B,left:wn(r.left,s,u),placement:M}:null}const E=t==="left"?["left","right","below","above"]:t==="right"?["right","left","below","above"]:t==="above"?["above","below","right","left"]:["below","above","right","left"];for(const M of E){const B=M==="left"||M==="right"?k(M):T(M);if(B)return B}return{top:wn(t==="above"?w:b,s,d),left:wn(t==="left"?p:t==="right"?v:r.left,s,u),placement:t}}const Gt=224,oo=4,Ja=8,pd=32,un=120;function Di(r){return r==="below"?"translateY(-4px)":r==="above"?"translateY(4px)":r==="right"?"translateX(-4px)":"translateX(4px)"}function gd(r,e){const t=window.innerHeight-e-Ja,n=r-e/2;return Math.max(Ja,Math.min(n,t))}function Jl(r){const e=a.ref(null),t=a.ref(0),n=a.ref(0),o=a.ref(!1);let l=null;function i(){l&&(clearTimeout(l),l=null)}function s(){i(),e.value=null,o.value=!1,t.value=0,n.value=0}function u(b,w){var M;i(),e.value=b,o.value=!1;const k=w.currentTarget,T=k==null?void 0:k.getBoundingClientRect(),E=(M=k==null?void 0:k.closest(r.rootSelector))==null?void 0:M.getBoundingClientRect();T&&(t.value=gd(T.top+T.height/2,r.estimatedHeight())),E&&(n.value=E.right)}function d(){s()}function m(){l||(l=setTimeout(()=>{o.value||(e.value=null),l=null},r.closeDelay??un))}function h(){o.value=!0,i()}function p(){o.value=!1,m()}const v=a.computed(()=>({position:"fixed",top:`${t.value||r.fallbackTop()}px`,left:`${n.value||r.fallbackLeft()}px`,zIndex:"301"}));return a.watch(r.visible,b=>{b&&s()}),a.onBeforeUnmount(()=>{i()}),{rootId:e,hovered:o,style:v,open:u,close:d,scheduleClose:m,clearCloseTimer:i,onPanelMouseEnter:h,onPanelMouseLeave:p}}const vd=400;function Oi(r,e,t,n,o){const l=a.ref(!1),i=a.ref(0),s=a.ref(0),u=a.ref("left"),d=a.ref(null),m=a.ref("P");let h=null;function p(){h&&(clearTimeout(h),h=null)}function v(){l.value=!1}function b(){const D=d.value;D!==null&&r.value&&r.value.chain().focus().setTextSelection(D+1).run()}function w(){d.value=e(),m.value=n(),o(),p(),b();const D=t();if(!D)return;const z=Yl({top:D.top,left:D.left,width:D.width,height:D.height},Gt,"left",oo,vd);i.value=z.top,s.value=z.left,u.value=z.placement,l.value=!0}function k(){h||(h=setTimeout(()=>{l.value=!1,h=null},un))}function T(){p(),w()}function E(D){var W;const z=D==null?void 0:D.relatedTarget;(W=z==null?void 0:z.closest)!=null&&W.call(z,".pagely-block-menu, .pagely-block-submenu, .pagely-hover-preview")||k()}function M(){p()}function B(){k()}return a.onBeforeUnmount(p),{visible:l,top:i,left:s,placement:u,targetPos:d,sourceTag:m,open:w,close:v,focusTarget:b,onPillEnter:T,onPillLeave:E,onMenuEnter:M,onMenuLeave:B,clearHideTimer:p}}function We(r){if(Array.isArray(r))return r.filter(e=>typeof e=="string"&&e.length>0);if(typeof r!="string"||r.length===0)return[];try{const e=JSON.parse(r);return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function bd(r){return Array.from(new Set(r.filter(e=>e.length>0)))}function Ri(r,e){return bd([...r,e])}function Pi(r,e){return r.filter(t=>t!==e)}const Xa=20;function Hi(r){const e=r.trim().replace(/\s+/g," ");return e?e.length>Xa?`${e.slice(0,Xa)}…`:e:""}function Vi(r){return r.type.name==="table"?"[表格]":r.type.name==="tableRow"?"[行]":r.type.name==="tableCell"||r.type.name==="tableHeader"?"[单元格]":r.type.name==="codeBlock"?"[代码块]":r.type.name==="blockMath"?"[公式]":r.type.name==="image"?"[图片]":r.type.name==="mermaidBlock"?"[Mermaid 图表]":r.type.name==="dotFlowPadBlock"?"[画板]":r.type.name==="embedView"?String(r.attrs.label||r.attrs.href||"[嵌入内容]"):null}function Xl(r){const e=Vi(r);if(e)return e;const t=r.textContent.trim().replace(/\s+/g," ");return t||`[${r.type.name}]`}function Fi(r){const e=Vi(r);if(e)return e;const t=Xl(r);return t===`[${r.type.name}]`?t:Hi(t)}function yd(r){const e=new Set;return r.descendants(t=>{const n=We(t.attrs.commentIds);for(const o of n)e.add(o);for(const o of t.marks)if(o.type.name==="commentMark")for(const l of We(o.attrs.commentIds))e.add(l);return!0}),e}function ja(r,e,t,n){const o=r.doc.type.schema.marks.commentMark;if(!o||t<0||n>r.doc.content.size||t>=n)return!1;const l=[];r.doc.nodesBetween(t,n,(i,s)=>{if(!i.isText)return!0;const u=Math.max(t,s),d=Math.min(n,s+i.nodeSize);if(u>=d)return!1;const m=i.marks.find(h=>h.type===o);return l.push({from:u,to:d,commentIds:Ri(We(m==null?void 0:m.attrs.commentIds),e)}),!1});for(const i of l)r.removeMark(i.from,i.to,o),r.addMark(i.from,i.to,o.create({commentIds:i.commentIds}));return l.length>0}function wd(r,e){const t=r.doc.type.schema.marks.commentMark;if(!t)return!1;const n=[];r.doc.descendants((o,l)=>{if(!o.isText)return!0;const i=o.marks.find(u=>u.type===t),s=We(i==null?void 0:i.attrs.commentIds);return s.includes(e)&&n.push({from:l,to:l+o.nodeSize,commentIds:Pi(s,e)}),!1});for(const o of n)r.removeMark(o.from,o.to,t),o.commentIds.length>0&&r.addMark(o.from,o.to,t.create({commentIds:o.commentIds}));return n.length>0}function kd(r){const e=r.doc.type.schema.marks.commentMark;if(!e)return!1;const t=[];r.doc.descendants((n,o)=>n.isText?(n.marks.some(l=>l.type===e)&&t.push({from:o,to:o+n.nodeSize}),!1):!0);for(const n of t)r.removeMark(n.from,n.to,e);return t.length>0}function Qa(r,e,t){if(t<0||t>r.doc.content.size)return!1;const n=r.doc.nodeAt(t);if(!n||n.isText)return!1;const o=Ri(We(n.attrs.commentIds),e);return r.setNodeMarkup(t,void 0,{...n.attrs,commentIds:o},n.marks),!0}function xd(r,e){const t=[];r.doc.descendants((n,o)=>{if(n.isText)return!0;const l=We(n.attrs.commentIds);return l.includes(e)&&t.push({pos:o,node:n,commentIds:Pi(l,e)}),!0});for(const n of t)r.setNodeMarkup(n.pos,void 0,{...n.node.attrs,commentIds:n.commentIds},n.node.marks);return t.length>0}function Cd(r){const e=[];r.doc.descendants((t,n)=>(t.isText||We(t.attrs.commentIds).length>0&&e.push({pos:n,node:t}),!0));for(const t of e)r.setNodeMarkup(t.pos,void 0,{...t.node.attrs,commentIds:[]},t.node.marks);return e.length>0}function Oo(r,e){if(!(r instanceof Element))return null;const t=r.closest(".pagely-comment-inline, .pagely-comment-block");return t&&e.contains(t)?t:null}function Za(r){return We(r.getAttribute("data-comment-ids"))}function Td(r,e){const t=r.view.nodeDOM(e);return t instanceof HTMLElement?t.getBoundingClientRect():Me.posToDOMRect(r.view,e,e+1)}function Ed(r,e){return e.from<0||e.to>r.content.size||e.from>=e.to?!1:e.text?r.textBetween(e.from,e.to,"")===e.text:!0}function Sd(r,e){if(typeof e.nodePos!="number"||e.nodePos<0||e.nodePos>r.content.size)return!1;const t=r.nodeAt(e.nodePos);if(!t||t.isText||e.nodeType&&t.type.name!==e.nodeType)return!1;const n=e.fullText??e.text;return!(n&&Xl(t)!==n&&Fi(t)!==n)}function Ro(r){const e=new Map,t=[],n=r.state.schema.marks.commentMark;return r.state.doc.descendants((o,l)=>{if(o.isText){const s=n?o.marks.find(d=>d.type===n):null,u=We(s==null?void 0:s.attrs.commentIds);for(const d of u){const m=e.get(d)??[];m.push({from:l,to:l+o.nodeSize,text:o.text??""}),e.set(d,m)}return!1}const i=We(o.attrs.commentIds);for(const s of i)t.push({id:s,kind:"block",nodePos:l,nodeType:o.type.name,text:Fi(o),fullText:Xl(o)});return!0}),[...Array.from(e.entries()).map(([o,l])=>({id:o,kind:"inline",ranges:l,text:Hi(l.map(i=>i.text).join(""))})),...t]}function $i(r,e={}){let t,n=null,o=new Set,l=null;const i=new Set;let s="",u=null;function d(){const A=e.enabled;return typeof A=="boolean"?A:A&&typeof A=="object"&&"value"in A?A.value:!0}function m(){const A=r.value;return A?Ro(A):[]}function h(){l&&(clearTimeout(l),l=null)}function p(A){return JSON.stringify(A)}function v(A){return new Set(A.map(R=>R.id))}function b(A){u=A,h(),l=setTimeout(()=>{var K;l=null;const R=u??m();u=null,(K=e.onAnchorsChanged)==null||K.call(e,R)},300)}function w(A){var te;if(!d()||!A.transaction.docChanged)return;const R=Ro(A.editor),K=v(R);for(const Z of o)K.has(Z)||i.has(Z)||(te=e.onOrphaned)==null||te.call(e,{commentId:Z});i.clear(),o=K;const J=p(R);J!==s&&(s=J,b(R))}function k(A){var J;if(!d()||!t)return;const R=Oo(A.target,t.view.dom);if(!R)return;const K=Za(R);K.length!==0&&((J=e.onClick)==null||J.call(e,{commentIds:K,rect:R.getBoundingClientRect()}))}function T(A){var J;if(!d()||!t)return;const R=Oo(A.target,t.view.dom);if(!R)return;const K=Za(R);K.length>0&&((J=e.onHover)==null||J.call(e,{commentIds:K}))}function E(A){var K;if(!d()||!t)return;const R=Oo(A.target,t.view.dom);R&&(A.relatedTarget instanceof Node&&R.contains(A.relatedTarget)||(K=e.onHover)==null||K.call(e,null))}function M(A){t&&(t.off("transaction",w),n==null||n.removeEventListener("click",k),n==null||n.removeEventListener("mouseover",T),n==null||n.removeEventListener("mouseout",E)),t=A,n=null;const R=A?Ro(A):[];o=v(R),s=p(R),u=null,i.clear(),A&&(A.on("transaction",w),n=A.view.dom,n.addEventListener("click",k),n.addEventListener("mouseover",T),n.addEventListener("mouseout",E))}a.watch(r,M,{immediate:!0}),a.onBeforeUnmount(()=>{h(),M(void 0)});function B(A,R){const K=r.value;if(!K||!d())return!1;const J=K.state.tr;return!(R.kind==="inline"?ja(J,A,R.from,R.to):Qa(J,A,R.nodePos))||!J.docChanged?!1:(J.setMeta("addToHistory",!1),K.view.dispatch(J),!0)}function D(A){const R=r.value;if(!R)return!1;const K=R.state.tr,J=wd(K,A),te=xd(K,A);return!J&&!te?!1:(i.add(A),K.setMeta("addToHistory",!1),R.view.dispatch(K),!0)}function z(A){var le;const R=r.value;if(!R||!d())return!1;const K=[],J=[],te=new Set;for(const ee of A)if(ee.kind==="inline")for(const we of ee.ranges??[])Ed(R.state.doc,we)?K.push({id:ee.id,range:we}):te.add(ee.id);else Sd(R.state.doc,ee)?J.push({id:ee.id,nodePos:ee.nodePos}):te.add(ee.id);for(const ee of te)(le=e.onAnchorDrift)==null||le.call(e,{commentId:ee});if(A.length>0&&K.length===0&&J.length===0)return!1;const Z=R.state.tr;for(const ee of yd(R.state.doc))i.add(ee);kd(Z),Cd(Z);for(const ee of K)ja(Z,ee.id,ee.range.from,ee.range.to);for(const ee of J)Qa(Z,ee.id,ee.nodePos);return Z.docChanged?(Z.setMeta("addToHistory",!1),R.view.dispatch(Z),!0):!1}function W(A){var Z;const R=r.value;if(!R||!d())return!1;const{from:K,to:J,empty:te}=R.state.selection;return te||K>=J?!1:((Z=e.onCreate)==null||Z.call(e,{kind:"inline",from:K,to:J,rect:A??Me.posToDOMRect(R.view,K,J)}),!0)}function H(A,R){var J;const K=r.value;return!K||!d()?!1:((J=e.onCreate)==null||J.call(e,{kind:"block",nodePos:A,rect:R??Td(K,A)}),!0)}return{getCommentAnchors:m,applyCommentAnchors:z,addComment:B,removeCommentAnchor:D,requestInlineComment:W,requestBlockComment:H}}function Md(r){let e=!1,t=!1;function n(h){var v,b;const p=!!((b=(v=h.target).closest)!=null&&b.call(v,"td, th"));!e&&!t&&(p?(r.onBlockMouseLeave(),r.clearInsertButton()):(r.onBlockMouseMove(h),r.updateInsertButton())),r.onTableMouseMove(h)}function o(h){var w;const p=h.relatedTarget,v=document.querySelector(".block-btn-overlay"),b=document.querySelector(".pagely-insert-menu");v!=null&&v.contains(p)||b!=null&&b.contains(p)||(w=p==null?void 0:p.closest)!=null&&w.call(p,".table-tools-overlay")||(r.onBlockMouseLeave(),r.clearInsertButton(),r.scheduleTableHide())}function l(){e=!0,r.onBlockMouseLeave(),r.clearInsertButton(),r.closeBlockMenu(),r.closeInsertMenu()}function i(){e=!1}function s(){}function u(){!r.isBlockMenuVisible()&&!r.isInsertMenuVisible()&&(r.onBlockMouseLeave(),r.clearInsertButton())}function d(h){(h.ctrlKey||h.metaKey)&&h.shiftKey&&h.key.toLowerCase()==="v"&&(window.__pagelySkipNextPaste=!0),h.key==="Escape"&&(r.closeBlockMenu(),r.closeInsertMenu())}function m(h){t=h}return{onMove:n,onLeave:o,onEditorMouseDown:l,onDocMouseUp:i,onOverlayEnter:s,onOverlayLeave:u,onKeyDown:d,setHasSelection:m}}const qi={H1:{id:"H1",label:"一级标题",icon:L.Heading1},H2:{id:"H2",label:"二级标题",icon:L.Heading2},H3:{id:"H3",label:"三级标题",icon:L.Heading3},H4:{id:"H4",label:"四级标题",icon:L.Heading4},H5:{id:"H5",label:"五级标题",icon:L.Heading5},H6:{id:"H6",label:"六级标题",icon:L.Heading6},OL:{id:"OL",label:"有序列表",icon:L.ListOrdered},UL:{id:"UL",label:"无序列表",icon:L.List},TASK:{id:"TASK",label:"任务列表",icon:L.SquareCheckBig},PRE:{id:"PRE",label:"代码块",icon:L.CodeXml},BLOCKQUOTE:{id:"BLOCKQUOTE",label:"引用",icon:L.Quote},HR:{id:"HR",label:"分割线",icon:L.SeparatorHorizontal},FORMULA:{id:"FORMULA",label:"公式",icon:L.Sigma},COMMENT:{id:"COMMENT",label:"评论",icon:L.MessageSquare},IMAGE:{id:"IMAGE",label:"图片",icon:L.Image},FILE:{id:"FILE",label:"文件",icon:L.FileText},LINK:{id:"LINK",label:"链接",icon:L.Link2},CANVAS:{id:"CANVAS",label:"画板",icon:L.Workflow},MERMAID:{id:"MERMAID",label:"Mermaid 图表",icon:L.GitBranch},TABLE:{id:"TABLE",label:"表格",icon:L.Table,picker:"table"}},Ad=["H1","H2","H3","H4","H5","H6","OL","UL","TASK","PRE","BLOCKQUOTE","HR"],Ui=[{label:"基础",style:"tiles",items:Ad},{label:"常用",style:"list",items:["FORMULA","IMAGE","FILE","LINK","TABLE"]},{label:"绘图",style:"list",items:["CANVAS","MERMAID"]}],Wi=[{label:"常用",style:"list",items:["COMMENT","FORMULA"]}];function _i(r){return r.map(e=>({...e,items:e.items.map(t=>qi[t])}))}const Gi=_i(Ui),Ki=_i(Wi);function jl(r){const e=r.trim();if(!e)return"";try{return new URL(e).pathname||e}catch{return e.split(/[?#]/,1)[0]??e}}function Bd(r){const e=r.trim();if(!e)return null;try{const t=new URL(e);return t.protocol!=="blob:"?t:new URL(e.slice(5))}catch{return null}}function e0(r){var o;const n=(jl(r).split("/").filter(Boolean).pop()??"").match(/\.([a-z0-9]+)$/i);return((o=n==null?void 0:n[1])==null?void 0:o.toLowerCase())??""}function Nd(r){try{return new URL(r.trim()).protocol==="blob:"}catch{return!1}}function Dr(r){const e=Bd(r);return(e==null?void 0:e.host)||r}function Fn(r){const e=r.trim();if(!e)return"";let t=jl(e);try{t=new URL(e).pathname||e}catch{}const n=t.split("/").filter(Boolean).pop()??e;try{return decodeURIComponent(n)}catch{return n}}const Ld=new Set(["pdf","md","markdown","html","htm","txt","text","png","jpg","jpeg","gif","webp","svg","bmp","avif"]);function $n(r){const e=jl(r);return/\.pdf$/i.test(e)?"pdf":/\.(md|markdown)$/i.test(e)?"md":"url"}function Yi(r,e){const t=$n(r);return t==="url"&&e?$n(e):t}function Id(r,e=""){const t=Yi(r,e);return t==="pdf"?"card":t==="md"?"preview":"link"}function en(r,e=""){const t=$n(r),n=$n(e);if(t==="pdf"||t==="md"||n==="pdf"||n==="md")return!0;const o=e0(e)||e0(r);return o?Ld.has(o):Nd(r)?!1:Hr(r)}function Hr(r){const e=r.trim();if(!e)return!1;try{const t=new URL(e,"https://pagely.local/");if(t.protocol==="http:"||t.protocol==="https:")return!0;if(t.protocol!=="blob:")return!1;const n=new URL(e.slice(5));return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}const zd=new Set(["link","card","preview"]);function Dd(r,e,t){if(zd.has(t)){const o=t;return o==="preview"&&!en(r,e)?"link":o}const n=Id(r,e);return n==="preview"&&!en(r,e)?"link":n}function cr(r){var o,l;const e=((o=r.href)==null?void 0:o.trim())??"";if(!Hr(e))return null;const n=(((l=r.label)==null?void 0:l.trim())??"")||Fn(e)||e;return{href:e,label:n,view:Dd(e,n,r.preferredView)}}const or={H1:r=>r.setHeading({level:1}),H2:r=>r.setHeading({level:2}),H3:r=>r.setHeading({level:3}),H4:r=>r.setHeading({level:4}),H5:r=>r.setHeading({level:5}),H6:r=>r.setHeading({level:6}),OL:r=>r.toggleOrderedList(),UL:r=>r.toggleBulletList(),TASK:r=>r.toggleTaskList(),PRE:r=>r.setCodeBlock(),BLOCKQUOTE:r=>r.toggleBlockquote(),HR:r=>r.setHorizontalRule(),FORMULA:(r,e)=>r.insertInlineMath({latex:"\\placeholder",...(e==null?void 0:e.pos)!==void 0?{pos:e.pos}:{}}),COMMENT:()=>{},IMAGE:(r,e)=>{e!=null&&e.src&&r.insertImage({src:e.src,alt:e.alt??null,title:e.title??null})},FILE:(r,e)=>{const t=cr({href:(e==null?void 0:e.href)??"",label:(e==null?void 0:e.label)??(e==null?void 0:e.text)??"",preferredView:e==null?void 0:e.view});t&&r.insertEmbedView(t)},LINK:(r,e)=>{var o,l;const t=(o=e==null?void 0:e.href)==null?void 0:o.trim();if(!t)return;const n=((l=e==null?void 0:e.text)==null?void 0:l.trim())||t;r.insertContent({type:"text",text:n,marks:[{type:"link",attrs:{href:t,target:"_blank"}}]})},CANVAS:r=>r.insertDotFlowPadBlock(),MERMAID:r=>r.insertMermaidBlock(),TABLE:(r,e)=>r.insertTable({rows:(e==null?void 0:e.rows)??4,cols:(e==null?void 0:e.cols)??4,withHeaderRow:!0})},Ji={CANVAS:r=>r.insertDotFlowPadBlock(),MERMAID:r=>r.insertMermaidBlock()},xr={rowBefore:{id:"rowBefore",label:"在上方插入行",icon:L.ArrowUpToLine,kind:"cell-op"},rowAfter:{id:"rowAfter",label:"在下方插入行",icon:L.ArrowDownToLine,kind:"cell-op"},colBefore:{id:"colBefore",label:"在左侧插入列",icon:L.ArrowLeftToLine,kind:"cell-op"},colAfter:{id:"colAfter",label:"在右侧插入列",icon:L.ArrowRightToLine,kind:"cell-op"},delRow:{id:"delRow",label:"删除当前行",icon:L.Trash2,danger:!0,kind:"cell-op"},delCol:{id:"delCol",label:"删除当前列",icon:L.Trash2,danger:!0,kind:"cell-op"}},Od=[{label:"行列操作",style:"list",items:[xr.rowBefore,xr.rowAfter,xr.colBefore,xr.colAfter]},{label:"",style:"list",items:[xr.delRow,xr.delCol]}],Xi=[...Ki,...Od];function Vt(r){return"kind"in r&&r.kind==="cell-op"}function ji(r){const{$from:e}=r.state.selection;let t=0;for(let n=0;n<=e.depth;n++){const o=e.node(n).type.name;(o==="listItem"||o==="taskItem")&&t++}return t}function Qi(r){return r?!!(r.can().sinkListItem("listItem")||r.can().sinkListItem("taskItem")):!1}function Zi(r){return r?ji(r)>=2:!1}function es(r){r.can().sinkListItem("listItem")?r.chain().focus().sinkListItem("listItem").run():r.can().sinkListItem("taskItem")&&r.chain().focus().sinkListItem("taskItem").run()}function ts(r){ji(r)<2||(r.isActive("taskItem")?r.chain().focus().liftListItem("taskItem").run():r.chain().focus().liftListItem("listItem").run())}const Rd=["svg.lf-canvas-overlay",".lf-graph svg.lf-canvas-overlay",".lf-container svg.lf-canvas-overlay",".lf-container svg"];function t0(r){if(r.classList.contains("lucide")||r.closest(".eb-toolbar, .dfp-preview-overlay, .floating-left-bar, .canvas-extra-controls, .status-bar, .lf-control"))return!1;const e=r.getBoundingClientRect();return e.width>16&&e.height>16}function rs(r){if(!r)return null;for(const e of Rd){const t=r.querySelector(e);if(t&&t0(t))return t}return Array.from(r.querySelectorAll("svg")).find(e=>t0(e))??null}function lo(){function r(t){var o;const n="http://www.w3.org/2000/svg";for(const l of Array.from(t.querySelectorAll("foreignObject"))){const i=(o=l.textContent)==null?void 0:o.replace(/\s+/g," ").trim();if(!i){l.remove();continue}const s=Number(l.getAttribute("x"))||0,u=Number(l.getAttribute("y"))||0,d=Number(l.getAttribute("width"))||0,m=Number(l.getAttribute("height"))||0,h=document.createElementNS(n,"text");h.setAttribute("x",String(s+d/2)),h.setAttribute("y",String(u+m/2)),h.setAttribute("text-anchor","middle"),h.setAttribute("dominant-baseline","middle"),h.setAttribute("font-family","Arial, sans-serif"),h.setAttribute("font-size","14"),h.setAttribute("fill","#333"),h.textContent=i,l.replaceWith(h)}}async function e(t,n=2){var o;try{if(!("ClipboardItem"in window)||!((o=navigator.clipboard)!=null&&o.write))return!1;const l=t();if(!l)return!1;const i=l.getBoundingClientRect(),s=l.getAttribute("viewBox"),u=(s==null?void 0:s.split(/[\s,]+/).map(Number))??[],d=i.width||Number(l.getAttribute("width"))||u[2]||1,m=i.height||Number(l.getAttribute("height"))||u[3]||1,h=l.cloneNode(!0);r(h),h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.setAttribute("width",String(d)),h.setAttribute("height",String(m)),h.getAttribute("viewBox")||h.setAttribute("viewBox",`0 0 ${d} ${m}`);const p=new XMLSerializer().serializeToString(h),v=new Blob([p],{type:"image/svg+xml;charset=utf-8"}),b=URL.createObjectURL(v);try{const w=new Image,k=new Promise((B,D)=>{w.onload=()=>B(),w.onerror=()=>D(new Error("Failed to load SVG for PNG export"))});w.src=b,await k;const T=document.createElement("canvas");T.width=Math.max(1,Math.ceil(d*n)),T.height=Math.max(1,Math.ceil(m*n));const E=T.getContext("2d");if(!E)return!1;E.setTransform(n,0,0,n,0,0),E.fillStyle="#fff",E.fillRect(0,0,d,m),E.drawImage(w,0,0,d,m);const M=await new Promise(B=>{T.toBlob(B,"image/png")});return M?(await navigator.clipboard.write([new ClipboardItem({"image/png":M})]),!0):!1}finally{URL.revokeObjectURL(b)}}catch{return!1}}return{copyPngToClipboard:e}}function hr(r,e){const t=r.state.doc.nodeAt(e);return t?{node:t,from:e,to:e+t.nodeSize}:null}async function qn(r){if(r)try{await navigator.clipboard.writeText(r)}catch{}}async function ao(r,e){var t;try{return!("ClipboardItem"in window)||!((t=navigator.clipboard)!=null&&t.write)?(await qn(e),!0):(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})})]),!0)}catch{return await qn(e),!1}}function io(r,e,t){const n=r.state.doc.slice(e,t),l=Vn.DOMSerializer.fromSchema(r.schema).serializeFragment(n.content),i=document.createElement("div");return i.appendChild(l),i.innerHTML}function so(r,e){if(r.type.name==="image"){const t=r.attrs.src;if(typeof t=="string"&&t)return t}return r.textContent||e}function Pd(r,e){const t=hr(r,e);if(!t)return;const n=io(r,t.from,t.to);ao(n,so(t.node,n))}function Hd(r,e){const t=hr(r,e);!t||t.node.type.name!=="codeBlock"||qn(t.node.textContent)}function Vd(r,e){const t=hr(r,e);t&&r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function Fd(r,e){const t=hr(r,e);!t||t.node.type.name!=="codeBlock"||r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function $d(r,e){const t=hr(r,e);if(!t)return;const n=io(r,t.from,t.to),o=so(t.node,n);ao(n,o),r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function cn(r,e){const t=r.state.doc.nodeAt(e);if((t==null?void 0:t.type.name)==="table")return{node:t,from:e,to:e+t.nodeSize};try{const n=r.state.doc.resolve(e+1);for(let o=n.depth;o>=0;o--){const l=n.node(o);if(l.type.name==="table"){const i=n.before(o);return{node:l,from:i,to:i+l.nodeSize}}}}catch{return null}return null}function ns(r,e){let t=e+1;return r.descendants((n,o)=>n.isTextblock?(t=e+1+o+1,!1):!0),t}function qd(r,e){const t=cn(r,e);if(!t)return;const n=io(r,t.from,t.to);ao(n,so(t.node,n))}function Ud(r,e){const t=cn(r,e);if(!t)return;const n=io(r,t.from,t.to),o=so(t.node,n);ao(n,o),r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function Wd(r,e){const t=hr(r,e);if(!t||t.node.type.name!=="dotFlowPadBlock")return;const n=t.node.attrs.data;typeof n=="string"&&qn(n)}function _d(r,e){const t=hr(r,e);if(!t||t.node.type.name!=="dotFlowPadBlock")return;const n=r.view.nodeDOM(e);if(!n)return;const{copyPngToClipboard:o}=lo();o(()=>rs(n))}function Gd(r,e){const t=cn(r,e);t&&r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function Kd(r,e){const t=cn(r,e);t&&r.chain().focus().setTextSelection(ns(t.node,t.from)).toggleHeaderRow().run()}function Yd(r,e){const t=cn(r,e);t&&r.chain().focus().setTextSelection(ns(t.node,t.from)).toggleHeaderColumn().run()}const Po={copyBlock:Pd,copyCode:Hd,copyCanvasCode:Wd,copyCanvasImage:_d,copyTable:qd,cutTable:Ud,cutBlock:$d,deleteBlock:Vd,deleteCodeBlock:Fd,deleteTable:Gd,toggleTableHeaderRow:Kd,toggleTableHeaderColumn:Yd};function vl(r,e,t){var n;e!==null&&((n=Po[t])==null||n.call(Po,r,e))}function os(r){function e(i,s){try{const d=i.state.doc.resolve(s).parent;return d.type.name==="paragraph"&&d.content.size===0}catch{return!1}}function t(i,s){var p;const u=r.editor.value;if(!u)return;const d=u.chain().focus(),m=r.insertTargetPos.value,h=m!==null?m+1:void 0;if(h!==void 0&&d.setTextSelection(h),i==="FORMULA"){r.closeInsertMenu();const v=h??u.state.selection.from,b=e(u,v)?"block":"inline";r.openMathPopoverForInsert(v,r.getMathRectAtPos(v),b);return}(p=or[i])==null||p.call(or,d,{...s,pos:h}),d.run(),r.closeInsertMenu()}function n(i){var m;const s=r.editor.value;if(!s)return;r.focusHoveredCell();const u=s.state.selection.from;if(i==="FORMULA"){r.openMathPopoverForInsert(u,r.getMathRectAtPos(u),"inline");return}const d=s.chain().focus();(m=or[i])==null||m.call(or,d,{pos:u}),d.run()}function o(i){var s,u;(u=(s=r.cellOps)[i])==null||u.call(s)}function l(i){var v;const s=r.editor.value;if(!s)return;const u=Kl[i];if((u==null?void 0:u.action)==="indent"&&u.indentDir){r.focusBlockTarget(),u.indentDir==="inc"?es(s):ts(s),r.closeBlockMenu();return}if((u==null?void 0:u.action)==="op"&&u.op){vl(s,r.blockTargetPos.value,u.op),r.closeBlockMenu();return}const d=Ji[i];if(d){const b=s.chain().focus(),w=r.blockTargetPos.value;w!==null&&b.setTextSelection(w+1),d(b),b.run(),r.closeBlockMenu();return}const m=r.blockTargetPos.value,h=zr(r.blockSourceTag.value),p=s.chain().focus();m!==null&&p.setTextSelection(m+1),(v=h.applyConvert)==null||v.call(h,p,i),p.run(),r.closeBlockMenu()}return{onInsert:t,onCellInsert:n,onCellOp:o,onConvert:l}}function ls(r,e,t){const n=a.ref(!1);function o(){var s;const i=t();n.value=(i==null?void 0:i.tagName.toUpperCase())==="P"&&((s=i.textContent)==null?void 0:s.trim())===""}function l(){n.value=!1}return{isEmptyParagraph:n,updateFromCurrentBlock:o,clear:l}}const Jd=220;function as(r,e,t){const n=a.ref(!1),o=a.ref(0),l=a.ref(0),i=a.ref("left"),s=a.ref(null);let u=null;function d(){u&&(clearTimeout(u),u=null)}function m(){u||(u=setTimeout(()=>{n.value=!1,u=null},un))}function h(M,B,D){s.value=M,t(),d();const z=Yl(B,Gt,D,oo,Jd);o.value=z.top,l.value=z.left,i.value=z.placement,n.value=!0}function p(){const M=r();if(M===null)return;const B=e();B&&h(M,{top:B.top,left:B.left,width:B.width,height:B.height},"left")}function v(M,B){h(M,{top:B.top,left:B.left,width:B.width,height:B.height},"below")}function b(){d(),p()}function w(M){var D;const B=M.relatedTarget;(D=B==null?void 0:B.closest)!=null&&D.call(B,".pagely-insert-menu")||m()}function k(){d()}function T(){m()}function E(){n.value=!1}return a.onBeforeUnmount(d),{visible:n,top:o,left:l,placement:i,targetPos:s,openFromButton:p,openFromSlash:v,onButtonEnter:b,onButtonLeave:w,onMenuEnter:k,onMenuLeave:T,close:E,scheduleClose:m,clearHideTimer:d}}function Xd(r){const e=a.ref(!1),t=a.ref(null),n=a.ref(""),o=a.ref(null),l=a.ref("insert"),i=a.ref("inline");function s(b){var T;const w=(T=r.value)==null?void 0:T.view;if(!w)return null;const k=w.coordsAtPos(b);return new DOMRect(k.left,k.top,k.right-k.left,k.bottom-k.top)}function u(b,w,k="inline"){var E;const T=(E=r.value)==null?void 0:E.view.nodeDOM(w);t.value=(T==null?void 0:T.getBoundingClientRect())??s(w),n.value=b.attrs.latex,o.value=w,l.value="edit",i.value=k,e.value=!0}function d(b,w,k="inline"){t.value=w??s(b),n.value="",o.value=b,l.value="insert",i.value=k,e.value=!0}function m(){e.value=!1}function h(b){if(m(),!r.value||o.value===null)return;const w=b.trim();if(!w)return;const k=r.value.chain().focus(),T={latex:w,pos:o.value};l.value==="insert"?i.value==="block"?k.insertBlockMath(T):k.insertInlineMath(T):i.value==="block"?k.updateBlockMath(T):k.updateInlineMath(T),k.run()}function p(b){!e.value||o.value===null||(o.value=b.mapping.map(o.value,l.value==="insert"?1:-1))}function v(b){p(b.transaction);for(const w of b.appendedTransactions)p(w)}return a.onMounted(()=>{var b;(b=r.value)==null||b.on("transaction",v)}),a.onBeforeUnmount(()=>{var b;(b=r.value)==null||b.off("transaction",v)}),{visible:e,anchorRect:t,initialLatex:n,openForEdit:u,openForInsert:d,confirm:h,close:m,rectAtPos:s}}function jd(r){const{$from:e}=r.state.selection;for(let t=e.depth;t>0;t-=1)if(e.node(t).type.name==="codeBlock")return!0;return!1}function Ho(r){const{selection:e,doc:t}=r.state;if(!e.empty||jd(r))return null;const{$from:n}=e,o=n.start(),l=t.textBetween(o,e.from,`
1
+ "use strict";var Pc=Object.create;var Wa=Object.defineProperty;var Hc=Object.getOwnPropertyDescriptor;var Vc=Object.getOwnPropertyNames;var Fc=Object.getPrototypeOf,$c=Object.prototype.hasOwnProperty;var qc=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Vc(e))!$c.call(r,o)&&o!==t&&Wa(r,o,{get:()=>e[o],enumerable:!(n=Hc(e,o))||n.enumerable});return r};var lt=(r,e,t)=>(t=r!=null?Pc(Fc(r)):{},qc(e||!r||!r.__esModule?Wa(t,"default",{value:r,enumerable:!0}):t,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),_e=require("@tiptap/vue-3"),L=require("lucide-vue-next"),Me=require("@tiptap/core"),Vn=require("@tiptap/pm/model"),Uc=require("markdown-it"),Wc=require("turndown"),_c=require("@tiptap/starter-kit"),Kr=require("@tiptap/extension-table"),Gc=require("@tiptap/extension-task-list"),Kc=require("@tiptap/extension-task-item"),Yc=require("@tiptap/extension-color"),Jc=require("@tiptap/extension-highlight"),Xc=require("@tiptap/extension-text-style"),mr=require("@tiptap/pm/state");require("@fontsource/jetbrains-mono/400.css");require("@fontsource/jetbrains-mono/500.css");const rt=require("@codemirror/view"),tr=require("@codemirror/state"),yn=require("@codemirror/commands"),_r=require("@codemirror/language"),_a=require("@codemirror/autocomplete"),Ni=require("@tiptap/extension-mathematics"),Ga=require("@henryx/dot-flow-pad"),jc=require("@henryx/mermaid-smart-editor"),Qc=require("mermaid"),gl=require("@tiptap/pm/tables"),no=new Set(["P","H1","H2","H3","H4","H5","H6","PRE"]),Zc=new Set(["BLOCKQUOTE"]);function Lt(r,e){switch(e){case"P":r.setParagraph();break;case"H1":r.setHeading({level:1});break;case"H2":r.setHeading({level:2});break;case"H3":r.setHeading({level:3});break;case"H4":r.setHeading({level:4});break;case"H5":r.setHeading({level:5});break;case"H6":r.setHeading({level:6});break;case"UL":r.toggleBulletList();break;case"OL":r.toggleOrderedList();break;case"LI_TASK":r.toggleTaskList();break;case"PRE":r.setCodeBlock();break;case"BLOCKQUOTE":r.toggleBlockquote();break}}function ed(r,e,t,n){if(e!==t){if(no.has(e)){Lt(r,e);return}if(Zc.has(e)){n(),Lt(r,e);return}n(),Lt(r,e)}}function td(r,e){ed(r,e,"BLOCKQUOTE",()=>r.toggleBlockquote())}function rd(r,e){if(e!=="PRE"){if(no.has(e)){Lt(r,e);return}r.unsetCodeBlock(),Lt(r,e)}}function Li(r,e,t,n){e.forEach((o,l)=>{const i=t+1+l;(o.type.name==="bulletList"||o.type.name==="orderedList")&&(r.setNodeMarkup(i,n,o.attrs),o.forEach((s,u)=>{s.type.name==="listItem"&&Li(r,s,i+1+u,n)}))})}function nd(r,e){if(no.has(e)){r.liftListItem("listItem"),e!=="P"&&Lt(r,e);return}if(e==="LI_TASK"){r.liftListItem("listItem"),r.toggleTaskList();return}const t=e==="UL"?"bulletList":"orderedList";r.command(({tr:n,state:o})=>{const{$from:l}=o.selection,i=o.schema.nodes[t];if(!i)return!1;let s=-1;for(let p=l.depth;p>=0;p-=1)if(l.node(p).type.name==="listItem"){s=p;break}if(s<1)return!1;const u=l.before(s),d=l.node(s),m=l.node(s-1),h=l.before(s-1);return(m.type.name==="bulletList"||m.type.name==="orderedList")&&n.setNodeMarkup(h,i,m.attrs),Li(n,d,u,i),!0})}function od(r,e){if(e!=="LI_TASK"){if(no.has(e)){r.liftListItem("taskItem"),e!=="P"&&Lt(r,e);return}r.toggleTaskList(),e!=="P"&&Lt(r,e)}}const ld={text:Lt,blockquote:td,pre:rd,listItem:nd,taskItem:od},Kl={P:{id:"P",label:"正文",icon:L.Type},H1:{id:"H1",label:"一级标题",icon:L.Heading1},H2:{id:"H2",label:"二级标题",icon:L.Heading2},H3:{id:"H3",label:"三级标题",icon:L.Heading3},H4:{id:"H4",label:"四级标题",icon:L.Heading4},H5:{id:"H5",label:"五级标题",icon:L.Heading5},H6:{id:"H6",label:"六级标题",icon:L.Heading6},UL:{id:"UL",label:"无序列表",icon:L.List},OL:{id:"OL",label:"有序列表",icon:L.ListOrdered},LI_TASK:{id:"LI_TASK",label:"任务列表",icon:L.SquareCheckBig},PRE:{id:"PRE",label:"代码块",icon:L.CodeXml},BLOCKQUOTE:{id:"BLOCKQUOTE",label:"引用",icon:L.Quote},CUT_BLOCK:{id:"CUT_BLOCK",label:"剪切",icon:L.Scissors,action:"op",op:"cutBlock"},COPY_BLOCK:{id:"COPY_BLOCK",label:"复制",icon:L.Copy,action:"op",op:"copyBlock"},DELETE_BLOCK:{id:"DELETE_BLOCK",label:"删除",icon:L.Trash2,danger:!0,action:"op",op:"deleteBlock"},COPY_CODE:{id:"COPY_CODE",label:"复制代码",icon:L.Copy,action:"op",op:"copyCode"},DELETE_CODE_BLOCK:{id:"DELETE_CODE_BLOCK",label:"删除代码块",icon:L.Trash2,danger:!0,action:"op",op:"deleteCodeBlock"},COPY_CANVAS_CODE:{id:"COPY_CANVAS_CODE",label:"复制画板代码",icon:L.FileCode,action:"op",op:"copyCanvasCode"},COPY_CANVAS_IMAGE:{id:"COPY_CANVAS_IMAGE",label:"复制图片",icon:L.Image,action:"op",op:"copyCanvasImage"},CUT_TABLE:{id:"CUT_TABLE",label:"剪切",icon:L.Scissors,action:"op",op:"cutTable"},COPY_TABLE:{id:"COPY_TABLE",label:"复制",icon:L.Copy,action:"op",op:"copyTable"},TOGGLE_TABLE_HEADER_ROW:{id:"TOGGLE_TABLE_HEADER_ROW",label:"标题行",icon:L.Rows3,action:"op",op:"toggleTableHeaderRow",toggle:!0},TOGGLE_TABLE_HEADER_COL:{id:"TOGGLE_TABLE_HEADER_COL",label:"标题列",icon:L.Columns3,action:"op",op:"toggleTableHeaderColumn",toggle:!0},DELETE_TABLE:{id:"DELETE_TABLE",label:"删除",icon:L.Trash2,danger:!0,action:"op",op:"deleteTable"},INDENT_INC:{id:"INDENT_INC",label:"增加缩进",icon:L.Indent,action:"indent",indentDir:"inc"},INDENT_DEC:{id:"INDENT_DEC",label:"减少缩进",icon:L.Outdent,action:"indent",indentDir:"dec"},SUBMENU_INDENT_LIST:{id:"SUBMENU_INDENT_LIST",label:"缩进",icon:L.Indent,children:["INDENT_DEC","INDENT_INC"]},COLOR:{id:"COLOR",label:"颜色",icon:L.Palette,panel:"color"},CANVAS:{id:"CANVAS",label:"画板",icon:L.Workflow,description:"在文档中轻松画出清晰好看的示意图、结构图、流程图"},MERMAID:{id:"MERMAID",label:"Mermaid 图表",icon:L.GitBranch,description:"用文本语法描述流程图、时序图、甘特图等"}},ad={CONVERT_TILES:{style:"tiles",items:["P","H1","H2","H3","H4","H5","H6","UL","OL","LI_TASK","PRE","BLOCKQUOTE"]},DRAW:{style:"list",label:"绘图",items:["CANVAS","MERMAID"]},OPS:{style:"list",items:["COPY_BLOCK","DELETE_BLOCK"]},CODE_OPS:{style:"list",items:["COPY_CODE","DELETE_CODE_BLOCK"]},TABLE_OPS:{style:"list",items:["CUT_TABLE","COPY_TABLE","TOGGLE_TABLE_HEADER_ROW","TOGGLE_TABLE_HEADER_COL","DELETE_TABLE"]},INDENT_LIST:{style:"list",items:["SUBMENU_INDENT_LIST"]},COLOR_SECTION:{style:"list",items:["COLOR"]},CANVAS_OPS:{style:"list",items:["CUT_BLOCK","COPY_CANVAS_CODE","COPY_CANVAS_IMAGE","DELETE_BLOCK"]},IMAGE_OPS:{style:"list",items:["CUT_BLOCK","COPY_BLOCK","DELETE_BLOCK"]},EMBED_VIEW_OPS:{style:"list",items:["CUT_BLOCK","DELETE_BLOCK"]}},Ka=r=>r.firstElementChild??r,id={TEXT_LIKE:{sections:["CONVERT_TILES","COLOR_SECTION"],convert:"text"},HEADING:{sections:["CONVERT_TILES","COLOR_SECTION"],convert:"text"},BLOCKQUOTE:{sections:["CONVERT_TILES","OPS"],convert:"blockquote",isWrapper:!0,getPMDomTarget:r=>r.firstElementChild??r},TASK_ITEM:{sections:["CONVERT_TILES","INDENT_LIST","COLOR_SECTION"],currentTypeId:"LI_TASK",getRectEl:r=>r.querySelector(":scope > div")??r.firstElementChild??r,getPMDomTarget:r=>r.querySelector(":scope > div")??r.firstElementChild??r,convert:"taskItem"},LI:{sections:["CONVERT_TILES","INDENT_LIST","COLOR_SECTION"],getCurrentTypeId:r=>{var e;return((e=r.parentElement)==null?void 0:e.tagName.toUpperCase())??"UL"},getRectEl:Ka,getPMDomTarget:Ka,convert:"listItem"},PRE:{sections:["CONVERT_TILES","CODE_OPS"],convert:"pre"},TABLE:{sections:["TABLE_OPS"]},TABLE_CELL:{sections:["OPS"]},MINIMAL:{sections:["OPS"]},MERMAID:{sections:["CODE_OPS"]},CANVAS:{sections:["CANVAS_OPS"]},IMAGE:{sections:["IMAGE_OPS"]},EMBED_VIEW:{sections:["EMBED_VIEW_OPS"]}},sd={P:"TEXT_LIKE",H1:"HEADING",H2:"HEADING",H3:"HEADING",H4:"HEADING",H5:"HEADING",H6:"HEADING",BLOCKQUOTE:"BLOCKQUOTE",TASK_ITEM:"TASK_ITEM",LI:"LI",PRE:"PRE",TABLE:"TABLE",TD:"TABLE_CELL",TH:"TABLE_CELL",HR:"MINIMAL",DOT_FLOW_PAD_BLOCK:"CANVAS",MERMAID_BLOCK:"MERMAID",IMG:"IMAGE",BLOCK_MATH:"MINIMAL",EMBED_VIEW:"EMBED_VIEW"},Ii={P:{label:"正文",icon:L.Type,pillVariant:"text"},H1:{label:"标题 1",icon:L.Heading1,pillVariant:"text"},H2:{label:"标题 2",icon:L.Heading2,pillVariant:"text"},H3:{label:"标题 3",icon:L.Heading3,pillVariant:"text"},H4:{label:"标题 4",icon:L.Heading4,pillVariant:"text"},H5:{label:"标题 5",icon:L.Heading5,pillVariant:"text"},H6:{label:"标题 6",icon:L.Heading6,pillVariant:"text"},PRE:{label:"代码块",icon:L.CodeXml,pillVariant:"text"},BLOCKQUOTE:{label:"引用",icon:L.Quote,pillVariant:"text"},TASK_ITEM:{label:"任务项",icon:L.SquareCheckBig,pillVariant:"text"},LI:{label:"列表项",icon:L.List,pillVariant:"text"},TABLE:{label:"表格",icon:L.Grid2x2,pillVariant:"table"},TD:{label:"单元格",icon:L.Grid2x2,pillVariant:"minimal"},TH:{label:"表头格",icon:L.Grid2x2,pillVariant:"minimal"},HR:{label:"分割线",icon:L.Minus,pillVariant:"minimal"},MERMAID_BLOCK:{label:"Mermaid 图表",icon:L.GitBranch,pillVariant:"minimal"},DOT_FLOW_PAD_BLOCK:{label:"画板",icon:L.Workflow,pillVariant:"minimal"},IMG:{label:"图片",icon:L.Image,pillVariant:"minimal"},BLOCK_MATH:{label:"公式",icon:L.Type,pillVariant:"minimal"},EMBED_VIEW:{label:"预览",icon:L.FileText,pillVariant:"text"}};function ud(r){return{label:r.label,style:r.style,items:r.items.map(e=>Kl[e])}}function zr(r){const e=r.toUpperCase(),t=Ii[e]??cd,n=id[sd[e]??"MINIMAL"];return{...t,sections:n.sections.map(o=>ud(ad[o])),getRectEl:n.getRectEl,getPMDomTarget:n.getPMDomTarget,applyConvert:n.convert?ld[n.convert]:void 0,currentTypeId:n.currentTypeId,getCurrentTypeId:n.getCurrentTypeId,isWrapper:n.isWrapper}}const cd={label:"块",icon:L.Type,pillVariant:"text"},ur=Object.fromEntries(Object.keys(Ii).map(r=>[r,zr(r)]));ur.P??(ur.P=zr("P"));const dd=8,fd=[r=>r.closest("td, th"),(r,e)=>{const t=r.closest(".tableWrapper"),n=t==null?void 0:t.querySelector("table");return n&&e.contains(n)?n:null},(r,e)=>{if(r.tagName==="UL"||r.tagName==="OL")return null;const t=r.closest("li");return t&&e.contains(t)?t:null},(r,e)=>{let t=r;for(;t&&t.parentElement!==e;){if(t===e)return null;t=t.parentElement}return!t||t===e||t.tagName==="UL"||t.tagName==="OL"?null:t}];function md(r,e){if(r===e)return null;for(const t of fd){const n=t(r,e);if(n)return n}return null}function hd(r,e){var n;let t=e;for(;t&&t.parentElement!==r;)t=t.parentElement;return((n=t??r.firstElementChild)==null?void 0:n.tagName.toUpperCase())??null}function Ya(r){var n;const e=r.dataset.type;if(e==="code-block")return"PRE";if(e==="mermaid-block")return"MERMAID_BLOCK";if(e==="dot-flow-pad")return"DOT_FLOW_PAD_BLOCK";if(e==="block-math")return"BLOCK_MATH";if(e==="image-block")return"IMG";if(e==="embed-view")return"EMBED_VIEW";const t=r.tagName.toUpperCase();return t==="LI"&&((n=r.parentElement)==null?void 0:n.dataset.type)==="taskList"?"TASK_ITEM":t}function zi(r,e){const t=a.ref(!1),n=a.reactive({}),o=a.reactive({tag:"P",label:"正文",currentTypeIds:["P"]});let l=null;function i(h){var W,H,A;const p=r.value;if(!p)return;const v=p.querySelector(".ProseMirror");if(!v)return;const b=h.target;if((W=b.closest)!=null&&W.call(b,".block-btn-overlay")||!v.contains(b))return;const w=md(b,v);if(!w)return;l=w;const k=Ya(w),T=zr(k),M=(((H=T.getRectEl)==null?void 0:H.call(T,w))??w).getBoundingClientRect(),B=w.closest("td, th"),D=B?B.getBoundingClientRect().left:M.left;n.top=`${M.top+M.height/2}px`,n.left=`${D-dd}px`,o.tag=k,o.label=T.label;const z=T.currentTypeId??((A=T.getCurrentTypeId)==null?void 0:A.call(T,w))??k;if(T.isWrapper){const R=hd(w,b);o.currentTypeIds=R?[z,R]:[z]}else o.currentTypeIds=[z];t.value=!0}function s(){u()}function u(){t.value=!1,l=null}function d(){var h;if(!l||!e.value)return null;try{const p=Ya(l),v=zr(p),b=((h=v.getPMDomTarget)==null?void 0:h.call(v,l))??l,w=e.value.view.posAtDOM(b,0);if(b!==l)return w;const k=w-1;return k>=0&&e.value.state.doc.nodeAt(k)?k:e.value.state.doc.nodeAt(w)?w:k}catch{return null}}function m(){if(!l||!e.value)return null;try{const h=e.value.view.posAtDOM(l,0),p=h-1;return p>=0&&e.value.state.doc.nodeAt(p)?p:e.value.state.doc.nodeAt(h)?h:p>=0?p:null}catch{return null}}return{overlayVisible:t,overlayStyle:n,blockInfo:o,onMouseMove:i,onMouseLeave:s,getCurrentBlockEl:()=>l,getCurrentBlockPMPos:d,getCurrentBlockRootPMPos:m}}function wn(r,e,t){return Math.max(e,Math.min(r,t))}function Yl(r,e,t,n=4,o=0){const l=window.innerWidth,i=window.innerHeight,s=8,u=Math.max(s,l-e-s),d=Math.max(s,i-o-s),m=M=>M>=s&&M+e<=l-s,h=M=>o<=0||M>=s&&M+o<=i-s,p=r.left-n-e,v=r.left+r.width+n,b=r.top+r.height+n,w=r.top-o-n;function k(M){const B=M==="left"?p:v;return m(B)?{top:wn(r.top,s,d),left:B,placement:M}:null}function T(M){const B=M==="below"?b:w;return h(B)?{top:B,left:wn(r.left,s,u),placement:M}:null}const E=t==="left"?["left","right","below","above"]:t==="right"?["right","left","below","above"]:t==="above"?["above","below","right","left"]:["below","above","right","left"];for(const M of E){const B=M==="left"||M==="right"?k(M):T(M);if(B)return B}return{top:wn(t==="above"?w:b,s,d),left:wn(t==="left"?p:t==="right"?v:r.left,s,u),placement:t}}const Gt=224,oo=4,Ja=8,pd=32,un=120;function Di(r){return r==="below"?"translateY(-4px)":r==="above"?"translateY(4px)":r==="right"?"translateX(-4px)":"translateX(4px)"}function gd(r,e){const t=window.innerHeight-e-Ja,n=r-e/2;return Math.max(Ja,Math.min(n,t))}function Jl(r){const e=a.ref(null),t=a.ref(0),n=a.ref(0),o=a.ref(!1);let l=null;function i(){l&&(clearTimeout(l),l=null)}function s(){i(),e.value=null,o.value=!1,t.value=0,n.value=0}function u(b,w){var M;i(),e.value=b,o.value=!1;const k=w.currentTarget,T=k==null?void 0:k.getBoundingClientRect(),E=(M=k==null?void 0:k.closest(r.rootSelector))==null?void 0:M.getBoundingClientRect();T&&(t.value=gd(T.top+T.height/2,r.estimatedHeight())),E&&(n.value=E.right)}function d(){s()}function m(){l||(l=setTimeout(()=>{o.value||(e.value=null),l=null},r.closeDelay??un))}function h(){o.value=!0,i()}function p(){o.value=!1,m()}const v=a.computed(()=>({position:"fixed",top:`${t.value||r.fallbackTop()}px`,left:`${n.value||r.fallbackLeft()}px`,zIndex:"301"}));return a.watch(r.visible,b=>{b&&s()}),a.onBeforeUnmount(()=>{i()}),{rootId:e,hovered:o,style:v,open:u,close:d,scheduleClose:m,clearCloseTimer:i,onPanelMouseEnter:h,onPanelMouseLeave:p}}const vd=400;function Oi(r,e,t,n,o){const l=a.ref(!1),i=a.ref(0),s=a.ref(0),u=a.ref("left"),d=a.ref(null),m=a.ref("P");let h=null;function p(){h&&(clearTimeout(h),h=null)}function v(){l.value=!1}function b(){const D=d.value;D!==null&&r.value&&r.value.chain().focus().setTextSelection(D+1).run()}function w(){d.value=e(),m.value=n(),o(),p(),b();const D=t();if(!D)return;const z=Yl({top:D.top,left:D.left,width:D.width,height:D.height},Gt,"left",oo,vd);i.value=z.top,s.value=z.left,u.value=z.placement,l.value=!0}function k(){h||(h=setTimeout(()=>{l.value=!1,h=null},un))}function T(){p(),w()}function E(D){var W;const z=D==null?void 0:D.relatedTarget;(W=z==null?void 0:z.closest)!=null&&W.call(z,".pagely-block-menu, .pagely-block-submenu, .pagely-hover-preview")||k()}function M(){p()}function B(){k()}return a.onBeforeUnmount(p),{visible:l,top:i,left:s,placement:u,targetPos:d,sourceTag:m,open:w,close:v,focusTarget:b,onPillEnter:T,onPillLeave:E,onMenuEnter:M,onMenuLeave:B,clearHideTimer:p}}function We(r){if(Array.isArray(r))return r.filter(e=>typeof e=="string"&&e.length>0);if(typeof r!="string"||r.length===0)return[];try{const e=JSON.parse(r);return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}catch{return[]}}function bd(r){return Array.from(new Set(r.filter(e=>e.length>0)))}function Ri(r,e){return bd([...r,e])}function Pi(r,e){return r.filter(t=>t!==e)}const Xa=20;function Hi(r){const e=r.trim().replace(/\s+/g," ");return e?e.length>Xa?`${e.slice(0,Xa)}…`:e:""}function Vi(r){return r.type.name==="table"?"[表格]":r.type.name==="tableRow"?"[行]":r.type.name==="tableCell"||r.type.name==="tableHeader"?"[单元格]":r.type.name==="codeBlock"?"[代码块]":r.type.name==="blockMath"?"[公式]":r.type.name==="image"?"[图片]":r.type.name==="mermaidBlock"?"[Mermaid 图表]":r.type.name==="dotFlowPadBlock"?"[画板]":r.type.name==="embedView"?String(r.attrs.label||r.attrs.href||"[嵌入内容]"):null}function Xl(r){const e=Vi(r);if(e)return e;const t=r.textContent.trim().replace(/\s+/g," ");return t||`[${r.type.name}]`}function Fi(r){const e=Vi(r);if(e)return e;const t=Xl(r);return t===`[${r.type.name}]`?t:Hi(t)}function yd(r){const e=new Set;return r.descendants(t=>{const n=We(t.attrs.commentIds);for(const o of n)e.add(o);for(const o of t.marks)if(o.type.name==="commentMark")for(const l of We(o.attrs.commentIds))e.add(l);return!0}),e}function ja(r,e,t,n){const o=r.doc.type.schema.marks.commentMark;if(!o||t<0||n>r.doc.content.size||t>=n)return!1;const l=[];r.doc.nodesBetween(t,n,(i,s)=>{if(!i.isText)return!0;const u=Math.max(t,s),d=Math.min(n,s+i.nodeSize);if(u>=d)return!1;const m=i.marks.find(h=>h.type===o);return l.push({from:u,to:d,commentIds:Ri(We(m==null?void 0:m.attrs.commentIds),e)}),!1});for(const i of l)r.removeMark(i.from,i.to,o),r.addMark(i.from,i.to,o.create({commentIds:i.commentIds}));return l.length>0}function wd(r,e){const t=r.doc.type.schema.marks.commentMark;if(!t)return!1;const n=[];r.doc.descendants((o,l)=>{if(!o.isText)return!0;const i=o.marks.find(u=>u.type===t),s=We(i==null?void 0:i.attrs.commentIds);return s.includes(e)&&n.push({from:l,to:l+o.nodeSize,commentIds:Pi(s,e)}),!1});for(const o of n)r.removeMark(o.from,o.to,t),o.commentIds.length>0&&r.addMark(o.from,o.to,t.create({commentIds:o.commentIds}));return n.length>0}function kd(r){const e=r.doc.type.schema.marks.commentMark;if(!e)return!1;const t=[];r.doc.descendants((n,o)=>n.isText?(n.marks.some(l=>l.type===e)&&t.push({from:o,to:o+n.nodeSize}),!1):!0);for(const n of t)r.removeMark(n.from,n.to,e);return t.length>0}function Qa(r,e,t){if(t<0||t>r.doc.content.size)return!1;const n=r.doc.nodeAt(t);if(!n||n.isText)return!1;const o=Ri(We(n.attrs.commentIds),e);return r.setNodeMarkup(t,void 0,{...n.attrs,commentIds:o},n.marks),!0}function xd(r,e){const t=[];r.doc.descendants((n,o)=>{if(n.isText)return!0;const l=We(n.attrs.commentIds);return l.includes(e)&&t.push({pos:o,node:n,commentIds:Pi(l,e)}),!0});for(const n of t)r.setNodeMarkup(n.pos,void 0,{...n.node.attrs,commentIds:n.commentIds},n.node.marks);return t.length>0}function Cd(r){const e=[];r.doc.descendants((t,n)=>(t.isText||We(t.attrs.commentIds).length>0&&e.push({pos:n,node:t}),!0));for(const t of e)r.setNodeMarkup(t.pos,void 0,{...t.node.attrs,commentIds:[]},t.node.marks);return e.length>0}function Oo(r,e){if(!(r instanceof Element))return null;const t=r.closest(".pagely-comment-inline, .pagely-comment-block");return t&&e.contains(t)?t:null}function Za(r){return We(r.getAttribute("data-comment-ids"))}function Td(r,e){const t=r.view.nodeDOM(e);return t instanceof HTMLElement?t.getBoundingClientRect():Me.posToDOMRect(r.view,e,e+1)}function Ed(r,e){return e.from<0||e.to>r.content.size||e.from>=e.to?!1:e.text?r.textBetween(e.from,e.to,"")===e.text:!0}function Sd(r,e){if(typeof e.nodePos!="number"||e.nodePos<0||e.nodePos>r.content.size)return!1;const t=r.nodeAt(e.nodePos);if(!t||t.isText||e.nodeType&&t.type.name!==e.nodeType)return!1;const n=e.fullText??e.text;return!(n&&Xl(t)!==n&&Fi(t)!==n)}function Ro(r){const e=new Map,t=[],n=r.state.schema.marks.commentMark;return r.state.doc.descendants((o,l)=>{if(o.isText){const s=n?o.marks.find(d=>d.type===n):null,u=We(s==null?void 0:s.attrs.commentIds);for(const d of u){const m=e.get(d)??[];m.push({from:l,to:l+o.nodeSize,text:o.text??""}),e.set(d,m)}return!1}const i=We(o.attrs.commentIds);for(const s of i)t.push({id:s,kind:"block",nodePos:l,nodeType:o.type.name,text:Fi(o),fullText:Xl(o)});return!0}),[...Array.from(e.entries()).map(([o,l])=>({id:o,kind:"inline",ranges:l,text:Hi(l.map(i=>i.text).join(""))})),...t]}function $i(r,e={}){let t,n=null,o=new Set,l=null;const i=new Set;let s="",u=null;function d(){const A=e.enabled;return typeof A=="boolean"?A:A&&typeof A=="object"&&"value"in A?A.value:!0}function m(){const A=r.value;return A?Ro(A):[]}function h(){l&&(clearTimeout(l),l=null)}function p(A){return JSON.stringify(A)}function v(A){return new Set(A.map(R=>R.id))}function b(A){u=A,h(),l=setTimeout(()=>{var K;l=null;const R=u??m();u=null,(K=e.onAnchorsChanged)==null||K.call(e,R)},300)}function w(A){var te;if(!d()||!A.transaction.docChanged)return;const R=Ro(A.editor),K=v(R);for(const Z of o)K.has(Z)||i.has(Z)||(te=e.onOrphaned)==null||te.call(e,{commentId:Z});i.clear(),o=K;const J=p(R);J!==s&&(s=J,b(R))}function k(A){var J;if(!d()||!t)return;const R=Oo(A.target,t.view.dom);if(!R)return;const K=Za(R);K.length!==0&&((J=e.onClick)==null||J.call(e,{commentIds:K,rect:R.getBoundingClientRect()}))}function T(A){var J;if(!d()||!t)return;const R=Oo(A.target,t.view.dom);if(!R)return;const K=Za(R);K.length>0&&((J=e.onHover)==null||J.call(e,{commentIds:K}))}function E(A){var K;if(!d()||!t)return;const R=Oo(A.target,t.view.dom);R&&(A.relatedTarget instanceof Node&&R.contains(A.relatedTarget)||(K=e.onHover)==null||K.call(e,null))}function M(A){t&&(t.off("transaction",w),n==null||n.removeEventListener("click",k),n==null||n.removeEventListener("mouseover",T),n==null||n.removeEventListener("mouseout",E)),t=A,n=null;const R=A?Ro(A):[];o=v(R),s=p(R),u=null,i.clear(),A&&(A.on("transaction",w),n=A.view.dom,n.addEventListener("click",k),n.addEventListener("mouseover",T),n.addEventListener("mouseout",E))}a.watch(r,M,{immediate:!0}),a.onBeforeUnmount(()=>{h(),M(void 0)});function B(A,R){const K=r.value;if(!K||!d())return!1;const J=K.state.tr;return!(R.kind==="inline"?ja(J,A,R.from,R.to):Qa(J,A,R.nodePos))||!J.docChanged?!1:(J.setMeta("addToHistory",!1),K.view.dispatch(J),!0)}function D(A){const R=r.value;if(!R)return!1;const K=R.state.tr,J=wd(K,A),te=xd(K,A);return!J&&!te?!1:(i.add(A),K.setMeta("addToHistory",!1),R.view.dispatch(K),!0)}function z(A){var le;const R=r.value;if(!R||!d())return!1;const K=[],J=[],te=new Set;for(const ee of A)if(ee.kind==="inline")for(const we of ee.ranges??[])Ed(R.state.doc,we)?K.push({id:ee.id,range:we}):te.add(ee.id);else Sd(R.state.doc,ee)?J.push({id:ee.id,nodePos:ee.nodePos}):te.add(ee.id);for(const ee of te)(le=e.onAnchorDrift)==null||le.call(e,{commentId:ee});if(A.length>0&&K.length===0&&J.length===0)return!1;const Z=R.state.tr;for(const ee of yd(R.state.doc))i.add(ee);kd(Z),Cd(Z);for(const ee of K)ja(Z,ee.id,ee.range.from,ee.range.to);for(const ee of J)Qa(Z,ee.id,ee.nodePos);return Z.docChanged?(Z.setMeta("addToHistory",!1),R.view.dispatch(Z),!0):!1}function W(A){var Z;const R=r.value;if(!R||!d())return!1;const{from:K,to:J,empty:te}=R.state.selection;return te||K>=J?!1:((Z=e.onCreate)==null||Z.call(e,{kind:"inline",from:K,to:J,rect:A??Me.posToDOMRect(R.view,K,J)}),!0)}function H(A,R){var J;const K=r.value;return!K||!d()?!1:((J=e.onCreate)==null||J.call(e,{kind:"block",nodePos:A,rect:R??Td(K,A)}),!0)}return{getCommentAnchors:m,applyCommentAnchors:z,addComment:B,removeCommentAnchor:D,requestInlineComment:W,requestBlockComment:H}}function Md(r){let e=!1,t=!1;function n(h){var v,b;const p=!!((b=(v=h.target).closest)!=null&&b.call(v,"td, th"));!e&&!t&&(p?(r.onBlockMouseLeave(),r.clearInsertButton()):(r.onBlockMouseMove(h),r.updateInsertButton())),r.onTableMouseMove(h)}function o(h){var w;const p=h.relatedTarget,v=document.querySelector(".block-btn-overlay"),b=document.querySelector(".pagely-insert-menu");v!=null&&v.contains(p)||b!=null&&b.contains(p)||(w=p==null?void 0:p.closest)!=null&&w.call(p,".table-tools-overlay")||(r.onBlockMouseLeave(),r.clearInsertButton(),r.scheduleTableHide())}function l(){e=!0,r.onBlockMouseLeave(),r.clearInsertButton(),r.closeBlockMenu(),r.closeInsertMenu()}function i(){e=!1}function s(){}function u(){!r.isBlockMenuVisible()&&!r.isInsertMenuVisible()&&(r.onBlockMouseLeave(),r.clearInsertButton())}function d(h){(h.ctrlKey||h.metaKey)&&h.shiftKey&&h.key.toLowerCase()==="v"&&(window.__pagelySkipNextPaste=!0),h.key==="Escape"&&(r.closeBlockMenu(),r.closeInsertMenu())}function m(h){t=h}return{onMove:n,onLeave:o,onEditorMouseDown:l,onDocMouseUp:i,onOverlayEnter:s,onOverlayLeave:u,onKeyDown:d,setHasSelection:m}}const qi={H1:{id:"H1",label:"一级标题",icon:L.Heading1},H2:{id:"H2",label:"二级标题",icon:L.Heading2},H3:{id:"H3",label:"三级标题",icon:L.Heading3},H4:{id:"H4",label:"四级标题",icon:L.Heading4},H5:{id:"H5",label:"五级标题",icon:L.Heading5},H6:{id:"H6",label:"六级标题",icon:L.Heading6},OL:{id:"OL",label:"有序列表",icon:L.ListOrdered},UL:{id:"UL",label:"无序列表",icon:L.List},TASK:{id:"TASK",label:"任务列表",icon:L.SquareCheckBig},PRE:{id:"PRE",label:"代码块",icon:L.CodeXml},BLOCKQUOTE:{id:"BLOCKQUOTE",label:"引用",icon:L.Quote},HR:{id:"HR",label:"分割线",icon:L.SeparatorHorizontal},FORMULA:{id:"FORMULA",label:"公式",icon:L.Sigma},COMMENT:{id:"COMMENT",label:"评论",icon:L.MessageSquare},IMAGE:{id:"IMAGE",label:"图片",icon:L.Image},FILE:{id:"FILE",label:"文件",icon:L.FileText},LINK:{id:"LINK",label:"链接",icon:L.Link2},CANVAS:{id:"CANVAS",label:"画板",icon:L.Workflow},MERMAID:{id:"MERMAID",label:"Mermaid 图表",icon:L.GitBranch},TABLE:{id:"TABLE",label:"表格",icon:L.Table,picker:"table"}},Ad=["H1","H2","H3","H4","H5","H6","OL","UL","TASK","PRE","BLOCKQUOTE","HR"],Ui=[{label:"基础",style:"tiles",items:Ad},{label:"常用",style:"list",items:["FORMULA","IMAGE","FILE","LINK","TABLE"]},{label:"绘图",style:"list",items:["CANVAS","MERMAID"]}],Wi=[{label:"常用",style:"list",items:["COMMENT","FORMULA"]}];function _i(r){return r.map(e=>({...e,items:e.items.map(t=>qi[t])}))}const Gi=_i(Ui),Ki=_i(Wi);function jl(r){const e=r.trim();if(!e)return"";try{return new URL(e).pathname||e}catch{return e.split(/[?#]/,1)[0]??e}}function Bd(r){const e=r.trim();if(!e)return null;try{const t=new URL(e);return t.protocol!=="blob:"?t:new URL(e.slice(5))}catch{return null}}function e0(r){var o;const n=(jl(r).split("/").filter(Boolean).pop()??"").match(/\.([a-z0-9]+)$/i);return((o=n==null?void 0:n[1])==null?void 0:o.toLowerCase())??""}function Nd(r){try{return new URL(r.trim()).protocol==="blob:"}catch{return!1}}function Dr(r){const e=Bd(r);return(e==null?void 0:e.host)||r}function Fn(r){const e=r.trim();if(!e)return"";let t=jl(e);try{t=new URL(e).pathname||e}catch{}const n=t.split("/").filter(Boolean).pop()??e;try{return decodeURIComponent(n)}catch{return n}}const Ld=new Set(["pdf","md","markdown","html","htm","txt","text","png","jpg","jpeg","gif","webp","svg","bmp","avif"]);function $n(r){const e=jl(r);return/\.pdf$/i.test(e)?"pdf":/\.(md|markdown)$/i.test(e)?"md":"url"}function Yi(r,e){const t=$n(r);return t==="url"&&e?$n(e):t}function Id(r,e=""){const t=Yi(r,e);return t==="pdf"?"card":t==="md"?"preview":"link"}function en(r,e=""){const t=$n(r),n=$n(e);if(t==="pdf"||t==="md"||n==="pdf"||n==="md")return!0;const o=e0(e)||e0(r);return o?Ld.has(o):Nd(r)?!1:Hr(r)}function Hr(r){const e=r.trim();if(!e)return!1;try{const t=new URL(e,"https://pagely.local/");if(t.protocol==="http:"||t.protocol==="https:")return!0;if(t.protocol!=="blob:")return!1;const n=new URL(e.slice(5));return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}const zd=new Set(["link","card","preview"]);function Dd(r,e,t){if(zd.has(t)){const o=t;return o==="preview"&&!en(r,e)?"link":o}const n=Id(r,e);return n==="preview"&&!en(r,e)?"link":n}function cr(r){var o,l;const e=((o=r.href)==null?void 0:o.trim())??"";if(!Hr(e))return null;const n=(((l=r.label)==null?void 0:l.trim())??"")||Fn(e)||e;return{href:e,label:n,view:Dd(e,n,r.preferredView)}}const or={H1:r=>r.setHeading({level:1}),H2:r=>r.setHeading({level:2}),H3:r=>r.setHeading({level:3}),H4:r=>r.setHeading({level:4}),H5:r=>r.setHeading({level:5}),H6:r=>r.setHeading({level:6}),OL:r=>r.toggleOrderedList(),UL:r=>r.toggleBulletList(),TASK:r=>r.toggleTaskList(),PRE:r=>r.setCodeBlock(),BLOCKQUOTE:r=>r.toggleBlockquote(),HR:r=>r.setHorizontalRule(),FORMULA:(r,e)=>r.insertInlineMath({latex:"\\placeholder",...(e==null?void 0:e.pos)!==void 0?{pos:e.pos}:{}}),COMMENT:()=>{},IMAGE:(r,e)=>{e!=null&&e.src&&r.insertImage({src:e.src,alt:e.alt??null,title:e.title??null})},FILE:(r,e)=>{const t=cr({href:(e==null?void 0:e.href)??"",label:(e==null?void 0:e.label)??(e==null?void 0:e.text)??"",preferredView:e==null?void 0:e.view});t&&r.insertEmbedView(t)},LINK:(r,e)=>{var o,l;const t=(o=e==null?void 0:e.href)==null?void 0:o.trim();if(!t)return;const n=((l=e==null?void 0:e.text)==null?void 0:l.trim())||t;r.insertContent({type:"text",text:n,marks:[{type:"link",attrs:{href:t,target:"_blank"}}]})},CANVAS:r=>r.insertDotFlowPadBlock(),MERMAID:r=>r.insertMermaidBlock(),TABLE:(r,e)=>r.insertTable({rows:(e==null?void 0:e.rows)??4,cols:(e==null?void 0:e.cols)??4,withHeaderRow:!0})},Ji={CANVAS:r=>r.insertDotFlowPadBlock(),MERMAID:r=>r.insertMermaidBlock()},xr={rowBefore:{id:"rowBefore",label:"在上方插入行",icon:L.ArrowUpToLine,kind:"cell-op"},rowAfter:{id:"rowAfter",label:"在下方插入行",icon:L.ArrowDownToLine,kind:"cell-op"},colBefore:{id:"colBefore",label:"在左侧插入列",icon:L.ArrowLeftToLine,kind:"cell-op"},colAfter:{id:"colAfter",label:"在右侧插入列",icon:L.ArrowRightToLine,kind:"cell-op"},delRow:{id:"delRow",label:"删除当前行",icon:L.Trash2,danger:!0,kind:"cell-op"},delCol:{id:"delCol",label:"删除当前列",icon:L.Trash2,danger:!0,kind:"cell-op"}},Od=[{label:"行列操作",style:"list",items:[xr.rowBefore,xr.rowAfter,xr.colBefore,xr.colAfter]},{label:"",style:"list",items:[xr.delRow,xr.delCol]}],Xi=[...Ki,...Od];function Vt(r){return"kind"in r&&r.kind==="cell-op"}function ji(r){const{$from:e}=r.state.selection;let t=0;for(let n=0;n<=e.depth;n++){const o=e.node(n).type.name;(o==="listItem"||o==="taskItem")&&t++}return t}function Qi(r){return r?!!(r.can().sinkListItem("listItem")||r.can().sinkListItem("taskItem")):!1}function Zi(r){return r?ji(r)>=2:!1}function es(r){r.can().sinkListItem("listItem")?r.chain().focus().sinkListItem("listItem").run():r.can().sinkListItem("taskItem")&&r.chain().focus().sinkListItem("taskItem").run()}function ts(r){ji(r)<2||(r.isActive("taskItem")?r.chain().focus().liftListItem("taskItem").run():r.chain().focus().liftListItem("listItem").run())}const Rd=["svg.lf-canvas-overlay",".lf-graph svg.lf-canvas-overlay",".lf-container svg.lf-canvas-overlay",".lf-container svg"];function t0(r){if(r.classList.contains("lucide")||r.closest(".eb-toolbar, .dfp-preview-overlay, .floating-left-bar, .canvas-extra-controls, .status-bar, .lf-control"))return!1;const e=r.getBoundingClientRect();return e.width>16&&e.height>16}function rs(r){if(!r)return null;for(const e of Rd){const t=r.querySelector(e);if(t&&t0(t))return t}return Array.from(r.querySelectorAll("svg")).find(e=>t0(e))??null}function lo(){function r(t){var o;const n="http://www.w3.org/2000/svg";for(const l of Array.from(t.querySelectorAll("foreignObject"))){const i=(o=l.textContent)==null?void 0:o.replace(/\s+/g," ").trim();if(!i){l.remove();continue}const s=Number(l.getAttribute("x"))||0,u=Number(l.getAttribute("y"))||0,d=Number(l.getAttribute("width"))||0,m=Number(l.getAttribute("height"))||0,h=document.createElementNS(n,"text");h.setAttribute("x",String(s+d/2)),h.setAttribute("y",String(u+m/2)),h.setAttribute("text-anchor","middle"),h.setAttribute("dominant-baseline","middle"),h.setAttribute("font-family","Arial, sans-serif"),h.setAttribute("font-size","14"),h.setAttribute("fill","#333"),h.textContent=i,l.replaceWith(h)}}async function e(t,n=2){var o;try{if(!("ClipboardItem"in window)||!((o=navigator.clipboard)!=null&&o.write))return!1;const l=t();if(!l)return!1;const i=l.getBoundingClientRect(),s=l.getAttribute("viewBox"),u=(s==null?void 0:s.split(/[\s,]+/).map(Number))??[],d=i.width||Number(l.getAttribute("width"))||u[2]||1,m=i.height||Number(l.getAttribute("height"))||u[3]||1,h=l.cloneNode(!0);r(h),h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.setAttribute("width",String(d)),h.setAttribute("height",String(m)),h.getAttribute("viewBox")||h.setAttribute("viewBox",`0 0 ${d} ${m}`);const p=new XMLSerializer().serializeToString(h),v=new Blob([p],{type:"image/svg+xml;charset=utf-8"}),b=URL.createObjectURL(v);try{const w=new Image,k=new Promise((B,D)=>{w.onload=()=>B(),w.onerror=()=>D(new Error("Failed to load SVG for PNG export"))});w.src=b,await k;const T=document.createElement("canvas");T.width=Math.max(1,Math.ceil(d*n)),T.height=Math.max(1,Math.ceil(m*n));const E=T.getContext("2d");if(!E)return!1;E.setTransform(n,0,0,n,0,0),E.fillStyle="#fff",E.fillRect(0,0,d,m),E.drawImage(w,0,0,d,m);const M=await new Promise(B=>{T.toBlob(B,"image/png")});return M?(await navigator.clipboard.write([new ClipboardItem({"image/png":M})]),!0):!1}finally{URL.revokeObjectURL(b)}}catch{return!1}}return{copyPngToClipboard:e}}function hr(r,e){const t=r.state.doc.nodeAt(e);return t?{node:t,from:e,to:e+t.nodeSize}:null}async function qn(r){if(r)try{await navigator.clipboard.writeText(r)}catch{}}async function ao(r,e){var t;try{return!("ClipboardItem"in window)||!((t=navigator.clipboard)!=null&&t.write)?(await qn(e),!0):(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})})]),!0)}catch{return await qn(e),!1}}function io(r,e,t){const n=r.state.doc.slice(e,t),l=Vn.DOMSerializer.fromSchema(r.schema).serializeFragment(n.content),i=document.createElement("div");return i.appendChild(l),i.innerHTML}function so(r,e){if(r.type.name==="image"){const t=r.attrs.src;if(typeof t=="string"&&t)return t}return r.textContent||e}function Pd(r,e){const t=hr(r,e);if(!t)return;const n=io(r,t.from,t.to);ao(n,so(t.node,n))}function Hd(r,e){const t=hr(r,e);!t||t.node.type.name!=="codeBlock"||qn(t.node.textContent)}function Vd(r,e){const t=hr(r,e);t&&r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function Fd(r,e){const t=hr(r,e);!t||t.node.type.name!=="codeBlock"||r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function $d(r,e){const t=hr(r,e);if(!t)return;const n=io(r,t.from,t.to),o=so(t.node,n);ao(n,o),r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function cn(r,e){const t=r.state.doc.nodeAt(e);if((t==null?void 0:t.type.name)==="table")return{node:t,from:e,to:e+t.nodeSize};try{const n=r.state.doc.resolve(e+1);for(let o=n.depth;o>=0;o--){const l=n.node(o);if(l.type.name==="table"){const i=n.before(o);return{node:l,from:i,to:i+l.nodeSize}}}}catch{return null}return null}function ns(r,e){let t=e+1;return r.descendants((n,o)=>n.isTextblock?(t=e+1+o+1,!1):!0),t}function qd(r,e){const t=cn(r,e);if(!t)return;const n=io(r,t.from,t.to);ao(n,so(t.node,n))}function Ud(r,e){const t=cn(r,e);if(!t)return;const n=io(r,t.from,t.to),o=so(t.node,n);ao(n,o),r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function Wd(r,e){const t=hr(r,e);if(!t||t.node.type.name!=="dotFlowPadBlock")return;const n=t.node.attrs.data;typeof n=="string"&&qn(n)}function _d(r,e){const t=hr(r,e);if(!t||t.node.type.name!=="dotFlowPadBlock")return;const n=r.view.nodeDOM(e);if(!n)return;const{copyPngToClipboard:o}=lo();o(()=>rs(n))}function Gd(r,e){const t=cn(r,e);t&&r.chain().focus().deleteRange({from:t.from,to:t.to}).run()}function Kd(r,e){const t=cn(r,e);t&&r.chain().focus().setTextSelection(ns(t.node,t.from)).toggleHeaderRow().run()}function Yd(r,e){const t=cn(r,e);t&&r.chain().focus().setTextSelection(ns(t.node,t.from)).toggleHeaderColumn().run()}const Po={copyBlock:Pd,copyCode:Hd,copyCanvasCode:Wd,copyCanvasImage:_d,copyTable:qd,cutTable:Ud,cutBlock:$d,deleteBlock:Vd,deleteCodeBlock:Fd,deleteTable:Gd,toggleTableHeaderRow:Kd,toggleTableHeaderColumn:Yd};function vl(r,e,t){var n;e!==null&&((n=Po[t])==null||n.call(Po,r,e))}function os(r){function e(i,s){try{const d=i.state.doc.resolve(s).parent;return d.type.name==="paragraph"&&d.content.size===0}catch{return!1}}function t(i,s){var p;const u=r.editor.value;if(!u)return;const d=u.chain().focus(),m=r.insertTargetPos.value,h=m!==null?m+1:void 0;if(h!==void 0&&d.setTextSelection(h),i==="FORMULA"){r.closeInsertMenu();const v=h??u.state.selection.from,b=e(u,v)?"block":"inline";r.openMathPopoverForInsert(v,r.getMathRectAtPos(v),b);return}(p=or[i])==null||p.call(or,d,{...s,pos:h}),d.run(),r.closeInsertMenu()}function n(i){var m;const s=r.editor.value;if(!s)return;r.focusHoveredCell();const u=s.state.selection.from;if(i==="FORMULA"){r.openMathPopoverForInsert(u,r.getMathRectAtPos(u),"inline");return}const d=s.chain().focus();(m=or[i])==null||m.call(or,d,{pos:u}),d.run()}function o(i){var s,u;(u=(s=r.cellOps)[i])==null||u.call(s)}function l(i){var v;const s=r.editor.value;if(!s)return;const u=Kl[i];if((u==null?void 0:u.action)==="indent"&&u.indentDir){r.focusBlockTarget(),u.indentDir==="inc"?es(s):ts(s),r.closeBlockMenu();return}if((u==null?void 0:u.action)==="op"&&u.op){vl(s,r.blockTargetPos.value,u.op),r.closeBlockMenu();return}const d=Ji[i];if(d){const b=s.chain().focus(),w=r.blockTargetPos.value;w!==null&&b.setTextSelection(w+1),d(b),b.run(),r.closeBlockMenu();return}const m=r.blockTargetPos.value,h=zr(r.blockSourceTag.value),p=s.chain().focus();m!==null&&p.setTextSelection(m+1),(v=h.applyConvert)==null||v.call(h,p,i),p.run(),r.closeBlockMenu()}return{onInsert:t,onCellInsert:n,onCellOp:o,onConvert:l}}function ls(r,e,t){const n=a.ref(!1);function o(){var s;const i=t();n.value=(i==null?void 0:i.tagName.toUpperCase())==="P"&&((s=i.textContent)==null?void 0:s.trim())===""}function l(){n.value=!1}return{isEmptyParagraph:n,updateFromCurrentBlock:o,clear:l}}const Jd=220;function as(r,e,t){const n=a.ref(!1),o=a.ref(0),l=a.ref(0),i=a.ref("left"),s=a.ref(null);let u=null;function d(){u&&(clearTimeout(u),u=null)}function m(){u||(u=setTimeout(()=>{n.value=!1,u=null},un))}function h(M,B,D){s.value=M,t(),d();const z=Yl(B,Gt,D,oo,Jd);o.value=z.top,l.value=z.left,i.value=z.placement,n.value=!0}function p(){const M=r();if(M===null)return;const B=e();B&&h(M,{top:B.top,left:B.left,width:B.width,height:B.height},"left")}function v(M,B){h(M,{top:B.top,left:B.left,width:B.width,height:B.height},"below")}function b(){d(),p()}function w(M){var D;const B=M.relatedTarget;(D=B==null?void 0:B.closest)!=null&&D.call(B,".pagely-insert-menu")||m()}function k(){d()}function T(){m()}function E(){n.value=!1}return a.onBeforeUnmount(d),{visible:n,top:o,left:l,placement:i,targetPos:s,openFromButton:p,openFromSlash:v,onButtonEnter:b,onButtonLeave:w,onMenuEnter:k,onMenuLeave:T,close:E,scheduleClose:m,clearHideTimer:d}}function Xd(r){const e=a.ref(!1),t=a.ref(null),n=a.ref(""),o=a.ref(null),l=a.ref("insert"),i=a.ref("inline");function s(b){var T;const w=(T=r.value)==null?void 0:T.view;if(!w)return null;const k=w.coordsAtPos(b);return new DOMRect(k.left,k.top,k.right-k.left,k.bottom-k.top)}function u(b,w,k="inline"){var E;const T=(E=r.value)==null?void 0:E.view.nodeDOM(w);t.value=(T==null?void 0:T.getBoundingClientRect())??s(w),n.value=b.attrs.latex,o.value=w,l.value="edit",i.value=k,e.value=!0}function d(b,w,k="inline"){t.value=w??s(b),n.value="",o.value=b,l.value="insert",i.value=k,e.value=!0}function m(){e.value=!1}function h(b){if(m(),!r.value||o.value===null)return;const w=b.trim();if(!w)return;const k=r.value.chain().focus(),T={latex:w,pos:o.value};l.value==="insert"?i.value==="block"?k.insertBlockMath(T):k.insertInlineMath(T):i.value==="block"?k.updateBlockMath(T):k.updateInlineMath(T),k.run()}function p(b){!e.value||o.value===null||(o.value=b.mapping.map(o.value,l.value==="insert"?1:-1))}function v(b){p(b.transaction);for(const w of b.appendedTransactions)p(w)}return a.onMounted(()=>{var b;(b=r.value)==null||b.on("transaction",v)}),a.onBeforeUnmount(()=>{var b;(b=r.value)==null||b.off("transaction",v)}),{visible:e,anchorRect:t,initialLatex:n,openForEdit:u,openForInsert:d,confirm:h,close:m,rectAtPos:s}}function jd(r){const{$from:e}=r.state.selection;for(let t=e.depth;t>0;t-=1)if(e.node(t).type.name==="codeBlock")return!0;return!1}function Ho(r){const{selection:e,doc:t}=r.state;if(!e.empty||jd(r))return null;const{$from:n}=e,o=n.start(),l=t.textBetween(o,e.from,`
2
2
  `,"\0"),i=/(?:^|\s)@([^\s@]*)$/.exec(l);if(!i)return null;const s=i[1]??"",u=o+l.length-s.length-1;return{query:s,from:u,to:e.from}}function Qd(r,e){const t=`@${e.displayName}`,n=e.from+t.length;if(e.from>=0&&n<=r.content.size&&r.textBetween(e.from,n,"")===t)return{from:e.from,to:n};const o=[];return r.descendants((l,i)=>{if(!l.isText||!l.text)return!0;let s=l.text.indexOf(t);for(;s>=0;){const u=i+s;o.push({from:u,to:u+t.length,distance:Math.abs(u-e.from)}),s=l.text.indexOf(t,s+t.length)}return!0}),o.sort((l,i)=>l.distance-i.distance),o[0]??null}function is(r,e={}){let t,n=null,o="",l=null,i=null,s=!1;function u(k,T=!1){var B;const E=k?Ho(k):null,M=(E==null?void 0:E.from)??(l==null?void 0:l.from)??null;s&&((B=e.onCancel)==null||B.call(e)),o="",l=null,s=!1,i=T?M:null}function d(k){var M;const T=Ho(k);if(!T){u();return}if(i===T.from)return;const E=`${T.from}:${T.to}:${T.query}`;l={from:T.from,to:T.to},E!==o&&(o=E,s=!0,(M=e.onTrigger)==null||M.call(e,{query:T.query,rect:Me.posToDOMRect(k.view,T.from,T.to)}))}function m(k){!k.transaction.docChanged&&!k.transaction.selectionSet||d(k.editor)}function h(k){t&&(k.key!=="Escape"&&k.key!=="Enter"&&k.key!==" "||u(t,k.key==="Escape"))}function p(k){t&&(t.off("transaction",m),n==null||n.removeEventListener("keydown",h,!0)),t=k,n=null,o="",l=null,i=null,s=!1,k&&(k.on("transaction",m),n=k.view.dom,n.addEventListener("keydown",h,!0))}a.watch(r,p,{immediate:!0}),a.onBeforeUnmount(()=>{p(void 0)});function v(k){const T=r.value;if(!T)return!1;const E=Ho(T),M=E?{from:E.from,to:E.to}:l;return l=null,o="",i=null,s=!1,M?T.chain().focus().insertContentAt(M,[{type:"mention",attrs:k},{type:"text",text:" "}]).run():T.commands.insertMention(k)}function b(){const k=r.value;if(!k)return[];const T=[];return k.state.doc.descendants((E,M)=>E.type.name!=="mention"?!0:(T.push({userId:String(E.attrs.userId??""),displayName:String(E.attrs.displayName??""),from:M,to:M+E.nodeSize}),!1)),T}function w(k){const T=r.value,E=T==null?void 0:T.state.schema.nodes.mention;if(!T||!E)return!1;let M=T.state.tr;for(const B of[...k].sort((D,z)=>z.from-D.from)){const D=Qd(M.doc,B);D&&(M=M.replaceWith(D.from,D.to,E.create({userId:B.userId,displayName:B.displayName})))}return M.docChanged?(M.setMeta("addToHistory",!1),T.view.dispatch(M),!0):!1}return{insertMention:v,getMentions:b,applyMentions:w}}const Zd={js:"javascript",ts:"typescript",py:"python",rb:"ruby",md:"markdown",sh:"bash",zsh:"bash",yml:"yaml",tf:"hcl"};function ss(r){const e=r.toLowerCase().trim();return Zd[e]??e}function r0(r){try{return JSON.stringify(JSON.parse(r))}catch{return r}}function e1(r,e){const n=(`${r}
3
3
  ${e}`.match(/`+/g)??[]).reduce((l,i)=>Math.max(l,i.length),0),o="`".repeat(Math.max(3,n+1));return`${o}${r}
4
4
  ${e}
@@ -304,7 +304,7 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
304
304
  |[ \r ]+
305
305
  ?)[ \r ]*`,_l="[̀-ͯ]",wh=new RegExp(_l+"+$"),kh="("+qu+"+)|"+(yh+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(_l+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(_l+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+bh)+("|"+vh+")");class ui{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(kh,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new it("EOF",new nt(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new _("Unexpected character: '"+e[t]+"'",new it(e[t],new nt(this,t,t+1)));var o=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[o]===14){var l=e.indexOf(`
306
306
  `,this.tokenRegex.lastIndex);return l===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=l+1,this.lex()}return new it(o,new nt(this,t,this.tokenRegex.lastIndex))}}class xh{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new _("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var o=0;o<this.undefStack.length;o++)delete this.undefStack[o][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var l=this.undefStack[this.undefStack.length-1];l&&!l.hasOwnProperty(e)&&(l[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var Ch=Lu;y("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});y("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}});y("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}});y("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}});y("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});y("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");y("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var ci={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};y("\\char",function(r){var e=r.popToken(),t,n=0;if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new _("\\char` missing argument");n=e.text.charCodeAt(0)}else t=10;if(t){if(n=ci[e.text],n==null||n>=t)throw new _("Invalid base-"+t+" digit "+e.text);for(var o;(o=ci[r.future().text])!=null&&o<t;)n*=t,n+=o,r.popToken()}return"\\@char{"+n+"}"});var ka=(r,e,t,n)=>{var o=r.consumeArg().tokens;if(o.length!==1)throw new _("\\newcommand's first argument must be a macro name");var l=o[0].text,i=r.isDefined(l);if(i&&!e)throw new _("\\newcommand{"+l+"} attempting to redefine "+(l+"; use \\renewcommand"));if(!i&&!t)throw new _("\\renewcommand{"+l+"} when command "+l+" does not yet exist; use \\newcommand");var s=0;if(o=r.consumeArg().tokens,o.length===1&&o[0].text==="["){for(var u="",d=r.expandNextToken();d.text!=="]"&&d.text!=="EOF";)u+=d.text,d=r.expandNextToken();if(!u.match(/^\s*[0-9]+\s*$/))throw new _("Invalid number of arguments: "+u);s=parseInt(u),o=r.consumeArg().tokens}return i&&n||r.macros.set(l,{tokens:o,numArgs:s}),""};y("\\newcommand",r=>ka(r,!1,!0,!1));y("\\renewcommand",r=>ka(r,!0,!1,!1));y("\\providecommand",r=>ka(r,!0,!0,!0));y("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});y("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});y("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),_t[t],Se.math[t],Se.text[t]),""});y("\\bgroup","{");y("\\egroup","}");y("~","\\nobreakspace");y("\\lq","`");y("\\rq","'");y("\\aa","\\r a");y("\\AA","\\r A");y("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");y("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");y("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");y("ℬ","\\mathscr{B}");y("ℰ","\\mathscr{E}");y("ℱ","\\mathscr{F}");y("ℋ","\\mathscr{H}");y("ℐ","\\mathscr{I}");y("ℒ","\\mathscr{L}");y("ℳ","\\mathscr{M}");y("ℛ","\\mathscr{R}");y("ℭ","\\mathfrak{C}");y("ℌ","\\mathfrak{H}");y("ℨ","\\mathfrak{Z}");y("\\Bbbk","\\Bbb{k}");y("\\llap","\\mathllap{\\textrm{#1}}");y("\\rlap","\\mathrlap{\\textrm{#1}}");y("\\clap","\\mathclap{\\textrm{#1}}");y("\\mathstrut","\\vphantom{(}");y("\\underbar","\\underline{\\text{#1}}");y("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');y("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");y("\\ne","\\neq");y("≠","\\neq");y("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");y("∉","\\notin");y("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");y("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");y("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");y("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");y("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");y("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");y("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");y("⟂","\\perp");y("‼","\\mathclose{!\\mkern-0.8mu!}");y("∌","\\notni");y("⌜","\\ulcorner");y("⌝","\\urcorner");y("⌞","\\llcorner");y("⌟","\\lrcorner");y("©","\\copyright");y("®","\\textregistered");y("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');y("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');y("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');y("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');y("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");y("⋮","\\vdots");y("\\varGamma","\\mathit{\\Gamma}");y("\\varDelta","\\mathit{\\Delta}");y("\\varTheta","\\mathit{\\Theta}");y("\\varLambda","\\mathit{\\Lambda}");y("\\varXi","\\mathit{\\Xi}");y("\\varPi","\\mathit{\\Pi}");y("\\varSigma","\\mathit{\\Sigma}");y("\\varUpsilon","\\mathit{\\Upsilon}");y("\\varPhi","\\mathit{\\Phi}");y("\\varPsi","\\mathit{\\Psi}");y("\\varOmega","\\mathit{\\Omega}");y("\\substack","\\begin{subarray}{c}#1\\end{subarray}");y("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");y("\\boxed","\\fbox{$\\displaystyle{#1}$}");y("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");y("\\implies","\\DOTSB\\;\\Longrightarrow\\;");y("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");y("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");y("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var di={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Th=new Set(["bin","rel"]);y("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in di?e=di[t]:(t.slice(0,4)==="\\not"||t in Se.math&&Th.has(Se.math[t].group))&&(e="\\dotsb"),e});var xa={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};y("\\dotso",function(r){var e=r.future().text;return e in xa?"\\ldots\\,":"\\ldots"});y("\\dotsc",function(r){var e=r.future().text;return e in xa&&e!==","?"\\ldots\\,":"\\ldots"});y("\\cdots",function(r){var e=r.future().text;return e in xa?"\\@cdots\\,":"\\@cdots"});y("\\dotsb","\\cdots");y("\\dotsm","\\cdots");y("\\dotsi","\\!\\cdots");y("\\dotsx","\\ldots\\,");y("\\DOTSI","\\relax");y("\\DOTSB","\\relax");y("\\DOTSX","\\relax");y("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");y("\\,","\\tmspace+{3mu}{.1667em}");y("\\thinspace","\\,");y("\\>","\\mskip{4mu}");y("\\:","\\tmspace+{4mu}{.2222em}");y("\\medspace","\\:");y("\\;","\\tmspace+{5mu}{.2777em}");y("\\thickspace","\\;");y("\\!","\\tmspace-{3mu}{.1667em}");y("\\negthinspace","\\!");y("\\negmedspace","\\tmspace-{4mu}{.2222em}");y("\\negthickspace","\\tmspace-{5mu}{.277em}");y("\\enspace","\\kern.5em ");y("\\enskip","\\hskip.5em\\relax");y("\\quad","\\hskip1em\\relax");y("\\qquad","\\hskip2em\\relax");y("\\tag","\\@ifstar\\tag@literal\\tag@paren");y("\\tag@paren","\\tag@literal{({#1})}");y("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new _("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});y("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");y("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");y("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");y("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");y("\\newline","\\\\\\relax");y("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Uu=Y(wt["Main-Regular"][84][1]-.7*wt["Main-Regular"][65][1]);y("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Uu+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");y("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Uu+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");y("\\hspace","\\@ifstar\\@hspacer\\@hspace");y("\\@hspace","\\hskip #1\\relax");y("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");y("\\ordinarycolon",":");y("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");y("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');y("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');y("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');y("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');y("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');y("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');y("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');y("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');y("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');y("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');y("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');y("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');y("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');y("∷","\\dblcolon");y("∹","\\eqcolon");y("≔","\\coloneqq");y("≕","\\eqqcolon");y("⩴","\\Coloneqq");y("\\ratio","\\vcentcolon");y("\\coloncolon","\\dblcolon");y("\\colonequals","\\coloneqq");y("\\coloncolonequals","\\Coloneqq");y("\\equalscolon","\\eqqcolon");y("\\equalscoloncolon","\\Eqqcolon");y("\\colonminus","\\coloneq");y("\\coloncolonminus","\\Coloneq");y("\\minuscolon","\\eqcolon");y("\\minuscoloncolon","\\Eqcolon");y("\\coloncolonapprox","\\Colonapprox");y("\\coloncolonsim","\\Colonsim");y("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");y("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");y("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");y("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");y("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");y("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");y("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");y("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");y("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");y("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");y("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");y("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");y("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");y("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");y("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");y("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");y("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");y("\\nleqq","\\html@mathml{\\@nleqq}{≰}");y("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");y("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");y("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");y("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");y("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");y("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");y("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");y("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");y("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");y("\\imath","\\html@mathml{\\@imath}{ı}");y("\\jmath","\\html@mathml{\\@jmath}{ȷ}");y("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");y("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");y("⟦","\\llbracket");y("⟧","\\rrbracket");y("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");y("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");y("⦃","\\lBrace");y("⦄","\\rBrace");y("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");y("⦵","\\minuso");y("\\darr","\\downarrow");y("\\dArr","\\Downarrow");y("\\Darr","\\Downarrow");y("\\lang","\\langle");y("\\rang","\\rangle");y("\\uarr","\\uparrow");y("\\uArr","\\Uparrow");y("\\Uarr","\\Uparrow");y("\\N","\\mathbb{N}");y("\\R","\\mathbb{R}");y("\\Z","\\mathbb{Z}");y("\\alef","\\aleph");y("\\alefsym","\\aleph");y("\\Alpha","\\mathrm{A}");y("\\Beta","\\mathrm{B}");y("\\bull","\\bullet");y("\\Chi","\\mathrm{X}");y("\\clubs","\\clubsuit");y("\\cnums","\\mathbb{C}");y("\\Complex","\\mathbb{C}");y("\\Dagger","\\ddagger");y("\\diamonds","\\diamondsuit");y("\\empty","\\emptyset");y("\\Epsilon","\\mathrm{E}");y("\\Eta","\\mathrm{H}");y("\\exist","\\exists");y("\\harr","\\leftrightarrow");y("\\hArr","\\Leftrightarrow");y("\\Harr","\\Leftrightarrow");y("\\hearts","\\heartsuit");y("\\image","\\Im");y("\\infin","\\infty");y("\\Iota","\\mathrm{I}");y("\\isin","\\in");y("\\Kappa","\\mathrm{K}");y("\\larr","\\leftarrow");y("\\lArr","\\Leftarrow");y("\\Larr","\\Leftarrow");y("\\lrarr","\\leftrightarrow");y("\\lrArr","\\Leftrightarrow");y("\\Lrarr","\\Leftrightarrow");y("\\Mu","\\mathrm{M}");y("\\natnums","\\mathbb{N}");y("\\Nu","\\mathrm{N}");y("\\Omicron","\\mathrm{O}");y("\\plusmn","\\pm");y("\\rarr","\\rightarrow");y("\\rArr","\\Rightarrow");y("\\Rarr","\\Rightarrow");y("\\real","\\Re");y("\\reals","\\mathbb{R}");y("\\Reals","\\mathbb{R}");y("\\Rho","\\mathrm{P}");y("\\sdot","\\cdot");y("\\sect","\\S");y("\\spades","\\spadesuit");y("\\sub","\\subset");y("\\sube","\\subseteq");y("\\supe","\\supseteq");y("\\Tau","\\mathrm{T}");y("\\thetasym","\\vartheta");y("\\weierp","\\wp");y("\\Zeta","\\mathrm{Z}");y("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");y("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");y("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");y("\\bra","\\mathinner{\\langle{#1}|}");y("\\ket","\\mathinner{|{#1}\\rangle}");y("\\braket","\\mathinner{\\langle{#1}\\rangle}");y("\\Bra","\\left\\langle#1\\right|");y("\\Ket","\\left|#1\\right\\rangle");var Wu=r=>e=>{var t=e.consumeArg().tokens,n=e.consumeArg().tokens,o=e.consumeArg().tokens,l=e.consumeArg().tokens,i=e.macros.get("|"),s=e.macros.get("\\|");e.macros.beginGroup();var u=h=>p=>{r&&(p.macros.set("|",i),o.length&&p.macros.set("\\|",s));var v=h;if(!h&&o.length){var b=p.future();b.text==="|"&&(p.popToken(),v=!0)}return{tokens:v?o:n,numArgs:0}};e.macros.set("|",u(!1)),o.length&&e.macros.set("\\|",u(!0));var d=e.consumeArg().tokens,m=e.expandTokens([...l,...d,...t]);return e.macros.endGroup(),{tokens:m.reverse(),numArgs:0}};y("\\bra@ket",Wu(!1));y("\\bra@set",Wu(!0));y("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");y("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");y("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");y("\\angln","{\\angl n}");y("\\blue","\\textcolor{##6495ed}{#1}");y("\\orange","\\textcolor{##ffa500}{#1}");y("\\pink","\\textcolor{##ff00af}{#1}");y("\\red","\\textcolor{##df0030}{#1}");y("\\green","\\textcolor{##28ae7b}{#1}");y("\\gray","\\textcolor{gray}{#1}");y("\\purple","\\textcolor{##9d38bd}{#1}");y("\\blueA","\\textcolor{##ccfaff}{#1}");y("\\blueB","\\textcolor{##80f6ff}{#1}");y("\\blueC","\\textcolor{##63d9ea}{#1}");y("\\blueD","\\textcolor{##11accd}{#1}");y("\\blueE","\\textcolor{##0c7f99}{#1}");y("\\tealA","\\textcolor{##94fff5}{#1}");y("\\tealB","\\textcolor{##26edd5}{#1}");y("\\tealC","\\textcolor{##01d1c1}{#1}");y("\\tealD","\\textcolor{##01a995}{#1}");y("\\tealE","\\textcolor{##208170}{#1}");y("\\greenA","\\textcolor{##b6ffb0}{#1}");y("\\greenB","\\textcolor{##8af281}{#1}");y("\\greenC","\\textcolor{##74cf70}{#1}");y("\\greenD","\\textcolor{##1fab54}{#1}");y("\\greenE","\\textcolor{##0d923f}{#1}");y("\\goldA","\\textcolor{##ffd0a9}{#1}");y("\\goldB","\\textcolor{##ffbb71}{#1}");y("\\goldC","\\textcolor{##ff9c39}{#1}");y("\\goldD","\\textcolor{##e07d10}{#1}");y("\\goldE","\\textcolor{##a75a05}{#1}");y("\\redA","\\textcolor{##fca9a9}{#1}");y("\\redB","\\textcolor{##ff8482}{#1}");y("\\redC","\\textcolor{##f9685d}{#1}");y("\\redD","\\textcolor{##e84d39}{#1}");y("\\redE","\\textcolor{##bc2612}{#1}");y("\\maroonA","\\textcolor{##ffbde0}{#1}");y("\\maroonB","\\textcolor{##ff92c6}{#1}");y("\\maroonC","\\textcolor{##ed5fa6}{#1}");y("\\maroonD","\\textcolor{##ca337c}{#1}");y("\\maroonE","\\textcolor{##9e034e}{#1}");y("\\purpleA","\\textcolor{##ddd7ff}{#1}");y("\\purpleB","\\textcolor{##c6b9fc}{#1}");y("\\purpleC","\\textcolor{##aa87ff}{#1}");y("\\purpleD","\\textcolor{##7854ab}{#1}");y("\\purpleE","\\textcolor{##543b78}{#1}");y("\\mintA","\\textcolor{##f5f9e8}{#1}");y("\\mintB","\\textcolor{##edf2df}{#1}");y("\\mintC","\\textcolor{##e0e5cc}{#1}");y("\\grayA","\\textcolor{##f6f7f7}{#1}");y("\\grayB","\\textcolor{##f0f1f2}{#1}");y("\\grayC","\\textcolor{##e3e5e6}{#1}");y("\\grayD","\\textcolor{##d6d8da}{#1}");y("\\grayE","\\textcolor{##babec2}{#1}");y("\\grayF","\\textcolor{##888d93}{#1}");y("\\grayG","\\textcolor{##626569}{#1}");y("\\grayH","\\textcolor{##3b3e40}{#1}");y("\\grayI","\\textcolor{##21242c}{#1}");y("\\kaBlue","\\textcolor{##314453}{#1}");y("\\kaGreen","\\textcolor{##71B307}{#1}");var _u={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Eh{constructor(e,t,n){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new xh(Ch,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new ui(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,o;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:o,end:n}=this.consumeArg(["]"])}else({tokens:o,start:t,end:n}=this.consumeArg());return this.pushToken(new it("EOF",n.loc)),this.pushTokens(o),new it("",nt.range(t,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var o=this.future(),l,i=0,s=0;do{if(l=this.popToken(),t.push(l),l.text==="{")++i;else if(l.text==="}"){if(--i,i===-1)throw new _("Extra }",l)}else if(l.text==="EOF")throw new _("Unexpected end of input in a macro argument, expected '"+(e&&n?e[s]:"}")+"'",l);if(e&&n)if((i===0||i===1&&e[s]==="{")&&l.text===e[s]){if(++s,s===e.length){t.splice(-s,s);break}}else s=0}while(i!==0||n);return o.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:o,end:l}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new _("The length of delimiters doesn't match the number of args!");for(var n=t[0],o=0;o<n.length;o++){var l=this.popToken();if(n[o]!==l.text)throw new _("Use of the macro doesn't match its definition",l)}}for(var i=[],s=0;s<e;s++)i.push(this.consumeArg(t&&t[s+1]).tokens);return i}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new _("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,o=t.noexpand?null:this._getExpansion(n);if(o==null||e&&o.unexpandable){if(e&&o==null&&n[0]==="\\"&&!this.isDefined(n))throw new _("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var l=o.tokens,i=this.consumeArgs(o.numArgs,o.delimiters);if(o.numArgs){l=l.slice();for(var s=l.length-1;s>=0;--s){var u=l[s];if(u.text==="#"){if(s===0)throw new _("Incomplete placeholder at end of macro body",u);if(u=l[--s],u.text==="#")l.splice(s+1,1);else if(/^[1-9]$/.test(u.text))l.splice(s,2,...i[+u.text-1]);else throw new _("Not a valid argument number",u)}}}return this.pushTokens(l),l.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new it(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var o=this.stack.pop();o.treatAsRelax&&(o.noexpand=!1,o.treatAsRelax=!1),t.push(o)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(n=>n.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var o=typeof t=="function"?t(this):t;if(typeof o=="string"){var l=0;if(o.includes("#"))for(var i=o.replace(/##/g,"");i.includes("#"+(l+1));)++l;for(var s=new ui(o,this.settings),u=[],d=s.lex();d.text!=="EOF";)u.push(d),d=s.lex();u.reverse();var m={tokens:u,numArgs:l};return m}return o}isDefined(e){return this.macros.has(e)||_t.hasOwnProperty(e)||Se.math.hasOwnProperty(e)||Se.text.hasOwnProperty(e)||_u.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:_t.hasOwnProperty(e)&&!_t[e].primitive}}var fi=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,In=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),cl={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},mi={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Mo{constructor(e,t){this.mode="math",this.gullet=new Eh(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new _("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new it("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var o=this.fetch();if(Mo.endOfExpression.has(o.text)||t&&o.text===t||e&&_t[o.text]&&_t[o.text].infix)break;var l=this.parseAtom(t);if(l){if(l.type==="internal")continue}else break;n.push(l)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t=-1,n,o=0;o<e.length;o++){var l=e[o];if(l.type==="infix"){if(t!==-1)throw new _("only one infix operator per group",l.token);t=o,n=l.replaceWith}}if(t!==-1&&n){var i,s,u=e.slice(0,t),d=e.slice(t+1);u.length===1&&u[0].type==="ordgroup"?i=u[0]:i={type:"ordgroup",mode:this.mode,body:u},d.length===1&&d[0].type==="ordgroup"?s=d[0]:s={type:"ordgroup",mode:this.mode,body:d};var m;return n==="\\\\abovefrac"?m=this.callFunction(n,[i,e[t],s],[]):m=this.callFunction(n,[i,s],[]),[m]}else return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var o;do{var l;o=this.parseGroup(e)}while(((l=o)==null?void 0:l.type)==="internal");if(!o)throw new _("Expected group after '"+n+"'",t);return o}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var o={type:"text",mode:this.mode,body:t},l={type:"color",mode:this.mode,color:this.settings.errorColor,body:[o]};return l}parseAtom(e){var t=this.parseGroup("atom",e);if((t==null?void 0:t.type)==="internal"||this.mode==="text")return t;for(var n,o;;){this.consumeSpaces();var l=this.fetch();if(l.text==="\\limits"||l.text==="\\nolimits"){if(t&&t.type==="op"){var i=l.text==="\\limits";t.limits=i,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=l.text==="\\limits");else throw new _("Limit controls must follow a math operator",l);this.consume()}else if(l.text==="^"){if(n)throw new _("Double superscript",l);n=this.handleSupSubscript("superscript")}else if(l.text==="_"){if(o)throw new _("Double subscript",l);o=this.handleSupSubscript("subscript")}else if(l.text==="'"){if(n)throw new _("Double superscript",l);var s={type:"textord",mode:this.mode,text:"\\prime"},u=[s];for(this.consume();this.fetch().text==="'";)u.push(s),this.consume();this.fetch().text==="^"&&u.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:u}}else if(In[l.text]){var d=fi.test(l.text),m=[];for(m.push(new it(In[l.text])),this.consume();;){var h=this.fetch().text;if(!In[h]||fi.test(h)!==d)break;m.unshift(new it(In[h])),this.consume()}var p=this.subparse(m);d?o={type:"ordgroup",mode:"math",body:p}:n={type:"ordgroup",mode:"math",body:p}}else break}return n||o?{type:"supsub",mode:this.mode,base:t,sup:n,sub:o}:t}parseFunction(e,t){var n=this.fetch(),o=n.text,l=_t[o];if(!l)return null;if(this.consume(),t&&t!=="atom"&&!l.allowedInArgument)throw new _("Got function '"+o+"' with no arguments"+(t?" as "+t:""),n);if(this.mode==="text"&&!l.allowedInText)throw new _("Can't use function '"+o+"' in text mode",n);if(this.mode==="math"&&l.allowedInMath===!1)throw new _("Can't use function '"+o+"' in math mode",n);var{args:i,optArgs:s}=this.parseArguments(o,l);return this.callFunction(o,i,s,n,e)}callFunction(e,t,n,o,l){var i={funcName:e,parser:this,token:o,breakOnTokenText:l},s=_t[e];if(s&&s.handler)return s.handler(i,t,n);throw new _("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var o=[],l=[],i=0;i<n;i++){var s=t.argTypes&&t.argTypes[i],u=i<t.numOptionalArgs;("primitive"in t&&t.primitive&&s==null||t.type==="sqrt"&&i===1&&l[0]==null)&&(s="primitive");var d=this.parseGroupOfType("argument to '"+e+"'",s,u);if(u)l.push(d);else if(d!=null)o.push(d);else throw new _("Null argument, please report this as a bug")}return{args:o,optArgs:l}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":{var o=this.parseArgumentGroup(n,"text");return o!=null?{type:"styling",mode:o.mode,body:[o],style:"text"}:null}case"raw":{var l=this.parseStringGroup("raw",n);return l!=null?{type:"raw",mode:"text",string:l.text}:null}case"primitive":{if(n)throw new _("A primitive argument cannot be optional");var i=this.parseGroup(e);if(i==null)throw new _("Expected group as "+e,this.fetch());return i}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new _("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var o="",l;(l=this.fetch()).text!=="EOF";)o+=l.text,this.consume();return this.consume(),n.text=o,n}parseRegexGroup(e,t){for(var n=this.fetch(),o=n,l="",i;(i=this.fetch()).text!=="EOF"&&e.test(l+i.text);)o=i,l+=o.text,this.consume();if(l==="")throw new _("Invalid "+t+": '"+n.text+"'",n);return n.range(o,l)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new _("Invalid color: '"+t.text+"'",t);var o=n[0];return/^[0-9a-f]{6}$/i.test(o)&&(o="#"+o),{type:"color-token",mode:this.mode,color:o}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",n=!0);var o=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!o)throw new _("Invalid size: '"+t.text+"'",t);var l={number:+(o[1]+o[2]),unit:o[3]};if(!Zs(l))throw new _("Invalid unit: '"+l.unit+"'",t);return{type:"size",mode:this.mode,value:l,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var o=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var l=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var i={type:"ordgroup",mode:this.mode,loc:n.loc,body:l};return t&&this.switchMode(o),i}parseGroup(e,t){var n=this.fetch(),o=n.text,l;if(o==="{"||o==="\\begingroup"){this.consume();var i=o==="{"?"}":"\\endgroup";this.gullet.beginGroup();var s=this.parseExpression(!1,i),u=this.fetch();this.expect(i),this.gullet.endGroup(),l={type:"ordgroup",mode:this.mode,loc:nt.range(n,u),body:s,semisimple:o==="\\begingroup"||void 0}}else if(l=this.parseFunction(t,e)||this.parseSymbol(),l==null&&o[0]==="\\"&&!_u.hasOwnProperty(o)){if(this.settings.throwOnError)throw new _("Undefined control sequence: "+o,n);l=this.formatUnsupportedCmd(o),this.consume()}return l}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var o=e[n];if(o.type==="textord"){var l=o.text,i=e[n+1];if(!(!i||i.type!=="textord")){if(l==="-"&&i.text==="-"){var s=e[n+2];n+1<t&&s&&s.type==="textord"&&s.text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:nt.range(o,s),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:nt.range(o,i),text:"--"}),t-=1)}(l==="'"||l==="`")&&i.text===l&&(e.splice(n,2,{type:"textord",mode:"text",loc:nt.range(o,i),text:l+l}),t-=1)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),o=n.charAt(0)==="*";if(o&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new _(`\\verb assertion failed --
307
- please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:o}}mi.hasOwnProperty(t[0])&&!Se[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=mi[t[0]]+t.slice(1));var l=wh.exec(t);l&&(t=t.substring(0,l.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var i;if(Se[this.mode][t]){this.settings.strict&&this.mode==="math"&&Rl.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var s=Se[this.mode][t].group,u=nt.range(e),d;if(km.hasOwnProperty(s)){var m=s;d={type:"atom",mode:this.mode,family:m,loc:u,text:t}}else d={type:s,mode:this.mode,loc:u,text:t};i=d}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Qs(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),i={type:"textord",mode:"text",loc:nt.range(e),text:t};else return null;if(this.consume(),l)for(var h=0;h<l[0].length;h++){var p=l[0][h];if(!cl[p])throw new _("Unknown accent ' "+p+"'",e);var v=cl[p][this.mode]||cl[p].text;if(!v)throw new _("Accent "+p+" unsupported in "+this.mode+" mode",e);i={type:"accent",mode:this.mode,loc:nt.range(e),label:v,isStretchy:!1,isShifty:!0,base:i}}return i}}Mo.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Ca=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Mo(e,t);delete n.gullet.macros.current["\\df@tag"];var o=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new _("\\tag works only in display equations");o=[{type:"tag",mode:"text",body:o,tag:n.subparse([new it("\\df@tag")])}]}return o},Gu=function(e,t,n){t.textContent="";var o=Ta(e,n).toNode();t.appendChild(o)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Gu=function(){throw new _("KaTeX doesn't work in quirks mode.")});var Sh=function(e,t){var n=Ta(e,t).toMarkup();return n},Mh=function(e,t){var n=new ca(t);return Ca(e,n)},Ku=function(e,t,n){if(n.throwOnError||!(e instanceof _))throw e;var o=U(["katex-error"],[new ut(t)]);return o.setAttribute("title",e.toString()),o.setAttribute("style","color:"+n.errorColor),o},Ta=function(e,t){var n=new ca(t);try{var o=Ca(e,n);return Pm(o,e,n)}catch(l){return Ku(l,e,n)}},Ah=function(e,t){var n=new ca(t);try{var o=Ca(e,n);return Hm(o,e,n)}catch(l){return Ku(l,e,n)}},Bh="0.16.45",Nh={Span:$r,Anchor:po,SymbolNode:ut,SvgNode:zt,PathNode:Jt,LineNode:Ol},Yu={version:Bh,render:Gu,renderToString:Sh,ParseError:_,SETTINGS_SCHEMA:Il,__parse:Mh,__renderToDomTree:Ta,__renderToHTMLTree:Ah,__setFontMetrics:ym,__defineSymbol:c,__defineFunction:j,__defineMacro:y,__domTree:Nh};const Lh=Ni.BlockMath.extend({addNodeView(){const{katexOptions:r}=this.options;return({node:e,getPos:t})=>{let n=e;const o=document.createElement("div"),l=document.createElement("div");o.classList.add("tiptap-mathematics-render"),this.editor.isEditable&&o.classList.add("tiptap-mathematics-render--editable"),l.className="block-math-inner",o.appendChild(l);const i=()=>{const d=We(n.attrs.commentIds);o.dataset.type="block-math",o.setAttribute("data-latex",n.attrs.latex),d.length>0?(o.setAttribute("data-comment-ids",JSON.stringify(d)),o.classList.add("pagely-comment-block"),d.length>1?o.setAttribute("data-comment-count",String(d.length)):o.removeAttribute("data-comment-count")):(o.removeAttribute("data-comment-ids"),o.removeAttribute("data-comment-count"),o.classList.remove("pagely-comment-block"))};function s(){try{Yu.render(n.attrs.latex,l,r),o.classList.remove("block-math-error")}catch{l.textContent=n.attrs.latex,o.classList.add("block-math-error")}}const u=d=>{var h,p;d.preventDefault(),d.stopPropagation();const m=t();m!=null&&((p=(h=this.options).onClick)==null||p.call(h,n,m))};return this.options.onClick&&o.addEventListener("click",u),i(),s(),{dom:o,update:d=>{if(d.type!==n.type)return!1;const m=d.attrs.latex!==n.attrs.latex;return n=d,i(),m&&s(),!0},destroy(){o.removeEventListener("click",u)}}}}}),Ih=Me.Extension.create({name:"Mathematics",addOptions(){return{inlineOptions:void 0,blockOptions:void 0,katexOptions:void 0}},addExtensions(){return[Lh.configure({...this.options.blockOptions,katexOptions:this.options.katexOptions}),Ni.InlineMath.configure({...this.options.inlineOptions,katexOptions:this.options.katexOptions})]}}),zh=["paragraph","heading","blockquote","bulletList","orderedList","listItem","taskList","taskItem","codeBlock","table","tableRow","tableCell","tableHeader","image","mermaidBlock","dotFlowPadBlock","blockMath","embedView"],Ju=Me.Extension.create({name:"commentBlock",addGlobalAttributes(){return[{types:zh,attributes:{commentIds:{default:[],parseHTML:r=>We(r.getAttribute("data-comment-ids")),renderHTML:r=>{const e=We(r.commentIds);if(e.length===0)return{};const t={"data-comment-ids":JSON.stringify(e),class:"pagely-comment-block"};return e.length>1&&(t["data-comment-count"]=String(e.length)),t}}}}]}});function Dh(r){return r.filter(e=>e.type.name!=="commentMark")}function Xu(r){const e=Dh(r.marks);if(r.isText)return r.mark(e);const t=Array.isArray(r.attrs.commentIds)&&r.attrs.commentIds.length>0?{...r.attrs,commentIds:[]}:r.attrs,n=[];return r.content.forEach(o=>{n.push(Xu(o))}),r.type.create(t,Vn.Fragment.fromArray(n),e)}function Oh(r){const e=[];return r.content.forEach(t=>{e.push(Xu(t))}),new Vn.Slice(Vn.Fragment.fromArray(e),r.openStart,r.openEnd)}const ju=Me.Mark.create({name:"commentMark",priority:1001,inclusive:!1,addAttributes(){return{commentIds:{default:[],parseHTML:r=>We(r.getAttribute("data-comment-ids")),renderHTML:r=>({"data-comment-ids":JSON.stringify(We(r.commentIds))})}}},parseHTML(){return[{tag:"span[data-comment-ids]"}]},renderHTML({HTMLAttributes:r}){const e=We(r["data-comment-ids"]),t={class:"pagely-comment-inline"};return e.length>1&&(t["data-comment-count"]=String(e.length)),["span",Me.mergeAttributes(t,r),0]},addProseMirrorPlugins(){return[new mr.Plugin({key:new mr.PluginKey("commentPasteStrip"),props:{transformPasted(r){return Oh(r)}}})]}});function hi(r,e){const t=We(e.attrs.commentIds);if(t.length>0){r.classList.add("pagely-comment-block"),r.setAttribute("data-comment-ids",JSON.stringify(t)),t.length>1?r.setAttribute("data-comment-count",String(t.length)):r.removeAttribute("data-comment-count");return}r.classList.remove("pagely-comment-block"),r.removeAttribute("data-comment-ids"),r.removeAttribute("data-comment-count")}class Rh extends Kr.TableView{constructor(e,t,n){super(e,t),hi(this.dom,e)}update(e){return super.update(e)?(hi(this.dom,e),!0):!1}}const Ph={class:"eb-shell"},Hh={class:"eb-label"},Vh={key:0,class:"eb-copy-tip"},Fh={key:0,class:"eb-copy-tip"},$h={class:"eb-label"},Ea=a.defineComponent({__name:"EmbedBlockShell",props:{label:{},fullscreen:{type:Boolean,default:!1},beforeCloseFullscreen:{},canCopySource:{type:Boolean,default:!0},canCopyImage:{type:Boolean,default:!1},canFullscreen:{type:Boolean,default:!0},fullscreenCloseLabel:{default:"完成"}},emits:["update:fullscreen","copy-source","copy-image"],setup(r,{expose:e,emit:t}){const n=t,o=a.ref(!1),l=a.ref(!1);let i=null,s=null;function u(p){const v=p==="source"?o:l,b=p==="source"?i:s;b&&clearTimeout(b),v.value=!0;const w=setTimeout(()=>{v.value=!1,p==="source"?i=null:s=null},1500);p==="source"?i=w:s=w}function d(){n("update:fullscreen",!0)}function m(){n("copy-source")}function h(){n("copy-image")}return e({showCopyTip:u}),a.onBeforeUnmount(()=>{i&&clearTimeout(i),s&&clearTimeout(s)}),(p,v)=>(a.openBlock(),a.createElementBlock("div",Ph,[a.createElementVNode("div",{class:"eb-toolbar",onMousedown:v[0]||(v[0]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",Hh,a.toDisplayString(r.label),1),a.renderSlot(p.$slots,"toolbar-before-actions"),v[2]||(v[2]=a.createElementVNode("div",{class:"eb-spacer"},null,-1)),a.renderSlot(p.$slots,"toolbar-extra"),r.canCopyImage?(a.openBlock(),a.createElementBlock("button",{key:0,class:"eb-btn",type:"button",title:"复制为图片",onClick:h},[a.createVNode(a.unref(L.Image),{size:14,"stroke-width":1.4}),l.value?(a.openBlock(),a.createElementBlock("span",Vh,"已复制")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),r.canCopySource?(a.openBlock(),a.createElementBlock("button",{key:1,class:"eb-btn",type:"button",title:"复制源码",onClick:m},[a.createVNode(a.unref(L.Copy),{size:14,"stroke-width":1.4}),o.value?(a.openBlock(),a.createElementBlock("span",Fh,"已复制")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),r.canFullscreen?(a.openBlock(),a.createElementBlock("button",{key:2,class:"eb-btn",type:"button",title:"全屏",onClick:d},[a.createVNode(a.unref(L.Maximize2),{size:14,"stroke-width":1.4})])):a.createCommentVNode("",!0)],32),a.renderSlot(p.$slots,"inline"),r.canFullscreen?(a.openBlock(),a.createBlock(ho,{key:0,open:r.fullscreen,"before-close":r.beforeCloseFullscreen,"close-label":r.fullscreenCloseLabel,"onUpdate:open":v[1]||(v[1]=b=>n("update:fullscreen",b))},{toolbar:a.withCtx(()=>[a.createElementVNode("span",$h,a.toDisplayString(r.label),1)]),body:a.withCtx(()=>[a.renderSlot(p.$slots,"fullscreen")]),_:3},8,["open","before-close","close-label"])):a.createCommentVNode("",!0)]))}}),qh={key:1,class:"dfp-preview-overlay"},Uh=a.defineComponent({__name:"DotFlowPadBlockView",props:{decorations:{},selected:{type:Boolean},updateAttributes:{type:Function},deleteNode:{type:Function},node:{},view:{},getPos:{},innerDecorations:{},editor:{},extension:{},HTMLAttributes:{}},setup(r){const e=r,{commentAttrs:t,commentClass:n}=hn(()=>e.node.attrs),o=a.ref(null),l=a.ref(null),i=a.ref(null),s=a.ref(null),u=a.ref(!1),d=a.ref(null),{copyPngToClipboard:m}=lo(),h=a.computed(()=>e.editor.isEditable),p=a.ref(!1);a.onMounted(()=>a.nextTick(()=>{p.value=!0,h.value&&e.node.attrs.autoOpen&&(a.nextTick(()=>w()),b({autoOpen:!1}))}));const v=a.computed(()=>{try{return JSON.parse(e.node.attrs.data)}catch{return{nodes:[],edges:[]}}});a.watch(v,B=>{!u.value&&o.value&&(o.value.setData(B),setTimeout(()=>{var D,z;return(z=(D=o.value)==null?void 0:D.fitView)==null?void 0:z.call(D)},100))});function b(B){var A,R;const D=(A=e.getPos)==null?void 0:A.call(e);if(D===void 0||!((R=e.editor)!=null&&R.view))return;const{state:z,dispatch:W}=e.editor.view,H=z.doc.nodeAt(D);H&&W(z.tr.setNodeMarkup(D,void 0,{...H.attrs,...B}))}function w(){u.value=!0}function k(){h.value&&w()}function T(){var D;if(!h.value)return;const B=(D=l.value)==null?void 0:D.getData();B&&(b({data:JSON.stringify(B)}),a.nextTick(()=>{var z;(z=o.value)==null||z.setData(B),setTimeout(()=>{var W,H;return(H=(W=o.value)==null?void 0:W.fitView)==null?void 0:H.call(W)},100)}))}async function E(){var B;try{await navigator.clipboard.writeText(e.node.attrs.data),(B=d.value)==null||B.showCopyTip("source")}catch{}}async function M(){var z;const B=u.value?s.value:i.value;await m(()=>rs(B))&&((z=d.value)==null||z.showCopyTip("image"))}return(B,D)=>(a.openBlock(),a.createBlock(a.unref(_e.NodeViewWrapper),a.mergeProps({"data-type":"dot-flow-pad",class:a.unref(n)},a.unref(t)),{default:a.withCtx(()=>[a.createVNode(Ea,{ref_key:"shellRef",ref:d,class:"dot-flow-pad-block-wrap",label:"画板",fullscreen:u.value,"onUpdate:fullscreen":D[0]||(D[0]=z=>u.value=z),"before-close-fullscreen":T,"can-copy-source":!0,"can-copy-image":!0,"can-fullscreen":!0,onCopySource:E,onCopyImage:M},{inline:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"inlineWrap",ref:i,class:"dfp-canvas-wrap dfp-preview",onClick:k},[p.value?(a.openBlock(),a.createBlock(a.unref(Ga.DotFlowPad),{key:0,ref_key:"inlineRef",ref:o,"initial-data":v.value,readonly:!0,class:"dfp-preview-canvas"},null,8,["initial-data"])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",qh,[a.createVNode(a.unref(L.Maximize2),{size:20,"stroke-width":1.4}),D[1]||(D[1]=a.createElementVNode("span",null,"点击编辑",-1))])):a.createCommentVNode("",!0)],512)]),fullscreen:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"fullscreenWrap",ref:s,class:"dfp-fullscreen-canvas"},[u.value?(a.openBlock(),a.createBlock(a.unref(Ga.DotFlowPad),{key:0,ref_key:"fullscreenRef",ref:l,"initial-data":v.value,readonly:!h.value},null,8,["initial-data","readonly"])):a.createCommentVNode("",!0)],512)]),_:1},8,["fullscreen"])]),_:1},16,["class"]))}}),gt=(r,e)=>{const t=r.__vccOpts||r;for(const[n,o]of e)t[n]=o;return t},Wh=gt(Uh,[["__scopeId","data-v-50011b37"]]),Qu=Me.Node.create({name:"dotFlowPadBlock",content:"",marks:"",group:"block",atom:!0,defining:!0,isolating:!0,addAttributes(){return{data:{default:JSON.stringify({nodes:[],edges:[]}),parseHTML:r=>r.getAttribute("data-graph")??JSON.stringify({nodes:[],edges:[]}),renderHTML:r=>({"data-graph":r.data})},autoOpen:{default:!1,parseHTML:()=>!1,renderHTML:()=>({})}}},parseHTML(){return[{tag:'div[data-type="dot-flow-pad"]'}]},renderHTML({HTMLAttributes:r}){return["div",Me.mergeAttributes(r,{"data-type":"dot-flow-pad"})]},addNodeView(){return _e.VueNodeViewRenderer(Wh)},addCommands(){return{insertDotFlowPadBlock:()=>({commands:r})=>r.insertContent({type:this.name,attrs:{data:JSON.stringify({nodes:[],edges:[]}),autoOpen:!0}})}}}),_h='.ProseMirror p{margin:3px 0}.ProseMirror p.is-empty:before,.ProseMirror p:first-child:empty:before{content:attr(data-placeholder);float:left;color:#bbbfc4;pointer-events:none;height:0}.ProseMirror h1{font-size:1.875em;font-weight:700;margin:28px 0 6px;color:#1f2329;line-height:1.4}.ProseMirror h2{font-size:1.375em;font-weight:600;margin:22px 0 4px;color:#1f2329;line-height:1.5}.ProseMirror h3{font-size:1.125em;font-weight:600;margin:16px 0 3px;color:#1f2329}.ProseMirror h4{font-size:1em;font-weight:600;margin:12px 0 2px;color:#1f2329}.ProseMirror h5{font-size:.925em;font-weight:600;margin:10px 0 2px;color:#646a73}.ProseMirror h6{font-size:.875em;font-weight:600;margin:8px 0 2px;color:#646a73}.ProseMirror>h1:first-child{font-size:2.125em;margin-top:8px}.ProseMirror code{background:#1c73e812;border:1px solid rgba(28,115,232,.18);border-radius:4px;padding:1px 4px;font-size:.875em;font-family:monospace;color:#3370ff}.ProseMirror blockquote{border-left:3px solid #dee0e3;margin:6px 0;padding:2px 14px;color:#646a73}.ProseMirror ul,.ProseMirror ol{padding-left:1.5em;margin:4px 0}.ProseMirror li{margin:2px 0}.ProseMirror ol{list-style-type:decimal}.ProseMirror ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol{list-style-type:lower-roman}.ProseMirror ol ol ol ol{list-style-type:decimal}.ProseMirror ol ol ol ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol ol ol ol{list-style-type:lower-roman}.ProseMirror hr{border:none;border-top:1px solid #dee0e3;margin:16px 0}.ProseMirror a.pm-link{color:#3370ff;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.ProseMirror a.pm-link:hover{color:#2860de}.link-loading-icon{display:inline-flex;align-items:center;vertical-align:middle;margin-left:1px;color:#8f959e;pointer-events:none;-webkit-user-select:none;user-select:none}.link-loading-icon svg{animation:link-spin .75s linear infinite}@keyframes link-spin{to{transform:rotate(360deg)}}.heading-collapsed-content{display:none!important}.ProseMirror ul[data-type=taskList]{list-style:none;padding-left:.5em}.ProseMirror ul[data-type=taskList] li{display:flex;align-items:flex-start;gap:8px}.ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:3px}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer}.ProseMirror ul[data-type=taskList] li>div{flex:1}.ProseMirror ul[data-type=taskList] li>div>p{margin:0}.ProseMirror ul[data-type=taskList] li[data-checked=true]>div{color:#8f959e;text-decoration:line-through}.ProseMirror table{border-collapse:collapse;width:100%;margin:10px 0;table-layout:fixed}.ProseMirror td,.ProseMirror th{border:1px solid #dee0e3;padding:7px 12px;min-width:80px;vertical-align:top;position:relative;transition:background .1s}.ProseMirror th{background:#f4f5f6;font-weight:600;text-align:left;color:#1f2329;font-size:.9em}.ProseMirror td>p,.ProseMirror th>p{margin:0}.ProseMirror .selectedCell:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:#3370ff1a;pointer-events:none}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;background-color:#3370ff;cursor:col-resize;pointer-events:all;z-index:1}.ProseMirror table:hover{box-shadow:0 0 0 2px #3370ff38;border-radius:2px}.code-block-cm{background:#f4f5f6;margin:8px 0}.code-block-cm.is-collapsed .cm-editor-wrap{display:none}.cm-title-input{flex:1;min-width:0;border:none;background:transparent;font-size:12px;color:#1f2329;outline:none;padding:2px 4px}.cm-title-input::placeholder{color:#bbbfc4}.cm-title-input--fullscreen{max-width:260px}.cm-lang-select{border:1px solid #dee0e3;border-radius:4px;background:#fff;font-size:11px;color:#646a73;padding:2px 4px;cursor:pointer;outline:none;max-width:110px}.cm-lang-select:hover{border-color:#3370ff}.cm-chevron{transition:transform .15s ease}.cm-chevron.collapsed{transform:rotate(-90deg)}.cm-editor-wrap{overflow:hidden}.cm-editor-wrap .cm-editor{max-height:600px}.cm-editor-wrap--fullscreen{height:100%;background:#f4f5f6}.cm-editor-wrap--fullscreen .cm-editor{height:100%;max-height:none}.cm-editor-wrap--fullscreen .cm-scroller{height:100%}.ProseMirror>.code-block-cm:hover{background:#f4f5f6}.wl-toolbar{position:fixed;display:flex;align-items:center;gap:2px;height:44px;padding:0 8px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:6px;box-shadow:0 3px 10px #0000001f;z-index:9999;white-space:nowrap}.wl-tb-url{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#646a73;background:#f4f5f6;border:1px solid #e4e5e7;border-radius:4px;padding:2px 7px;margin-right:2px}.wl-tb-btn{display:flex;align-items:center;justify-content:center;width:30px;height:30px;border:none;background:transparent;border-radius:4px;color:#646a73;cursor:pointer;padding:0;flex-shrink:0}.wl-tb-btn:hover{background:#1c73e814;color:#3370ff}.wl-tb-sep{width:1px;height:20px;background:#e4e5e7;margin:0 4px;flex-shrink:0}.wl-view-wrap{position:relative}.wl-tb-view-btn{display:flex;align-items:center;gap:4px;height:30px;padding:0 8px;border:none;background:transparent;border-radius:4px;font-size:12px;color:#1f2329;cursor:pointer;white-space:nowrap}.wl-tb-view-btn:hover{background:#1c73e814}.wl-tb-view-btn span{color:#1f2329}.wl-chev{color:#8f959e;transition:transform .15s;flex-shrink:0}.wl-chev.open{transform:rotate(180deg)}.wl-view-menu{position:absolute;top:calc(100% + 4px);right:0;min-width:148px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:8px;box-shadow:0 4px 16px #0000001f;padding:4px 0;z-index:10000}.wl-view-sep{height:1px;margin:4px 6px;background:#eef0f4}.wl-view-item{display:flex;align-items:center;gap:8px;width:100%;height:34px;padding:0 12px;border:none;background:transparent;font-size:13px;color:#1f2329;cursor:pointer;text-align:left}.wl-view-item:hover{background:#1c73e80f}.wl-view-item.active .wl-vi-icon{color:#3370ff}.wl-vi-icon{color:#646a73;flex-shrink:0}.wl-vi-check{margin-left:auto;flex-shrink:0}.wl-edit-input{flex:1;min-width:220px;height:26px;border:1px solid #3370ff;border-radius:4px;padding:0 8px;font-size:13px;color:#1f2329;outline:none}.wl-edit-ok{height:26px;padding:0 10px;background:#3370ff;color:#fff;border:none;border-radius:4px;font-size:12px;cursor:pointer}.wl-edit-ok:hover{background:#2860de}.wl-edit-cancel{height:26px;padding:0 8px;background:transparent;color:#646a73;border:1px solid #e4e5e7;border-radius:4px;font-size:12px;cursor:pointer}.wl-edit-cancel:hover{border-color:#c4c9d4;color:#1f2329}.sel-toolbar{position:fixed;display:flex;align-items:center;gap:1px;height:42px;padding:0 8px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:6px;box-shadow:#1f23291a 0 4px 8px;z-index:9998;white-space:nowrap;-webkit-user-select:none;user-select:none}.sel-btn{display:inline-flex;align-items:center;justify-content:center;gap:3px;height:28px;min-width:28px;padding:0 5px;border:none;border-radius:4px;background:transparent;color:#1f2329;cursor:pointer;font-size:13px;line-height:1}.sel-btn:hover:not(:disabled){background:#1c73e814;color:#3370ff}.sel-btn.active{color:#3370ff}.sel-btn:disabled,.sel-btn.disabled{opacity:.35;cursor:not-allowed}.sel-sep{width:1px;height:20px;background:#dee0e3;margin:0 3px;flex-shrink:0}.sel-btn--type{padding:0 6px;gap:4px}.sel-type-label{font-size:12px;color:inherit;line-height:1}.sel-chev{color:#8f959e;transition:transform .15s;flex-shrink:0}.sel-chev.open{transform:rotate(180deg)}.sel-type-wrap{position:relative}.sel-dropdown{position:absolute;top:calc(100% + 5px);left:0;min-width:120px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:6px;box-shadow:0 3px 10px #0000001f;padding:4px;z-index:10000}.sel-dd-item{display:flex;align-items:center;gap:8px;width:100%;height:32px;padding:0 8px;border:none;border-radius:4px;background:transparent;color:#1f2329;cursor:pointer;font-size:13px;text-align:left}.sel-dd-item:hover{background:#1c73e80f}.sel-dd-item.active .sel-dd-icon{color:#3370ff}.sel-dd-icon{color:#646a73;flex-shrink:0}.sel-dd-check{margin-left:auto;flex-shrink:0}.sel-btn--color{padding:0 5px;gap:2px}.sel-color-wrap{position:relative}.sel-color-panel{position:absolute;top:calc(100% + 5px);left:50%;transform:translate(-50%);z-index:10000}.sel-link-input{height:26px;width:220px;padding:0 8px;border:1px solid #3370ff;border-radius:4px;font-size:13px;color:#1f2329;outline:none}.sel-link-ok{height:26px;padding:0 10px;margin-left:4px;background:#3370ff;color:#fff;border:none;border-radius:4px;font-size:12px;cursor:pointer}.sel-link-ok:hover{background:#2860de}.sel-link-cancel{height:26px;padding:0 8px;margin-left:2px;background:transparent;color:#646a73;border:1px solid #e4e5e7;border-radius:4px;font-size:12px;cursor:pointer}.sel-link-cancel:hover{border-color:#c4c9d4;color:#1f2329}.mermaid-block-wrap{margin:8px 0;border:1px solid #e4e5e7;border-radius:6px;overflow:hidden;background:#f4f5f6}.cm-lang-label{font-size:12px;color:#8f959e;padding:0 6px}.mermaid-preview{padding:20px;background:#fff;min-height:120px;display:flex;align-items:center;justify-content:center}.mermaid-svg-container{width:100%;display:flex;justify-content:center;overflow:auto;max-height:500px}.mermaid-svg-container :deep(svg){max-width:100%;height:auto}.mermaid-error{display:flex;align-items:center;gap:8px;color:#c0392b;padding:12px;background:#ff4d4f14;border-radius:4px;font-size:13px;font-family:monospace}.mermaid-block-wrap .mep-root{height:400px}.mermaid-fullscreen-panel{display:flex;flex-direction:column;height:100%;min-height:0}.mermaid-fullscreen-panel .mep-root{flex:1;height:100%;min-height:0}.mermaid-error--fullscreen{margin:12px;flex-shrink:0}.ProseMirror>.mermaid-block-wrap:hover{background:#f4f5f6}.ProseMirror>[data-type=mermaid-block]:hover,.ProseMirror>[data-type=dot-flow-pad]:hover,.ProseMirror>[data-type=image-block]:hover{background:none}.mermaid-preview--fullscreen{height:100%;min-height:0}.pagely-editor-wrap{max-width:860px;margin:0 auto;padding:60px 80px max(320px,56vh) 100px;position:relative;flex:0 0 auto}.pagely-document-end{display:flex;align-items:center;gap:10px;margin-top:48px;pointer-events:none;-webkit-user-select:none;user-select:none}.pagely-document-end:before,.pagely-document-end:after{content:"";height:1px;flex:1;background:linear-gradient(90deg,transparent,#dfe3e8)}.pagely-document-end:after{background:linear-gradient(90deg,#dfe3e8,transparent)}.pagely-document-end-mark{width:4px;height:4px;border-radius:999px;background:#c8ced6;box-shadow:0 0 0 4px #fff;flex:0 0 auto}.ProseMirror{outline:none;line-height:1.75;font-size:15px;color:#1f2329;caret-color:#3370ff}.ProseMirror>*:hover,.ProseMirror td:hover>*,.ProseMirror th:hover>*{background:#1c73e80a;border-radius:3px}.ProseMirror>pre:hover,.ProseMirror>table:hover{background:none}.ProseMirror ::selection{background:#3370ff2e}',Gh=".ProseMirror p{margin:3px 0}.ProseMirror p.is-empty:before,.ProseMirror p:first-child:empty:before{content:attr(data-placeholder);float:left;color:#bbbfc4;pointer-events:none;height:0}.ProseMirror h1{font-size:1.875em;font-weight:700;margin:28px 0 6px;color:#1f2329;line-height:1.4}.ProseMirror h2{font-size:1.375em;font-weight:600;margin:22px 0 4px;color:#1f2329;line-height:1.5}.ProseMirror h3{font-size:1.125em;font-weight:600;margin:16px 0 3px;color:#1f2329}.ProseMirror h4{font-size:1em;font-weight:600;margin:12px 0 2px;color:#1f2329}.ProseMirror h5{font-size:.925em;font-weight:600;margin:10px 0 2px;color:#646a73}.ProseMirror h6{font-size:.875em;font-weight:600;margin:8px 0 2px;color:#646a73}.ProseMirror>h1:first-child{font-size:2.125em;margin-top:8px}.ProseMirror code{background:#1c73e812;border:1px solid rgba(28,115,232,.18);border-radius:4px;padding:1px 4px;font-size:.875em;font-family:monospace;color:#3370ff}.ProseMirror blockquote{border-left:3px solid #dee0e3;margin:6px 0;padding:2px 14px;color:#646a73}.ProseMirror ul,.ProseMirror ol{padding-left:1.5em;margin:4px 0}.ProseMirror li{margin:2px 0}.ProseMirror ol{list-style-type:decimal}.ProseMirror ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol{list-style-type:lower-roman}.ProseMirror ol ol ol ol{list-style-type:decimal}.ProseMirror ol ol ol ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol ol ol ol{list-style-type:lower-roman}.ProseMirror hr{border:none;border-top:1px solid #dee0e3;margin:16px 0}.ProseMirror a.pm-link{color:#3370ff;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.ProseMirror a.pm-link:hover{color:#2860de}.link-loading-icon{display:inline-flex;align-items:center;vertical-align:middle;margin-left:1px;color:#8f959e;pointer-events:none;-webkit-user-select:none;user-select:none}.link-loading-icon svg{animation:link-spin .75s linear infinite}@keyframes link-spin{to{transform:rotate(360deg)}}.heading-collapsed-content{display:none!important}.ProseMirror ul[data-type=taskList]{list-style:none;padding-left:.5em}.ProseMirror ul[data-type=taskList] li{display:flex;align-items:flex-start;gap:8px}.ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:3px}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer}.ProseMirror ul[data-type=taskList] li>div{flex:1}.ProseMirror ul[data-type=taskList] li>div>p{margin:0}.ProseMirror ul[data-type=taskList] li[data-checked=true]>div{color:#8f959e;text-decoration:line-through}",Kh='.ProseMirror table{border-collapse:collapse;width:100%;margin:10px 0;table-layout:fixed}.ProseMirror td,.ProseMirror th{border:1px solid #dee0e3;padding:7px 12px;min-width:80px;vertical-align:top;position:relative;transition:background .1s}.ProseMirror th{background:#f4f5f6;font-weight:600;text-align:left;color:#1f2329;font-size:.9em}.ProseMirror td>p,.ProseMirror th>p{margin:0}.ProseMirror .selectedCell:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:#3370ff1a;pointer-events:none}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;background-color:#3370ff;cursor:col-resize;pointer-events:all;z-index:1}.ProseMirror table:hover{box-shadow:0 0 0 2px #3370ff38;border-radius:2px}',Yh=".code-block-cm{background:#f4f5f6;margin:8px 0}.code-block-cm.is-collapsed .cm-editor-wrap{display:none}.cm-title-input{flex:1;min-width:0;border:none;background:transparent;font-size:12px;color:#1f2329;outline:none;padding:2px 4px}.cm-title-input::placeholder{color:#bbbfc4}.cm-title-input--fullscreen{max-width:260px}.cm-lang-select{border:1px solid #dee0e3;border-radius:4px;background:#fff;font-size:11px;color:#646a73;padding:2px 4px;cursor:pointer;outline:none;max-width:110px}.cm-lang-select:hover{border-color:#3370ff}.cm-chevron{transition:transform .15s ease}.cm-chevron.collapsed{transform:rotate(-90deg)}.cm-editor-wrap{overflow:hidden}.cm-editor-wrap .cm-editor{max-height:600px}.cm-editor-wrap--fullscreen{height:100%;background:#f4f5f6}.cm-editor-wrap--fullscreen .cm-editor{height:100%;max-height:none}.cm-editor-wrap--fullscreen .cm-scroller{height:100%}.ProseMirror>.code-block-cm:hover{background:#f4f5f6}",Jh=".mermaid-block-wrap{margin:8px 0;border:1px solid #e4e5e7;border-radius:6px;overflow:hidden;background:#f4f5f6}.cm-lang-label{font-size:12px;color:#8f959e;padding:0 6px}.mermaid-preview{padding:20px;background:#fff;min-height:120px;display:flex;align-items:center;justify-content:center}.mermaid-svg-container{width:100%;display:flex;justify-content:center;overflow:auto;max-height:500px}.mermaid-svg-container :deep(svg){max-width:100%;height:auto}.mermaid-error{display:flex;align-items:center;gap:8px;color:#c0392b;padding:12px;background:#ff4d4f14;border-radius:4px;font-size:13px;font-family:monospace}.mermaid-block-wrap .mep-root{height:400px}.mermaid-fullscreen-panel{display:flex;flex-direction:column;height:100%;min-height:0}.mermaid-fullscreen-panel .mep-root{flex:1;height:100%;min-height:0}.mermaid-error--fullscreen{margin:12px;flex-shrink:0}.ProseMirror>.mermaid-block-wrap:hover{background:#f4f5f6}.ProseMirror>[data-type=mermaid-block]:hover,.ProseMirror>[data-type=dot-flow-pad]:hover,.ProseMirror>[data-type=image-block]:hover{background:none}.mermaid-preview--fullscreen{height:100%;min-height:0}",Xh=`
307
+ please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:o}}mi.hasOwnProperty(t[0])&&!Se[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=mi[t[0]]+t.slice(1));var l=wh.exec(t);l&&(t=t.substring(0,l.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var i;if(Se[this.mode][t]){this.settings.strict&&this.mode==="math"&&Rl.includes(t)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var s=Se[this.mode][t].group,u=nt.range(e),d;if(km.hasOwnProperty(s)){var m=s;d={type:"atom",mode:this.mode,family:m,loc:u,text:t}}else d={type:s,mode:this.mode,loc:u,text:t};i=d}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Qs(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),i={type:"textord",mode:"text",loc:nt.range(e),text:t};else return null;if(this.consume(),l)for(var h=0;h<l[0].length;h++){var p=l[0][h];if(!cl[p])throw new _("Unknown accent ' "+p+"'",e);var v=cl[p][this.mode]||cl[p].text;if(!v)throw new _("Accent "+p+" unsupported in "+this.mode+" mode",e);i={type:"accent",mode:this.mode,loc:nt.range(e),label:v,isStretchy:!1,isShifty:!0,base:i}}return i}}Mo.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Ca=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new Mo(e,t);delete n.gullet.macros.current["\\df@tag"];var o=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new _("\\tag works only in display equations");o=[{type:"tag",mode:"text",body:o,tag:n.subparse([new it("\\df@tag")])}]}return o},Gu=function(e,t,n){t.textContent="";var o=Ta(e,n).toNode();t.appendChild(o)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Gu=function(){throw new _("KaTeX doesn't work in quirks mode.")});var Sh=function(e,t){var n=Ta(e,t).toMarkup();return n},Mh=function(e,t){var n=new ca(t);return Ca(e,n)},Ku=function(e,t,n){if(n.throwOnError||!(e instanceof _))throw e;var o=U(["katex-error"],[new ut(t)]);return o.setAttribute("title",e.toString()),o.setAttribute("style","color:"+n.errorColor),o},Ta=function(e,t){var n=new ca(t);try{var o=Ca(e,n);return Pm(o,e,n)}catch(l){return Ku(l,e,n)}},Ah=function(e,t){var n=new ca(t);try{var o=Ca(e,n);return Hm(o,e,n)}catch(l){return Ku(l,e,n)}},Bh="0.16.45",Nh={Span:$r,Anchor:po,SymbolNode:ut,SvgNode:zt,PathNode:Jt,LineNode:Ol},Yu={version:Bh,render:Gu,renderToString:Sh,ParseError:_,SETTINGS_SCHEMA:Il,__parse:Mh,__renderToDomTree:Ta,__renderToHTMLTree:Ah,__setFontMetrics:ym,__defineSymbol:c,__defineFunction:j,__defineMacro:y,__domTree:Nh};const Lh=Ni.BlockMath.extend({addNodeView(){const{katexOptions:r}=this.options;return({node:e,getPos:t})=>{let n=e;const o=document.createElement("div"),l=document.createElement("div");o.classList.add("tiptap-mathematics-render"),this.editor.isEditable&&o.classList.add("tiptap-mathematics-render--editable"),l.className="block-math-inner",o.appendChild(l);const i=()=>{const d=We(n.attrs.commentIds);o.dataset.type="block-math",o.setAttribute("data-latex",n.attrs.latex),d.length>0?(o.setAttribute("data-comment-ids",JSON.stringify(d)),o.classList.add("pagely-comment-block"),d.length>1?o.setAttribute("data-comment-count",String(d.length)):o.removeAttribute("data-comment-count")):(o.removeAttribute("data-comment-ids"),o.removeAttribute("data-comment-count"),o.classList.remove("pagely-comment-block"))};function s(){try{Yu.render(n.attrs.latex,l,r),o.classList.remove("block-math-error")}catch{l.textContent=n.attrs.latex,o.classList.add("block-math-error")}}const u=d=>{var h,p;d.preventDefault(),d.stopPropagation();const m=t();m!=null&&((p=(h=this.options).onClick)==null||p.call(h,n,m))};return this.options.onClick&&o.addEventListener("click",u),i(),s(),{dom:o,update:d=>{if(d.type!==n.type)return!1;const m=d.attrs.latex!==n.attrs.latex;return n=d,i(),m&&s(),!0},destroy(){o.removeEventListener("click",u)}}}}}),Ih=Me.Extension.create({name:"Mathematics",addOptions(){return{inlineOptions:void 0,blockOptions:void 0,katexOptions:void 0}},addExtensions(){return[Lh.configure({...this.options.blockOptions,katexOptions:this.options.katexOptions}),Ni.InlineMath.configure({...this.options.inlineOptions,katexOptions:this.options.katexOptions})]}}),zh=["paragraph","heading","blockquote","bulletList","orderedList","listItem","taskList","taskItem","codeBlock","table","tableRow","tableCell","tableHeader","image","mermaidBlock","dotFlowPadBlock","blockMath","embedView"],Ju=Me.Extension.create({name:"commentBlock",addGlobalAttributes(){return[{types:zh,attributes:{commentIds:{default:[],parseHTML:r=>We(r.getAttribute("data-comment-ids")),renderHTML:r=>{const e=We(r.commentIds);if(e.length===0)return{};const t={"data-comment-ids":JSON.stringify(e),class:"pagely-comment-block"};return e.length>1&&(t["data-comment-count"]=String(e.length)),t}}}}]}});function Dh(r){return r.filter(e=>e.type.name!=="commentMark")}function Xu(r){const e=Dh(r.marks);if(r.isText)return r.mark(e);const t=Array.isArray(r.attrs.commentIds)&&r.attrs.commentIds.length>0?{...r.attrs,commentIds:[]}:r.attrs,n=[];return r.content.forEach(o=>{n.push(Xu(o))}),r.type.create(t,Vn.Fragment.fromArray(n),e)}function Oh(r){const e=[];return r.content.forEach(t=>{e.push(Xu(t))}),new Vn.Slice(Vn.Fragment.fromArray(e),r.openStart,r.openEnd)}const ju=Me.Mark.create({name:"commentMark",priority:1001,inclusive:!1,addAttributes(){return{commentIds:{default:[],parseHTML:r=>We(r.getAttribute("data-comment-ids")),renderHTML:r=>({"data-comment-ids":JSON.stringify(We(r.commentIds))})}}},parseHTML(){return[{tag:"span[data-comment-ids]"}]},renderHTML({HTMLAttributes:r}){const e=We(r["data-comment-ids"]),t={class:"pagely-comment-inline"};return e.length>1&&(t["data-comment-count"]=String(e.length)),["span",Me.mergeAttributes(t,r),0]},addProseMirrorPlugins(){return[new mr.Plugin({key:new mr.PluginKey("commentPasteStrip"),props:{transformPasted(r){return Oh(r)}}})]}});function hi(r,e){const t=We(e.attrs.commentIds);if(t.length>0){r.classList.add("pagely-comment-block"),r.setAttribute("data-comment-ids",JSON.stringify(t)),t.length>1?r.setAttribute("data-comment-count",String(t.length)):r.removeAttribute("data-comment-count");return}r.classList.remove("pagely-comment-block"),r.removeAttribute("data-comment-ids"),r.removeAttribute("data-comment-count")}class Rh extends Kr.TableView{constructor(e,t,n){super(e,t),hi(this.dom,e)}update(e){return super.update(e)?(hi(this.dom,e),!0):!1}}const Ph={class:"eb-shell"},Hh={class:"eb-label"},Vh={key:0,class:"eb-copy-tip"},Fh={key:0,class:"eb-copy-tip"},$h={class:"eb-label"},Ea=a.defineComponent({__name:"EmbedBlockShell",props:{label:{},fullscreen:{type:Boolean,default:!1},beforeCloseFullscreen:{},canCopySource:{type:Boolean,default:!0},canCopyImage:{type:Boolean,default:!1},canFullscreen:{type:Boolean,default:!0},fullscreenCloseLabel:{default:"完成"}},emits:["update:fullscreen","copy-source","copy-image"],setup(r,{expose:e,emit:t}){const n=t,o=a.ref(!1),l=a.ref(!1);let i=null,s=null;function u(p){const v=p==="source"?o:l,b=p==="source"?i:s;b&&clearTimeout(b),v.value=!0;const w=setTimeout(()=>{v.value=!1,p==="source"?i=null:s=null},1500);p==="source"?i=w:s=w}function d(){n("update:fullscreen",!0)}function m(){n("copy-source")}function h(){n("copy-image")}return e({showCopyTip:u}),a.onBeforeUnmount(()=>{i&&clearTimeout(i),s&&clearTimeout(s)}),(p,v)=>(a.openBlock(),a.createElementBlock("div",Ph,[a.createElementVNode("div",{class:"eb-toolbar",onMousedown:v[0]||(v[0]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",Hh,a.toDisplayString(r.label),1),a.renderSlot(p.$slots,"toolbar-before-actions"),v[2]||(v[2]=a.createElementVNode("div",{class:"eb-spacer"},null,-1)),a.renderSlot(p.$slots,"toolbar-extra"),r.canCopyImage?(a.openBlock(),a.createElementBlock("button",{key:0,class:"eb-btn",type:"button",title:"复制为图片",onClick:h},[a.createVNode(a.unref(L.Image),{size:14,"stroke-width":1.4}),l.value?(a.openBlock(),a.createElementBlock("span",Vh,"已复制")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),r.canCopySource?(a.openBlock(),a.createElementBlock("button",{key:1,class:"eb-btn",type:"button",title:"复制源码",onClick:m},[a.createVNode(a.unref(L.Copy),{size:14,"stroke-width":1.4}),o.value?(a.openBlock(),a.createElementBlock("span",Fh,"已复制")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),r.canFullscreen?(a.openBlock(),a.createElementBlock("button",{key:2,class:"eb-btn",type:"button",title:"全屏",onClick:d},[a.createVNode(a.unref(L.Maximize2),{size:14,"stroke-width":1.4})])):a.createCommentVNode("",!0)],32),a.renderSlot(p.$slots,"inline"),r.canFullscreen?(a.openBlock(),a.createBlock(ho,{key:0,open:r.fullscreen,"before-close":r.beforeCloseFullscreen,"close-label":r.fullscreenCloseLabel,"onUpdate:open":v[1]||(v[1]=b=>n("update:fullscreen",b))},{toolbar:a.withCtx(()=>[a.createElementVNode("span",$h,a.toDisplayString(r.label),1)]),body:a.withCtx(()=>[a.renderSlot(p.$slots,"fullscreen")]),_:3},8,["open","before-close","close-label"])):a.createCommentVNode("",!0)]))}}),qh={key:1,class:"dfp-preview-overlay"},Uh=a.defineComponent({__name:"DotFlowPadBlockView",props:{decorations:{},selected:{type:Boolean},updateAttributes:{type:Function},deleteNode:{type:Function},node:{},view:{},getPos:{},innerDecorations:{},editor:{},extension:{},HTMLAttributes:{}},setup(r){const e=r,{commentAttrs:t,commentClass:n}=hn(()=>e.node.attrs),o=a.ref(null),l=a.ref(null),i=a.ref(null),s=a.ref(null),u=a.ref(!1),d=a.ref(null),{copyPngToClipboard:m}=lo(),h=a.computed(()=>e.editor.isEditable),p=a.ref(!1);a.onMounted(()=>a.nextTick(()=>{p.value=!0,h.value&&e.node.attrs.autoOpen&&(a.nextTick(()=>w()),b({autoOpen:!1}))}));const v=a.computed(()=>{try{return JSON.parse(e.node.attrs.data)}catch{return{nodes:[],edges:[]}}});a.watch(v,B=>{!u.value&&o.value&&(o.value.setData(B),setTimeout(()=>{var D,z;return(z=(D=o.value)==null?void 0:D.fitView)==null?void 0:z.call(D)},100))});function b(B){var A,R;const D=(A=e.getPos)==null?void 0:A.call(e);if(D===void 0||!((R=e.editor)!=null&&R.view))return;const{state:z,dispatch:W}=e.editor.view,H=z.doc.nodeAt(D);H&&W(z.tr.setNodeMarkup(D,void 0,{...H.attrs,...B}))}function w(){u.value=!0}function k(){h.value&&w()}function T(){var D;if(!h.value)return;const B=(D=l.value)==null?void 0:D.getData();B&&(b({data:JSON.stringify(B)}),a.nextTick(()=>{var z;(z=o.value)==null||z.setData(B),setTimeout(()=>{var W,H;return(H=(W=o.value)==null?void 0:W.fitView)==null?void 0:H.call(W)},100)}))}async function E(){var B;try{await navigator.clipboard.writeText(e.node.attrs.data),(B=d.value)==null||B.showCopyTip("source")}catch{}}async function M(){var z;const B=u.value?s.value:i.value;await m(()=>rs(B))&&((z=d.value)==null||z.showCopyTip("image"))}return(B,D)=>(a.openBlock(),a.createBlock(a.unref(_e.NodeViewWrapper),a.mergeProps({"data-type":"dot-flow-pad",class:a.unref(n)},a.unref(t)),{default:a.withCtx(()=>[a.createVNode(Ea,{ref_key:"shellRef",ref:d,class:"dot-flow-pad-block-wrap",label:"画板",fullscreen:u.value,"onUpdate:fullscreen":D[0]||(D[0]=z=>u.value=z),"before-close-fullscreen":T,"can-copy-source":!0,"can-copy-image":!0,"can-fullscreen":!0,onCopySource:E,onCopyImage:M},{inline:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"inlineWrap",ref:i,class:"dfp-canvas-wrap dfp-preview",onClick:k},[p.value?(a.openBlock(),a.createBlock(a.unref(Ga.DotFlowPad),{key:0,ref_key:"inlineRef",ref:o,"initial-data":v.value,readonly:!0,class:"dfp-preview-canvas"},null,8,["initial-data"])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",qh,[a.createVNode(a.unref(L.Maximize2),{size:20,"stroke-width":1.4}),D[1]||(D[1]=a.createElementVNode("span",null,"点击编辑",-1))])):a.createCommentVNode("",!0)],512)]),fullscreen:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"fullscreenWrap",ref:s,class:"dfp-fullscreen-canvas"},[u.value?(a.openBlock(),a.createBlock(a.unref(Ga.DotFlowPad),{key:0,ref_key:"fullscreenRef",ref:l,"initial-data":v.value,readonly:!h.value},null,8,["initial-data","readonly"])):a.createCommentVNode("",!0)],512)]),_:1},8,["fullscreen"])]),_:1},16,["class"]))}}),gt=(r,e)=>{const t=r.__vccOpts||r;for(const[n,o]of e)t[n]=o;return t},Wh=gt(Uh,[["__scopeId","data-v-9cffdd9d"]]),Qu=Me.Node.create({name:"dotFlowPadBlock",content:"",marks:"",group:"block",atom:!0,defining:!0,isolating:!0,addAttributes(){return{data:{default:JSON.stringify({nodes:[],edges:[]}),parseHTML:r=>r.getAttribute("data-graph")??JSON.stringify({nodes:[],edges:[]}),renderHTML:r=>({"data-graph":r.data})},autoOpen:{default:!1,parseHTML:()=>!1,renderHTML:()=>({})}}},parseHTML(){return[{tag:'div[data-type="dot-flow-pad"]'}]},renderHTML({HTMLAttributes:r}){return["div",Me.mergeAttributes(r,{"data-type":"dot-flow-pad"})]},addNodeView(){return _e.VueNodeViewRenderer(Wh)},addCommands(){return{insertDotFlowPadBlock:()=>({commands:r})=>r.insertContent({type:this.name,attrs:{data:JSON.stringify({nodes:[],edges:[]}),autoOpen:!0}})}}}),_h='.ProseMirror p{margin:3px 0}.ProseMirror p.is-empty:before,.ProseMirror p:first-child:empty:before{content:attr(data-placeholder);float:left;color:#bbbfc4;pointer-events:none;height:0}.ProseMirror h1{font-size:1.875em;font-weight:700;margin:28px 0 6px;color:#1f2329;line-height:1.4}.ProseMirror h2{font-size:1.375em;font-weight:600;margin:22px 0 4px;color:#1f2329;line-height:1.5}.ProseMirror h3{font-size:1.125em;font-weight:600;margin:16px 0 3px;color:#1f2329}.ProseMirror h4{font-size:1em;font-weight:600;margin:12px 0 2px;color:#1f2329}.ProseMirror h5{font-size:.925em;font-weight:600;margin:10px 0 2px;color:#646a73}.ProseMirror h6{font-size:.875em;font-weight:600;margin:8px 0 2px;color:#646a73}.ProseMirror>h1:first-child{font-size:2.125em;margin-top:8px}.ProseMirror code{background:#1c73e812;border:1px solid rgba(28,115,232,.18);border-radius:4px;padding:1px 4px;font-size:.875em;font-family:monospace;color:#3370ff}.ProseMirror blockquote{border-left:3px solid #dee0e3;margin:6px 0;padding:2px 14px;color:#646a73}.ProseMirror ul,.ProseMirror ol{padding-left:1.5em;margin:4px 0}.ProseMirror li{margin:2px 0}.ProseMirror ol{list-style-type:decimal}.ProseMirror ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol{list-style-type:lower-roman}.ProseMirror ol ol ol ol{list-style-type:decimal}.ProseMirror ol ol ol ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol ol ol ol{list-style-type:lower-roman}.ProseMirror hr{border:none;border-top:1px solid #dee0e3;margin:16px 0}.ProseMirror a.pm-link{color:#3370ff;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.ProseMirror a.pm-link:hover{color:#2860de}.link-loading-icon{display:inline-flex;align-items:center;vertical-align:middle;margin-left:1px;color:#8f959e;pointer-events:none;-webkit-user-select:none;user-select:none}.link-loading-icon svg{animation:link-spin .75s linear infinite}@keyframes link-spin{to{transform:rotate(360deg)}}.heading-collapsed-content{display:none!important}.ProseMirror ul[data-type=taskList]{list-style:none;padding-left:.5em}.ProseMirror ul[data-type=taskList] li{display:flex;align-items:flex-start;gap:8px}.ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:3px}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer}.ProseMirror ul[data-type=taskList] li>div{flex:1}.ProseMirror ul[data-type=taskList] li>div>p{margin:0}.ProseMirror ul[data-type=taskList] li[data-checked=true]>div{color:#8f959e;text-decoration:line-through}.ProseMirror table{border-collapse:collapse;width:100%;margin:10px 0;table-layout:fixed}.ProseMirror td,.ProseMirror th{border:1px solid #dee0e3;padding:7px 12px;min-width:80px;vertical-align:top;position:relative;transition:background .1s}.ProseMirror th{background:#f4f5f6;font-weight:600;text-align:left;color:#1f2329;font-size:.9em}.ProseMirror td>p,.ProseMirror th>p{margin:0}.ProseMirror .selectedCell:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:#3370ff1a;pointer-events:none}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;background-color:#3370ff;cursor:col-resize;pointer-events:all;z-index:1}.ProseMirror table:hover{box-shadow:0 0 0 2px #3370ff38;border-radius:2px}.code-block-cm{background:#f4f5f6;margin:8px 0}.code-block-cm.is-collapsed .cm-editor-wrap{display:none}.cm-title-input{flex:1;min-width:0;border:none;background:transparent;font-size:12px;color:#1f2329;outline:none;padding:2px 4px}.cm-title-input::placeholder{color:#bbbfc4}.cm-title-input--fullscreen{max-width:260px}.cm-lang-select{border:1px solid #dee0e3;border-radius:4px;background:#fff;font-size:11px;color:#646a73;padding:2px 4px;cursor:pointer;outline:none;max-width:110px}.cm-lang-select:hover{border-color:#3370ff}.cm-chevron{transition:transform .15s ease}.cm-chevron.collapsed{transform:rotate(-90deg)}.cm-editor-wrap{overflow:hidden}.cm-editor-wrap .cm-editor{max-height:600px}.cm-editor-wrap--fullscreen{height:100%;background:#f4f5f6}.cm-editor-wrap--fullscreen .cm-editor{height:100%;max-height:none}.cm-editor-wrap--fullscreen .cm-scroller{height:100%}.ProseMirror>.code-block-cm:hover{background:#f4f5f6}.wl-toolbar{position:fixed;display:flex;align-items:center;gap:2px;height:44px;padding:0 8px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:6px;box-shadow:0 3px 10px #0000001f;z-index:9999;white-space:nowrap}.wl-tb-url{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#646a73;background:#f4f5f6;border:1px solid #e4e5e7;border-radius:4px;padding:2px 7px;margin-right:2px}.wl-tb-btn{display:flex;align-items:center;justify-content:center;width:30px;height:30px;border:none;background:transparent;border-radius:4px;color:#646a73;cursor:pointer;padding:0;flex-shrink:0}.wl-tb-btn:hover{background:#1c73e814;color:#3370ff}.wl-tb-sep{width:1px;height:20px;background:#e4e5e7;margin:0 4px;flex-shrink:0}.wl-view-wrap{position:relative}.wl-tb-view-btn{display:flex;align-items:center;gap:4px;height:30px;padding:0 8px;border:none;background:transparent;border-radius:4px;font-size:12px;color:#1f2329;cursor:pointer;white-space:nowrap}.wl-tb-view-btn:hover{background:#1c73e814}.wl-tb-view-btn span{color:#1f2329}.wl-chev{color:#8f959e;transition:transform .15s;flex-shrink:0}.wl-chev.open{transform:rotate(180deg)}.wl-view-menu{position:absolute;top:calc(100% + 4px);right:0;min-width:148px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:8px;box-shadow:0 4px 16px #0000001f;padding:4px 0;z-index:10000}.wl-view-sep{height:1px;margin:4px 6px;background:#eef0f4}.wl-view-item{display:flex;align-items:center;gap:8px;width:100%;height:34px;padding:0 12px;border:none;background:transparent;font-size:13px;color:#1f2329;cursor:pointer;text-align:left}.wl-view-item:hover{background:#1c73e80f}.wl-view-item.active .wl-vi-icon{color:#3370ff}.wl-vi-icon{color:#646a73;flex-shrink:0}.wl-vi-check{margin-left:auto;flex-shrink:0}.wl-edit-input{flex:1;min-width:220px;height:26px;border:1px solid #3370ff;border-radius:4px;padding:0 8px;font-size:13px;color:#1f2329;outline:none}.wl-edit-ok{height:26px;padding:0 10px;background:#3370ff;color:#fff;border:none;border-radius:4px;font-size:12px;cursor:pointer}.wl-edit-ok:hover{background:#2860de}.wl-edit-cancel{height:26px;padding:0 8px;background:transparent;color:#646a73;border:1px solid #e4e5e7;border-radius:4px;font-size:12px;cursor:pointer}.wl-edit-cancel:hover{border-color:#c4c9d4;color:#1f2329}.sel-toolbar{position:fixed;display:flex;align-items:center;gap:1px;height:42px;padding:0 8px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:6px;box-shadow:#1f23291a 0 4px 8px;z-index:9998;white-space:nowrap;-webkit-user-select:none;user-select:none}.sel-btn{display:inline-flex;align-items:center;justify-content:center;gap:3px;height:28px;min-width:28px;padding:0 5px;border:none;border-radius:4px;background:transparent;color:#1f2329;cursor:pointer;font-size:13px;line-height:1}.sel-btn:hover:not(:disabled){background:#1c73e814;color:#3370ff}.sel-btn.active{color:#3370ff}.sel-btn:disabled,.sel-btn.disabled{opacity:.35;cursor:not-allowed}.sel-sep{width:1px;height:20px;background:#dee0e3;margin:0 3px;flex-shrink:0}.sel-btn--type{padding:0 6px;gap:4px}.sel-type-label{font-size:12px;color:inherit;line-height:1}.sel-chev{color:#8f959e;transition:transform .15s;flex-shrink:0}.sel-chev.open{transform:rotate(180deg)}.sel-type-wrap{position:relative}.sel-dropdown{position:absolute;top:calc(100% + 5px);left:0;min-width:120px;background:#fff;border:1px solid rgba(28,31,35,.1);border-radius:6px;box-shadow:0 3px 10px #0000001f;padding:4px;z-index:10000}.sel-dd-item{display:flex;align-items:center;gap:8px;width:100%;height:32px;padding:0 8px;border:none;border-radius:4px;background:transparent;color:#1f2329;cursor:pointer;font-size:13px;text-align:left}.sel-dd-item:hover{background:#1c73e80f}.sel-dd-item.active .sel-dd-icon{color:#3370ff}.sel-dd-icon{color:#646a73;flex-shrink:0}.sel-dd-check{margin-left:auto;flex-shrink:0}.sel-btn--color{padding:0 5px;gap:2px}.sel-color-wrap{position:relative}.sel-color-panel{position:absolute;top:calc(100% + 5px);left:50%;transform:translate(-50%);z-index:10000}.sel-link-input{height:26px;width:220px;padding:0 8px;border:1px solid #3370ff;border-radius:4px;font-size:13px;color:#1f2329;outline:none}.sel-link-ok{height:26px;padding:0 10px;margin-left:4px;background:#3370ff;color:#fff;border:none;border-radius:4px;font-size:12px;cursor:pointer}.sel-link-ok:hover{background:#2860de}.sel-link-cancel{height:26px;padding:0 8px;margin-left:2px;background:transparent;color:#646a73;border:1px solid #e4e5e7;border-radius:4px;font-size:12px;cursor:pointer}.sel-link-cancel:hover{border-color:#c4c9d4;color:#1f2329}.mermaid-block-wrap{margin:8px 0;border:1px solid #e4e5e7;border-radius:6px;overflow:hidden;background:#f4f5f6}.cm-lang-label{font-size:12px;color:#8f959e;padding:0 6px}.mermaid-preview{padding:20px;background:#fff;min-height:120px;display:flex;align-items:center;justify-content:center}.mermaid-svg-container{width:100%;display:flex;justify-content:center;overflow:auto;max-height:500px}.mermaid-svg-container :deep(svg){max-width:100%;height:auto}.mermaid-error{display:flex;align-items:center;gap:8px;color:#c0392b;padding:12px;background:#ff4d4f14;border-radius:4px;font-size:13px;font-family:monospace}.mermaid-block-wrap .mep-root{height:400px}.mermaid-fullscreen-panel{display:flex;flex-direction:column;height:100%;min-height:0}.mermaid-fullscreen-panel .mep-root{flex:1;height:100%;min-height:0}.mermaid-error--fullscreen{margin:12px;flex-shrink:0}.ProseMirror>.mermaid-block-wrap:hover{background:#f4f5f6}.ProseMirror>[data-type=mermaid-block]:hover,.ProseMirror>[data-type=dot-flow-pad]:hover,.ProseMirror>[data-type=image-block]:hover{background:none}.mermaid-preview--fullscreen{height:100%;min-height:0}.pagely-editor-wrap{max-width:860px;margin:0 auto;padding:60px 80px max(320px,56vh) 100px;position:relative;flex:0 0 auto}.pagely-document-end{display:flex;align-items:center;gap:10px;margin-top:48px;pointer-events:none;-webkit-user-select:none;user-select:none}.pagely-document-end:before,.pagely-document-end:after{content:"";height:1px;flex:1;background:linear-gradient(90deg,transparent,#dfe3e8)}.pagely-document-end:after{background:linear-gradient(90deg,#dfe3e8,transparent)}.pagely-document-end-mark{width:4px;height:4px;border-radius:999px;background:#c8ced6;box-shadow:0 0 0 4px #fff;flex:0 0 auto}.ProseMirror{outline:none;line-height:1.75;font-size:15px;color:#1f2329;caret-color:#3370ff}.ProseMirror>*:hover,.ProseMirror td:hover>*,.ProseMirror th:hover>*{background:#1c73e80a;border-radius:3px}.ProseMirror>pre:hover,.ProseMirror>table:hover{background:none}.ProseMirror ::selection{background:#3370ff2e}',Gh=".ProseMirror p{margin:3px 0}.ProseMirror p.is-empty:before,.ProseMirror p:first-child:empty:before{content:attr(data-placeholder);float:left;color:#bbbfc4;pointer-events:none;height:0}.ProseMirror h1{font-size:1.875em;font-weight:700;margin:28px 0 6px;color:#1f2329;line-height:1.4}.ProseMirror h2{font-size:1.375em;font-weight:600;margin:22px 0 4px;color:#1f2329;line-height:1.5}.ProseMirror h3{font-size:1.125em;font-weight:600;margin:16px 0 3px;color:#1f2329}.ProseMirror h4{font-size:1em;font-weight:600;margin:12px 0 2px;color:#1f2329}.ProseMirror h5{font-size:.925em;font-weight:600;margin:10px 0 2px;color:#646a73}.ProseMirror h6{font-size:.875em;font-weight:600;margin:8px 0 2px;color:#646a73}.ProseMirror>h1:first-child{font-size:2.125em;margin-top:8px}.ProseMirror code{background:#1c73e812;border:1px solid rgba(28,115,232,.18);border-radius:4px;padding:1px 4px;font-size:.875em;font-family:monospace;color:#3370ff}.ProseMirror blockquote{border-left:3px solid #dee0e3;margin:6px 0;padding:2px 14px;color:#646a73}.ProseMirror ul,.ProseMirror ol{padding-left:1.5em;margin:4px 0}.ProseMirror li{margin:2px 0}.ProseMirror ol{list-style-type:decimal}.ProseMirror ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol{list-style-type:lower-roman}.ProseMirror ol ol ol ol{list-style-type:decimal}.ProseMirror ol ol ol ol ol{list-style-type:lower-latin}.ProseMirror ol ol ol ol ol ol{list-style-type:lower-roman}.ProseMirror hr{border:none;border-top:1px solid #dee0e3;margin:16px 0}.ProseMirror a.pm-link{color:#3370ff;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.ProseMirror a.pm-link:hover{color:#2860de}.link-loading-icon{display:inline-flex;align-items:center;vertical-align:middle;margin-left:1px;color:#8f959e;pointer-events:none;-webkit-user-select:none;user-select:none}.link-loading-icon svg{animation:link-spin .75s linear infinite}@keyframes link-spin{to{transform:rotate(360deg)}}.heading-collapsed-content{display:none!important}.ProseMirror ul[data-type=taskList]{list-style:none;padding-left:.5em}.ProseMirror ul[data-type=taskList] li{display:flex;align-items:flex-start;gap:8px}.ProseMirror ul[data-type=taskList] li>label{flex-shrink:0;margin-top:3px}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer}.ProseMirror ul[data-type=taskList] li>div{flex:1}.ProseMirror ul[data-type=taskList] li>div>p{margin:0}.ProseMirror ul[data-type=taskList] li[data-checked=true]>div{color:#8f959e;text-decoration:line-through}",Kh='.ProseMirror table{border-collapse:collapse;width:100%;margin:10px 0;table-layout:fixed}.ProseMirror td,.ProseMirror th{border:1px solid #dee0e3;padding:7px 12px;min-width:80px;vertical-align:top;position:relative;transition:background .1s}.ProseMirror th{background:#f4f5f6;font-weight:600;text-align:left;color:#1f2329;font-size:.9em}.ProseMirror td>p,.ProseMirror th>p{margin:0}.ProseMirror .selectedCell:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:#3370ff1a;pointer-events:none}.ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;background-color:#3370ff;cursor:col-resize;pointer-events:all;z-index:1}.ProseMirror table:hover{box-shadow:0 0 0 2px #3370ff38;border-radius:2px}',Yh=".code-block-cm{background:#f4f5f6;margin:8px 0}.code-block-cm.is-collapsed .cm-editor-wrap{display:none}.cm-title-input{flex:1;min-width:0;border:none;background:transparent;font-size:12px;color:#1f2329;outline:none;padding:2px 4px}.cm-title-input::placeholder{color:#bbbfc4}.cm-title-input--fullscreen{max-width:260px}.cm-lang-select{border:1px solid #dee0e3;border-radius:4px;background:#fff;font-size:11px;color:#646a73;padding:2px 4px;cursor:pointer;outline:none;max-width:110px}.cm-lang-select:hover{border-color:#3370ff}.cm-chevron{transition:transform .15s ease}.cm-chevron.collapsed{transform:rotate(-90deg)}.cm-editor-wrap{overflow:hidden}.cm-editor-wrap .cm-editor{max-height:600px}.cm-editor-wrap--fullscreen{height:100%;background:#f4f5f6}.cm-editor-wrap--fullscreen .cm-editor{height:100%;max-height:none}.cm-editor-wrap--fullscreen .cm-scroller{height:100%}.ProseMirror>.code-block-cm:hover{background:#f4f5f6}",Jh=".mermaid-block-wrap{margin:8px 0;border:1px solid #e4e5e7;border-radius:6px;overflow:hidden;background:#f4f5f6}.cm-lang-label{font-size:12px;color:#8f959e;padding:0 6px}.mermaid-preview{padding:20px;background:#fff;min-height:120px;display:flex;align-items:center;justify-content:center}.mermaid-svg-container{width:100%;display:flex;justify-content:center;overflow:auto;max-height:500px}.mermaid-svg-container :deep(svg){max-width:100%;height:auto}.mermaid-error{display:flex;align-items:center;gap:8px;color:#c0392b;padding:12px;background:#ff4d4f14;border-radius:4px;font-size:13px;font-family:monospace}.mermaid-block-wrap .mep-root{height:400px}.mermaid-fullscreen-panel{display:flex;flex-direction:column;height:100%;min-height:0}.mermaid-fullscreen-panel .mep-root{flex:1;height:100%;min-height:0}.mermaid-error--fullscreen{margin:12px;flex-shrink:0}.ProseMirror>.mermaid-block-wrap:hover{background:#f4f5f6}.ProseMirror>[data-type=mermaid-block]:hover,.ProseMirror>[data-type=dot-flow-pad]:hover,.ProseMirror>[data-type=image-block]:hover{background:none}.mermaid-preview--fullscreen{height:100%;min-height:0}",Xh=`
308
308
  html,body{margin:0;background:#fff;}
309
309
  body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;}
310
310
  .pagely-md-preview{max-width:860px;margin:0 auto;padding:28px 40px 56px;}
package/dist/pagely.js CHANGED
@@ -21,8 +21,8 @@ import { history as bd, defaultKeymap as yd, historyKeymap as wd, indentWithTab
21
21
  import { bracketMatching as kd, indentOnInput as Td, foldGutter as Cd, syntaxHighlighting as Sd, defaultHighlightStyle as Md } from "@codemirror/language";
22
22
  import { closeBracketsKeymap as Ad, closeBrackets as Ed } from "@codemirror/autocomplete";
23
23
  import { InlineMath as Ld, BlockMath as Id } from "@tiptap/extension-mathematics";
24
- import { DotFlowPad as Wo } from "dot-flow-pad";
25
- import { MermaidEditorPanel as zd } from "mermaid-smart-editor";
24
+ import { DotFlowPad as Wo } from "@henryx/dot-flow-pad";
25
+ import { MermaidEditorPanel as zd } from "@henryx/mermaid-smart-editor";
26
26
  import Bd from "mermaid";
27
27
  import { CellSelection as Dd, TableMap as Od, selectedRect as Nd } from "@tiptap/pm/tables";
28
28
  const F0 = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE"]), Rd = /* @__PURE__ */ new Set(["BLOCKQUOTE"]);
@@ -19127,7 +19127,7 @@ const P4 = { class: "eb-shell" }, H4 = { class: "eb-label" }, $4 = {
19127
19127
  for (const [n, a] of e)
19128
19128
  t[n] = a;
19129
19129
  return t;
19130
- }, W4 = /* @__PURE__ */ Bt(U4, [["__scopeId", "data-v-50011b37"]]), G4 = mn.create({
19130
+ }, W4 = /* @__PURE__ */ Bt(U4, [["__scopeId", "data-v-9cffdd9d"]]), G4 = mn.create({
19131
19131
  name: "dotFlowPadBlock",
19132
19132
  content: "",
19133
19133
  marks: "",