@henryx/pagely 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pagely.cjs CHANGED
@@ -1,54 +1,49 @@
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,`
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
- ${e}`.match(/`+/g)??[]).reduce((l,i)=>Math.max(l,i.length),0),o="`".repeat(Math.max(3,n+1));return`${o}${r}
1
+ "use strict";var ls=Object.create;var da=Object.defineProperty;var is=Object.getOwnPropertyDescriptor;var ss=Object.getOwnPropertyNames;var us=Object.getPrototypeOf,cs=Object.prototype.hasOwnProperty;var ds=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ss(e))!cs.call(t,o)&&o!==r&&da(t,o,{get:()=>e[o],enumerable:!(n=is(e,o))||n.enumerable});return t};var Xe=(t,e,r)=>(r=t!=null?ls(us(t)):{},ds(e||!t||!t.__esModule?da(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),Oe=require("@tiptap/vue-3"),I=require("lucide-vue-next"),Te=require("@tiptap/core"),qr=require("@tiptap/pm/model"),ms=require("markdown-it"),fs=require("turndown"),ps=require("@tiptap/starter-kit"),fr=require("@tiptap/extension-table"),hs=require("@tiptap/extension-task-list"),vs=require("@tiptap/extension-task-item"),gs=require("@tiptap/extension-color"),bs=require("@tiptap/extension-highlight"),ys=require("@tiptap/extension-text-style"),rt=require("@tiptap/pm/state"),Mt=require("@tiptap/pm/view");require("@fontsource/jetbrains-mono/400.css");require("@fontsource/jetbrains-mono/500.css");const Ke=require("@codemirror/view"),Dt=require("@codemirror/state"),Sr=require("@codemirror/commands"),dr=require("@codemirror/language"),ma=require("@codemirror/autocomplete"),Bo=require("@tiptap/extension-mathematics"),fa=require("@henryx/dot-flow-pad"),ws=require("@henryx/mermaid-smart-editor"),ks=require("mermaid"),r0=require("@tiptap/pm/tables"),en=new Set(["P","H1","H2","H3","H4","H5","H6","PRE"]),xs=new Set(["BLOCKQUOTE"]);function pt(t,e){switch(e){case"P":t.setParagraph();break;case"H1":t.setHeading({level:1});break;case"H2":t.setHeading({level:2});break;case"H3":t.setHeading({level:3});break;case"H4":t.setHeading({level:4});break;case"H5":t.setHeading({level:5});break;case"H6":t.setHeading({level:6});break;case"UL":t.toggleBulletList();break;case"OL":t.toggleOrderedList();break;case"LI_TASK":t.toggleTaskList();break;case"PRE":t.setCodeBlock();break;case"BLOCKQUOTE":t.toggleBlockquote();break}}function Cs(t,e,r,n){if(e!==r){if(en.has(e)){pt(t,e);return}if(xs.has(e)){n(),pt(t,e);return}n(),pt(t,e)}}function Ts(t,e){Cs(t,e,"BLOCKQUOTE",()=>t.toggleBlockquote())}function Es(t,e){if(e!=="PRE"){if(en.has(e)){pt(t,e);return}t.unsetCodeBlock(),pt(t,e)}}function Lo(t,e,r,n){e.forEach((o,l)=>{const i=r+1+l;(o.type.name==="bulletList"||o.type.name==="orderedList")&&(t.setNodeMarkup(i,n,o.attrs),o.forEach((s,c)=>{s.type.name==="listItem"&&Lo(t,s,i+1+c,n)}))})}function Ms(t,e){if(en.has(e)){t.liftListItem("listItem"),e!=="P"&&pt(t,e);return}if(e==="LI_TASK"){t.liftListItem("listItem"),t.toggleTaskList();return}const r=e==="UL"?"bulletList":"orderedList";t.command(({tr:n,state:o})=>{const{$from:l}=o.selection,i=o.schema.nodes[r];if(!i)return!1;let s=-1;for(let g=l.depth;g>=0;g-=1)if(l.node(g).type.name==="listItem"){s=g;break}if(s<1)return!1;const c=l.before(s),m=l.node(s),p=l.node(s-1),f=l.before(s-1);return(p.type.name==="bulletList"||p.type.name==="orderedList")&&n.setNodeMarkup(f,i,p.attrs),Lo(n,m,c,i),!0})}function Ss(t,e){if(e!=="LI_TASK"){if(en.has(e)){t.liftListItem("taskItem"),e!=="P"&&pt(t,e);return}t.toggleTaskList(),e!=="P"&&pt(t,e)}}const As={text:pt,blockquote:Ts,pre:Es,listItem:Ms,taskItem:Ss},C0={P:{id:"P",label:"正文",icon:I.Type},H1:{id:"H1",label:"一级标题",icon:I.Heading1},H2:{id:"H2",label:"二级标题",icon:I.Heading2},H3:{id:"H3",label:"三级标题",icon:I.Heading3},H4:{id:"H4",label:"四级标题",icon:I.Heading4},H5:{id:"H5",label:"五级标题",icon:I.Heading5},H6:{id:"H6",label:"六级标题",icon:I.Heading6},UL:{id:"UL",label:"无序列表",icon:I.List},OL:{id:"OL",label:"有序列表",icon:I.ListOrdered},LI_TASK:{id:"LI_TASK",label:"任务列表",icon:I.SquareCheckBig},PRE:{id:"PRE",label:"代码块",icon:I.CodeXml},BLOCKQUOTE:{id:"BLOCKQUOTE",label:"引用",icon:I.Quote},CUT_BLOCK:{id:"CUT_BLOCK",label:"剪切",icon:I.Scissors,action:"op",op:"cutBlock"},COPY_BLOCK:{id:"COPY_BLOCK",label:"复制",icon:I.Copy,action:"op",op:"copyBlock"},DELETE_BLOCK:{id:"DELETE_BLOCK",label:"删除",icon:I.Trash2,danger:!0,action:"op",op:"deleteBlock"},COPY_CODE:{id:"COPY_CODE",label:"复制代码",icon:I.Copy,action:"op",op:"copyCode"},DELETE_CODE_BLOCK:{id:"DELETE_CODE_BLOCK",label:"删除代码块",icon:I.Trash2,danger:!0,action:"op",op:"deleteCodeBlock"},COPY_CANVAS_CODE:{id:"COPY_CANVAS_CODE",label:"复制画板代码",icon:I.FileCode,action:"op",op:"copyCanvasCode"},COPY_CANVAS_IMAGE:{id:"COPY_CANVAS_IMAGE",label:"复制图片",icon:I.Image,action:"op",op:"copyCanvasImage"},CUT_TABLE:{id:"CUT_TABLE",label:"剪切",icon:I.Scissors,action:"op",op:"cutTable"},COPY_TABLE:{id:"COPY_TABLE",label:"复制",icon:I.Copy,action:"op",op:"copyTable"},TOGGLE_TABLE_HEADER_ROW:{id:"TOGGLE_TABLE_HEADER_ROW",label:"标题行",icon:I.Rows3,action:"op",op:"toggleTableHeaderRow",toggle:!0},TOGGLE_TABLE_HEADER_COL:{id:"TOGGLE_TABLE_HEADER_COL",label:"标题列",icon:I.Columns3,action:"op",op:"toggleTableHeaderColumn",toggle:!0},DELETE_TABLE:{id:"DELETE_TABLE",label:"删除",icon:I.Trash2,danger:!0,action:"op",op:"deleteTable"},INDENT_INC:{id:"INDENT_INC",label:"增加缩进",icon:I.Indent,action:"indent",indentDir:"inc"},INDENT_DEC:{id:"INDENT_DEC",label:"减少缩进",icon:I.Outdent,action:"indent",indentDir:"dec"},SUBMENU_INDENT_LIST:{id:"SUBMENU_INDENT_LIST",label:"缩进",icon:I.Indent,children:["INDENT_DEC","INDENT_INC"]},COLOR:{id:"COLOR",label:"颜色",icon:I.Palette,panel:"color"},CANVAS:{id:"CANVAS",label:"画板",icon:I.Workflow,description:"在文档中轻松画出清晰好看的示意图、结构图、流程图"},MERMAID:{id:"MERMAID",label:"Mermaid 图表",icon:I.GitBranch,description:"用文本语法描述流程图、时序图、甘特图等"}},Bs={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"]}},pa=t=>t.firstElementChild??t,Ls={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:t=>t.firstElementChild??t},TASK_ITEM:{sections:["CONVERT_TILES","INDENT_LIST","COLOR_SECTION"],currentTypeId:"LI_TASK",getRectEl:t=>t.querySelector(":scope > div")??t.firstElementChild??t,getPMDomTarget:t=>t.querySelector(":scope > div")??t.firstElementChild??t,convert:"taskItem"},LI:{sections:["CONVERT_TILES","INDENT_LIST","COLOR_SECTION"],getCurrentTypeId:t=>{var e;return((e=t.parentElement)==null?void 0:e.tagName.toUpperCase())??"UL"},getRectEl:pa,getPMDomTarget:pa,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"]}},Ns={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"},No={P:{label:"正文",icon:I.Type,pillVariant:"text"},H1:{label:"标题 1",icon:I.Heading1,pillVariant:"text"},H2:{label:"标题 2",icon:I.Heading2,pillVariant:"text"},H3:{label:"标题 3",icon:I.Heading3,pillVariant:"text"},H4:{label:"标题 4",icon:I.Heading4,pillVariant:"text"},H5:{label:"标题 5",icon:I.Heading5,pillVariant:"text"},H6:{label:"标题 6",icon:I.Heading6,pillVariant:"text"},PRE:{label:"代码块",icon:I.CodeXml,pillVariant:"text"},BLOCKQUOTE:{label:"引用",icon:I.Quote,pillVariant:"text"},TASK_ITEM:{label:"任务项",icon:I.SquareCheckBig,pillVariant:"text"},LI:{label:"列表项",icon:I.List,pillVariant:"text"},TABLE:{label:"表格",icon:I.Grid2x2,pillVariant:"table"},TD:{label:"单元格",icon:I.Grid2x2,pillVariant:"minimal"},TH:{label:"表头格",icon:I.Grid2x2,pillVariant:"minimal"},HR:{label:"分割线",icon:I.Minus,pillVariant:"minimal"},MERMAID_BLOCK:{label:"Mermaid 图表",icon:I.GitBranch,pillVariant:"minimal"},DOT_FLOW_PAD_BLOCK:{label:"画板",icon:I.Workflow,pillVariant:"minimal"},IMG:{label:"图片",icon:I.Image,pillVariant:"minimal"},BLOCK_MATH:{label:"公式",icon:I.Type,pillVariant:"minimal"},EMBED_VIEW:{label:"预览",icon:I.FileText,pillVariant:"text"}};function Is(t){return{label:t.label,style:t.style,items:t.items.map(e=>C0[e])}}function Qt(t){const e=t.toUpperCase(),r=No[e]??zs,n=Ls[Ns[e]??"MINIMAL"];return{...r,sections:n.sections.map(o=>Is(Bs[o])),getRectEl:n.getRectEl,getPMDomTarget:n.getPMDomTarget,applyConvert:n.convert?As[n.convert]:void 0,currentTypeId:n.currentTypeId,getCurrentTypeId:n.getCurrentTypeId,isWrapper:n.isWrapper}}const zs={label:"块",icon:I.Type,pillVariant:"text"},Ot=Object.fromEntries(Object.keys(No).map(t=>[t,Qt(t)]));Ot.P??(Ot.P=Qt("P"));const Ds=8,Hs=[t=>t.closest("td, th"),(t,e)=>{const r=t.closest(".tableWrapper"),n=r==null?void 0:r.querySelector("table");return n&&e.contains(n)?n:null},(t,e)=>{if(t.tagName==="UL"||t.tagName==="OL")return null;const r=t.closest("li");return r&&e.contains(r)?r:null},(t,e)=>{let r=t;for(;r&&r.parentElement!==e;){if(r===e)return null;r=r.parentElement}return!r||r===e||r.tagName==="UL"||r.tagName==="OL"?null:r}];function Rs(t,e){if(t===e)return null;for(const r of Hs){const n=r(t,e);if(n)return n}return null}function Ps(t,e){var n;let r=e;for(;r&&r.parentElement!==t;)r=r.parentElement;return((n=r??t.firstElementChild)==null?void 0:n.tagName.toUpperCase())??null}function ha(t){var n;const e=t.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 r=t.tagName.toUpperCase();return r==="LI"&&((n=t.parentElement)==null?void 0:n.dataset.type)==="taskList"?"TASK_ITEM":r}function Io(t,e){const r=a.ref(!1),n=a.reactive({}),o=a.reactive({tag:"P",label:"正文",currentTypeIds:["P"]});let l=null;function i(f){var F,P,N;const g=t.value;if(!g)return;const b=g.querySelector(".ProseMirror");if(!b)return;const v=f.target;if((F=v.closest)!=null&&F.call(v,".block-btn-overlay")||!b.contains(v))return;const w=Rs(v,b);if(!w)return;l=w;const k=ha(w),T=Qt(k),E=(((P=T.getRectEl)==null?void 0:P.call(T,w))??w).getBoundingClientRect(),S=w.closest("td, th"),B=S?S.getBoundingClientRect().left:E.left;n.top=`${E.top+E.height/2}px`,n.left=`${B-Ds}px`,o.tag=k,o.label=T.label;const z=T.currentTypeId??((N=T.getCurrentTypeId)==null?void 0:N.call(T,w))??k;if(T.isWrapper){const H=Ps(w,v);o.currentTypeIds=H?[z,H]:[z]}else o.currentTypeIds=[z];r.value=!0}function s(){c()}function c(){r.value=!1,l=null}function m(){var f;if(!l||!e.value)return null;try{const g=ha(l),b=Qt(g),v=((f=b.getPMDomTarget)==null?void 0:f.call(b,l))??l,w=e.value.view.posAtDOM(v,0);if(v!==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 p(){if(!l||!e.value)return null;try{const f=e.value.view.posAtDOM(l,0),g=f-1;return g>=0&&e.value.state.doc.nodeAt(g)?g:e.value.state.doc.nodeAt(f)?f:g>=0?g:null}catch{return null}}return{overlayVisible:r,overlayStyle:n,blockInfo:o,onMouseMove:i,onMouseLeave:s,getCurrentBlockEl:()=>l,getCurrentBlockPMPos:m,getCurrentBlockRootPMPos:p}}function Ar(t,e,r){return Math.max(e,Math.min(t,r))}function T0(t,e,r,n=4,o=0){const l=window.innerWidth,i=window.innerHeight,s=8,c=Math.max(s,l-e-s),m=Math.max(s,i-o-s),p=E=>E>=s&&E+e<=l-s,f=E=>o<=0||E>=s&&E+o<=i-s,g=t.left-n-e,b=t.left+t.width+n,v=t.top+t.height+n,w=t.top-o-n;function k(E){const S=E==="left"?g:b;return p(S)?{top:Ar(t.top,s,m),left:S,placement:E}:null}function T(E){const S=E==="below"?v:w;return f(S)?{top:S,left:Ar(t.left,s,c),placement:E}:null}const M=r==="left"?["left","right","below","above"]:r==="right"?["right","left","below","above"]:r==="above"?["above","below","right","left"]:["below","above","right","left"];for(const E of M){const S=E==="left"||E==="right"?k(E):T(E);if(S)return S}return{top:Ar(r==="above"?w:v,s,m),left:Ar(r==="left"?g:r==="right"?b:t.left,s,c),placement:r}}const St=224,tn=4,va=8,Os=32,wr=120;function zo(t){return t==="below"?"translateY(-4px)":t==="above"?"translateY(4px)":t==="right"?"translateX(-4px)":"translateX(4px)"}function Vs(t,e){const r=window.innerHeight-e-va,n=t-e/2;return Math.max(va,Math.min(n,r))}function E0(t){const e=a.ref(null),r=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,r.value=0,n.value=0}function c(v,w){var E;i(),e.value=v,o.value=!1;const k=w.currentTarget,T=k==null?void 0:k.getBoundingClientRect(),M=(E=k==null?void 0:k.closest(t.rootSelector))==null?void 0:E.getBoundingClientRect();T&&(r.value=Vs(T.top+T.height/2,t.estimatedHeight())),M&&(n.value=M.right)}function m(){s()}function p(){l||(l=setTimeout(()=>{o.value||(e.value=null),l=null},t.closeDelay??wr))}function f(){o.value=!0,i()}function g(){o.value=!1,p()}const b=a.computed(()=>({position:"fixed",top:`${r.value||t.fallbackTop()}px`,left:`${n.value||t.fallbackLeft()}px`,zIndex:"301"}));return a.watch(t.visible,v=>{v&&s()}),a.onBeforeUnmount(()=>{i()}),{rootId:e,hovered:o,style:b,open:c,close:m,scheduleClose:p,clearCloseTimer:i,onPanelMouseEnter:f,onPanelMouseLeave:g}}const $s=400;function Do(t,e,r,n,o){const l=a.ref(!1),i=a.ref(0),s=a.ref(0),c=a.ref("left"),m=a.ref(null),p=a.ref("P");let f=null;function g(){f&&(clearTimeout(f),f=null)}function b(){l.value=!1}function v(){const B=m.value;B!==null&&t.value&&t.value.chain().focus().setTextSelection(B+1).run()}function w(){m.value=e(),p.value=n(),o(),g(),v();const B=r();if(!B)return;const z=T0({top:B.top,left:B.left,width:B.width,height:B.height},St,"left",tn,$s);i.value=z.top,s.value=z.left,c.value=z.placement,l.value=!0}function k(){f||(f=setTimeout(()=>{l.value=!1,f=null},wr))}function T(){g(),w()}function M(B){var F;const z=B==null?void 0:B.relatedTarget;(F=z==null?void 0:z.closest)!=null&&F.call(z,".pagely-block-menu, .pagely-block-submenu, .pagely-hover-preview")||k()}function E(){g()}function S(){k()}return a.onBeforeUnmount(g),{visible:l,top:i,left:s,placement:c,targetPos:m,sourceTag:p,open:w,close:b,focusTarget:v,onPillEnter:T,onPillLeave:M,onMenuEnter:E,onMenuLeave:S,clearHideTimer:g}}function Pe(t){if(Array.isArray(t))return t.filter(e=>typeof e=="string"&&e.length>0);if(typeof t!="string"||t.length===0)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.length>0):[]}catch{return[]}}function Fs(t){return Array.from(new Set(t.filter(e=>e.length>0)))}function Ho(t,e){return Fs([...t,e])}function Ro(t,e){return t.filter(r=>r!==e)}const ga=20;function Po(t){const e=t.trim().replace(/\s+/g," ");return e?e.length>ga?`${e.slice(0,ga)}…`:e:""}function Oo(t){return t.type.name==="table"?"[表格]":t.type.name==="tableRow"?"[行]":t.type.name==="tableCell"||t.type.name==="tableHeader"?"[单元格]":t.type.name==="codeBlock"?"[代码块]":t.type.name==="blockMath"?"[公式]":t.type.name==="image"?"[图片]":t.type.name==="mermaidBlock"?"[Mermaid 图表]":t.type.name==="dotFlowPadBlock"?"[画板]":t.type.name==="embedView"?String(t.attrs.label||t.attrs.href||"[嵌入内容]"):null}function M0(t){const e=Oo(t);if(e)return e;const r=t.textContent.trim().replace(/\s+/g," ");return r||`[${t.type.name}]`}function Vo(t){const e=Oo(t);if(e)return e;const r=M0(t);return r===`[${t.type.name}]`?r:Po(r)}function qs(t){const e=new Set;return t.descendants(r=>{const n=Pe(r.attrs.commentIds);for(const o of n)e.add(o);for(const o of r.marks)if(o.type.name==="commentMark")for(const l of Pe(o.attrs.commentIds))e.add(l);return!0}),e}function ba(t,e,r,n){const o=t.doc.type.schema.marks.commentMark;if(!o||r<0||n>t.doc.content.size||r>=n)return!1;const l=[];t.doc.nodesBetween(r,n,(i,s)=>{if(!i.isText)return!0;const c=Math.max(r,s),m=Math.min(n,s+i.nodeSize);if(c>=m)return!1;const p=i.marks.find(f=>f.type===o);return l.push({from:c,to:m,commentIds:Ho(Pe(p==null?void 0:p.attrs.commentIds),e)}),!1});for(const i of l)t.removeMark(i.from,i.to,o),t.addMark(i.from,i.to,o.create({commentIds:i.commentIds}));return l.length>0}function Us(t,e){const r=t.doc.type.schema.marks.commentMark;if(!r)return!1;const n=[];t.doc.descendants((o,l)=>{if(!o.isText)return!0;const i=o.marks.find(c=>c.type===r),s=Pe(i==null?void 0:i.attrs.commentIds);return s.includes(e)&&n.push({from:l,to:l+o.nodeSize,commentIds:Ro(s,e)}),!1});for(const o of n)t.removeMark(o.from,o.to,r),o.commentIds.length>0&&t.addMark(o.from,o.to,r.create({commentIds:o.commentIds}));return n.length>0}function _s(t){const e=t.doc.type.schema.marks.commentMark;if(!e)return!1;const r=[];t.doc.descendants((n,o)=>n.isText?(n.marks.some(l=>l.type===e)&&r.push({from:o,to:o+n.nodeSize}),!1):!0);for(const n of r)t.removeMark(n.from,n.to,e);return r.length>0}function ya(t,e,r){if(r<0||r>t.doc.content.size)return!1;const n=t.doc.nodeAt(r);if(!n||n.isText)return!1;const o=Ho(Pe(n.attrs.commentIds),e);return t.setNodeMarkup(r,void 0,{...n.attrs,commentIds:o},n.marks),!0}function Ws(t,e){const r=[];t.doc.descendants((n,o)=>{if(n.isText)return!0;const l=Pe(n.attrs.commentIds);return l.includes(e)&&r.push({pos:o,node:n,commentIds:Ro(l,e)}),!0});for(const n of r)t.setNodeMarkup(n.pos,void 0,{...n.node.attrs,commentIds:n.commentIds},n.node.marks);return r.length>0}function Gs(t){const e=[];t.doc.descendants((r,n)=>(r.isText||Pe(r.attrs.commentIds).length>0&&e.push({pos:n,node:r}),!0));for(const r of e)t.setNodeMarkup(r.pos,void 0,{...r.node.attrs,commentIds:[]},r.node.marks);return e.length>0}function An(t,e){if(!(t instanceof Element))return null;const r=t.closest(".pagely-comment-inline, .pagely-comment-block");return r&&e.contains(r)?r:null}function wa(t){return Pe(t.getAttribute("data-comment-ids"))}function Ks(t,e){const r=t.view.nodeDOM(e);return r instanceof HTMLElement?r.getBoundingClientRect():Te.posToDOMRect(t.view,e,e+1)}function Ys(t,e){return e.from<0||e.to>t.content.size||e.from>=e.to?!1:e.text?t.textBetween(e.from,e.to,"")===e.text:!0}function js(t,e){if(typeof e.nodePos!="number"||e.nodePos<0||e.nodePos>t.content.size)return!1;const r=t.nodeAt(e.nodePos);if(!r||r.isText||e.nodeType&&r.type.name!==e.nodeType)return!1;const n=e.fullText??e.text;return!(n&&M0(r)!==n&&Vo(r)!==n)}function Bn(t){const e=new Map,r=[],n=t.state.schema.marks.commentMark;return t.state.doc.descendants((o,l)=>{if(o.isText){const s=n?o.marks.find(m=>m.type===n):null,c=Pe(s==null?void 0:s.attrs.commentIds);for(const m of c){const p=e.get(m)??[];p.push({from:l,to:l+o.nodeSize,text:o.text??""}),e.set(m,p)}return!1}const i=Pe(o.attrs.commentIds);for(const s of i)r.push({id:s,kind:"block",nodePos:l,nodeType:o.type.name,text:Vo(o),fullText:M0(o)});return!0}),[...Array.from(e.entries()).map(([o,l])=>({id:o,kind:"inline",ranges:l,text:Po(l.map(i=>i.text).join(""))})),...r]}function $o(t,e={}){let r,n=null,o=new Set,l=null;const i=new Set;let s="",c=null;function m(){const N=e.enabled;return typeof N=="boolean"?N:N&&typeof N=="object"&&"value"in N?N.value:!0}function p(){const N=t.value;return N?Bn(N):[]}function f(){l&&(clearTimeout(l),l=null)}function g(N){return JSON.stringify(N)}function b(N){return new Set(N.map(H=>H.id))}function v(N){c=N,f(),l=setTimeout(()=>{var G;l=null;const H=c??p();c=null,(G=e.onAnchorsChanged)==null||G.call(e,H)},300)}function w(N){var ae;if(!m()||!N.transaction.docChanged)return;const H=Bn(N.editor),G=b(H);for(const re of o)G.has(re)||i.has(re)||(ae=e.onOrphaned)==null||ae.call(e,{commentId:re});i.clear(),o=G;const X=g(H);X!==s&&(s=X,v(H))}function k(N){var X;if(!m()||!r)return;const H=An(N.target,r.view.dom);if(!H)return;const G=wa(H);G.length!==0&&((X=e.onClick)==null||X.call(e,{commentIds:G,rect:H.getBoundingClientRect()}))}function T(N){var X;if(!m()||!r)return;const H=An(N.target,r.view.dom);if(!H)return;const G=wa(H);G.length>0&&((X=e.onHover)==null||X.call(e,{commentIds:G}))}function M(N){var G;if(!m()||!r)return;const H=An(N.target,r.view.dom);H&&(N.relatedTarget instanceof Node&&H.contains(N.relatedTarget)||(G=e.onHover)==null||G.call(e,null))}function E(N){r&&(r.off("transaction",w),n==null||n.removeEventListener("click",k),n==null||n.removeEventListener("mouseover",T),n==null||n.removeEventListener("mouseout",M)),r=N,n=null;const H=N?Bn(N):[];o=b(H),s=g(H),c=null,i.clear(),N&&(N.on("transaction",w),n=N.view.dom,n.addEventListener("click",k),n.addEventListener("mouseover",T),n.addEventListener("mouseout",M))}a.watch(t,E,{immediate:!0}),a.onBeforeUnmount(()=>{f(),E(void 0)});function S(N,H){const G=t.value;if(!G||!m())return!1;const X=G.state.tr;return!(H.kind==="inline"?ba(X,N,H.from,H.to):ya(X,N,H.nodePos))||!X.docChanged?!1:(X.setMeta("addToHistory",!1),G.view.dispatch(X),!0)}function B(N){const H=t.value;if(!H)return!1;const G=H.state.tr,X=Us(G,N),ae=Ws(G,N);return!X&&!ae?!1:(i.add(N),G.setMeta("addToHistory",!1),H.view.dispatch(G),!0)}function z(N){var ce;const H=t.value;if(!H||!m())return!1;const G=[],X=[],ae=new Set;for(const ne of N)if(ne.kind==="inline")for(const ge of ne.ranges??[])Ys(H.state.doc,ge)?G.push({id:ne.id,range:ge}):ae.add(ne.id);else js(H.state.doc,ne)?X.push({id:ne.id,nodePos:ne.nodePos}):ae.add(ne.id);for(const ne of ae)(ce=e.onAnchorDrift)==null||ce.call(e,{commentId:ne});if(N.length>0&&G.length===0&&X.length===0)return!1;const re=H.state.tr;for(const ne of qs(H.state.doc))i.add(ne);_s(re),Gs(re);for(const ne of G)ba(re,ne.id,ne.range.from,ne.range.to);for(const ne of X)ya(re,ne.id,ne.nodePos);return re.docChanged?(re.setMeta("addToHistory",!1),H.view.dispatch(re),!0):!1}function F(N){var re;const H=t.value;if(!H||!m())return!1;const{from:G,to:X,empty:ae}=H.state.selection;return ae||G>=X?!1:((re=e.onCreate)==null||re.call(e,{kind:"inline",from:G,to:X,rect:N??Te.posToDOMRect(H.view,G,X)}),!0)}function P(N,H){var X;const G=t.value;return!G||!m()?!1:((X=e.onCreate)==null||X.call(e,{kind:"block",nodePos:N,rect:H??Ks(G,N)}),!0)}return{getCommentAnchors:p,applyCommentAnchors:z,addComment:S,removeCommentAnchor:B,requestInlineComment:F,requestBlockComment:P}}function Xs(t){let e=!1,r=!1;function n(f){var b,v;const g=!!((v=(b=f.target).closest)!=null&&v.call(b,"td, th"));!e&&!r&&(g?(t.onBlockMouseLeave(),t.clearInsertButton()):(t.onBlockMouseMove(f),t.updateInsertButton())),t.onTableMouseMove(f)}function o(f){var w;const g=f.relatedTarget,b=document.querySelector(".block-btn-overlay"),v=document.querySelector(".pagely-insert-menu");b!=null&&b.contains(g)||v!=null&&v.contains(g)||(w=g==null?void 0:g.closest)!=null&&w.call(g,".table-tools-overlay")||(t.onBlockMouseLeave(),t.clearInsertButton(),t.scheduleTableHide())}function l(){e=!0,t.onBlockMouseLeave(),t.clearInsertButton(),t.closeBlockMenu(),t.closeInsertMenu()}function i(){e=!1}function s(){}function c(){!t.isBlockMenuVisible()&&!t.isInsertMenuVisible()&&(t.onBlockMouseLeave(),t.clearInsertButton())}function m(f){(f.ctrlKey||f.metaKey)&&f.shiftKey&&f.key.toLowerCase()==="v"&&(window.__pagelySkipNextPaste=!0),f.key==="Escape"&&(t.closeBlockMenu(),t.closeInsertMenu())}function p(f){r=f}return{onMove:n,onLeave:o,onEditorMouseDown:l,onDocMouseUp:i,onOverlayEnter:s,onOverlayLeave:c,onKeyDown:m,setHasSelection:p}}const Fo={H1:{id:"H1",label:"一级标题",icon:I.Heading1},H2:{id:"H2",label:"二级标题",icon:I.Heading2},H3:{id:"H3",label:"三级标题",icon:I.Heading3},H4:{id:"H4",label:"四级标题",icon:I.Heading4},H5:{id:"H5",label:"五级标题",icon:I.Heading5},H6:{id:"H6",label:"六级标题",icon:I.Heading6},OL:{id:"OL",label:"有序列表",icon:I.ListOrdered},UL:{id:"UL",label:"无序列表",icon:I.List},TASK:{id:"TASK",label:"任务列表",icon:I.SquareCheckBig},PRE:{id:"PRE",label:"代码块",icon:I.CodeXml},BLOCKQUOTE:{id:"BLOCKQUOTE",label:"引用",icon:I.Quote},HR:{id:"HR",label:"分割线",icon:I.SeparatorHorizontal},FORMULA:{id:"FORMULA",label:"公式",icon:I.Sigma},COMMENT:{id:"COMMENT",label:"评论",icon:I.MessageSquare},IMAGE:{id:"IMAGE",label:"图片",icon:I.Image},FILE:{id:"FILE",label:"文件",icon:I.FileText},LINK:{id:"LINK",label:"链接",icon:I.Link2},CANVAS:{id:"CANVAS",label:"画板",icon:I.Workflow},MERMAID:{id:"MERMAID",label:"Mermaid 图表",icon:I.GitBranch},TABLE:{id:"TABLE",label:"表格",icon:I.Table,picker:"table"}},Js=["H1","H2","H3","H4","H5","H6","OL","UL","TASK","PRE","BLOCKQUOTE","HR"],qo=[{label:"基础",style:"tiles",items:Js},{label:"常用",style:"list",items:["FORMULA","IMAGE","FILE","LINK","TABLE"]},{label:"绘图",style:"list",items:["CANVAS","MERMAID"]}],Uo=[{label:"常用",style:"list",items:["COMMENT","FORMULA"]}];function _o(t){return t.map(e=>({...e,items:e.items.map(r=>Fo[r])}))}const Wo=_o(qo),Go=_o(Uo);function S0(t){const e=t.trim();if(!e)return"";try{return new URL(e).pathname||e}catch{return e.split(/[?#]/,1)[0]??e}}function Qs(t){const e=t.trim();if(!e)return null;try{const r=new URL(e);return r.protocol!=="blob:"?r:new URL(e.slice(5))}catch{return null}}function ka(t){var o;const n=(S0(t).split("/").filter(Boolean).pop()??"").match(/\.([a-z0-9]+)$/i);return((o=n==null?void 0:n[1])==null?void 0:o.toLowerCase())??""}function Zs(t){try{return new URL(t.trim()).protocol==="blob:"}catch{return!1}}function Zt(t){const e=Qs(t);return(e==null?void 0:e.host)||t}function Ur(t){const e=t.trim();if(!e)return"";let r=S0(e);try{r=new URL(e).pathname||e}catch{}const n=r.split("/").filter(Boolean).pop()??e;try{return decodeURIComponent(n)}catch{return n}}const eu=new Set(["pdf","md","markdown","html","htm","txt","text","png","jpg","jpeg","gif","webp","svg","bmp","avif"]);function _r(t){const e=S0(t);return/\.pdf$/i.test(e)?"pdf":/\.(md|markdown)$/i.test(e)?"md":"url"}function Ko(t,e){const r=_r(t);return r==="url"&&e?_r(e):r}function tu(t,e=""){const r=Ko(t,e);return r==="pdf"?"card":r==="md"?"preview":"link"}function gr(t,e=""){const r=_r(t),n=_r(e);if(r==="pdf"||r==="md"||n==="pdf"||n==="md")return!0;const o=ka(e)||ka(t);return o?eu.has(o):Zs(t)?!1:nr(t)}function nr(t){const e=t.trim();if(!e)return!1;try{const r=new URL(e,"https://pagely.local/");if(r.protocol==="http:"||r.protocol==="https:")return!0;if(r.protocol!=="blob:")return!1;const n=new URL(e.slice(5));return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}const ru=new Set(["link","card","preview"]);function nu(t,e,r){if(ru.has(r)){const o=r;return o==="preview"&&!gr(t,e)?"link":o}const n=tu(t,e);return n==="preview"&&!gr(t,e)?"link":n}function Vt(t){var o,l;const e=((o=t.href)==null?void 0:o.trim())??"";if(!nr(e))return null;const n=(((l=t.label)==null?void 0:l.trim())??"")||Ur(e)||e;return{href:e,label:n,view:nu(e,n,t.preferredView)}}const Pt={H1:t=>t.setHeading({level:1}),H2:t=>t.setHeading({level:2}),H3:t=>t.setHeading({level:3}),H4:t=>t.setHeading({level:4}),H5:t=>t.setHeading({level:5}),H6:t=>t.setHeading({level:6}),OL:t=>t.toggleOrderedList(),UL:t=>t.toggleBulletList(),TASK:t=>t.toggleTaskList(),PRE:t=>t.setCodeBlock(),BLOCKQUOTE:t=>t.toggleBlockquote(),HR:t=>t.setHorizontalRule(),FORMULA:(t,e)=>t.insertInlineMath({latex:"\\placeholder",...(e==null?void 0:e.pos)!==void 0?{pos:e.pos}:{}}),COMMENT:()=>{},IMAGE:(t,e)=>{e!=null&&e.src&&t.insertImage({src:e.src,attachmentId:e.attachmentId??null,fileName:e.fileName??null,mimeType:e.mimeType??null,alt:e.alt??null,title:e.title??null})},FILE:(t,e)=>{const r=Vt({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});r&&t.insertEmbedView(r)},LINK:(t,e)=>{var o,l;const r=(o=e==null?void 0:e.href)==null?void 0:o.trim();if(!r)return;const n=((l=e==null?void 0:e.text)==null?void 0:l.trim())||r;t.insertContent({type:"text",text:n,marks:[{type:"link",attrs:{href:r,target:"_blank"}}]})},CANVAS:t=>t.insertDotFlowPadBlock(),MERMAID:t=>t.insertMermaidBlock(),TABLE:(t,e)=>t.insertTable({rows:(e==null?void 0:e.rows)??4,cols:(e==null?void 0:e.cols)??4,withHeaderRow:!0})},Yo={CANVAS:t=>t.insertDotFlowPadBlock(),MERMAID:t=>t.insertMermaidBlock()},Gt={rowBefore:{id:"rowBefore",label:"在上方插入行",icon:I.ArrowUpToLine,kind:"cell-op"},rowAfter:{id:"rowAfter",label:"在下方插入行",icon:I.ArrowDownToLine,kind:"cell-op"},colBefore:{id:"colBefore",label:"在左侧插入列",icon:I.ArrowLeftToLine,kind:"cell-op"},colAfter:{id:"colAfter",label:"在右侧插入列",icon:I.ArrowRightToLine,kind:"cell-op"},delRow:{id:"delRow",label:"删除当前行",icon:I.Trash2,danger:!0,kind:"cell-op"},delCol:{id:"delCol",label:"删除当前列",icon:I.Trash2,danger:!0,kind:"cell-op"}},au=[{label:"行列操作",style:"list",items:[Gt.rowBefore,Gt.rowAfter,Gt.colBefore,Gt.colAfter]},{label:"",style:"list",items:[Gt.delRow,Gt.delCol]}],jo=[...Go,...au];function kt(t){return"kind"in t&&t.kind==="cell-op"}function Xo(t){const{$from:e}=t.state.selection;let r=0;for(let n=0;n<=e.depth;n++){const o=e.node(n).type.name;(o==="listItem"||o==="taskItem")&&r++}return r}function Jo(t){return t?!!(t.can().sinkListItem("listItem")||t.can().sinkListItem("taskItem")):!1}function Qo(t){return t?Xo(t)>=2:!1}function Zo(t){t.can().sinkListItem("listItem")?t.chain().focus().sinkListItem("listItem").run():t.can().sinkListItem("taskItem")&&t.chain().focus().sinkListItem("taskItem").run()}function el(t){Xo(t)<2||(t.isActive("taskItem")?t.chain().focus().liftListItem("taskItem").run():t.chain().focus().liftListItem("listItem").run())}const ou=["svg.lf-canvas-overlay",".lf-graph svg.lf-canvas-overlay",".lf-container svg.lf-canvas-overlay",".lf-container svg"];function xa(t){if(t.classList.contains("lucide")||t.closest(".eb-toolbar, .dfp-preview-overlay, .floating-left-bar, .canvas-extra-controls, .status-bar, .lf-control"))return!1;const e=t.getBoundingClientRect();return e.width>16&&e.height>16}function tl(t){if(!t)return null;for(const e of ou){const r=t.querySelector(e);if(r&&xa(r))return r}return Array.from(t.querySelectorAll("svg")).find(e=>xa(e))??null}function rn(){function t(r){var o;const n="http://www.w3.org/2000/svg";for(const l of Array.from(r.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,c=Number(l.getAttribute("y"))||0,m=Number(l.getAttribute("width"))||0,p=Number(l.getAttribute("height"))||0,f=document.createElementNS(n,"text");f.setAttribute("x",String(s+m/2)),f.setAttribute("y",String(c+p/2)),f.setAttribute("text-anchor","middle"),f.setAttribute("dominant-baseline","middle"),f.setAttribute("font-family","Arial, sans-serif"),f.setAttribute("font-size","14"),f.setAttribute("fill","#333"),f.textContent=i,l.replaceWith(f)}}async function e(r,n=2){var o;try{if(!("ClipboardItem"in window)||!((o=navigator.clipboard)!=null&&o.write))return!1;const l=r();if(!l)return!1;const i=l.getBoundingClientRect(),s=l.getAttribute("viewBox"),c=(s==null?void 0:s.split(/[\s,]+/).map(Number))??[],m=i.width||Number(l.getAttribute("width"))||c[2]||1,p=i.height||Number(l.getAttribute("height"))||c[3]||1,f=l.cloneNode(!0);t(f),f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.setAttribute("width",String(m)),f.setAttribute("height",String(p)),f.getAttribute("viewBox")||f.setAttribute("viewBox",`0 0 ${m} ${p}`);const g=new XMLSerializer().serializeToString(f),b=new Blob([g],{type:"image/svg+xml;charset=utf-8"}),v=URL.createObjectURL(b);try{const w=new Image,k=new Promise((S,B)=>{w.onload=()=>S(),w.onerror=()=>B(new Error("Failed to load SVG for PNG export"))});w.src=v,await k;const T=document.createElement("canvas");T.width=Math.max(1,Math.ceil(m*n)),T.height=Math.max(1,Math.ceil(p*n));const M=T.getContext("2d");if(!M)return!1;M.setTransform(n,0,0,n,0,0),M.fillStyle="#fff",M.fillRect(0,0,m,p),M.drawImage(w,0,0,m,p);const E=await new Promise(S=>{T.toBlob(S,"image/png")});return E?(await navigator.clipboard.write([new ClipboardItem({"image/png":E})]),!0):!1}finally{URL.revokeObjectURL(v)}}catch{return!1}}return{copyPngToClipboard:e}}function $t(t,e){const r=t.state.doc.nodeAt(e);return r?{node:r,from:e,to:e+r.nodeSize}:null}async function Wr(t){if(t)try{await navigator.clipboard.writeText(t)}catch{}}async function nn(t,e){var r;try{return!("ClipboardItem"in window)||!((r=navigator.clipboard)!=null&&r.write)?(await Wr(e),!0):(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})})]),!0)}catch{return await Wr(e),!1}}function an(t,e,r){const n=t.state.doc.slice(e,r),l=qr.DOMSerializer.fromSchema(t.schema).serializeFragment(n.content),i=document.createElement("div");return i.appendChild(l),i.innerHTML}function on(t,e){if(t.type.name==="image"){const r=t.attrs.src;if(typeof r=="string"&&r)return r}return t.textContent||e}function lu(t,e){const r=$t(t,e);if(!r)return;const n=an(t,r.from,r.to);nn(n,on(r.node,n))}function iu(t,e){const r=$t(t,e);!r||r.node.type.name!=="codeBlock"||Wr(r.node.textContent)}function su(t,e){const r=$t(t,e);r&&t.chain().focus().deleteRange({from:r.from,to:r.to}).run()}function uu(t,e){const r=$t(t,e);!r||r.node.type.name!=="codeBlock"||t.chain().focus().deleteRange({from:r.from,to:r.to}).run()}function cu(t,e){const r=$t(t,e);if(!r)return;const n=an(t,r.from,r.to),o=on(r.node,n);nn(n,o),t.chain().focus().deleteRange({from:r.from,to:r.to}).run()}function kr(t,e){const r=t.state.doc.nodeAt(e);if((r==null?void 0:r.type.name)==="table")return{node:r,from:e,to:e+r.nodeSize};try{const n=t.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 rl(t,e){let r=e+1;return t.descendants((n,o)=>n.isTextblock?(r=e+1+o+1,!1):!0),r}function du(t,e){const r=kr(t,e);if(!r)return;const n=an(t,r.from,r.to);nn(n,on(r.node,n))}function mu(t,e){const r=kr(t,e);if(!r)return;const n=an(t,r.from,r.to),o=on(r.node,n);nn(n,o),t.chain().focus().deleteRange({from:r.from,to:r.to}).run()}function fu(t,e){const r=$t(t,e);if(!r||r.node.type.name!=="dotFlowPadBlock")return;const n=r.node.attrs.data;typeof n=="string"&&Wr(n)}function pu(t,e){const r=$t(t,e);if(!r||r.node.type.name!=="dotFlowPadBlock")return;const n=t.view.nodeDOM(e);if(!n)return;const{copyPngToClipboard:o}=rn();o(()=>tl(n))}function hu(t,e){const r=kr(t,e);r&&t.chain().focus().deleteRange({from:r.from,to:r.to}).run()}function vu(t,e){const r=kr(t,e);r&&t.chain().focus().setTextSelection(rl(r.node,r.from)).toggleHeaderRow().run()}function gu(t,e){const r=kr(t,e);r&&t.chain().focus().setTextSelection(rl(r.node,r.from)).toggleHeaderColumn().run()}const Ln={copyBlock:lu,copyCode:iu,copyCanvasCode:fu,copyCanvasImage:pu,copyTable:du,cutTable:mu,cutBlock:cu,deleteBlock:su,deleteCodeBlock:uu,deleteTable:hu,toggleTableHeaderRow:vu,toggleTableHeaderColumn:gu};function n0(t,e,r){var n;e!==null&&((n=Ln[r])==null||n.call(Ln,t,e))}function nl(t){function e(i,s){try{const m=i.state.doc.resolve(s).parent;return m.type.name==="paragraph"&&m.content.size===0}catch{return!1}}function r(i,s){var g;const c=t.editor.value;if(!c)return;const m=c.chain().focus(),p=t.insertTargetPos.value,f=p!==null?p+1:void 0;if(f!==void 0&&m.setTextSelection(f),i==="FORMULA"){t.closeInsertMenu();const b=f??c.state.selection.from,v=e(c,b)?"block":"inline";t.openMathPopoverForInsert(b,t.getMathRectAtPos(b),v);return}(g=Pt[i])==null||g.call(Pt,m,{...s,pos:f}),m.run(),t.closeInsertMenu()}function n(i){var p;const s=t.editor.value;if(!s)return;t.focusHoveredCell();const c=s.state.selection.from;if(i==="FORMULA"){t.openMathPopoverForInsert(c,t.getMathRectAtPos(c),"inline");return}const m=s.chain().focus();(p=Pt[i])==null||p.call(Pt,m,{pos:c}),m.run()}function o(i){var s,c;(c=(s=t.cellOps)[i])==null||c.call(s)}function l(i){var b;const s=t.editor.value;if(!s)return;const c=C0[i];if((c==null?void 0:c.action)==="indent"&&c.indentDir){t.focusBlockTarget(),c.indentDir==="inc"?Zo(s):el(s),t.closeBlockMenu();return}if((c==null?void 0:c.action)==="op"&&c.op){n0(s,t.blockTargetPos.value,c.op),t.closeBlockMenu();return}const m=Yo[i];if(m){const v=s.chain().focus(),w=t.blockTargetPos.value;w!==null&&v.setTextSelection(w+1),m(v),v.run(),t.closeBlockMenu();return}const p=t.blockTargetPos.value,f=Qt(t.blockSourceTag.value),g=s.chain().focus();p!==null&&g.setTextSelection(p+1),(b=f.applyConvert)==null||b.call(f,g,i),g.run(),t.closeBlockMenu()}return{onInsert:r,onCellInsert:n,onCellOp:o,onConvert:l}}function al(t,e,r){const n=a.ref(!1);function o(){var s;const i=r();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 bu=220;function ol(t,e,r){const n=a.ref(!1),o=a.ref(0),l=a.ref(0),i=a.ref("left"),s=a.ref(null);let c=null;function m(){c&&(clearTimeout(c),c=null)}function p(){c||(c=setTimeout(()=>{n.value=!1,c=null},wr))}function f(E,S,B){s.value=E,r(),m();const z=T0(S,St,B,tn,bu);o.value=z.top,l.value=z.left,i.value=z.placement,n.value=!0}function g(){const E=t();if(E===null)return;const S=e();S&&f(E,{top:S.top,left:S.left,width:S.width,height:S.height},"left")}function b(E,S){f(E,{top:S.top,left:S.left,width:S.width,height:S.height},"below")}function v(){m(),g()}function w(E){var B;const S=E.relatedTarget;(B=S==null?void 0:S.closest)!=null&&B.call(S,".pagely-insert-menu")||p()}function k(){m()}function T(){p()}function M(){n.value=!1}return a.onBeforeUnmount(m),{visible:n,top:o,left:l,placement:i,targetPos:s,openFromButton:g,openFromSlash:b,onButtonEnter:v,onButtonLeave:w,onMenuEnter:k,onMenuLeave:T,close:M,scheduleClose:p,clearHideTimer:m}}function yu(t){const e=a.ref(!1),r=a.ref(null),n=a.ref(""),o=a.ref(null),l=a.ref("insert"),i=a.ref("inline");function s(v){var T;const w=(T=t.value)==null?void 0:T.view;if(!w)return null;const k=w.coordsAtPos(v);return new DOMRect(k.left,k.top,k.right-k.left,k.bottom-k.top)}function c(v,w,k="inline"){var M;const T=(M=t.value)==null?void 0:M.view.nodeDOM(w);r.value=(T==null?void 0:T.getBoundingClientRect())??s(w),n.value=v.attrs.latex,o.value=w,l.value="edit",i.value=k,e.value=!0}function m(v,w,k="inline"){r.value=w??s(v),n.value="",o.value=v,l.value="insert",i.value=k,e.value=!0}function p(){e.value=!1}function f(v){if(p(),!t.value||o.value===null)return;const w=v.trim();if(!w)return;const k=t.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 g(v){!e.value||o.value===null||(o.value=v.mapping.map(o.value,l.value==="insert"?1:-1))}function b(v){g(v.transaction);for(const w of v.appendedTransactions)g(w)}return a.onMounted(()=>{var v;(v=t.value)==null||v.on("transaction",b)}),a.onBeforeUnmount(()=>{var v;(v=t.value)==null||v.off("transaction",b)}),{visible:e,anchorRect:r,initialLatex:n,openForEdit:c,openForInsert:m,confirm:f,close:p,rectAtPos:s}}function wu(t){const{$from:e}=t.state.selection;for(let r=e.depth;r>0;r-=1)if(e.node(r).type.name==="codeBlock")return!0;return!1}function Nn(t){const{selection:e,doc:r}=t.state;if(!e.empty||wu(t))return null;const{$from:n}=e,o=n.start(),l=r.textBetween(o,e.from,`
2
+ `,"\0"),i=/(?:^|\s)@([^\s@]*)$/.exec(l);if(!i)return null;const s=i[1]??"",c=o+l.length-s.length-1;return{query:s,from:c,to:e.from}}function ku(t,e){const r=`@${e.displayName}`,n=e.from+r.length;if(e.from>=0&&n<=t.content.size&&t.textBetween(e.from,n,"")===r)return{from:e.from,to:n};const o=[];return t.descendants((l,i)=>{if(!l.isText||!l.text)return!0;let s=l.text.indexOf(r);for(;s>=0;){const c=i+s;o.push({from:c,to:c+r.length,distance:Math.abs(c-e.from)}),s=l.text.indexOf(r,s+r.length)}return!0}),o.sort((l,i)=>l.distance-i.distance),o[0]??null}function ll(t,e={}){let r,n=null,o="",l=null,i=null,s=!1;function c(k,T=!1){var S;const M=k?Nn(k):null,E=(M==null?void 0:M.from)??(l==null?void 0:l.from)??null;s&&((S=e.onCancel)==null||S.call(e)),o="",l=null,s=!1,i=T?E:null}function m(k){var E;const T=Nn(k);if(!T){c();return}if(i===T.from)return;const M=`${T.from}:${T.to}:${T.query}`;l={from:T.from,to:T.to},M!==o&&(o=M,s=!0,(E=e.onTrigger)==null||E.call(e,{query:T.query,rect:Te.posToDOMRect(k.view,T.from,T.to)}))}function p(k){!k.transaction.docChanged&&!k.transaction.selectionSet||m(k.editor)}function f(k){r&&(k.key!=="Escape"&&k.key!=="Enter"&&k.key!==" "||c(r,k.key==="Escape"))}function g(k){r&&(r.off("transaction",p),n==null||n.removeEventListener("keydown",f,!0)),r=k,n=null,o="",l=null,i=null,s=!1,k&&(k.on("transaction",p),n=k.view.dom,n.addEventListener("keydown",f,!0))}a.watch(t,g,{immediate:!0}),a.onBeforeUnmount(()=>{g(void 0)});function b(k){const T=t.value;if(!T)return!1;const M=Nn(T),E=M?{from:M.from,to:M.to}:l;return l=null,o="",i=null,s=!1,E?T.chain().focus().insertContentAt(E,[{type:"mention",attrs:k},{type:"text",text:" "}]).run():T.commands.insertMention(k)}function v(){const k=t.value;if(!k)return[];const T=[];return k.state.doc.descendants((M,E)=>M.type.name!=="mention"?!0:(T.push({userId:String(M.attrs.userId??""),displayName:String(M.attrs.displayName??""),from:E,to:E+M.nodeSize}),!1)),T}function w(k){const T=t.value,M=T==null?void 0:T.state.schema.nodes.mention;if(!T||!M)return!1;let E=T.state.tr;for(const S of[...k].sort((B,z)=>z.from-B.from)){const B=ku(E.doc,S);B&&(E=E.replaceWith(B.from,B.to,M.create({userId:S.userId,displayName:S.displayName})))}return E.docChanged?(E.setMeta("addToHistory",!1),T.view.dispatch(E),!0):!1}return{insertMention:b,getMentions:v,applyMentions:w}}const xu={js:"javascript",ts:"typescript",py:"python",rb:"ruby",md:"markdown",sh:"bash",zsh:"bash",yml:"yaml",tf:"hcl"};function il(t){const e=t.toLowerCase().trim();return xu[e]??e}function Ca(t){try{return JSON.stringify(JSON.parse(t))}catch{return t}}function Cu(t,e){const n=(`${t}
3
+ ${e}`.match(/`+/g)??[]).reduce((l,i)=>Math.max(l,i.length),0),o="`".repeat(Math.max(3,n+1));return`${o}${t}
4
4
  ${e}
5
- ${o}`}function us(r,e){const t=r.extractBody(e);return`
6
- ${e1(r.lang,t)}
7
- `}const Ql=[{lang:"mermaid",dataType:"mermaid-block",htmlTag:"pre",extractBody:r=>(r.textContent??"").trim(),buildHtml:(r,e)=>`<pre data-type="mermaid-block">${e(r)}</pre>
8
- `},{lang:"logicflow",dataType:"dot-flow-pad",htmlTag:"div",extractBody:r=>r0(r.getAttribute("data-graph")??'{"nodes":[],"edges":[]}'),buildHtml:(r,e)=>{const t=r0(r.trim());return`<div data-type="dot-flow-pad" data-graph="${e(t)}"></div>
9
- `}}];function cs(r){const e=r;return Ql.find(t=>{var n;return r.nodeName===t.htmlTag.toUpperCase()&&((n=e.getAttribute)==null?void 0:n.call(e,"data-type"))===t.dataType})??null}function n0(r){return r.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#39;";default:return e}})}function bl(r){return r.nodeName==="SPAN"&&r.getAttribute("data-type")==="inline-math"?r.getAttribute("data-latex")??r.textContent??"":null}function yl(r){var e;return r.nodeName==="DIV"&&((e=r.getAttribute)==null?void 0:e.call(r,"data-type"))==="block-math"?r.getAttribute("data-latex")??"":null}function t1(r){return r===0}function r1(r){let e=0,t=r.length;for(;e<t&&r[e].type==="text"&&r[e].content.trim()==="";)e++;for(;t>e&&r[t-1].type==="text"&&r[t-1].content.trim()==="";)t--;return r.slice(e,t)}function n1(r){return r.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\r?\n/g," ").trim()}function o1(r){return r.replace(/\)/g,"%29").trim()}function l1(r){r.core.ruler.push("embed_view",e=>{var t;for(let n=0;n<e.tokens.length-2;n++){const o=e.tokens[n],l=e.tokens[n+1],i=e.tokens[n+2];if(o.type!=="paragraph_open"||!t1(o.level)||l.type!=="inline"||!l.children||i.type!=="paragraph_close")continue;const s=r1(l.children);if(s.length!==3)continue;const[u,d,m]=s;if(u.type!=="link_open"||d.type!=="text"||m.type!=="link_close")continue;const h=((t=u.attrGet("href"))==null?void 0:t.trim())??"",p=d.content.trim();if(!h||!p)continue;const v=cr({href:h,label:p});if(!v)continue;const b=new e.Token("html_block","",0);b.block=!0,b.content=`<div data-type="embed-view" data-view="${v.view}" data-href="${r.utils.escapeHtml(v.href)}">${r.utils.escapeHtml(v.label)}</div>
10
- `,e.tokens.splice(n,3,b)}})}const a1={name:"embedView",filter:r=>r.nodeName==="DIV"&&r.getAttribute("data-type")==="embed-view",replacement:(r,e)=>{var l;const t=e,n=((l=t.getAttribute("data-href"))==null?void 0:l.trim())??"";return n?`
5
+ ${o}`}function sl(t,e){const r=t.extractBody(e);return`
6
+ ${Cu(t.lang,r)}
7
+ `}const A0=[{lang:"mermaid",dataType:"mermaid-block",htmlTag:"pre",extractBody:t=>(t.textContent??"").trim(),buildHtml:(t,e)=>`<pre data-type="mermaid-block">${e(t)}</pre>
8
+ `},{lang:"logicflow",dataType:"dot-flow-pad",htmlTag:"div",extractBody:t=>Ca(t.getAttribute("data-graph")??'{"nodes":[],"edges":[]}'),buildHtml:(t,e)=>{const r=Ca(t.trim());return`<div data-type="dot-flow-pad" data-graph="${e(r)}"></div>
9
+ `}}];function ul(t){const e=t;return A0.find(r=>{var n;return t.nodeName===r.htmlTag.toUpperCase()&&((n=e.getAttribute)==null?void 0:n.call(e,"data-type"))===r.dataType})??null}function Ta(t){return t.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#39;";default:return e}})}function a0(t){return t.nodeName==="SPAN"&&t.getAttribute("data-type")==="inline-math"?t.getAttribute("data-latex")??t.textContent??"":null}function o0(t){var e;return t.nodeName==="DIV"&&((e=t.getAttribute)==null?void 0:e.call(t,"data-type"))==="block-math"?t.getAttribute("data-latex")??"":null}function Tu(t){return t===0}function Eu(t){let e=0,r=t.length;for(;e<r&&t[e].type==="text"&&t[e].content.trim()==="";)e++;for(;r>e&&t[r-1].type==="text"&&t[r-1].content.trim()==="";)r--;return t.slice(e,r)}function Mu(t){return t.replace(/\\/g,"\\\\").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\r?\n/g," ").trim()}function Su(t){return t.replace(/\)/g,"%29").trim()}function Au(t){t.core.ruler.push("embed_view",e=>{var r;for(let n=0;n<e.tokens.length-2;n++){const o=e.tokens[n],l=e.tokens[n+1],i=e.tokens[n+2];if(o.type!=="paragraph_open"||!Tu(o.level)||l.type!=="inline"||!l.children||i.type!=="paragraph_close")continue;const s=Eu(l.children);if(s.length!==3)continue;const[c,m,p]=s;if(c.type!=="link_open"||m.type!=="text"||p.type!=="link_close")continue;const f=((r=c.attrGet("href"))==null?void 0:r.trim())??"",g=m.content.trim();if(!f||!g)continue;const b=Vt({href:f,label:g});if(!b)continue;const v=new e.Token("html_block","",0);v.block=!0,v.content=`<div data-type="embed-view" data-view="${b.view}" data-href="${t.utils.escapeHtml(b.href)}">${t.utils.escapeHtml(b.label)}</div>
10
+ `,e.tokens.splice(n,3,v)}})}const Bu={name:"embedView",filter:t=>t.nodeName==="DIV"&&t.getAttribute("data-type")==="embed-view",replacement:(t,e)=>{var l;const r=e,n=((l=r.getAttribute("data-href"))==null?void 0:l.trim())??"";return n?`
11
11
 
12
- [${n1(t.textContent||n)||n}](${o1(n)})
12
+ [${Mu(r.textContent||n)||n}](${Su(n)})
13
13
 
14
- `:""}};let Vo=null;function i1(){if(Vo)return Vo;const r=Vo=new Uc({html:!0,linkify:!0,typographer:!1});l1(r);const e=new Map(Ql.map(n=>[n.lang,n])),t=r.utils.escapeHtml.bind(r.utils);return r.renderer.rules.fence=(n,o)=>{const l=n[o],i=l.info?ss(l.info.trim()):"plaintext",s=e.get(i);if(s)return s.buildHtml(l.content,t);const u=t(l.content);return`<pre><code class="language-${i}">${u}</code></pre>
15
- `},r.core.ruler.push("math_block",n=>{for(let o=0;o<n.tokens.length;o++){if(n.tokens[o].type!=="paragraph_open")continue;const i=n.tokens[o+1],s=n.tokens[o+2];if(!i||i.type!=="inline"||!s||s.type!=="paragraph_close")continue;const u=i.content.match(/^\$\$([\s\S]+?)\$\$$/);if(!u)continue;const d=n0(u[1].trim()),m=new n.Token("html_block","",0);m.content=`<div data-type="block-math" data-latex="${d}"></div>
16
- `,n.tokens.splice(o,3,m)}}),r.core.ruler.push("math_inline",n=>{for(const o of n.tokens)o.type!=="inline"||!o.children||(o.children=o.children.flatMap(l=>l.type!=="text"?[l]:l.content.split(/(\$(?!\d+\$)[^$\n]+?\$(?!\d))/g).map(s=>{const u=s.match(/^\$(?!\d+\$)([^$\n]+?)\$(?!\d)$/);if(u){const m=new n.Token("html_inline","",0),h=n0(u[1]);return m.content=`<span data-type="inline-math" data-latex="${h}">${h}</span>`,m}const d=new n.Token("text","",0);return d.content=s,d})))}),r}function dn(r){return r.trim()?i1().render(r):""}function Vr(r){var n,o,l;const e=r.getAttribute("align");if(e==="left"||e==="center"||e==="right")return e;const t=(l=(o=(n=r.getAttribute("style"))==null?void 0:n.match(/text-align\s*:\s*(left|center|right)/i))==null?void 0:o[1])==null?void 0:l.toLowerCase();return t==="left"||t==="center"||t==="right"?t:null}function o0(r){let e=r.parentNode;for(;e;){if(e.nodeName==="LI")return!0;e=e.parentNode}return!1}const s1=new Set(["UL","OL","PRE","BLOCKQUOTE","HR","H1","H2","H3","H4","H5","H6"]),u1=new Set(["mermaid-block","block-math","dot-flow-pad","dot-flow-pad-block","embed-view","taskList","taskItem"]),c1=new Set(["data-type","data-latex","data-checked","data-href","data-language","data-view","data-graph","align","href","src","alt","title"]);function d1(r){return Array.from(r.querySelectorAll("*")).some(t=>{if(s1.has(t.tagName))return!0;const n=t.getAttribute("data-type");return n!==null&&u1.has(n)})}function f1(r){return Array.from(r.querySelectorAll("th, td")).some(d1)}function m1(r,e){const t=r.cloneNode(!0);for(const o of Array.from(t.querySelectorAll('span[data-type="inline-math"][data-latex]'))){const l=o.getAttribute("data-latex")??o.textContent??"",i=o.previousSibling,s=o.nextSibling,u=i?"PAGELYCELLSPACE":"",d=s?"PAGELYCELLSPACE":"";(i==null?void 0:i.nodeType)===3&&(i.nodeValue=(i.nodeValue??"").replace(/\s+$/,"")),(s==null?void 0:s.nodeType)===3&&(s.nodeValue=(s.nodeValue??"").replace(/^\s+/,"")),o.replaceWith(t.ownerDocument.createTextNode(`${u}$${l}$${d}`))}for(const o of Array.from(t.querySelectorAll("br")))o.replaceWith(t.ownerDocument.createTextNode("PAGELYBRK"));return e.turndown(t.innerHTML).replace(/PAGELYCELLSPACE/g," ").replace(/PAGELYBRK/g,"<br>").replace(/\r?\n/g," ").replace(/\|/g,"\\|").trim()}function h1(r){return r.name==="class"?r.value.split(/\s+/).some(e=>e.startsWith("language-")):c1.has(r.name)}function p1(r){var n;const e=r.cloneNode(!0);for(const o of Array.from(e.querySelectorAll("colgroup")))o.remove();for(const o of Array.from(e.querySelectorAll('li[data-type="taskItem"]'))){for(const l of Array.from(o.children))l.tagName==="LABEL"&&l.remove();for(const l of Array.from(o.children))if(l.tagName==="DIV"){for(;l.firstChild;)o.insertBefore(l.firstChild,l);l.remove()}}for(const o of Array.from(e.querySelectorAll("th > p, td > p")))!((n=o.textContent)!=null&&n.trim())&&o.children.length===0&&o.remove();const t=[e,...Array.from(e.querySelectorAll("*"))];for(const o of t){if(o.tagName==="TD"||o.tagName==="TH"){const i=Vr(o);for(const s of Array.from(o.attributes))if(s.name!=="align"){if(s.name==="class"){const u=s.value.split(/\s+/).filter(d=>d.startsWith("language-"));u.length?o.setAttribute("class",u.join(" ")):o.removeAttribute("class");continue}o.removeAttribute(s.name)}i?o.setAttribute("align",i):o.removeAttribute("align");continue}for(const i of Array.from(o.attributes))if(!h1(i)){o.removeAttribute(i.name);continue}const l=o.getAttribute("class");if(l!==null){const i=l.split(/\s+/).filter(s=>s.startsWith("language-"));i.length?o.setAttribute("class",i.join(" ")):o.removeAttribute("class")}}return e.outerHTML}function g1(r){return[...Ql.map(n=>({name:`${n.lang}Block`,filter:o=>cs(o)===n,replacement:(o,l)=>us(n,l)})),a1,{name:"strikethrough",filter:["del","s","strike"],replacement:n=>`~~${n}~~`},{name:"codeBlock",filter:n=>n.nodeName==="PRE"&&n.getAttribute("data-type")==="code-block",replacement:(n,o)=>{var u;const l=o,i=l.getAttribute("data-language")??"plaintext",s=((u=l.querySelector("code"))==null?void 0:u.textContent)??"";return`
14
+ `:""}};let In=null;function Lu(){if(In)return In;const t=In=new ms({html:!0,linkify:!0,typographer:!1});Au(t);const e=new Map(A0.map(n=>[n.lang,n])),r=t.utils.escapeHtml.bind(t.utils);return t.renderer.rules.fence=(n,o)=>{const l=n[o],i=l.info?il(l.info.trim()):"plaintext",s=e.get(i);if(s)return s.buildHtml(l.content,r);const c=r(l.content);return`<pre><code class="language-${i}">${c}</code></pre>
15
+ `},t.core.ruler.push("math_block",n=>{for(let o=0;o<n.tokens.length;o++){if(n.tokens[o].type!=="paragraph_open")continue;const i=n.tokens[o+1],s=n.tokens[o+2];if(!i||i.type!=="inline"||!s||s.type!=="paragraph_close")continue;const c=i.content.match(/^\$\$([\s\S]+?)\$\$$/);if(!c)continue;const m=Ta(c[1].trim()),p=new n.Token("html_block","",0);p.content=`<div data-type="block-math" data-latex="${m}"></div>
16
+ `,n.tokens.splice(o,3,p)}}),t.core.ruler.push("math_inline",n=>{for(const o of n.tokens)o.type!=="inline"||!o.children||(o.children=o.children.flatMap(l=>l.type!=="text"?[l]:l.content.split(/(\$(?!\d+\$)[^$\n]+?\$(?!\d))/g).map(s=>{const c=s.match(/^\$(?!\d+\$)([^$\n]+?)\$(?!\d)$/);if(c){const p=new n.Token("html_inline","",0),f=Ta(c[1]);return p.content=`<span data-type="inline-math" data-latex="${f}">${f}</span>`,p}const m=new n.Token("text","",0);return m.content=s,m})))}),t}function ar(t){return t.trim()?Lu().render(t):""}function or(t){var n,o,l;const e=t.getAttribute("align");if(e==="left"||e==="center"||e==="right")return e;const r=(l=(o=(n=t.getAttribute("style"))==null?void 0:n.match(/text-align\s*:\s*(left|center|right)/i))==null?void 0:o[1])==null?void 0:l.toLowerCase();return r==="left"||r==="center"||r==="right"?r:null}function Ea(t){let e=t.parentNode;for(;e;){if(e.nodeName==="LI")return!0;e=e.parentNode}return!1}const Nu=new Set(["UL","OL","PRE","BLOCKQUOTE","HR","H1","H2","H3","H4","H5","H6"]),Iu=new Set(["mermaid-block","block-math","dot-flow-pad","dot-flow-pad-block","embed-view","taskList","taskItem"]),zu=new Set(["data-type","data-latex","data-checked","data-href","data-language","data-view","data-graph","align","href","src","alt","title"]);function Du(t){return Array.from(t.querySelectorAll("*")).some(r=>{if(Nu.has(r.tagName))return!0;const n=r.getAttribute("data-type");return n!==null&&Iu.has(n)})}function Hu(t){return Array.from(t.querySelectorAll("th, td")).some(Du)}function Ru(t,e){const r=t.cloneNode(!0);for(const o of Array.from(r.querySelectorAll('span[data-type="inline-math"][data-latex]'))){const l=o.getAttribute("data-latex")??o.textContent??"",i=o.previousSibling,s=o.nextSibling,c=i?"PAGELYCELLSPACE":"",m=s?"PAGELYCELLSPACE":"";(i==null?void 0:i.nodeType)===3&&(i.nodeValue=(i.nodeValue??"").replace(/\s+$/,"")),(s==null?void 0:s.nodeType)===3&&(s.nodeValue=(s.nodeValue??"").replace(/^\s+/,"")),o.replaceWith(r.ownerDocument.createTextNode(`${c}$${l}$${m}`))}for(const o of Array.from(r.querySelectorAll("br")))o.replaceWith(r.ownerDocument.createTextNode("PAGELYBRK"));return e.turndown(r.innerHTML).replace(/PAGELYCELLSPACE/g," ").replace(/PAGELYBRK/g,"<br>").replace(/\r?\n/g," ").replace(/\|/g,"\\|").trim()}function Pu(t){return t.name==="class"?t.value.split(/\s+/).some(e=>e.startsWith("language-")):zu.has(t.name)}function Ou(t){var n;const e=t.cloneNode(!0);for(const o of Array.from(e.querySelectorAll("colgroup")))o.remove();for(const o of Array.from(e.querySelectorAll('li[data-type="taskItem"]'))){for(const l of Array.from(o.children))l.tagName==="LABEL"&&l.remove();for(const l of Array.from(o.children))if(l.tagName==="DIV"){for(;l.firstChild;)o.insertBefore(l.firstChild,l);l.remove()}}for(const o of Array.from(e.querySelectorAll("th > p, td > p")))!((n=o.textContent)!=null&&n.trim())&&o.children.length===0&&o.remove();const r=[e,...Array.from(e.querySelectorAll("*"))];for(const o of r){if(o.tagName==="TD"||o.tagName==="TH"){const i=or(o);for(const s of Array.from(o.attributes))if(s.name!=="align"){if(s.name==="class"){const c=s.value.split(/\s+/).filter(m=>m.startsWith("language-"));c.length?o.setAttribute("class",c.join(" ")):o.removeAttribute("class");continue}o.removeAttribute(s.name)}i?o.setAttribute("align",i):o.removeAttribute("align");continue}for(const i of Array.from(o.attributes))if(!Pu(i)){o.removeAttribute(i.name);continue}const l=o.getAttribute("class");if(l!==null){const i=l.split(/\s+/).filter(s=>s.startsWith("language-"));i.length?o.setAttribute("class",i.join(" ")):o.removeAttribute("class")}}return e.outerHTML}function Vu(t){return[...A0.map(n=>({name:`${n.lang}Block`,filter:o=>ul(o)===n,replacement:(o,l)=>sl(n,l)})),Bu,{name:"strikethrough",filter:["del","s","strike"],replacement:n=>`~~${n}~~`},{name:"codeBlock",filter:n=>n.nodeName==="PRE"&&n.getAttribute("data-type")==="code-block",replacement:(n,o)=>{var c;const l=o,i=l.getAttribute("data-language")??"plaintext",s=((c=l.querySelector("code"))==null?void 0:c.textContent)??"";return`
17
17
  \`\`\`${i}
18
18
  ${s}
19
19
  \`\`\`
20
- `}},{name:"taskItem",filter:n=>n.nodeName==="LI"&&n.getAttribute("data-type")==="taskItem",replacement:(n,o)=>{const l=o,i=l.getAttribute("data-checked")==="true",s=l.querySelector("div"),u=(s?s.textContent:l.textContent)??"";return`- ${i?"[x]":"[ ]"} ${u.trim()}
20
+ `}},{name:"taskItem",filter:n=>n.nodeName==="LI"&&n.getAttribute("data-type")==="taskItem",replacement:(n,o)=>{const l=o,i=l.getAttribute("data-checked")==="true",s=l.querySelector("div"),c=(s?s.textContent:l.textContent)??"";return`- ${i?"[x]":"[ ]"} ${c.trim()}
21
21
  `}},{name:"taskList",filter:n=>n.nodeName==="UL"&&n.getAttribute("data-type")==="taskList",replacement:n=>`
22
22
  ${n}
23
23
  `},{name:"listItem",filter:"li",replacement:(n,o,l)=>{var s;n=n.replace(/^\n+/,"").replace(/\n+$/,`
24
24
  `).replace(/\n/gm,`
25
- `);const i=o.parentNode;if((i==null?void 0:i.nodeName)==="OL"){const u=parseInt(((s=i.getAttribute)==null?void 0:s.call(i,"start"))??"1")||1,m=Array.from(i.childNodes).filter(h=>h.nodeName==="LI").indexOf(o);return`${u+m}. ${n}${o.nextSibling?`
25
+ `);const i=o.parentNode;if((i==null?void 0:i.nodeName)==="OL"){const c=parseInt(((s=i.getAttribute)==null?void 0:s.call(i,"start"))??"1")||1,p=Array.from(i.childNodes).filter(f=>f.nodeName==="LI").indexOf(o);return`${c+p}. ${n}${o.nextSibling?`
26
26
  `:""}`}return`${l.bulletListMarker} ${n}${o.nextSibling?`
27
- `:""}`}},{name:"pInsideLi",filter:n=>n.nodeName==="P"&&o0(n),replacement:n=>`${n}
28
- `},{name:"brInsideLi",filter:n=>n.nodeName==="BR"&&o0(n),replacement:()=>`
29
- `},{name:"table",filter:"table",replacement:(n,o)=>{const l=o;if(f1(l))return`
27
+ `:""}`}},{name:"pInsideLi",filter:n=>n.nodeName==="P"&&Ea(n),replacement:n=>`${n}
28
+ `},{name:"brInsideLi",filter:n=>n.nodeName==="BR"&&Ea(n),replacement:()=>`
29
+ `},{name:"table",filter:"table",replacement:(n,o)=>{const l=o;if(Hu(l))return`
30
30
 
31
- ${p1(l)}
31
+ ${Ou(l)}
32
32
 
33
- `;const i=Array.from(l.querySelectorAll("tr"));if(!i.length)return"";const s=b=>Array.from(b.querySelectorAll("th, td")).map(w=>m1(w,r)),u=b=>Array.from(b.querySelectorAll(":scope > th, :scope > td")).map(w=>{switch(Vr(w)){case"left":return":---";case"center":return":---:";case"right":return"---:";default:return"---"}}),d=i[0],m=d.querySelector("th")!==null,h=s(d).length,p=u(d),v=[];if(m){v.push("| "+s(d).join(" | ")+" |"),v.push("| "+(p.length===h?p:Array(h).fill("---")).join(" | ")+" |");for(let b=1;b<i.length;b++)v.push("| "+s(i[b]).join(" | ")+" |")}else{v.push("| "+Array(h).fill("").join(" | ")+" |"),v.push("| "+(p.length===h?p:Array(h).fill("---")).join(" | ")+" |");for(const b of i)v.push("| "+s(b).join(" | ")+" |")}return`
33
+ `;const i=Array.from(l.querySelectorAll("tr"));if(!i.length)return"";const s=v=>Array.from(v.querySelectorAll("th, td")).map(w=>Ru(w,t)),c=v=>Array.from(v.querySelectorAll(":scope > th, :scope > td")).map(w=>{switch(or(w)){case"left":return":---";case"center":return":---:";case"right":return"---:";default:return"---"}}),m=i[0],p=m.querySelector("th")!==null,f=s(m).length,g=c(m),b=[];if(p){b.push("| "+s(m).join(" | ")+" |"),b.push("| "+(g.length===f?g:Array(f).fill("---")).join(" | ")+" |");for(let v=1;v<i.length;v++)b.push("| "+s(i[v]).join(" | ")+" |")}else{b.push("| "+Array(f).fill("").join(" | ")+" |"),b.push("| "+(g.length===f?g:Array(f).fill("---")).join(" | ")+" |");for(const v of i)b.push("| "+s(v).join(" | ")+" |")}return`
34
34
 
35
- `+v.join(`
35
+ `+b.join(`
36
36
  `)+`
37
37
 
38
- `}},{name:"tableCell",filter:["th","td"],replacement:n=>n},{name:"tableRow",filter:"tr",replacement:n=>n},{name:"tableBody",filter:["thead","tbody","tfoot"],replacement:n=>n},{name:"blockMath",filter:n=>yl(n)!==null,replacement:(n,o)=>`
38
+ `}},{name:"tableCell",filter:["th","td"],replacement:n=>n},{name:"tableRow",filter:"tr",replacement:n=>n},{name:"tableBody",filter:["thead","tbody","tfoot"],replacement:n=>n},{name:"blockMath",filter:n=>o0(n)!==null,replacement:(n,o)=>`
39
39
 
40
- $$${yl(o)??""}$$
40
+ $$${o0(o)??""}$$
41
41
 
42
- `},{name:"inlineMath",filter:n=>bl(n)!==null,replacement:(n,o)=>`$${bl(o)??""}$`}]}let Cr=null;function v1(){if(Cr)return Cr;Cr=new Wc({headingStyle:"atx",codeBlockStyle:"fenced",hr:"---",bulletListMarker:"-",blankReplacement:(r,e)=>{const t=cs(e);if(t)return us(t,e);const n=yl(e);if(n!==null)return`
42
+ `},{name:"inlineMath",filter:n=>a0(n)!==null,replacement:(n,o)=>`$${a0(o)??""}$`}]}let Kt=null;function $u(){if(Kt)return Kt;Kt=new fs({headingStyle:"atx",codeBlockStyle:"fenced",hr:"---",bulletListMarker:"-",blankReplacement:(t,e)=>{const r=ul(e);if(r)return sl(r,e);const n=o0(e);if(n!==null)return`
43
43
 
44
44
  $$${n}$$
45
45
 
46
- `;const o=bl(e);return o!==null?`$${o}$`:""}});for(const{name:r,...e}of[...g1(Cr)].reverse())Cr.addRule(r,e);return Cr}function Un(r){return!r||r==="<p></p>"?"":v1().turndown(r)}const b1=new Set(["P","BR","SPAN","DIV","H1","H2","H3","H4","H5","H6","UL","OL","LI","STRONG","B","EM","I","U","S","CODE","PRE","BLOCKQUOTE","HR","A","IMG","TABLE","THEAD","TBODY","TR","TD","TH"]),y1={A:new Set(["href","title"]),DIV:new Set(["data-type","data-view","data-href","data-latex","data-graph"]),IMG:new Set(["src","alt","title"]),LI:new Set(["data-type","data-checked"]),PRE:new Set(["data-type","data-language"]),SPAN:new Set(["data-type","data-latex","data-mention-user-id","data-mention-display-name"]),UL:new Set(["data-type"])},w1=new Set(["SCRIPT","STYLE","META","LINK","HEAD"]);function Wn(r){const e=document.createElement("template");e.innerHTML=r;for(const t of Array.from(e.content.querySelectorAll("table")))x1(t);return wl(e.content),e.innerHTML.trim()}function wl(r){for(let e=r.childNodes.length-1;e>=0;e--){const t=r.childNodes[e];if(t.nodeType!==Node.ELEMENT_NODE)continue;const n=t,o=n.tagName;if(w1.has(o)){n.remove();continue}if(!b1.has(o)){for(wl(n);n.firstChild;)r.insertBefore(n.firstChild,n);n.remove();continue}k1(n),wl(n)}}function k1(r){if(r.tagName==="TD"||r.tagName==="TH"){const t=Vr(r);for(const n of Array.from(r.attributes)){if(n.name.startsWith("on")){r.removeAttribute(n.name);continue}if(n.name!=="align"){if(n.name==="class"){const o=n.value.split(/\s+/).find(l=>l.startsWith("language-"));o?r.setAttribute("class",o):r.removeAttribute("class");continue}r.removeAttribute(n.name)}}t?r.setAttribute("align",t):r.removeAttribute("align");return}const e=y1[r.tagName];for(const t of Array.from(r.attributes)){if(t.name.startsWith("on")){r.removeAttribute(t.name);continue}if(t.name==="class"){const n=t.value.split(/\s+/).find(o=>o.startsWith("language-"));n?r.setAttribute("class",n):r.removeAttribute("class");continue}(!e||!e.has(t.name))&&r.removeAttribute(t.name)}r.tagName==="DIV"&&r.getAttribute("data-type")==="embed-view"&&!Hr(r.getAttribute("data-href")??"")&&(r.removeAttribute("data-type"),r.removeAttribute("data-view"),r.removeAttribute("data-href"))}function x1(r){var l,i;const e=Array.from(r.querySelectorAll(":scope > tr, :scope > thead > tr, :scope > tbody > tr, :scope > tfoot > tr"));if(!e.length)return;const t=[];function n(s,u){t[s]??(t[s]=[]);let d=u;for(;t[s][d];)d++;return d}for(let s=0;s<e.length;s++){const u=e[s],d=Array.from(u.children).filter(h=>h instanceof HTMLTableCellElement&&(h.tagName==="TD"||h.tagName==="TH"));let m=0;for(const h of d){const p=Math.max(1,Number(h.getAttribute("colspan")||"1")||1),v=Math.max(1,Number(h.getAttribute("rowspan")||"1")||1),b=n(s,m),w=Vr(h),k={cell:h,row:s,col:b,rowspan:v,colspan:p,align:w};for(let T=s;T<s+v;T++){t[T]??(t[T]=[]);for(let E=b;E<b+p;E++)t[T][E]=k}m=b+p}}const o=t.reduce((s,u)=>Math.max(s,u.length),0);for(const s of e)for(;s.firstChild;)s.removeChild(s.firstChild);for(let s=0;s<e.length;s++){const u=e[s],d=((l=u.parentElement)==null?void 0:l.tagName)==="THEAD"||u.querySelector("th")?"th":"td";for(let m=0;m<o;m++){const h=(i=t[s])==null?void 0:i[m];if(!h){u.appendChild(r.ownerDocument.createElement(d));continue}if(h.row===s&&h.col===m){h.cell.removeAttribute("colspan"),h.cell.removeAttribute("rowspan"),h.align?h.cell.setAttribute("align",h.align):h.cell.removeAttribute("align"),u.appendChild(h.cell);continue}const p=r.ownerDocument.createElement(h.cell.tagName.toLowerCase());h.align&&p.setAttribute("align",h.align),u.appendChild(p)}}}function ds(r,e,t=300){const n=a.ref(!1);let o=null;function l(){o&&(clearTimeout(o),o=null)}function i(h){l(),o=setTimeout(()=>{o=null,e("update:markdown",Un(h))},t)}function s(){var h;return((h=r())==null?void 0:h.getHTML())??""}function u(){return Un(s())}function d(h){const p=r();p&&(n.value=!0,p.chain().setMeta("addToHistory",!1).setContent(Wn(dn(h)),{emitUpdate:!1}).run(),a.nextTick(()=>{n.value=!1}))}function m(h){const p=r();p&&(n.value=!0,p.chain().setMeta("addToHistory",!1).setContent(Wn(h),{emitUpdate:!1}).run(),a.nextTick(()=>{n.value=!1}))}return a.onBeforeUnmount(l),{isSettingContent:n,scheduleMarkdownEmit:i,getHtml:s,getMarkdown:u,setMarkdown:d,setHtml:m}}function fs(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let o=r.child(n),l=e.child(n);if(o==l){t+=o.nodeSize;continue}if(!o.sameMarkup(l))return t;if(o.isText&&o.text!=l.text){for(let i=0;o.text[i]==l.text[i];i++)t++;return t}if(o.content.size||l.content.size){let i=fs(o.content,l.content,t+1);if(i!=null)return i}t+=o.nodeSize}}function ms(r,e,t,n){for(let o=r.childCount,l=e.childCount;;){if(o==0||l==0)return o==l?null:{a:t,b:n};let i=r.child(--o),s=e.child(--l),u=i.nodeSize;if(i==s){t-=u,n-=u;continue}if(!i.sameMarkup(s))return{a:t,b:n};if(i.isText&&i.text!=s.text){let d=0,m=Math.min(i.text.length,s.text.length);for(;d<m&&i.text[i.text.length-d-1]==s.text[s.text.length-d-1];)d++,t--,n--;return{a:t,b:n}}if(i.content.size||s.content.size){let d=ms(i.content,s.content,t-1,n-1);if(d)return d}t-=u,n-=u}}class be{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,o=0,l){for(let i=0,s=0;s<t;i++){let u=this.content[i],d=s+u.nodeSize;if(d>e&&n(u,o+s,l||null,i)!==!1&&u.content.size){let m=s+1;u.nodesBetween(Math.max(0,e-m),Math.min(u.content.size,t-m),n,o+m)}s=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,o){let l="",i=!0;return this.nodesBetween(e,t,(s,u)=>{let d=s.isText?s.text.slice(Math.max(e,u)-u,t-u):s.isLeaf?o?typeof o=="function"?o(s):o:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&d||s.isTextblock)&&n&&(i?i=!1:l+=n),l+=d},0),l}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,o=this.content.slice(),l=0;for(t.isText&&t.sameMarkup(n)&&(o[o.length-1]=t.withText(t.text+n.text),l=1);l<e.content.length;l++)o.push(e.content[l]);return new be(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],o=0;if(t>e)for(let l=0,i=0;i<t;l++){let s=this.content[l],u=i+s.nodeSize;u>e&&((i<e||u>t)&&(s.isText?s=s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s=s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),o+=s.nodeSize),i=u}return new be(n,o)}cutByIndex(e,t){return e==t?be.empty:e==0&&t==this.content.length?this:new be(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let o=this.content.slice(),l=this.size+t.nodeSize-n.nodeSize;return o[e]=t,new be(o,l)}addToStart(e){return new be([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new be(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let o=this.content[t];e(o,n,t),n+=o.nodeSize}}findDiffStart(e,t=0){return fs(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ms(this,e,t,n)}findIndex(e){if(e==0)return kn(0,e);if(e==this.size)return kn(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let o=this.child(t),l=n+o.nodeSize;if(l>=e)return l==e?kn(t+1,l):kn(t,n);n=l}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return be.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new be(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return be.empty;let t,n=0;for(let o=0;o<e.length;o++){let l=e[o];n+=l.nodeSize,o&&l.isText&&e[o-1].sameMarkup(l)?(t||(t=e.slice(0,o)),t[t.length-1]=l.withText(t[t.length-1].text+l.text)):t&&t.push(l)}return new be(t||e,n)}static from(e){if(!e)return be.empty;if(e instanceof be)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new be([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}be.empty=new be([],0);const Fo={index:0,offset:0};function kn(r,e){return Fo.index=r,Fo.offset=e,Fo}function kl(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!kl(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!kl(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}class mt{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let o=0;o<e.length;o++){let l=e[o];if(this.eq(l))return e;if(this.type.excludes(l.type))t||(t=e.slice(0,o));else{if(l.type.excludes(this.type))return e;!n&&l.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),n=!0),t&&t.push(l)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&kl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=n.create(t.attrs);return n.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return mt.none;if(e instanceof mt)return[e];let t=e.slice();return t.sort((n,o)=>n.type.rank-o.type.rank),t}}mt.none=[];class C1 extends Error{}class ye{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=ps(this.content,e+this.openStart,t);return n&&new ye(n,this.openStart,this.openEnd)}removeBetween(e,t){return new ye(hs(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ye.empty;let n=t.openStart||0,o=t.openEnd||0;if(typeof n!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ye(be.fromJSON(e,t.content),n,o)}static maxOpen(e,t=!0){let n=0,o=0;for(let l=e.firstChild;l&&!l.isLeaf&&(t||!l.type.spec.isolating);l=l.firstChild)n++;for(let l=e.lastChild;l&&!l.isLeaf&&(t||!l.type.spec.isolating);l=l.lastChild)o++;return new ye(e,n,o)}}ye.empty=new ye(be.empty,0,0);function hs(r,e,t){let{index:n,offset:o}=r.findIndex(e),l=r.maybeChild(n),{index:i,offset:s}=r.findIndex(t);if(o==e||l.isText){if(s!=t&&!r.child(i).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=i)throw new RangeError("Removing non-flat range");return r.replaceChild(n,l.copy(hs(l.content,e-o-1,t-o-1)))}function ps(r,e,t,n){let{index:o,offset:l}=r.findIndex(e),i=r.maybeChild(o);if(l==e||i.isText)return n&&!n.canReplace(o,o,t)?null:r.cut(0,e).append(t).append(r.cut(e));let s=ps(i.content,e-l-1,t,i);return s&&r.replaceChild(o,i.copy(s))}function T1(r){return r.tag!=null}function E1(r){return r.style!=null}let S1=class xl{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(o=>{if(T1(o))this.tags.push(o);else if(E1(o)){let l=/[^=]*/.exec(o.style)[0];n.indexOf(l)<0&&n.push(l),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let l=e.nodes[o.node];return l.contentMatch.matchType(l)})}parse(e,t={}){let n=new a0(this,t,!1);return n.addAll(e,mt.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new a0(this,t,!0);return n.addAll(e,mt.none,t.from,t.to),ye.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){let l=this.tags[o];if(B1(e,l.tag)&&(l.namespace===void 0||e.namespaceURI==l.namespace)&&(!l.context||t.matchesContext(l.context))){if(l.getAttrs){let i=l.getAttrs(e);if(i===!1)continue;l.attrs=i||void 0}return l}}}matchStyle(e,t,n,o){for(let l=o?this.styles.indexOf(o)+1:0;l<this.styles.length;l++){let i=this.styles[l],s=i.style;if(!(s.indexOf(e)!=0||i.context&&!n.matchesContext(i.context)||s.length>e.length&&(s.charCodeAt(e.length)!=61||s.slice(e.length+1)!=t))){if(i.getAttrs){let u=i.getAttrs(t);if(u===!1)continue;i.attrs=u||void 0}return i}}}static schemaRules(e){let t=[];function n(o){let l=o.priority==null?50:o.priority,i=0;for(;i<t.length;i++){let s=t[i];if((s.priority==null?50:s.priority)<l)break}t.splice(i,0,o)}for(let o in e.marks){let l=e.marks[o].spec.parseDOM;l&&l.forEach(i=>{n(i=i0(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let l=e.nodes[o].spec.parseDOM;l&&l.forEach(i=>{n(i=i0(i)),i.node||i.ignore||i.mark||(i.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xl(e,xl.schemaRules(e)))}};const gs={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},M1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},vs={ol:!0,ul:!0},tn=1,Cl=2,Jr=4;function l0(r,e,t){return e!=null?(e?tn:0)|(e==="full"?Cl:0):r&&r.whitespace=="pre"?tn|Cl:t&~Jr}class xn{constructor(e,t,n,o,l,i){this.type=e,this.attrs=t,this.marks=n,this.solid=o,this.options=i,this.content=[],this.activeMarks=mt.none,this.match=l||(i&Jr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(be.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,o;return(o=n.findWrapping(e.type))?(this.match=n,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&tn)){let n=this.content[this.content.length-1],o;if(n&&n.isText&&(o=/[ \t\r\n\u000c]+$/.exec(n.text))){let l=n;n.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=l.withText(l.text.slice(0,l.text.length-o[0].length))}}let t=be.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(be.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!gs.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class a0{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let o=t.topNode,l,i=l0(null,t.preserveWhitespace,0)|(n?Jr:0);o?l=new xn(o.type,o.attrs,mt.none,!0,t.topMatch||o.type.contentMatch,i):n?l=new xn(null,null,mt.none,!0,null,i):l=new xn(e.schema.topNodeType,null,mt.none,!0,null,i),this.nodes=[l],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,o=this.top,l=o.options&Cl?"full":this.localPreserveWS||(o.options&tn)>0,{schema:i}=this.parser;if(l==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(l)if(l==="full")n=n.replace(/\r\n?/g,`
47
- `);else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let s=n.split(/\r?\n|\r/);for(let u=0;u<s.length;u++)u&&this.insertNode(i.linebreakReplacement.create(),t,!0),s[u]&&this.insertNode(i.text(s[u]),t,!/\S/.test(s[u]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let s=o.content[o.content.length-1],u=e.previousSibling;(!s||u&&u.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let o=this.localPreserveWS,l=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),s;vs.hasOwnProperty(i)&&this.parser.normalizeLists&&A1(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(u?u.ignore:M1.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let d,m=this.needsBlock;if(gs.hasOwnProperty(i))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),d=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let h=u&&u.skip?t:this.readStyles(e,t);h&&this.addAll(e,h),d&&this.sync(l),this.needsBlock=m}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,u,d,u.consuming===!1?s:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
48
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let l=this.parser.matchedStyles[o],i=n.getPropertyValue(l);if(i)for(let s=void 0;;){let u=this.parser.matchStyle(l,i,this,s);if(!u)break;if(u.ignore)return null;if(u.clearMark?t=t.filter(d=>!u.clearMark(d)):t=t.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)s=u;else break}}return t}addElementByRule(e,t,n,o){let l,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let u=this.enter(i,t.attrs||null,n,t.preserveWhitespace);u&&(l=!0,n=u)}else{let u=this.parser.schema.marks[t.mark];n=n.concat(u.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(o)this.addElement(e,n,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,n,!1));else{let u=e;typeof t.contentElement=="string"?u=e.querySelector(t.contentElement):typeof t.contentElement=="function"?u=t.contentElement(e):t.contentElement&&(u=t.contentElement),this.findAround(e,u,!0),this.addAll(u,n),this.findAround(e,u,!1)}l&&this.sync(s)&&this.open--}addAll(e,t,n,o){let l=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=o==null?null:e.childNodes[o];i!=s;i=i.nextSibling,++l)this.findAtPoint(e,l),this.addDOM(i,t);this.findAtPoint(e,l)}findPlace(e,t,n){let o,l;for(let i=this.open,s=0;i>=0;i--){let u=this.nodes[i],d=u.findWrapping(e);if(d&&(!o||o.length>d.length+s)&&(o=d,l=u,!d.length))break;if(u.solid){if(n)break;s+=2}}if(!o)return null;this.sync(l);for(let i=0;i<o.length;i++)t=this.enterInner(o[i],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let l=this.textblockFromContext();l&&(t=this.enterInner(l,null,t))}let o=this.findPlace(e,t,n);if(o){this.closeExtra();let l=this.top;l.match&&(l.match=l.match.matchType(e.type));let i=mt.none;for(let s of o.concat(e.marks))(l.type?l.type.allowsMarkType(s.type):s0(s.type,e.type))&&(i=s.addToSet(i));return l.content.push(e.mark(i)),!0}return!1}enter(e,t,n,o){let l=this.findPlace(e.create(t),n,!1);return l&&(l=this.enterInner(e,t,n,!0,o)),l}enterInner(e,t,n,o=!1,l){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=l0(e,l,i.options);i.options&Jr&&i.content.length==0&&(s|=Jr);let u=mt.none;return n=n.filter(d=>(i.type?i.type.allowsMarkType(d.type):s0(d.type,e))?(u=d.addToSet(u),!1):!0),this.nodes.push(new xn(e,t,u,o,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=tn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let o=n.length-1;o>=0;o--)e+=n[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(n?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,o=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),l=-(n?n.depth+1:0)+(o?0:1),i=(s,u)=>{for(;s>=0;s--){let d=t[s];if(d==""){if(s==t.length-1||s==0)continue;for(;u>=l;u--)if(i(s-1,u))return!0;return!1}else{let m=u>0||u==0&&o?this.nodes[u].type:n&&u>=l?n.node(u-l).type:null;if(!m||m.name!=d&&!m.isInGroup(d))return!1;u--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function A1(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&vs.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function B1(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function i0(r){let e={};for(let t in r)e[t]=r[t];return e}function s0(r,e){let t=e.schema.nodes;for(let n in t){let o=t[n];if(!o.allowsMarkType(r))continue;let l=[],i=s=>{l.push(s);for(let u=0;u<s.edgeCount;u++){let{type:d,next:m}=s.edge(u);if(d==e||l.indexOf(m)<0&&i(m))return!0}};if(i(o.contentMatch))return!0}}class uo{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=$o(t).createDocumentFragment());let o=n,l=[];return e.forEach(i=>{if(l.length||i.marks.length){let s=0,u=0;for(;s<l.length&&u<i.marks.length;){let d=i.marks[u];if(!this.marks[d.type.name]){u++;continue}if(!d.eq(l[s][0])||d.type.spec.spanning===!1)break;s++,u++}for(;s<l.length;)o=l.pop()[1];for(;u<i.marks.length;){let d=i.marks[u++],m=this.serializeMark(d,i.isInline,t);m&&(l.push([d,o]),o.appendChild(m.dom),o=m.contentDOM||m.dom)}}o.appendChild(this.serializeNodeInner(i,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:o}=Dn($o(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let l=this.serializeMark(e.marks[o],e.isInline,t);l&&((l.contentDOM||l.dom).appendChild(n),n=l.dom)}return n}serializeMark(e,t,n={}){let o=this.marks[e.type.name];return o&&Dn($o(n),o(e,t),null,e.attrs)}static renderSpec(e,t,n=null,o){return Dn(e,t,n,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new uo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=u0(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return u0(e.marks)}}function u0(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function $o(r){return r.document||window.document}const c0=new WeakMap;function N1(r){let e=c0.get(r);return e===void 0&&c0.set(r,e=L1(r)),e}function L1(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let o=0;o<n.length;o++)t(n[o]);else for(let o in n)t(n[o])}return t(r),e}function Dn(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],l;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(l=N1(n))&&l.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let i=o.indexOf(" ");i>0&&(t=o.slice(0,i),o=o.slice(i+1));let s,u=t?r.createElementNS(t,o):r.createElement(o),d=e[1],m=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){m=2;for(let h in d)if(d[h]!=null){let p=h.indexOf(" ");p>0?u.setAttributeNS(h.slice(0,p),h.slice(p+1),d[h]):h=="style"&&u.style?u.style.cssText=d[h]:u.setAttribute(h,d[h])}}for(let h=m;h<e.length;h++){let p=e[h];if(p===0){if(h<e.length-1||h>m)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:v,contentDOM:b}=Dn(r,p,t,n);if(u.appendChild(v),b){if(s)throw new RangeError("Multiple content holes");s=b}}}return{dom:u,contentDOM:s}}const bs=65535,ys=Math.pow(2,16);function I1(r,e){return r+e*ys}function d0(r){return r&bs}function z1(r){return(r-(r&bs))/ys}const ws=1,ks=2,On=4,xs=8;class f0{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&xs)>0}get deletedBefore(){return(this.delInfo&(ws|On))>0}get deletedAfter(){return(this.delInfo&(ks|On))>0}get deletedAcross(){return(this.delInfo&On)>0}}class at{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&at.empty)return at.empty}recover(e){let t=0,n=d0(e);if(!this.inverted)for(let o=0;o<n;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[n*3]+t+z1(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let o=0,l=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let u=this.ranges[s]-(this.inverted?o:0);if(u>e)break;let d=this.ranges[s+l],m=this.ranges[s+i],h=u+d;if(e<=h){let p=d?e==u?-1:e==h?1:t:t,v=u+o+(p<0?0:m);if(n)return v;let b=e==(t<0?u:h)?null:I1(s/3,e-u),w=e==u?ks:e==h?ws:On;return(t<0?e!=u:e!=h)&&(w|=xs),new f0(v,w,b)}o+=m-d}return n?e+o:new f0(e+o,0,null)}touches(e,t){let n=0,o=d0(t),l=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let u=this.ranges[s]-(this.inverted?n:0);if(u>e)break;let d=this.ranges[s+l],m=u+d;if(e<=m&&s==o*3)return!0;n+=this.ranges[s+i]-d}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let o=0,l=0;o<this.ranges.length;o+=3){let i=this.ranges[o],s=i-(this.inverted?l:0),u=i+(this.inverted?0:l),d=this.ranges[o+t],m=this.ranges[o+n];e(s,s+d,u,u+m),l+=m-d}}invert(){return new at(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?at.empty:new at(e<0?[0,-e,0]:[0,0,e])}}at.empty=new at([]);const qo=Object.create(null);class Je{getMap(){return at.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=qo[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in qo)throw new RangeError("Duplicate use of step JSON ID "+e);return qo[e]=t,t.prototype.jsonID=e,t}}class Pe{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Pe(e,null)}static fail(e){return new Pe(null,e)}static fromReplace(e,t,n,o){try{return Pe.ok(e.replace(t,n,o))}catch(l){if(l instanceof C1)return Pe.fail(l.message);throw l}}}function Zl(r,e,t){let n=[];for(let o=0;o<r.childCount;o++){let l=r.child(o);l.content.size&&(l=l.copy(Zl(l.content,e,l))),l.isInline&&(l=e(l,t,o)),n.push(l)}return be.fromArray(n)}class ar extends Je{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),l=new ye(Zl(t.content,(i,s)=>!i.isAtom||!s.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),t.openStart,t.openEnd);return Pe.fromReplace(e,this.from,this.to,l)}invert(){return new ir(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ar(t.pos,n.pos,this.mark)}merge(e){return e instanceof ar&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ar(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ar(t.from,t.to,e.markFromJSON(t.mark))}}Je.jsonID("addMark",ar);class ir extends Je{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new ye(Zl(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return Pe.fromReplace(e,this.from,this.to,n)}invert(){return new ar(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ir(t.pos,n.pos,this.mark)}merge(e){return e instanceof ir&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ir(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ir(t.from,t.to,e.markFromJSON(t.mark))}}Je.jsonID("removeMark",ir);class sr extends Je{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Pe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Pe.fromReplace(e,this.pos,this.pos+1,new ye(be.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(n))return new sr(this.pos,t.marks[o]);return new sr(this.pos,this.mark)}}return new rn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new sr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new sr(t.pos,e.markFromJSON(t.mark))}}Je.jsonID("addNodeMark",sr);class rn extends Je{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Pe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Pe.fromReplace(e,this.pos,this.pos+1,new ye(be.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new sr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new rn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new rn(t.pos,e.markFromJSON(t.mark))}}Je.jsonID("removeNodeMark",rn);class Bt extends Je{constructor(e,t,n,o=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=o}apply(e){return this.structure&&Tl(e,this.from,this.to)?Pe.fail("Structure replace would overwrite content"):Pe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new at([this.from,this.to-this.from,this.slice.size])}invert(e){return new Bt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Bt(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Bt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?ye.empty:new ye(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Bt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?ye.empty:new ye(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Bt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Bt(t.from,t.to,ye.fromJSON(e,t.slice),!!t.structure)}}Je.jsonID("replace",Bt);class Br extends Je{constructor(e,t,n,o,l,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=o,this.slice=l,this.insert=i,this.structure=s}apply(e){if(this.structure&&(Tl(e,this.from,this.gapFrom)||Tl(e,this.gapTo,this.to)))return Pe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Pe.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Pe.fromReplace(e,this.from,this.to,n):Pe.fail("Content does not fit in gap")}getMap(){return new at([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Br(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),l=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||o<t.pos||l>n.pos?null:new Br(t.pos,n.pos,o,l,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Br(t.from,t.to,t.gapFrom,t.gapTo,ye.fromJSON(e,t.slice),t.insert,!!t.structure)}}Je.jsonID("replaceAround",Br);function Tl(r,e,t){let n=r.resolve(e),o=t-e,l=n.depth;for(;o>0&&l>0&&n.indexAfter(l)==n.node(l).childCount;)l--,o--;if(o>0){let i=n.node(l).maybeChild(n.indexAfter(l));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function D1(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let o=t.content;for(let l=0;l<t.openStart;l++)o=o.firstChild.content;for(let l=1;l<=(t.openStart==0&&t.size?2:1);l++)for(let i=n.depth;i>=0;i--){let s=i==n.depth?0:n.pos<=(n.start(i+1)+n.end(i+1))/2?-1:1,u=n.index(i)+(s>0?1:0),d=n.node(i),m=!1;if(l==1)m=d.canReplace(u,u,o);else{let h=d.contentMatchAt(u).findWrapping(o.firstChild.type);m=h&&d.canReplaceWith(u,u,h[0])}if(m)return s==0?n.pos:s<0?n.before(i+1):n.after(i+1)}return null}class Xr extends Je{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Pe.fail("No node at attribute step's position");let n=Object.create(null);for(let l in t.attrs)n[l]=t.attrs[l];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return Pe.fromReplace(e,this.pos,this.pos+1,new ye(be.from(o),0,t.isLeaf?0:1))}getMap(){return at.empty}invert(e){return new Xr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Xr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Xr(t.pos,t.attr,t.value)}}Je.jsonID("attr",Xr);class _n extends Je{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Pe.ok(n)}getMap(){return at.empty}invert(e){return new _n(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new _n(t.attr,t.value)}}Je.jsonID("docAttr",_n);let nn=class extends Error{};nn=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};nn.prototype=Object.create(Error.prototype);nn.prototype.constructor=nn;nn.prototype.name="TransformError";const Uo=Object.create(null);class Oe{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new O1(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=ye.empty){let n=t.content.lastChild,o=null;for(let s=0;s<t.openEnd;s++)o=n,n=n.lastChild;let l=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:u,$to:d}=i[s],m=e.mapping.slice(l);e.replaceRange(m.map(u.pos),m.map(d.pos),s?ye.empty:t),s==0&&p0(e,l,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:i,$to:s}=o[l],u=e.mapping.slice(n),d=u.map(i.pos),m=u.map(s.pos);l?e.deleteRange(d,m):(e.replaceRangeWith(d,m,t),p0(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let o=e.parent.inlineContent?new ze(e):Mr(e.node(0),e.parent,e.pos,e.index(),t,n);if(o)return o;for(let l=e.depth-1;l>=0;l--){let i=t<0?Mr(e.node(0),e.node(l),e.before(l+1),e.index(l),t,n):Mr(e.node(0),e.node(l),e.after(l+1),e.index(l)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new kt(e.node(0))}static atStart(e){return Mr(e,e,0,0,1)||new kt(e)}static atEnd(e){return Mr(e,e,e.content.size,e.childCount,-1)||new kt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Uo[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Uo)throw new RangeError("Duplicate use of selection JSON ID "+e);return Uo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ze.between(this.$anchor,this.$head).getBookmark()}}Oe.prototype.visible=!0;class O1{constructor(e,t){this.$from=e,this.$to=t}}let m0=!1;function h0(r){!m0&&!r.parent.inlineContent&&(m0=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class ze extends Oe{constructor(e,t=e){h0(e),h0(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Oe.near(n);let o=e.resolve(t.map(this.anchor));return new ze(o.parent.inlineContent?o:n,n)}replace(e,t=ye.empty){if(super.replace(e,t),t==ye.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof ze&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new co(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ze(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let o=e.resolve(t);return new this(o,n==t?o:e.resolve(n))}static between(e,t,n){let o=e.pos-t.pos;if((!n||o)&&(n=o>=0?1:-1),!t.parent.inlineContent){let l=Oe.findFrom(t,n,!0)||Oe.findFrom(t,-n,!0);if(l)t=l.$head;else return Oe.near(t,n)}return e.parent.inlineContent||(o==0?e=t:(e=(Oe.findFrom(e,-n,!0)||Oe.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new ze(e,t)}}Oe.jsonID("text",ze);class co{constructor(e,t){this.anchor=e,this.head=t}map(e){return new co(e.map(this.anchor),e.map(this.head))}resolve(e){return ze.between(e.resolve(this.anchor),e.resolve(this.head))}}class ke extends Oe{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:o}=t.mapResult(this.anchor),l=e.resolve(o);return n?Oe.near(l):new ke(l)}content(){return new ye(be.from(this.node),0,0)}eq(e){return e instanceof ke&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ea(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ke(e.resolve(t.anchor))}static create(e,t){return new ke(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ke.prototype.visible=!1;Oe.jsonID("node",ke);class ea{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new co(n,n):new ea(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&ke.isSelectable(n)?new ke(t):Oe.near(t)}}class kt extends Oe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ye.empty){if(t==ye.empty){e.delete(0,e.doc.content.size);let n=Oe.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new kt(e)}map(e){return new kt(e)}eq(e){return e instanceof kt}getBookmark(){return R1}}Oe.jsonID("all",kt);const R1={map(){return this},resolve(r){return new kt(r)}};function Mr(r,e,t,n,o,l=!1){if(e.inlineContent)return ze.create(r,t);for(let i=n-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let s=e.child(i);if(s.isAtom){if(!l&&ke.isSelectable(s))return ke.create(r,t-(o<0?s.nodeSize:0))}else{let u=Mr(r,s,t+o,o<0?s.childCount:0,o,l);if(u)return u}t+=s.nodeSize*o}return null}function p0(r,e,t){let n=r.steps.length-1;if(n<e)return;let o=r.steps[n];if(!(o instanceof Bt||o instanceof Br))return;let l=r.mapping.maps[n],i;l.forEach((s,u,d,m)=>{i==null&&(i=m)}),r.setSelection(Oe.near(r.doc.resolve(i),t))}function g0(r,e){return!e||!r?r:r.bind(e)}class Cn{constructor(e,t,n){this.name=e,this.init=g0(t.init,n),this.apply=g0(t.apply,n)}}new Cn("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Cn("selection",{init(r,e){return r.selection||Oe.atStart(e.doc)},apply(r){return r.selection}}),new Cn("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new Cn("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});function Cs(r,e,t){for(let n in r){let o=r[n];o instanceof Function?o=o.bind(e):n=="handleDOMEvents"&&(o=Cs(o,e,{})),t[n]=o}return t}class Ts{constructor(e){this.spec=e,this.props={},e.props&&Cs(e.props,this,this.props),this.key=e.key?e.key.key:Es("plugin")}getState(e){return e[this.key]}}const Wo=Object.create(null);function Es(r){return r in Wo?r+"$"+ ++Wo[r]:(Wo[r]=0,r+"$")}class Ss{constructor(e="key"){this.key=Es(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const pr=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Ms=function(r,e,t,n){return t&&(v0(r,e,t,n,-1)||v0(r,e,t,n,1))},P1=/^(img|br|input|textarea|hr)$/i;function v0(r,e,t,n,o){for(var l;;){if(r==t&&e==n)return!0;if(e==(o<0?0:Gn(r))){let i=r.parentNode;if(!i||i.nodeType!=1||ta(r)||P1.test(r.nodeName)||r.contentEditable=="false")return!1;e=pr(r)+(o<0?0:1),r=i}else if(r.nodeType==1){let i=r.childNodes[e+(o<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((l=i.pmViewDesc)===null||l===void 0)&&l.ignoreForSelection)e+=o;else return!1;else r=i,e=o<0?Gn(r):0}else return!1}}function Gn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function H1(r,e,t){for(let n=e==0,o=e==Gn(r);n||o;){if(r==t)return!0;let l=pr(r);if(r=r.parentNode,!r)return!1;n=n&&l==0,o=o&&l==Gn(r)}}function ta(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const As=function(r){return r.focusNode&&Ms(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function Bs(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}const xt=typeof navigator<"u"?navigator:null,b0=typeof document<"u"?document:null,Qt=xt&&xt.userAgent||"",El=/Edge\/(\d+)/.exec(Qt),Ns=/MSIE \d/.exec(Qt),Sl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qt),fn=!!(Ns||Sl||El),Ls=Ns?document.documentMode:Sl?+Sl[1]:El?+El[1]:0,fo=!fn&&/gecko\/(\d+)/i.test(Qt);fo&&+(/Firefox\/(\d+)/.exec(Qt)||[0,0])[1];const Ml=!fn&&/Chrome\/(\d+)/.exec(Qt),Dt=!!Ml,Is=Ml?+Ml[1]:0,gr=!fn&&!!xt&&/Apple Computer/.test(xt.vendor),ra=gr&&(/Mobile\/\w+/.test(Qt)||!!xt&&xt.maxTouchPoints>2),ft=ra||(xt?/Mac/.test(xt.platform):!1),zs=xt?/Win/.test(xt.platform):!1,mn=/Android \d/.test(Qt),na=!!b0&&"webkitFontSmoothing"in b0.documentElement.style,V1=na?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function F1(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let o=r.docView.nearestDesc(t.focusNode),l=o&&o.size==0,i=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(i<0)return null;let s=n.resolve(i),u,d;if(As(t)){for(u=i;o&&!o.node;)o=o.parent;let h=o.node;if(o&&h.isAtom&&ke.isSelectable(h)&&o.parent&&!(h.isInline&&H1(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;d=new ke(i==p?s:n.resolve(p))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=i,p=i;for(let v=0;v<t.rangeCount;v++){let b=t.getRangeAt(v);h=Math.min(h,r.docView.posFromDOM(b.startContainer,b.startOffset,1)),p=Math.max(p,r.docView.posFromDOM(b.endContainer,b.endOffset,-1))}if(h<0)return null;[u,i]=p==r.state.selection.anchor?[p,h]:[h,p],s=n.resolve(i)}else u=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null}let m=n.resolve(u);if(!d){let h=e=="pointer"||r.state.selection.head<s.pos&&!l?1:-1;d=Os(r,m,s,h)}return d}function Ds(r){return r.editable?r.hasFocus():W1(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function oa(r,e=!1){let t=r.state.selection;if(U1(r,t),!!Ds(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&Dt){let n=r.domSelectionRange(),o=r.domObserver.currentSelection;if(n.anchorNode&&o.anchorNode&&Ms(n.anchorNode,n.anchorOffset,o.anchorNode,o.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)q1(r);else{let{anchor:n,head:o}=t,l,i;y0&&!(t instanceof ze)&&(t.$from.parent.inlineContent||(l=w0(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(i=w0(r,t.to))),r.docView.setSelection(n,o,r,e),y0&&(l&&k0(l),i&&k0(i)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&$1(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const y0=gr||Dt&&Is<63;function w0(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),o=n<t.childNodes.length?t.childNodes[n]:null,l=n?t.childNodes[n-1]:null;if(gr&&o&&o.contentEditable=="false")return _o(o);if((!o||o.contentEditable=="false")&&(!l||l.contentEditable=="false")){if(o)return _o(o);if(l)return _o(l)}}function _o(r){return r.contentEditable="true",gr&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function k0(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function $1(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!Ds(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function q1(r){let e=r.domSelection();if(!e)return;let t=r.cursorWrapper.dom,n=t.nodeName=="IMG";n?e.collapse(t.parentNode,pr(t)+1):e.collapse(t,0),!n&&!r.state.selection.visible&&fn&&Ls<=11&&(t.disabled=!0,t.disabled=!1)}function U1(r,e){if(e instanceof ke){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(x0(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else x0(r)}function x0(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function Os(r,e,t,n){return r.someProp("createSelectionBetween",o=>o(r,e,t))||ze.between(e,t,n)}function W1(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Al(r,e){let{$anchor:t,$head:n}=r.selection,o=e>0?t.max(n):t.min(n),l=o.parent.inlineContent?o.depth?r.doc.resolve(e>0?o.after():o.before()):null:o;return l&&Oe.findFrom(l,e)}function qt(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function C0(r,e,t){let n=r.state.selection;if(n instanceof ze)if(t.indexOf("s")>-1){let{$head:o}=n,l=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!l||l.isText||!l.isLeaf)return!1;let i=r.state.doc.resolve(o.pos+l.nodeSize*(e<0?-1:1));return qt(r,new ze(n.$anchor,i))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let o=Al(r.state,e);return o&&o instanceof ke?qt(r,o):!1}else if(!(ft&&t.indexOf("m")>-1)){let o=n.$head,l=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,i;if(!l||l.isText)return!1;let s=e<0?o.pos-l.nodeSize:o.pos;return l.isAtom||(i=r.docView.descAt(s))&&!i.contentDOM?ke.isSelectable(l)?qt(r,new ke(e<0?r.state.doc.resolve(o.pos-l.nodeSize):o)):na?qt(r,new ze(r.state.doc.resolve(e<0?s:s+l.nodeSize))):!1:!1}}else return!1;else{if(n instanceof ke&&n.node.isInline)return qt(r,new ze(e>0?n.$to:n.$from));{let o=Al(r.state,e);return o?qt(r,o):!1}}}function Kn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function jr(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function Tr(r,e){return e<0?_1(r):G1(r)}function _1(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let o,l,i=!1;for(fo&&t.nodeType==1&&n<Kn(t)&&jr(t.childNodes[n],-1)&&(i=!0);;)if(n>0){if(t.nodeType!=1)break;{let s=t.childNodes[n-1];if(jr(s,-1))o=t,l=--n;else if(s.nodeType==3)t=s,n=t.nodeValue.length;else break}}else{if(Rs(t))break;{let s=t.previousSibling;for(;s&&jr(s,-1);)o=t.parentNode,l=pr(s),s=s.previousSibling;if(s)t=s,n=Kn(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}i?Bl(r,t,n):o&&Bl(r,o,l)}function G1(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let o=Kn(t),l,i;for(;;)if(n<o){if(t.nodeType!=1)break;let s=t.childNodes[n];if(jr(s,1))l=t,i=++n;else break}else{if(Rs(t))break;{let s=t.nextSibling;for(;s&&jr(s,1);)l=s.parentNode,i=pr(s)+1,s=s.nextSibling;if(s)t=s,n=0,o=Kn(t);else{if(t=t.parentNode,t==r.dom)break;n=o=0}}}l&&Bl(r,l,i)}function Rs(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function K1(r,e){for(;r&&e==r.childNodes.length&&!ta(r);)e=pr(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function Y1(r,e){for(;r&&!e&&!ta(r);)e=pr(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function Bl(r,e,t){if(e.nodeType!=3){let l,i;(i=K1(e,t))?(e=i,t=0):(l=Y1(e,t))&&(e=l,t=l.nodeValue.length)}let n=r.domSelection();if(!n)return;if(As(n)){let l=document.createRange();l.setEnd(e,t),l.setStart(e,t),n.removeAllRanges(),n.addRange(l)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:o}=r;setTimeout(()=>{r.state==o&&oa(r)},50)}function T0(r,e){let t=r.state.doc.resolve(e);if(!(Dt||zs)&&t.parent.inlineContent){let o=r.coordsAtPos(e);if(e>t.start()){let l=r.coordsAtPos(e-1),i=(l.top+l.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(l.left-o.left)>1)return l.left<o.left?"ltr":"rtl"}if(e<t.end()){let l=r.coordsAtPos(e+1),i=(l.top+l.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(l.left-o.left)>1)return l.left>o.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function E0(r,e,t){let n=r.state.selection;if(n instanceof ze&&!n.empty||t.indexOf("s")>-1||ft&&t.indexOf("m")>-1)return!1;let{$from:o,$to:l}=n;if(!o.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let i=Al(r.state,e);if(i&&i instanceof ke)return qt(r,i)}if(!o.parent.inlineContent){let i=e<0?o:l,s=n instanceof kt?Oe.near(i,e):Oe.findFrom(i,e);return s?qt(r,s):!1}return!1}function S0(r,e){if(!(r.state.selection instanceof ze))return!0;let{$head:t,$anchor:n,empty:o}=r.state.selection;if(!t.sameParent(n))return!0;if(!o)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let l=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(l&&!l.isText){let i=r.state.tr;return e<0?i.delete(t.pos-l.nodeSize,t.pos):i.delete(t.pos,t.pos+l.nodeSize),r.dispatch(i),!0}return!1}function M0(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function J1(r){if(!gr||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;M0(r,n,"true"),setTimeout(()=>M0(r,n,"false"),20)}return!1}function X1(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function j1(r,e){let t=e.keyCode,n=X1(e);if(t==8||ft&&t==72&&n=="c")return S0(r,-1)||Tr(r,-1);if(t==46&&!e.shiftKey||ft&&t==68&&n=="c")return S0(r,1)||Tr(r,1);if(t==13||t==27)return!0;if(t==37||ft&&t==66&&n=="c"){let o=t==37?T0(r,r.state.selection.from)=="ltr"?-1:1:-1;return C0(r,o,n)||Tr(r,o)}else if(t==39||ft&&t==70&&n=="c"){let o=t==39?T0(r,r.state.selection.from)=="ltr"?1:-1:1;return C0(r,o,n)||Tr(r,o)}else{if(t==38||ft&&t==80&&n=="c")return E0(r,-1,n)||Tr(r,-1);if(t==40||ft&&t==78&&n=="c")return J1(r)||E0(r,1,n)||Tr(r,1);if(n==(ft?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ps(r,e){r.someProp("transformCopied",v=>{e=v(e,r)});let t=[],{content:n,openStart:o,openEnd:l}=e;for(;o>1&&l>1&&n.childCount==1&&n.firstChild.childCount==1;){o--,l--;let v=n.firstChild;t.push(v.type.name,v.attrs!=v.type.defaultAttrs?v.attrs:null),n=v.content}let i=r.someProp("clipboardSerializer")||uo.fromSchema(r.state.schema),s=Us(),u=s.createElement("div");u.appendChild(i.serializeFragment(n,{document:s}));let d=u.firstChild,m,h=0;for(;d&&d.nodeType==1&&(m=qs[d.nodeName.toLowerCase()]);){for(let v=m.length-1;v>=0;v--){let b=s.createElement(m[v]);for(;u.firstChild;)b.appendChild(u.firstChild);u.appendChild(b),h++}d=u.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${o} ${l}${h?` -${h}`:""} ${JSON.stringify(t)}`);let p=r.someProp("clipboardTextSerializer",v=>v(e,r))||e.content.textBetween(0,e.content.size,`
49
-
50
- `);return{dom:u,text:p,slice:e}}function Hs(r,e,t,n,o){let l=o.parent.type.spec.code,i,s;if(!t&&!e)return null;let u=!!e&&(n||l||!t);if(u){if(r.someProp("transformPastedText",p=>{e=p(e,l||n,r)}),l)return s=new ye(be.from(r.state.schema.text(e.replace(/\r\n?/g,`
51
- `))),0,0),r.someProp("transformPasted",p=>{s=p(s,r,!0)}),s;let h=r.someProp("clipboardTextParser",p=>p(e,o,n,r));if(h)s=h;else{let p=o.marks(),{schema:v}=r.state,b=uo.fromSchema(v);i=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let k=i.appendChild(document.createElement("p"));w&&k.appendChild(b.serializeNode(v.text(w,p)))})}}else r.someProp("transformPastedHTML",h=>{t=h(t,r)}),i=tf(t),na&&rf(i);let d=i&&i.querySelector("[data-pm-slice]"),m=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let h=+m[3];h>0;h--){let p=i.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;i=p}if(s||(s=(r.someProp("clipboardParser")||r.someProp("domParser")||S1.fromSchema(r.state.schema)).parseSlice(i,{preserveWhitespace:!!(u||m),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Q1.test(p.parentNode.nodeName)?{ignore:!0}:null}})),m)s=nf(A0(s,+m[1],+m[2]),m[4]);else if(s=ye.maxOpen(Z1(s.content,o),!0),s.openStart||s.openEnd){let h=0,p=0;for(let v=s.content.firstChild;h<s.openStart&&!v.type.spec.isolating;h++,v=v.firstChild);for(let v=s.content.lastChild;p<s.openEnd&&!v.type.spec.isolating;p++,v=v.lastChild);s=A0(s,h,p)}return r.someProp("transformPasted",h=>{s=h(s,r,u)}),s}const Q1=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Z1(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),l,i=[];if(r.forEach(s=>{if(!i)return;let u=o.findWrapping(s.type),d;if(!u)return i=null;if(d=i.length&&l.length&&Fs(u,l,s,i[i.length-1],0))i[i.length-1]=d;else{i.length&&(i[i.length-1]=$s(i[i.length-1],l.length));let m=Vs(s,u);i.push(m),o=o.matchType(m.type),l=u}}),i)return be.from(i)}return r}function Vs(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,be.from(r));return r}function Fs(r,e,t,n,o){if(o<r.length&&o<e.length&&r[o]==e[o]){let l=Fs(r,e,t,n.lastChild,o+1);if(l)return n.copy(n.content.replaceChild(n.childCount-1,l));if(n.contentMatchAt(n.childCount).matchType(o==r.length-1?t.type:r[o+1]))return n.copy(n.content.append(be.from(Vs(t,r,o+1))))}}function $s(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,$s(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(be.empty,!0);return r.copy(t.append(n))}function Nl(r,e,t,n,o,l){let i=e<0?r.firstChild:r.lastChild,s=i.content;return r.childCount>1&&(l=0),o<n-1&&(s=Nl(s,e,t,n,o+1,l)),o>=t&&(s=e<0?i.contentMatchAt(0).fillBefore(s,l<=o).append(s):s.append(i.contentMatchAt(i.childCount).fillBefore(be.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,i.copy(s))}function A0(r,e,t){return e<r.openStart&&(r=new ye(Nl(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new ye(Nl(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const qs={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let B0=null;function Us(){return B0||(B0=document.implementation.createHTMLDocument("title"))}let Go=null;function ef(r){let e=window.trustedTypes;return e?(Go||(Go=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Go.createHTML(r)):r}function tf(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Us().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),o;if((o=n&&qs[n[1].toLowerCase()])&&(r=o.map(l=>"<"+l+">").join("")+r+o.map(l=>"</"+l+">").reverse().join("")),t.innerHTML=ef(r),o)for(let l=0;l<o.length;l++)t=t.querySelector(o[l])||t;return t}function rf(r){let e=r.querySelectorAll(Dt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function nf(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:o,openStart:l,openEnd:i}=r;for(let s=n.length-2;s>=0;s-=2){let u=t.nodes[n[s]];if(!u||u.hasRequiredAttrs())break;o=be.from(u.create(n[s+1],o)),l++,i++}return new ye(o,l,i)}const bt={},st={};function Wt(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}st.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!_s(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(mn&&Dt&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),ra&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",o=>o(r,Bs(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||j1(r,t)?t.preventDefault():Wt(r,"key")};st.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};st.keypress=(r,e)=>{let t=e;if(_s(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||ft&&t.metaKey)return;if(r.someProp("handleKeyPress",o=>o(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof ze)||!n.$from.sameParent(n.$to)){let o=String.fromCharCode(t.charCode),l=()=>r.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!r.someProp("handleTextInput",i=>i(r,n.$from.pos,n.$to.pos,o,l))&&r.dispatch(l()),t.preventDefault()}};function mo(r){return{left:r.clientX,top:r.clientY}}function of(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function la(r,e,t,n,o){if(n==-1)return!1;let l=r.state.doc.resolve(n);for(let i=l.depth+1;i>0;i--)if(r.someProp(e,s=>i>l.depth?s(r,t,l.nodeAfter,l.before(i),o,!0):s(r,t,l.node(i),l.before(i),o,!1)))return!0;return!1}function Nr(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function lf(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&ke.isSelectable(n)?(Nr(r,new ke(t)),!0):!1}function af(r,e){if(e==-1)return!1;let t=r.state.selection,n,o;t instanceof ke&&(n=t.node);let l=r.state.doc.resolve(e);for(let i=l.depth+1;i>0;i--){let s=i>l.depth?l.nodeAfter:l.node(i);if(ke.isSelectable(s)){n&&t.$from.depth>0&&i>=t.$from.depth&&l.before(t.$from.depth+1)==t.$from.pos?o=l.before(t.$from.depth):o=l.before(i);break}}return o!=null?(Nr(r,ke.create(r.state.doc,o)),!0):!1}function sf(r,e,t,n,o){return la(r,"handleClickOn",e,t,n)||r.someProp("handleClick",l=>l(r,e,n))||(o?af(r,t):lf(r,t))}function uf(r,e,t,n){return la(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",o=>o(r,e,n))}function cf(r,e,t,n){return la(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",o=>o(r,e,n))||df(r,t,n)}function df(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(Nr(r,ze.create(n,0,n.content.size)),!0):!1;let o=n.resolve(e);for(let l=o.depth+1;l>0;l--){let i=l>o.depth?o.nodeAfter:o.node(l),s=o.before(l);if(i.inlineContent)Nr(r,ze.create(n,s+1,s+1+i.content.size));else if(ke.isSelectable(i))Nr(r,ke.create(n,s));else continue;return!0}}function aa(r){return Yn(r)}const Ws=ft?"metaKey":"ctrlKey";bt.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=aa(r),o=Date.now(),l="singleClick";o-r.input.lastClick.time<500&&of(t,r.input.lastClick)&&!t[Ws]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?l="doubleClick":r.input.lastClick.type=="doubleClick"&&(l="tripleClick")),r.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:l,button:t.button};let i=r.posAtCoords(mo(t));i&&(l=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new ff(r,i,t,!!n)):(l=="doubleClick"?uf:cf)(r,i.pos,i.inside,t)?t.preventDefault():Wt(r,"pointer"))};class ff{constructor(e,t,n,o){this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Ws],this.allowDefault=n.shiftKey;let l,i;if(t.inside>-1)l=e.state.doc.nodeAt(t.inside),i=t.inside;else{let m=e.state.doc.resolve(t.pos);l=m.parent,i=m.depth?m.before():0}const s=o?null:n.target,u=s?e.docView.nearestDesc(s,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:d}=e.state;(n.button==0&&l.type.spec.draggable&&l.type.spec.selectable!==!1||d instanceof ke&&d.from<=i&&d.to>i)&&(this.mightDrag={node:l,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&fo&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wt(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>oa(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(mo(e))),this.updateAllowDefault(e),this.allowDefault||!t?Wt(this.view,"pointer"):sf(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||gr&&this.mightDrag&&!this.mightDrag.node.isAtom||Dt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Nr(this.view,Oe.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Wt(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wt(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}bt.touchstart=r=>{r.input.lastTouch=Date.now(),aa(r),Wt(r,"pointer")};bt.touchmove=r=>{r.input.lastTouch=Date.now(),Wt(r,"pointer")};bt.contextmenu=r=>aa(r);function _s(r,e){return r.composing?!0:gr&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const mf=mn?5e3:-1;st.compositionstart=st.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof ze&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Dt&&zs&&hf(r)))r.markCursor=r.state.storedMarks||t.marks(),Yn(r,!0),r.markCursor=null;else if(Yn(r,!e.selection.empty),fo&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let o=n.focusNode,l=n.focusOffset;o&&o.nodeType==1&&l!=0;){let i=l<0?o.lastChild:o.childNodes[l-1];if(!i)break;if(i.nodeType==3){let s=r.domSelection();s&&s.collapse(i,i.nodeValue.length);break}else o=i,l=-1}}r.input.composing=!0}Gs(r,mf)};function hf(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}st.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.badSafariComposition?r.domObserver.forceFlush():r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Gs(r,20))};function Gs(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Yn(r),e))}function pf(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=gf());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function gf(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function Yn(r,e=!1){if(!(mn&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),pf(r),e||r.docView&&r.docView.dirty){let t=F1(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function vf(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),o=document.createRange();o.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const on=fn&&Ls<15||ra&&V1<604;bt.copy=st.cut=(r,e)=>{let t=e,n=r.state.selection,o=t.type=="cut";if(n.empty)return;let l=on?null:t.clipboardData,i=n.content(),{dom:s,text:u}=Ps(r,i);l?(t.preventDefault(),l.clearData(),l.setData("text/html",s.innerHTML),l.setData("text/plain",u)):vf(r,s),o&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function bf(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function yf(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let o=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Ll(r,n.value,null,o,e):Ll(r,n.textContent,n.innerHTML,o,e)},50)}function Ll(r,e,t,n,o){let l=Hs(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",u=>u(r,o,l||ye.empty)))return!0;if(!l)return!1;let i=bf(l),s=i?r.state.tr.replaceSelectionWith(i,n):r.state.tr.replaceSelection(l);return r.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ks(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}st.paste=(r,e)=>{let t=e;if(r.composing&&!mn)return;let n=on?null:t.clipboardData,o=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Ll(r,Ks(n),n.getData("text/html"),o,t)?t.preventDefault():yf(r,t)};class wf{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const kf=ft?"altKey":"ctrlKey";function Ys(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[kf]}bt.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let o=r.state.selection,l=o.empty?null:r.posAtCoords(mo(t)),i;if(!(l&&l.pos>=o.from&&l.pos<=(o instanceof ke?o.to-1:o.to))){if(n&&n.mightDrag)i=ke.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let h=r.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=r.docView&&(i=ke.create(r.state.doc,h.posBefore))}}let s=(i||r.state.selection).content(),{dom:u,text:d,slice:m}=Ps(r,s);(!t.dataTransfer.files.length||!Dt||Is>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(on?"Text":"text/html",u.innerHTML),t.dataTransfer.effectAllowed="copyMove",on||t.dataTransfer.setData("text/plain",d),r.dragging=new wf(m,Ys(r,t),i)};bt.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};st.dragover=st.dragenter=(r,e)=>e.preventDefault();st.drop=(r,e)=>{try{xf(r,e,r.dragging)}finally{r.dragging=null}};function xf(r,e,t){if(!e.dataTransfer)return;let n=r.posAtCoords(mo(e));if(!n)return;let o=r.state.doc.resolve(n.pos),l=t&&t.slice;l?r.someProp("transformPasted",v=>{l=v(l,r,!1)}):l=Hs(r,Ks(e.dataTransfer),on?null:e.dataTransfer.getData("text/html"),!1,o);let i=!!(t&&Ys(r,e));if(r.someProp("handleDrop",v=>v(r,e,l||ye.empty,i))){e.preventDefault();return}if(!l)return;e.preventDefault();let s=l?D1(r.state.doc,o.pos,l):o.pos;s==null&&(s=o.pos);let u=r.state.tr;if(i){let{node:v}=t;v?v.replace(u):u.deleteSelection()}let d=u.mapping.map(s),m=l.openStart==0&&l.openEnd==0&&l.content.childCount==1,h=u.doc;if(m?u.replaceRangeWith(d,d,l.content.firstChild):u.replaceRange(d,d,l),u.doc.eq(h))return;let p=u.doc.resolve(d);if(m&&ke.isSelectable(l.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(l.content.firstChild))u.setSelection(new ke(p));else{let v=u.mapping.map(s);u.mapping.maps[u.mapping.maps.length-1].forEach((b,w,k,T)=>v=T),u.setSelection(Os(r,p,u.doc.resolve(v)))}r.focus(),r.dispatch(u.setMeta("uiEvent","drop"))}bt.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&oa(r)},20))};bt.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};bt.beforeinput=(r,e)=>{if(Dt&&mn&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",l=>l(r,Bs(8,"Backspace")))))return;let{$cursor:o}=r.state.selection;o&&o.pos>0&&r.dispatch(r.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let r in st)bt[r]=st[r];function ln(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Jn{constructor(e,t){this.toDOM=e,this.spec=t||dr,this.side=this.spec.side||0}map(e,t,n,o){let{pos:l,deleted:i}=e.mapResult(t.from+o,this.side<0?-1:1);return i?null:new vt(l-n,l-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Jn&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ln(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Kt{constructor(e,t){this.attrs=e,this.spec=t||dr}map(e,t,n,o){let l=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-n;return l>=i?null:new vt(l,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Kt&&ln(this.attrs,e.attrs)&&ln(this.spec,e.spec)}static is(e){return e.type instanceof Kt}destroy(){}}class ia{constructor(e,t){this.attrs=e,this.spec=t||dr}map(e,t,n,o){let l=e.mapResult(t.from+o,1);if(l.deleted)return null;let i=e.mapResult(t.to+o,-1);return i.deleted||i.pos<=l.pos?null:new vt(l.pos-n,i.pos-n,this)}valid(e,t){let{index:n,offset:o}=e.content.findIndex(t.from),l;return o==t.from&&!(l=e.child(n)).isText&&o+l.nodeSize==t.to}eq(e){return this==e||e instanceof ia&&ln(this.attrs,e.attrs)&&ln(this.spec,e.spec)}destroy(){}}class vt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new vt(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new vt(e,e,new Jn(t,n))}static inline(e,t,n,o){return new vt(e,t,new Kt(n,o))}static node(e,t,n,o){return new vt(e,t,new ia(n,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Kt}get widget(){return this.type instanceof Jn}}const Ar=[],dr={};class Le{constructor(e,t){this.local=e.length?e:Ar,this.children=t.length?t:Ar}static create(e,t){return t.length?Xn(t,e,0,dr):Qe}find(e,t,n){let o=[];return this.findInner(e??0,t??1e9,o,0,n),o}findInner(e,t,n,o,l){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!l||l(s.spec))&&n.push(s.copy(s.from+o,s.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,o+s,l)}}map(e,t,n){return this==Qe||e.maps.length==0?this:this.mapInner(e,t,0,0,n||dr)}mapInner(e,t,n,o,l){let i;for(let s=0;s<this.local.length;s++){let u=this.local[s].map(e,n,o);u&&u.type.valid(t,u)?(i||(i=[])).push(u):l.onRemove&&l.onRemove(this.local[s].spec)}return this.children.length?Cf(this.children,i||[],e,t,n,o,l):i?new Le(i.sort(fr),Ar):Qe}add(e,t){return t.length?this==Qe?Le.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let o,l=0;e.forEach((s,u)=>{let d=u+n,m;if(m=Xs(t,s,d)){for(o||(o=this.children.slice());l<o.length&&o[l]<u;)l+=3;o[l]==u?o[l+2]=o[l+2].addInner(s,m,d+1):o.splice(l,0,u,u+s.nodeSize,Xn(m,s,d+1,dr)),l+=3}});let i=Js(l?js(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new Le(i.length?this.local.concat(i).sort(fr):this.local,o||this.children)}remove(e){return e.length==0||this==Qe?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,o=this.local;for(let l=0;l<n.length;l+=3){let i,s=n[l]+t,u=n[l+1]+t;for(let m=0,h;m<e.length;m++)(h=e[m])&&h.from>s&&h.to<u&&(e[m]=null,(i||(i=[])).push(h));if(!i)continue;n==this.children&&(n=this.children.slice());let d=n[l+2].removeInner(i,s+1);d!=Qe?n[l+2]=d:(n.splice(l,3),l-=3)}if(o.length){for(let l=0,i;l<e.length;l++)if(i=e[l])for(let s=0;s<o.length;s++)o[s].eq(i,t)&&(o==this.local&&(o=this.local.slice()),o.splice(s--,1))}return n==this.children&&o==this.local?this:o.length||n.length?new Le(o,n):Qe}forChild(e,t){if(this==Qe)return this;if(t.isLeaf)return Le.empty;let n,o;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let l=e+1,i=l+t.content.size;for(let s=0;s<this.local.length;s++){let u=this.local[s];if(u.from<i&&u.to>l&&u.type instanceof Kt){let d=Math.max(l,u.from)-l,m=Math.min(i,u.to)-l;d<m&&(o||(o=[])).push(u.copy(d,m))}}if(o){let s=new Le(o.sort(fr),Ar);return n?new lr([s,n]):s}return n||Qe}eq(e){if(this==e)return!0;if(!(e instanceof Le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return sa(this.localsInner(e))}localsInner(e){if(this==Qe)return Ar;if(e.inlineContent||!this.local.some(Kt.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Kt||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Le.empty=new Le([],[]);Le.removeOverlap=sa;const Qe=Le.empty;class lr{constructor(e){this.members=e}map(e,t){const n=this.members.map(o=>o.map(e,t,dr));return lr.from(n)}forChild(e,t){if(t.isLeaf)return Le.empty;let n=[];for(let o=0;o<this.members.length;o++){let l=this.members[o].forChild(e,t);l!=Qe&&(l instanceof lr?n=n.concat(l.members):n.push(l))}return lr.from(n)}eq(e){if(!(e instanceof lr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let o=0;o<this.members.length;o++){let l=this.members[o].localsInner(e);if(l.length)if(!t)t=l;else{n&&(t=t.slice(),n=!1);for(let i=0;i<l.length;i++)t.push(l[i])}}return t?sa(n?t:t.sort(fr)):Ar}static from(e){switch(e.length){case 0:return Qe;case 1:return e[0];default:return new lr(e.every(t=>t instanceof Le)?e:e.reduce((t,n)=>t.concat(n instanceof Le?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Cf(r,e,t,n,o,l,i){let s=r.slice();for(let d=0,m=l;d<t.maps.length;d++){let h=0;t.maps[d].forEach((p,v,b,w)=>{let k=w-b-(v-p);for(let T=0;T<s.length;T+=3){let E=s[T+1];if(E<0||p>E+m-h)continue;let M=s[T]+m-h;v>=M?s[T+1]=p<=M?-2:-1:p>=m&&k&&(s[T]+=k,s[T+1]+=k)}h+=k}),m=t.maps[d].map(m,-1)}let u=!1;for(let d=0;d<s.length;d+=3)if(s[d+1]<0){if(s[d+1]==-2){u=!0,s[d+1]=-1;continue}let m=t.map(r[d]+l),h=m-o;if(h<0||h>=n.content.size){u=!0;continue}let p=t.map(r[d+1]+l,-1),v=p-o,{index:b,offset:w}=n.content.findIndex(h),k=n.maybeChild(b);if(k&&w==h&&w+k.nodeSize==v){let T=s[d+2].mapInner(t,k,m+1,r[d]+l+1,i);T!=Qe?(s[d]=h,s[d+1]=v,s[d+2]=T):(s[d+1]=-2,u=!0)}else u=!0}if(u){let d=Tf(s,r,e,t,o,l,i),m=Xn(d,n,0,i);e=m.local;for(let h=0;h<s.length;h+=3)s[h+1]<0&&(s.splice(h,3),h-=3);for(let h=0,p=0;h<m.children.length;h+=3){let v=m.children[h];for(;p<s.length&&s[p]<v;)p+=3;s.splice(p,0,m.children[h],m.children[h+1],m.children[h+2])}}return new Le(e.sort(fr),s)}function Js(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let o=r[n];t.push(new vt(o.from+e,o.to+e,o.type))}return t}function Tf(r,e,t,n,o,l,i){function s(u,d){for(let m=0;m<u.local.length;m++){let h=u.local[m].map(n,o,d);h?t.push(h):i.onRemove&&i.onRemove(u.local[m].spec)}for(let m=0;m<u.children.length;m+=3)s(u.children[m+2],u.children[m]+d+1)}for(let u=0;u<r.length;u+=3)r[u+1]==-1&&s(r[u+2],e[u]+l+1);return t}function Xs(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,o=null;for(let l=0,i;l<r.length;l++)(i=r[l])&&i.from>t&&i.to<n&&((o||(o=[])).push(i),r[l]=null);return o}function js(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function Xn(r,e,t,n){let o=[],l=!1;e.forEach((s,u)=>{let d=Xs(r,s,u+t);if(d){l=!0;let m=Xn(d,s,t+u+1,n);m!=Qe&&o.push(u,u+s.nodeSize,m)}});let i=Js(l?js(r):r,-t).sort(fr);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||(n.onRemove&&n.onRemove(i[s].spec),i.splice(s--,1));return i.length||o.length?new Le(i,o):Qe}function fr(r,e){return r.from-e.from||r.to-e.to}function sa(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let o=t+1;o<e.length;o++){let l=e[o];if(l.from==n.from){l.to!=n.to&&(e==r&&(e=r.slice()),e[o]=l.copy(l.from,n.to),N0(e,o+1,l.copy(n.to,l.to)));continue}else{l.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,l.from),N0(e,o,n.copy(l.from,n.to)));break}}}return e}function N0(r,e,t){for(;e<r.length&&fr(t,r[e])>0;)e++;r.splice(e,0,t)}const Ko=new Map,Yo=new Set,Gr=new Set,qe={getTitle:r=>Ko.get(r),hasTitle:r=>Ko.has(r),setTitle:(r,e)=>{Ko.set(r,e)},isPinned:r=>Yo.has(r),pin:r=>{Yo.add(r)},unpin:r=>{Yo.delete(r)},isFetching:r=>Gr.has(r),startFetch:r=>{Gr.add(r)},endFetch:r=>{Gr.delete(r)},fetchingSize:()=>Gr.size,fetchingSet:()=>Gr},Er=new Ss("autoLinkTitle");function Ef(){const r=document.createElement("span");return r.className="link-loading-icon",r.setAttribute("contenteditable","false"),r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>',r}function L0(r,e){const t=e.marks.link;if(!t||qe.fetchingSize()===0)return Le.empty;const n=[];return r.descendants((o,l)=>{if(!o.isText)return;const i=o.marks.find(u=>u.type===t);if(!i)return;const s=i.attrs.href;s!=null&&s.startsWith("http")&&(!qe.isFetching(s)||qe.isPinned(s)||o.text===s&&n.push(vt.widget(l+o.nodeSize,Ef,{side:1,key:`ld:${l}`})))}),Le.create(r,n)}const Sf=Me.Extension.create({name:"autoLinkTitle",addProseMirrorPlugins(){return[new Ts({key:Er,state:{init(r,e){return L0(e.doc,e.schema)},apply(r,e,t,n){return qe.fetchingSize()===0?Le.empty:!r.docChanged&&!r.getMeta(Er)?e.map(r.mapping,n.doc):L0(n.doc,n.schema)}},props:{decorations(r){return Er.getState(r)}},view(){return{update(r,e){if(r.state.doc.eq(e.doc))return;const t=r.state.schema.marks.link;if(!t)return;const n=new Map;r.state.doc.descendants((o,l)=>{if(!o.isText)return;const i=o.marks.find(u=>u.type===t);if(!i)return;const s=i.attrs.href;!s||!s.startsWith("http")||o.text===s&&(n.has(s)||n.set(s,[]),n.get(s).push({from:l,to:l+o.nodeSize}))}),n.size!==0&&n.forEach((o,l)=>{if(!qe.isPinned(l)){if(qe.hasTitle(l)){const i=qe.getTitle(l);i&&I0(r,l,i,t);return}qe.isFetching(l)||(qe.startFetch(l),r.dispatch(r.state.tr.setMeta(Er,!0)),fetch(`/api/fetch-meta?url=${encodeURIComponent(l)}`,{signal:AbortSignal.timeout(6e3)}).then(i=>i.ok?i.json():null).then(i=>{var u;const s=((u=i==null?void 0:i.title)==null?void 0:u.trim())??"";qe.setTitle(l,s),qe.endFetch(l),s&&!qe.isPinned(l)?I0(r,l,s,t):r.dispatch(r.state.tr.setMeta(Er,!0))}).catch(()=>{qe.setTitle(l,""),qe.endFetch(l),r.dispatch(r.state.tr.setMeta(Er,!0))}))}})}}}})]}});function I0(r,e,t,n){const o=r.state,l=[];if(o.doc.descendants((s,u)=>{if(!s.isText)return;const d=s.marks.find(m=>m.type===n);!d||d.attrs.href!==e||s.text===e&&l.push({from:u,to:u+s.nodeSize,mark:d})}),l.length===0)return;let i=o.tr;l.reverse().forEach(({from:s,to:u,mark:d})=>{i=i.replaceWith(s,u,o.schema.text(t,[d]))}),r.dispatch(i)}const Mf=rt.EditorView.theme({"&":{fontSize:"13px",fontFamily:"'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace",backgroundColor:"transparent"},".cm-content":{padding:"10px 0",caretColor:"#3370ff",fontFamily:"'JetBrains Mono', monospace"},".cm-focused":{outline:"none"},".cm-line":{padding:"0 16px",lineHeight:"1.6",color:"#1f2329"},".cm-lineNumbers .cm-gutterElement":{color:"#bbbfc4",fontSize:"12px",minWidth:"32px",paddingRight:"8px",userSelect:"none"},".cm-gutters":{backgroundColor:"transparent",border:"none",color:"#bbbfc4"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"#8f959e"},".cm-activeLine":{backgroundColor:"rgba(51, 112, 255, 0.04)"},".cm-matchingBracket":{backgroundColor:"rgba(51, 112, 255, 0.15)",outline:"1px solid rgba(51, 112, 255, 0.3)"},".cm-selectionBackground":{backgroundColor:"rgba(51, 112, 255, 0.18)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:"rgba(51, 112, 255, 0.18)"},".cm-cursor":{borderLeftColor:"#3370ff",borderLeftWidth:"2px"},".cm-scroller":{overflow:"auto"}},{dark:!1}),z0=rt.EditorView.lineWrapping;function D0(r){const{container:e,wordWrap:t,onContentChange:n}=r,o=r.readOnly??a.ref(!1);r.initialContent,r.initialLanguage;let l=null,i=!1;const s=new tr.Compartment,u=new tr.Compartment,d=new tr.Compartment,m=new tr.Compartment;function h(D){var H;const W=(((H=r.commentRanges)==null?void 0:H.value)??[]).map(A=>({from:Math.max(0,Math.min(A.from,D)),to:Math.max(0,Math.min(A.to,D)),commentIds:A.commentIds.filter(R=>R.length>0)})).filter(A=>A.from<A.to&&A.commentIds.length>0).sort((A,R)=>A.from-R.from||A.to-R.to).map(A=>rt.Decoration.mark({class:"pagely-comment-inline",attributes:{"data-comment-ids":JSON.stringify(A.commentIds),...A.commentIds.length>1?{"data-comment-count":String(A.commentIds.length)}:{}}}).range(A.from,A.to));return rt.Decoration.set(W,!0)}function p(D){return rt.EditorView.decorations.of(h(D))}function v(){if(!l||!r.onSelectionChange)return;const D=l.state.selection.main;if(D.empty){r.onSelectionChange(null);return}const z=Math.min(D.from,D.to),W=Math.max(D.from,D.to),H=l.coordsAtPos(z),A=l.coordsAtPos(W);if(!H||!A){r.onSelectionChange(null);return}const R=Math.min(H.left,A.left),K=Math.max(H.right,A.right),J=Math.min(H.top,A.top),te=Math.max(H.bottom,A.bottom);r.onSelectionChange({from:z,to:W,rect:new DOMRect(R,J,K-R,te-J)})}async function b(D){try{switch(D){case"javascript":case"typescript":{const{javascript:z}=await import("@codemirror/lang-javascript");return z({typescript:D==="typescript",jsx:!1})}case"jsx":case"tsx":{const{javascript:z}=await import("@codemirror/lang-javascript");return z({typescript:D==="tsx",jsx:!0})}case"python":{const{python:z}=await import("@codemirror/lang-python");return z()}case"html":{const{html:z}=await import("@codemirror/lang-html");return z()}case"css":{const{css:z}=await import("@codemirror/lang-css");return z()}case"json":{const{json:z}=await import("@codemirror/lang-json");return z()}case"markdown":{const{markdown:z}=await import("@codemirror/lang-markdown");return z()}case"java":{const{java:z}=await import("@codemirror/lang-java");return z()}case"cpp":case"c":{const{cpp:z}=await import("@codemirror/lang-cpp");return z()}case"rust":{const{rust:z}=await import("@codemirror/lang-rust");return z()}case"sql":{const{sql:z}=await import("@codemirror/lang-sql");return z()}case"xml":{const{xml:z}=await import("@codemirror/lang-xml");return z()}case"php":{const{php:z}=await import("@codemirror/lang-php");return z()}default:return[]}}catch{return[]}}async function w(D,z){if(!e.value)return;const W=await b(z),H=t.value?z0:[],A=rt.EditorView.updateListener.of(K=>{K.docChanged&&!i&&!o.value&&n(K.state.doc.toString()),K.selectionSet&&requestAnimationFrame(v)}),R=tr.EditorState.create({doc:D,extensions:[yn.history(),rt.keymap.of([..._a.closeBracketsKeymap,...yn.defaultKeymap,...yn.historyKeymap,yn.indentWithTab]),rt.lineNumbers(),rt.highlightActiveLine(),_r.bracketMatching(),_a.closeBrackets(),_r.indentOnInput(),_r.foldGutter(),_r.syntaxHighlighting(_r.defaultHighlightStyle),s.of(W),u.of(H),d.of([tr.EditorState.readOnly.of(o.value),rt.EditorView.editable.of(!o.value)]),m.of(p(D.length)),Mf,A,rt.EditorView.domEventHandlers({mouseup:()=>(requestAnimationFrame(v),!1),keyup:()=>(requestAnimationFrame(v),!1)}),rt.EditorView.contentAttributes.of({"data-gramm":"false"})]});l=new rt.EditorView({state:R,parent:e.value})}function k(D){!l||l.state.doc.toString()===D||(i=!0,l.dispatch({changes:{from:0,to:l.state.doc.length,insert:D}}),i=!1)}async function T(D){if(!l)return;const z=await b(D);l&&l.dispatch({effects:s.reconfigure(z)})}function E(D){l&&l.dispatch({effects:u.reconfigure(D?z0:[])})}a.watch(o,D=>{l&&l.dispatch({effects:d.reconfigure([tr.EditorState.readOnly.of(D),rt.EditorView.editable.of(!D)])})}),r.commentRanges&&a.watch(r.commentRanges,()=>{l&&l.dispatch({effects:m.reconfigure(p(l.state.doc.length))})},{deep:!0});function M(){return l}function B(){l==null||l.destroy(),l=null}return{initCM:w,syncFromPM:k,switchLanguage:T,setWordWrap:E,getCMView:M,destroy:B}}function hn(r){const e=a.computed(()=>We(r().commentIds)),t=a.computed(()=>{const o=e.value;return o.length===0?{}:{"data-comment-ids":JSON.stringify(o),"data-comment-count":o.length>1?String(o.length):void 0}}),n=a.computed(()=>({"pagely-comment-block":e.value.length>0}));return{commentAttrs:t,commentClass:n}}const Af={class:"eb-modal",role:"dialog","aria-modal":"true"},Bf={class:"eb-modal-body"},ho=a.defineComponent({__name:"EmbedFullscreenModal",props:{open:{type:Boolean},beforeClose:{},closeLabel:{default:"完成"}},emits:["update:open"],setup(r,{emit:e}){const t=r,n=e;let o=!1;async function l(){var s;if(!o){o=!0;try{await((s=t.beforeClose)==null?void 0:s.call(t)),n("update:open",!1)}catch(u){console.error(u)}finally{o=!1}}}function i(s){!t.open||s.key!=="Escape"||(s.preventDefault(),s.stopPropagation(),l())}return a.watch(()=>t.open,s=>{s?document.addEventListener("keydown",i,!0):document.removeEventListener("keydown",i,!0)},{immediate:!0}),a.onBeforeUnmount(()=>{document.removeEventListener("keydown",i,!0)}),(s,u)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.createVNode(a.Transition,{name:"eb-modal"},{default:a.withCtx(()=>[r.open?(a.openBlock(),a.createElementBlock("div",{key:0,class:"eb-modal-backdrop",onClick:a.withModifiers(l,["self"])},[a.createElementVNode("div",Af,[a.createElementVNode("div",{class:"eb-modal-toolbar eb-toolbar",onMousedown:u[0]||(u[0]=a.withModifiers(()=>{},["prevent"]))},[a.renderSlot(s.$slots,"toolbar"),u[1]||(u[1]=a.createElementVNode("div",{class:"eb-spacer"},null,-1)),a.createElementVNode("button",{class:"eb-btn eb-btn--text",type:"button",title:"关闭全屏 (Esc)",onClick:l},[a.createVNode(a.unref(L.Minimize2),{size:14,"stroke-width":1.4}),a.createElementVNode("span",null,a.toDisplayString(r.closeLabel),1)])],32),a.createElementVNode("div",Bf,[a.renderSlot(s.$slots,"body")])])])):a.createCommentVNode("",!0)]),_:3})]))}}),Nf=["disabled","title"],Lf=["value","readonly"],If=["value","disabled"],zf=["value"],Df=["disabled"],Of={key:0,class:"cm-copy-tip"},Rf=["value","readonly"],Pf=["value","disabled"],Hf=["value"],Vf=["disabled"],Ff={key:0,class:"cm-copy-tip"},$f=a.defineComponent({__name:"CodeBlockView",props:_e.nodeViewProps,setup(r){const e=r,{commentAttrs:t,commentClass:n}=hn(()=>e.node.attrs),o=a.ref(null),l=a.ref(null),i=a.ref(!1),s=a.ref(""),u=a.ref("plaintext"),d=a.ref(""),m=a.ref(!1),h=a.computed(()=>e.node.attrs.language??"plaintext"),p=a.computed(()=>e.node.attrs.title??""),v=a.computed(()=>e.node.attrs.collapsed??!1),b=a.computed(()=>e.node.attrs.wordWrap??!1),w=a.computed(()=>e.editor.isEditable),k=a.computed(()=>{const ne=[];return e.node.descendants((N,O)=>{if(!N.isText)return!0;for(const $ of N.marks){if($.type.name!=="commentMark")continue;const X=We($.attrs.commentIds);X.length>0&&ne.push({from:O,to:O+N.nodeSize,commentIds:X})}return!1}),ne});function T(ne,N={},O=!1){var Xe,ue;const $=(Xe=e.getPos)==null?void 0:Xe.call(e);if($===void 0||!((ue=e.editor)!=null&&ue.view))return;const{state:X,dispatch:oe}=e.editor.view,ve=X.doc.nodeAt($);if(!ve)return;const Be={...ve.attrs,...N},$e=X.schema,ot=X.tr.replaceWith($,$+ve.nodeSize,ve.type.create(Be,ne.length>0?$e.text(ne):[]));ot.setMeta("addToHistory",O),oe(ot)}function E(ne){w.value&&T(ne)}function M(ne){var ve,Be;if(!w.value||!((ve=e.editor)!=null&&ve.view))return;if(!ne){window.dispatchEvent(new CustomEvent("pagely:code-selection-toolbar",{detail:{editor:e.editor,rect:null}}));return}const N=(Be=e.getPos)==null?void 0:Be.call(e);if(N===void 0)return;const O=N+1+ne.from,$=N+1+ne.to,{state:X,dispatch:oe}=e.editor.view;O<0||$>X.doc.content.size||O>=$||(oe(X.tr.setSelection(mr.TextSelection.create(X.doc,O,$))),window.dispatchEvent(new CustomEvent("pagely:code-selection-toolbar",{detail:{editor:e.editor,rect:ne.rect}})))}const{initCM:B,syncFromPM:D,switchLanguage:z,setWordWrap:W,destroy:H}=D0({container:o,initialContent:e.node.textContent,initialLanguage:h.value,wordWrap:a.ref(b.value),readOnly:a.computed(()=>!w.value),onContentChange:E,onSelectionChange:M,commentRanges:k}),{initCM:A,switchLanguage:R,setWordWrap:K,destroy:J}=D0({container:l,initialContent:e.node.textContent,initialLanguage:h.value,wordWrap:m,readOnly:a.computed(()=>!w.value),onContentChange:ne=>{w.value&&(s.value=ne)}});a.onMounted(()=>{B(e.node.textContent,h.value)}),a.onBeforeUnmount(()=>{H(),J()}),a.watch(()=>e.node.textContent,ne=>{D(ne)}),a.watch(()=>e.node.attrs.language,ne=>{z(ne)}),a.watch(()=>e.node.attrs.wordWrap,ne=>{W(ne)}),a.watch(i,ne=>{ne||J()});function te(){var ne;w.value&&((ne=e.updateAttributes)==null||ne.call(e,{collapsed:!v.value}))}function Z(ne){var N;w.value&&((N=e.updateAttributes)==null||N.call(e,{title:ne.target.value}))}function le(ne){var N;w.value&&((N=e.updateAttributes)==null||N.call(e,{language:ne.target.value}))}function ee(){var ne;w.value&&((ne=e.updateAttributes)==null||ne.call(e,{wordWrap:!b.value}))}function we(){s.value=e.node.textContent,u.value=h.value,d.value=p.value,m.value=b.value,i.value=!0,a.nextTick(async()=>{J(),await A(s.value,u.value),K(m.value)})}function pe(ne){w.value&&(d.value=ne.target.value)}function se(ne){if(!w.value)return;const N=ne.target.value;u.value=N,R(N)}function I(){w.value&&(m.value=!m.value,K(m.value))}function P(){w.value&&T(s.value,{language:u.value,title:d.value,wordWrap:m.value},!0)}const V=a.ref(!1);let q=null;function ae(){const ne=e.node.textContent;navigator.clipboard.writeText(ne).then(()=>{V.value=!0,q&&clearTimeout(q),q=setTimeout(()=>{V.value=!1,q=null},1500)})}function ge(){navigator.clipboard.writeText(s.value).then(()=>{V.value=!0,q&&clearTimeout(q),q=setTimeout(()=>{V.value=!1,q=null},1500)})}return(ne,N)=>(a.openBlock(),a.createBlock(a.unref(_e.NodeViewWrapper),a.mergeProps({"data-type":"code-block",class:["code-block-cm",[{"is-collapsed":v.value},a.unref(n)]]},a.unref(t)),{default:a.withCtx(()=>[a.createElementVNode("div",{class:"cm-toolbar",onMousedown:N[4]||(N[4]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("button",{class:a.normalizeClass(["cm-btn cm-chevron",{collapsed:v.value}]),disabled:!w.value,title:v.value?"展开":"收起",onClick:te},[a.createVNode(a.unref(L.ChevronDown),{size:10,"stroke-width":1.8})],10,Nf),a.createElementVNode("input",{class:"cm-title-input",type:"text",placeholder:"添加标题…",value:p.value,readonly:!w.value,onInput:Z,onKeydown:N[0]||(N[0]=a.withModifiers(()=>{},["stop"])),onMousedown:N[1]||(N[1]=a.withModifiers(()=>{},["stop"]))},null,40,Lf),a.createElementVNode("select",{class:"cm-lang-select",value:h.value,disabled:!w.value,onChange:le,onMousedown:N[2]||(N[2]=a.withModifiers(()=>{},["stop"])),onKeydown:N[3]||(N[3]=a.withModifiers(()=>{},["stop"]))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(O0),O=>(a.openBlock(),a.createElementBlock("option",{key:O.id,value:O.id},a.toDisplayString(O.label),9,zf))),128))],40,If),a.createElementVNode("button",{class:a.normalizeClass(["cm-btn",{active:b.value}]),disabled:!w.value,title:"自动换行",onClick:ee},[a.createVNode(a.unref(L.WrapText),{size:14,"stroke-width":1.4})],10,Df),a.createElementVNode("button",{class:"cm-btn",title:"复制代码",onClick:ae},[a.createVNode(a.unref(L.Copy),{size:14,"stroke-width":1.4}),V.value?(a.openBlock(),a.createElementBlock("span",Of,"已复制")):a.createCommentVNode("",!0)]),a.createElementVNode("button",{class:"cm-btn",title:"全屏",onClick:we},[a.createVNode(a.unref(L.Maximize2),{size:14,"stroke-width":1.4})])],32),a.withDirectives(a.createElementVNode("div",{ref_key:"cmContainer",ref:o,class:"cm-editor-wrap"},null,512),[[a.vShow,!v.value]]),a.createVNode(ho,{open:i.value,"onUpdate:open":N[9]||(N[9]=O=>i.value=O),"before-close":P,"close-label":"完成"},{toolbar:a.withCtx(()=>[a.createElementVNode("input",{class:"cm-title-input cm-title-input--fullscreen",type:"text",placeholder:"添加标题…",value:d.value,readonly:!w.value,onInput:pe,onKeydown:N[5]||(N[5]=a.withModifiers(()=>{},["stop"])),onMousedown:N[6]||(N[6]=a.withModifiers(()=>{},["stop"]))},null,40,Rf),a.createElementVNode("select",{class:"cm-lang-select",value:u.value,disabled:!w.value,onChange:se,onMousedown:N[7]||(N[7]=a.withModifiers(()=>{},["stop"])),onKeydown:N[8]||(N[8]=a.withModifiers(()=>{},["stop"]))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(O0),O=>(a.openBlock(),a.createElementBlock("option",{key:O.id,value:O.id},a.toDisplayString(O.label),9,Hf))),128))],40,Pf),a.createElementVNode("button",{class:a.normalizeClass(["cm-btn",{active:m.value}]),disabled:!w.value,title:"自动换行",onClick:I},[a.createVNode(a.unref(L.WrapText),{size:14,"stroke-width":1.4})],10,Vf),a.createElementVNode("button",{class:"cm-btn",title:"复制代码",onClick:ge},[a.createVNode(a.unref(L.Copy),{size:14,"stroke-width":1.4}),V.value?(a.openBlock(),a.createElementBlock("span",Ff,"已复制")):a.createCommentVNode("",!0)])]),body:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"fullscreenCmContainer",ref:l,class:"cm-editor-wrap cm-editor-wrap--fullscreen"},null,512)]),_:1},8,["open"])]),_:1},16,["class"]))}}),O0=[{id:"plaintext",label:"Plain Text"},{id:"javascript",label:"JavaScript"},{id:"typescript",label:"TypeScript"},{id:"jsx",label:"JSX"},{id:"tsx",label:"TSX"},{id:"python",label:"Python"},{id:"html",label:"HTML"},{id:"css",label:"CSS"},{id:"json",label:"JSON"},{id:"java",label:"Java"},{id:"cpp",label:"C++"},{id:"rust",label:"Rust"},{id:"sql",label:"SQL"},{id:"markdown",label:"Markdown"},{id:"xml",label:"XML"},{id:"php",label:"PHP"}],qf=Me.Node.create({name:"codeBlock",content:"text*",marks:"commentMark",group:"block",code:!0,defining:!0,isolating:!0,addAttributes(){return{language:{default:"plaintext",parseHTML:r=>{var e;return r.getAttribute("data-language")??((e=r.querySelector("code"))==null?void 0:e.className.replace("language-",""))??"plaintext"}},title:{default:"",parseHTML:r=>r.getAttribute("data-title")??""},collapsed:{default:!1,parseHTML:r=>r.getAttribute("data-collapsed")==="true"},wordWrap:{default:!1,parseHTML:r=>r.getAttribute("data-word-wrap")==="true"}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full",getAttrs:r=>r.getAttribute("data-type")==="mermaid-block"?!1:null},{tag:'div[data-type="code-block"]',preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",Me.mergeAttributes(e,{"data-type":"code-block","data-language":r.attrs.language,"data-title":r.attrs.title,"data-collapsed":r.attrs.collapsed,"data-word-wrap":r.attrs.wordWrap}),["code",0]]},addCommands(){return{setCodeBlock:r=>({commands:e})=>e.setNode(this.name,r),unsetCodeBlock:()=>({commands:r})=>r.setNode("paragraph"),toggleCodeBlock:r=>({commands:e})=>e.toggleNode(this.name,"paragraph",r)}},addKeyboardShortcuts(){return{"Mod-Enter":()=>{const{state:r}=this.editor.view,{$from:e}=r.selection;return e.parent.type.name!==this.name?!1:this.editor.commands.exitCode()}}},addNodeView(){return _e.VueNodeViewRenderer($f)}});class _ extends Error{constructor(e,t){var n="KaTeX parse error: "+e,o,l,i=t&&t.loc;if(i&&i.start<=i.end){var s=i.lexer.input;o=i.start,l=i.end,o===s.length?n+=" at end of input: ":n+=" at position "+(o+1)+": ";var u=s.slice(o,l).replace(/[^]/g,"$&̲"),d;o>15?d="…"+s.slice(o-15,o):d=s.slice(0,o);var m;l+15<s.length?m=s.slice(l,l+15)+"…":m=s.slice(l),n+=d+u+m}super(n),this.name="ParseError",Object.setPrototypeOf(this,_.prototype),this.position=o,o!=null&&l!=null&&(this.length=l-o),this.rawMessage=e}}var Uf=/([A-Z])/g,ua=r=>r.replace(Uf,"-$1").toLowerCase(),Wf={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},_f=/[&><"']/g,Ye=r=>String(r).replace(_f,e=>Wf[e]),Rn=r=>r.type==="ordgroup"||r.type==="color"?r.body.length===1?Rn(r.body[0]):r:r.type==="font"?Rn(r.body):r,Gf=new Set(["mathord","textord","atom"]),Ot=r=>Gf.has(Rn(r).type),Kf=r=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(r);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},Il={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function Yf(r){if("default"in r)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class ca{constructor(e){e===void 0&&(e={}),e=e||{};for(var t of Object.keys(Il)){var n=Il[t],o=e[t];this[t]=o!==void 0?n.processor?n.processor(o):o:Yf(n)}}reportNonstrict(e,t,n){var o=this.strict;if(typeof o=="function"&&(o=o(e,t,n)),!(!o||o==="ignore")){if(o===!0||o==="error")throw new _("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),n);o==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+o+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,n){var o=this.strict;if(typeof o=="function")try{o=o(e,t,n)}catch{o="error"}return!o||o==="ignore"?!1:o===!0||o==="error"?!0:o==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+o+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var t=Kf(e.url);if(t==null)return!1;e.protocol=t}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class Ft{constructor(e,t,n){this.id=e,this.size=t,this.cramped=n}sup(){return yt[Jf[this.id]]}sub(){return yt[Xf[this.id]]}fracNum(){return yt[jf[this.id]]}fracDen(){return yt[Qf[this.id]]}cramp(){return yt[Zf[this.id]]}text(){return yt[em[this.id]]}isTight(){return this.size>=2}}var da=0,jn=1,Lr=2,It=3,an=4,ht=5,Or=6,et=7,yt=[new Ft(da,0,!1),new Ft(jn,0,!0),new Ft(Lr,1,!1),new Ft(It,1,!0),new Ft(an,2,!1),new Ft(ht,2,!0),new Ft(Or,3,!1),new Ft(et,3,!0)],Jf=[an,ht,an,ht,Or,et,Or,et],Xf=[ht,ht,ht,ht,et,et,et,et],jf=[Lr,It,an,ht,Or,et,Or,et],Qf=[It,It,ht,ht,et,et,et,et],Zf=[jn,jn,It,It,ht,ht,et,et],em=[da,jn,Lr,It,Lr,It,Lr,It],fe={DISPLAY:yt[da],TEXT:yt[Lr],SCRIPT:yt[an],SCRIPTSCRIPT:yt[Or]},zl=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function tm(r){for(var e=0;e<zl.length;e++)for(var t=zl[e],n=0;n<t.blocks.length;n++){var o=t.blocks[n];if(r>=o[0]&&r<=o[1])return t.name}return null}var Pn=[];zl.forEach(r=>r.blocks.forEach(e=>Pn.push(...e)));function Qs(r){for(var e=0;e<Pn.length;e+=2)if(r>=Pn[e]&&r<=Pn[e+1])return!0;return!1}var Ue=r=>r+" "+r,Sr=80,rm=function(e,t){return"M95,"+(622+e+t)+`
46
+ `;const o=a0(e);return o!==null?`$${o}$`:""}});for(const{name:t,...e}of[...Vu(Kt)].reverse())Kt.addRule(t,e);return Kt}function Gr(t){return!t||t==="<p></p>"?"":$u().turndown(t)}const Fu=new Set(["P","BR","SPAN","DIV","H1","H2","H3","H4","H5","H6","UL","OL","LI","STRONG","B","EM","I","U","S","CODE","PRE","BLOCKQUOTE","HR","A","IMG","TABLE","THEAD","TBODY","TR","TD","TH"]),qu={A:new Set(["href","title"]),DIV:new Set(["data-type","data-view","data-href","data-latex","data-graph"]),IMG:new Set(["src","alt","title"]),LI:new Set(["data-type","data-checked"]),PRE:new Set(["data-type","data-language"]),SPAN:new Set(["data-type","data-latex","data-mention-user-id","data-mention-display-name"]),UL:new Set(["data-type"])},Uu=new Set(["SCRIPT","STYLE","META","LINK","HEAD"]);function Kr(t){const e=document.createElement("template");e.innerHTML=t;for(const r of Array.from(e.content.querySelectorAll("table")))Wu(r);return l0(e.content),e.innerHTML.trim()}function l0(t){for(let e=t.childNodes.length-1;e>=0;e--){const r=t.childNodes[e];if(r.nodeType!==Node.ELEMENT_NODE)continue;const n=r,o=n.tagName;if(Uu.has(o)){n.remove();continue}if(!Fu.has(o)){for(l0(n);n.firstChild;)t.insertBefore(n.firstChild,n);n.remove();continue}_u(n),l0(n)}}function _u(t){if(t.tagName==="TD"||t.tagName==="TH"){const r=or(t);for(const n of Array.from(t.attributes)){if(n.name.startsWith("on")){t.removeAttribute(n.name);continue}if(n.name!=="align"){if(n.name==="class"){const o=n.value.split(/\s+/).find(l=>l.startsWith("language-"));o?t.setAttribute("class",o):t.removeAttribute("class");continue}t.removeAttribute(n.name)}}r?t.setAttribute("align",r):t.removeAttribute("align");return}const e=qu[t.tagName];for(const r of Array.from(t.attributes)){if(r.name.startsWith("on")){t.removeAttribute(r.name);continue}if(r.name==="class"){const n=r.value.split(/\s+/).find(o=>o.startsWith("language-"));n?t.setAttribute("class",n):t.removeAttribute("class");continue}(!e||!e.has(r.name))&&t.removeAttribute(r.name)}t.tagName==="DIV"&&t.getAttribute("data-type")==="embed-view"&&!nr(t.getAttribute("data-href")??"")&&(t.removeAttribute("data-type"),t.removeAttribute("data-view"),t.removeAttribute("data-href"))}function Wu(t){var l,i;const e=Array.from(t.querySelectorAll(":scope > tr, :scope > thead > tr, :scope > tbody > tr, :scope > tfoot > tr"));if(!e.length)return;const r=[];function n(s,c){r[s]??(r[s]=[]);let m=c;for(;r[s][m];)m++;return m}for(let s=0;s<e.length;s++){const c=e[s],m=Array.from(c.children).filter(f=>f instanceof HTMLTableCellElement&&(f.tagName==="TD"||f.tagName==="TH"));let p=0;for(const f of m){const g=Math.max(1,Number(f.getAttribute("colspan")||"1")||1),b=Math.max(1,Number(f.getAttribute("rowspan")||"1")||1),v=n(s,p),w=or(f),k={cell:f,row:s,col:v,rowspan:b,colspan:g,align:w};for(let T=s;T<s+b;T++){r[T]??(r[T]=[]);for(let M=v;M<v+g;M++)r[T][M]=k}p=v+g}}const o=r.reduce((s,c)=>Math.max(s,c.length),0);for(const s of e)for(;s.firstChild;)s.removeChild(s.firstChild);for(let s=0;s<e.length;s++){const c=e[s],m=((l=c.parentElement)==null?void 0:l.tagName)==="THEAD"||c.querySelector("th")?"th":"td";for(let p=0;p<o;p++){const f=(i=r[s])==null?void 0:i[p];if(!f){c.appendChild(t.ownerDocument.createElement(m));continue}if(f.row===s&&f.col===p){f.cell.removeAttribute("colspan"),f.cell.removeAttribute("rowspan"),f.align?f.cell.setAttribute("align",f.align):f.cell.removeAttribute("align"),c.appendChild(f.cell);continue}const g=t.ownerDocument.createElement(f.cell.tagName.toLowerCase());f.align&&g.setAttribute("align",f.align),c.appendChild(g)}}}function cl(t,e,r=300){const n=a.ref(!1);let o=null;function l(){o&&(clearTimeout(o),o=null)}function i(f){l(),o=setTimeout(()=>{o=null,e("update:markdown",Gr(f))},r)}function s(){var f;return((f=t())==null?void 0:f.getHTML())??""}function c(){return Gr(s())}function m(f){const g=t();g&&(n.value=!0,g.chain().setMeta("addToHistory",!1).setContent(Kr(ar(f)),{emitUpdate:!1}).run(),a.nextTick(()=>{n.value=!1}))}function p(f){const g=t();g&&(n.value=!0,g.chain().setMeta("addToHistory",!1).setContent(Kr(f),{emitUpdate:!1}).run(),a.nextTick(()=>{n.value=!1}))}return a.onBeforeUnmount(l),{isSettingContent:n,scheduleMarkdownEmit:i,getHtml:s,getMarkdown:c,setMarkdown:m,setHtml:p}}const zn=new Map,Dn=new Set,mr=new Set,He={getTitle:t=>zn.get(t),hasTitle:t=>zn.has(t),setTitle:(t,e)=>{zn.set(t,e)},isPinned:t=>Dn.has(t),pin:t=>{Dn.add(t)},unpin:t=>{Dn.delete(t)},isFetching:t=>mr.has(t),startFetch:t=>{mr.add(t)},endFetch:t=>{mr.delete(t)},fetchingSize:()=>mr.size,fetchingSet:()=>mr},Yt=new rt.PluginKey("autoLinkTitle");function Gu(){const t=document.createElement("span");return t.className="link-loading-icon",t.setAttribute("contenteditable","false"),t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>',t}function Ma(t,e){const r=e.marks.link;if(!r||He.fetchingSize()===0)return Mt.DecorationSet.empty;const n=[];return t.descendants((o,l)=>{if(!o.isText)return;const i=o.marks.find(c=>c.type===r);if(!i)return;const s=i.attrs.href;s!=null&&s.startsWith("http")&&(!He.isFetching(s)||He.isPinned(s)||o.text===s&&n.push(Mt.Decoration.widget(l+o.nodeSize,Gu,{side:1,key:`ld:${l}`})))}),Mt.DecorationSet.create(t,n)}const Ku=Te.Extension.create({name:"autoLinkTitle",addProseMirrorPlugins(){return[new rt.Plugin({key:Yt,state:{init(t,e){return Ma(e.doc,e.schema)},apply(t,e,r,n){return He.fetchingSize()===0?Mt.DecorationSet.empty:!t.docChanged&&!t.getMeta(Yt)?e.map(t.mapping,n.doc):Ma(n.doc,n.schema)}},props:{decorations(t){return Yt.getState(t)}},view(){return{update(t,e){if(t.state.doc.eq(e.doc))return;const r=t.state.schema.marks.link;if(!r)return;const n=new Map;t.state.doc.descendants((o,l)=>{if(!o.isText)return;const i=o.marks.find(c=>c.type===r);if(!i)return;const s=i.attrs.href;!s||!s.startsWith("http")||o.text===s&&(n.has(s)||n.set(s,[]),n.get(s).push({from:l,to:l+o.nodeSize}))}),n.size!==0&&n.forEach((o,l)=>{if(!He.isPinned(l)){if(He.hasTitle(l)){const i=He.getTitle(l);i&&Sa(t,l,i,r);return}He.isFetching(l)||(He.startFetch(l),t.dispatch(t.state.tr.setMeta(Yt,!0)),fetch(`/api/fetch-meta?url=${encodeURIComponent(l)}`,{signal:AbortSignal.timeout(6e3)}).then(i=>i.ok?i.json():null).then(i=>{var c;const s=((c=i==null?void 0:i.title)==null?void 0:c.trim())??"";He.setTitle(l,s),He.endFetch(l),s&&!He.isPinned(l)?Sa(t,l,s,r):t.dispatch(t.state.tr.setMeta(Yt,!0))}).catch(()=>{He.setTitle(l,""),He.endFetch(l),t.dispatch(t.state.tr.setMeta(Yt,!0))}))}})}}}})]}});function Sa(t,e,r,n){const o=t.state,l=[];if(o.doc.descendants((s,c)=>{if(!s.isText)return;const m=s.marks.find(p=>p.type===n);!m||m.attrs.href!==e||s.text===e&&l.push({from:c,to:c+s.nodeSize,mark:m})}),l.length===0)return;let i=o.tr;l.reverse().forEach(({from:s,to:c,mark:m})=>{i=i.replaceWith(s,c,o.schema.text(r,[m]))}),t.dispatch(i)}const Yu=Ke.EditorView.theme({"&":{fontSize:"13px",fontFamily:"'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace",backgroundColor:"transparent"},".cm-content":{padding:"10px 0",caretColor:"#3370ff",fontFamily:"'JetBrains Mono', monospace"},".cm-focused":{outline:"none"},".cm-line":{padding:"0 16px",lineHeight:"1.6",color:"#1f2329"},".cm-lineNumbers .cm-gutterElement":{color:"#bbbfc4",fontSize:"12px",minWidth:"32px",paddingRight:"8px",userSelect:"none"},".cm-gutters":{backgroundColor:"transparent",border:"none",color:"#bbbfc4"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"#8f959e"},".cm-activeLine":{backgroundColor:"rgba(51, 112, 255, 0.04)"},".cm-matchingBracket":{backgroundColor:"rgba(51, 112, 255, 0.15)",outline:"1px solid rgba(51, 112, 255, 0.3)"},".cm-selectionBackground":{backgroundColor:"rgba(51, 112, 255, 0.18)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:"rgba(51, 112, 255, 0.18)"},".cm-cursor":{borderLeftColor:"#3370ff",borderLeftWidth:"2px"},".cm-scroller":{overflow:"auto"}},{dark:!1}),Aa=Ke.EditorView.lineWrapping;function Ba(t){const{container:e,wordWrap:r,onContentChange:n}=t,o=t.readOnly??a.ref(!1);t.initialContent,t.initialLanguage;let l=null,i=!1;const s=new Dt.Compartment,c=new Dt.Compartment,m=new Dt.Compartment,p=new Dt.Compartment;function f(B){var P;const F=(((P=t.commentRanges)==null?void 0:P.value)??[]).map(N=>({from:Math.max(0,Math.min(N.from,B)),to:Math.max(0,Math.min(N.to,B)),commentIds:N.commentIds.filter(H=>H.length>0)})).filter(N=>N.from<N.to&&N.commentIds.length>0).sort((N,H)=>N.from-H.from||N.to-H.to).map(N=>Ke.Decoration.mark({class:"pagely-comment-inline",attributes:{"data-comment-ids":JSON.stringify(N.commentIds),...N.commentIds.length>1?{"data-comment-count":String(N.commentIds.length)}:{}}}).range(N.from,N.to));return Ke.Decoration.set(F,!0)}function g(B){return Ke.EditorView.decorations.of(f(B))}function b(){if(!l||!t.onSelectionChange)return;const B=l.state.selection.main;if(B.empty){t.onSelectionChange(null);return}const z=Math.min(B.from,B.to),F=Math.max(B.from,B.to),P=l.coordsAtPos(z),N=l.coordsAtPos(F);if(!P||!N){t.onSelectionChange(null);return}const H=Math.min(P.left,N.left),G=Math.max(P.right,N.right),X=Math.min(P.top,N.top),ae=Math.max(P.bottom,N.bottom);t.onSelectionChange({from:z,to:F,rect:new DOMRect(H,X,G-H,ae-X)})}async function v(B){try{switch(B){case"javascript":case"typescript":{const{javascript:z}=await import("@codemirror/lang-javascript");return z({typescript:B==="typescript",jsx:!1})}case"jsx":case"tsx":{const{javascript:z}=await import("@codemirror/lang-javascript");return z({typescript:B==="tsx",jsx:!0})}case"python":{const{python:z}=await import("@codemirror/lang-python");return z()}case"html":{const{html:z}=await import("@codemirror/lang-html");return z()}case"css":{const{css:z}=await import("@codemirror/lang-css");return z()}case"json":{const{json:z}=await import("@codemirror/lang-json");return z()}case"markdown":{const{markdown:z}=await import("@codemirror/lang-markdown");return z()}case"java":{const{java:z}=await import("@codemirror/lang-java");return z()}case"cpp":case"c":{const{cpp:z}=await import("@codemirror/lang-cpp");return z()}case"rust":{const{rust:z}=await import("@codemirror/lang-rust");return z()}case"sql":{const{sql:z}=await import("@codemirror/lang-sql");return z()}case"xml":{const{xml:z}=await import("@codemirror/lang-xml");return z()}case"php":{const{php:z}=await import("@codemirror/lang-php");return z()}default:return[]}}catch{return[]}}async function w(B,z){if(!e.value)return;const F=await v(z),P=r.value?Aa:[],N=Ke.EditorView.updateListener.of(G=>{G.docChanged&&!i&&!o.value&&n(G.state.doc.toString()),G.selectionSet&&requestAnimationFrame(b)}),H=Dt.EditorState.create({doc:B,extensions:[Sr.history(),Ke.keymap.of([...ma.closeBracketsKeymap,...Sr.defaultKeymap,...Sr.historyKeymap,Sr.indentWithTab]),Ke.lineNumbers(),Ke.highlightActiveLine(),dr.bracketMatching(),ma.closeBrackets(),dr.indentOnInput(),dr.foldGutter(),dr.syntaxHighlighting(dr.defaultHighlightStyle),s.of(F),c.of(P),m.of([Dt.EditorState.readOnly.of(o.value),Ke.EditorView.editable.of(!o.value)]),p.of(g(B.length)),Yu,N,Ke.EditorView.domEventHandlers({mouseup:()=>(requestAnimationFrame(b),!1),keyup:()=>(requestAnimationFrame(b),!1)}),Ke.EditorView.contentAttributes.of({"data-gramm":"false"})]});l=new Ke.EditorView({state:H,parent:e.value})}function k(B){!l||l.state.doc.toString()===B||(i=!0,l.dispatch({changes:{from:0,to:l.state.doc.length,insert:B}}),i=!1)}async function T(B){if(!l)return;const z=await v(B);l&&l.dispatch({effects:s.reconfigure(z)})}function M(B){l&&l.dispatch({effects:c.reconfigure(B?Aa:[])})}a.watch(o,B=>{l&&l.dispatch({effects:m.reconfigure([Dt.EditorState.readOnly.of(B),Ke.EditorView.editable.of(!B)])})}),t.commentRanges&&a.watch(t.commentRanges,()=>{l&&l.dispatch({effects:p.reconfigure(g(l.state.doc.length))})},{deep:!0});function E(){return l}function S(){l==null||l.destroy(),l=null}return{initCM:w,syncFromPM:k,switchLanguage:T,setWordWrap:M,getCMView:E,destroy:S}}function xr(t){const e=a.computed(()=>Pe(t().commentIds)),r=a.computed(()=>{const o=e.value;return o.length===0?{}:{"data-comment-ids":JSON.stringify(o),"data-comment-count":o.length>1?String(o.length):void 0}}),n=a.computed(()=>({"pagely-comment-block":e.value.length>0}));return{commentAttrs:r,commentClass:n}}const ju={class:"eb-modal",role:"dialog","aria-modal":"true"},Xu={class:"eb-modal-body"},ln=a.defineComponent({__name:"EmbedFullscreenModal",props:{open:{type:Boolean},beforeClose:{},closeLabel:{default:"完成"}},emits:["update:open"],setup(t,{emit:e}){const r=t,n=e;let o=!1;async function l(){var s;if(!o){o=!0;try{await((s=r.beforeClose)==null?void 0:s.call(r)),n("update:open",!1)}catch(c){console.error(c)}finally{o=!1}}}function i(s){!r.open||s.key!=="Escape"||(s.preventDefault(),s.stopPropagation(),l())}return a.watch(()=>r.open,s=>{s?document.addEventListener("keydown",i,!0):document.removeEventListener("keydown",i,!0)},{immediate:!0}),a.onBeforeUnmount(()=>{document.removeEventListener("keydown",i,!0)}),(s,c)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.createVNode(a.Transition,{name:"eb-modal"},{default:a.withCtx(()=>[t.open?(a.openBlock(),a.createElementBlock("div",{key:0,class:"eb-modal-backdrop",onClick:a.withModifiers(l,["self"])},[a.createElementVNode("div",ju,[a.createElementVNode("div",{class:"eb-modal-toolbar eb-toolbar",onMousedown:c[0]||(c[0]=a.withModifiers(()=>{},["prevent"]))},[a.renderSlot(s.$slots,"toolbar"),c[1]||(c[1]=a.createElementVNode("div",{class:"eb-spacer"},null,-1)),a.createElementVNode("button",{class:"eb-btn eb-btn--text",type:"button",title:"关闭全屏 (Esc)",onClick:l},[a.createVNode(a.unref(I.Minimize2),{size:14,"stroke-width":1.4}),a.createElementVNode("span",null,a.toDisplayString(t.closeLabel),1)])],32),a.createElementVNode("div",Xu,[a.renderSlot(s.$slots,"body")])])])):a.createCommentVNode("",!0)]),_:3})]))}}),Ju=["disabled","title"],Qu=["value","readonly"],Zu=["value","disabled"],ec=["value"],tc=["disabled"],rc={key:0,class:"cm-copy-tip"},nc=["value","readonly"],ac=["value","disabled"],oc=["value"],lc=["disabled"],ic={key:0,class:"cm-copy-tip"},sc=a.defineComponent({__name:"CodeBlockView",props:Oe.nodeViewProps,setup(t){const e=t,{commentAttrs:r,commentClass:n}=xr(()=>e.node.attrs),o=a.ref(null),l=a.ref(null),i=a.ref(!1),s=a.ref(""),c=a.ref("plaintext"),m=a.ref(""),p=a.ref(!1),f=a.computed(()=>e.node.attrs.language??"plaintext"),g=a.computed(()=>e.node.attrs.title??""),b=a.computed(()=>e.node.attrs.collapsed??!1),v=a.computed(()=>e.node.attrs.wordWrap??!1),w=a.computed(()=>e.editor.isEditable),k=a.computed(()=>{const J=[];return e.node.descendants((L,D)=>{if(!L.isText)return!0;for(const V of L.marks){if(V.type.name!=="commentMark")continue;const Q=Pe(V.attrs.commentIds);Q.length>0&&J.push({from:D,to:D+L.nodeSize,commentIds:Q})}return!1}),J});function T(J,L={},D=!1){var qe,ue;const V=(qe=e.getPos)==null?void 0:qe.call(e);if(V===void 0||!((ue=e.editor)!=null&&ue.view))return;const{state:Q,dispatch:le}=e.editor.view,be=Q.doc.nodeAt(V);if(!be)return;const Me={...be.attrs,...L},De=Q.schema,je=Q.tr.replaceWith(V,V+be.nodeSize,be.type.create(Me,J.length>0?De.text(J):[]));je.setMeta("addToHistory",D),le(je)}function M(J){w.value&&T(J)}function E(J){var be,Me;if(!w.value||!((be=e.editor)!=null&&be.view))return;if(!J){window.dispatchEvent(new CustomEvent("pagely:code-selection-toolbar",{detail:{editor:e.editor,rect:null}}));return}const L=(Me=e.getPos)==null?void 0:Me.call(e);if(L===void 0)return;const D=L+1+J.from,V=L+1+J.to,{state:Q,dispatch:le}=e.editor.view;D<0||V>Q.doc.content.size||D>=V||(le(Q.tr.setSelection(rt.TextSelection.create(Q.doc,D,V))),window.dispatchEvent(new CustomEvent("pagely:code-selection-toolbar",{detail:{editor:e.editor,rect:J.rect}})))}const{initCM:S,syncFromPM:B,switchLanguage:z,setWordWrap:F,destroy:P}=Ba({container:o,initialContent:e.node.textContent,initialLanguage:f.value,wordWrap:a.ref(v.value),readOnly:a.computed(()=>!w.value),onContentChange:M,onSelectionChange:E,commentRanges:k}),{initCM:N,switchLanguage:H,setWordWrap:G,destroy:X}=Ba({container:l,initialContent:e.node.textContent,initialLanguage:f.value,wordWrap:p,readOnly:a.computed(()=>!w.value),onContentChange:J=>{w.value&&(s.value=J)}});a.onMounted(()=>{S(e.node.textContent,f.value)}),a.onBeforeUnmount(()=>{P(),X()}),a.watch(()=>e.node.textContent,J=>{B(J)}),a.watch(()=>e.node.attrs.language,J=>{z(J)}),a.watch(()=>e.node.attrs.wordWrap,J=>{F(J)}),a.watch(i,J=>{J||X()});function ae(){var J;w.value&&((J=e.updateAttributes)==null||J.call(e,{collapsed:!b.value}))}function re(J){var L;w.value&&((L=e.updateAttributes)==null||L.call(e,{title:J.target.value}))}function ce(J){var L;w.value&&((L=e.updateAttributes)==null||L.call(e,{language:J.target.value}))}function ne(){var J;w.value&&((J=e.updateAttributes)==null||J.call(e,{wordWrap:!v.value}))}function ge(){s.value=e.node.textContent,c.value=f.value,m.value=g.value,p.value=v.value,i.value=!0,a.nextTick(async()=>{X(),await N(s.value,c.value),G(p.value)})}function ve(J){w.value&&(m.value=J.target.value)}function se(J){if(!w.value)return;const L=J.target.value;c.value=L,H(L)}function R(){w.value&&(p.value=!p.value,G(p.value))}function Y(){w.value&&T(s.value,{language:c.value,title:m.value,wordWrap:p.value},!0)}const K=a.ref(!1);let q=null;function U(){const J=e.node.textContent;navigator.clipboard.writeText(J).then(()=>{K.value=!0,q&&clearTimeout(q),q=setTimeout(()=>{K.value=!1,q=null},1500)})}function te(){navigator.clipboard.writeText(s.value).then(()=>{K.value=!0,q&&clearTimeout(q),q=setTimeout(()=>{K.value=!1,q=null},1500)})}return(J,L)=>(a.openBlock(),a.createBlock(a.unref(Oe.NodeViewWrapper),a.mergeProps({"data-type":"code-block",class:["code-block-cm",[{"is-collapsed":b.value},a.unref(n)]]},a.unref(r)),{default:a.withCtx(()=>[a.createElementVNode("div",{class:"cm-toolbar",onMousedown:L[4]||(L[4]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("button",{class:a.normalizeClass(["cm-btn cm-chevron",{collapsed:b.value}]),disabled:!w.value,title:b.value?"展开":"收起",onClick:ae},[a.createVNode(a.unref(I.ChevronDown),{size:10,"stroke-width":1.8})],10,Ju),a.createElementVNode("input",{class:"cm-title-input",type:"text",placeholder:"添加标题…",value:g.value,readonly:!w.value,onInput:re,onKeydown:L[0]||(L[0]=a.withModifiers(()=>{},["stop"])),onMousedown:L[1]||(L[1]=a.withModifiers(()=>{},["stop"]))},null,40,Qu),a.createElementVNode("select",{class:"cm-lang-select",value:f.value,disabled:!w.value,onChange:ce,onMousedown:L[2]||(L[2]=a.withModifiers(()=>{},["stop"])),onKeydown:L[3]||(L[3]=a.withModifiers(()=>{},["stop"]))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(La),D=>(a.openBlock(),a.createElementBlock("option",{key:D.id,value:D.id},a.toDisplayString(D.label),9,ec))),128))],40,Zu),a.createElementVNode("button",{class:a.normalizeClass(["cm-btn",{active:v.value}]),disabled:!w.value,title:"自动换行",onClick:ne},[a.createVNode(a.unref(I.WrapText),{size:14,"stroke-width":1.4})],10,tc),a.createElementVNode("button",{class:"cm-btn",title:"复制代码",onClick:U},[a.createVNode(a.unref(I.Copy),{size:14,"stroke-width":1.4}),K.value?(a.openBlock(),a.createElementBlock("span",rc,"已复制")):a.createCommentVNode("",!0)]),a.createElementVNode("button",{class:"cm-btn",title:"全屏",onClick:ge},[a.createVNode(a.unref(I.Maximize2),{size:14,"stroke-width":1.4})])],32),a.withDirectives(a.createElementVNode("div",{ref_key:"cmContainer",ref:o,class:"cm-editor-wrap"},null,512),[[a.vShow,!b.value]]),a.createVNode(ln,{open:i.value,"onUpdate:open":L[9]||(L[9]=D=>i.value=D),"before-close":Y,"close-label":"完成"},{toolbar:a.withCtx(()=>[a.createElementVNode("input",{class:"cm-title-input cm-title-input--fullscreen",type:"text",placeholder:"添加标题…",value:m.value,readonly:!w.value,onInput:ve,onKeydown:L[5]||(L[5]=a.withModifiers(()=>{},["stop"])),onMousedown:L[6]||(L[6]=a.withModifiers(()=>{},["stop"]))},null,40,nc),a.createElementVNode("select",{class:"cm-lang-select",value:c.value,disabled:!w.value,onChange:se,onMousedown:L[7]||(L[7]=a.withModifiers(()=>{},["stop"])),onKeydown:L[8]||(L[8]=a.withModifiers(()=>{},["stop"]))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(La),D=>(a.openBlock(),a.createElementBlock("option",{key:D.id,value:D.id},a.toDisplayString(D.label),9,oc))),128))],40,ac),a.createElementVNode("button",{class:a.normalizeClass(["cm-btn",{active:p.value}]),disabled:!w.value,title:"自动换行",onClick:R},[a.createVNode(a.unref(I.WrapText),{size:14,"stroke-width":1.4})],10,lc),a.createElementVNode("button",{class:"cm-btn",title:"复制代码",onClick:te},[a.createVNode(a.unref(I.Copy),{size:14,"stroke-width":1.4}),K.value?(a.openBlock(),a.createElementBlock("span",ic,"已复制")):a.createCommentVNode("",!0)])]),body:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"fullscreenCmContainer",ref:l,class:"cm-editor-wrap cm-editor-wrap--fullscreen"},null,512)]),_:1},8,["open"])]),_:1},16,["class"]))}}),La=[{id:"plaintext",label:"Plain Text"},{id:"javascript",label:"JavaScript"},{id:"typescript",label:"TypeScript"},{id:"jsx",label:"JSX"},{id:"tsx",label:"TSX"},{id:"python",label:"Python"},{id:"html",label:"HTML"},{id:"css",label:"CSS"},{id:"json",label:"JSON"},{id:"java",label:"Java"},{id:"cpp",label:"C++"},{id:"rust",label:"Rust"},{id:"sql",label:"SQL"},{id:"markdown",label:"Markdown"},{id:"xml",label:"XML"},{id:"php",label:"PHP"}],uc=Te.Node.create({name:"codeBlock",content:"text*",marks:"commentMark",group:"block",code:!0,defining:!0,isolating:!0,addAttributes(){return{language:{default:"plaintext",parseHTML:t=>{var e;return t.getAttribute("data-language")??((e=t.querySelector("code"))==null?void 0:e.className.replace("language-",""))??"plaintext"}},title:{default:"",parseHTML:t=>t.getAttribute("data-title")??""},collapsed:{default:!1,parseHTML:t=>t.getAttribute("data-collapsed")==="true"},wordWrap:{default:!1,parseHTML:t=>t.getAttribute("data-word-wrap")==="true"}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>t.getAttribute("data-type")==="mermaid-block"?!1:null},{tag:'div[data-type="code-block"]',preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Te.mergeAttributes(e,{"data-type":"code-block","data-language":t.attrs.language,"data-title":t.attrs.title,"data-collapsed":t.attrs.collapsed,"data-word-wrap":t.attrs.wordWrap}),["code",0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),unsetCodeBlock:()=>({commands:t})=>t.setNode("paragraph"),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Enter":()=>{const{state:t}=this.editor.view,{$from:e}=t.selection;return e.parent.type.name!==this.name?!1:this.editor.commands.exitCode()}}},addNodeView(){return Oe.VueNodeViewRenderer(sc)}});class _ extends Error{constructor(e,r){var n="KaTeX parse error: "+e,o,l,i=r&&r.loc;if(i&&i.start<=i.end){var s=i.lexer.input;o=i.start,l=i.end,o===s.length?n+=" at end of input: ":n+=" at position "+(o+1)+": ";var c=s.slice(o,l).replace(/[^]/g,"$&̲"),m;o>15?m="…"+s.slice(o-15,o):m=s.slice(0,o);var p;l+15<s.length?p=s.slice(l,l+15)+"…":p=s.slice(l),n+=m+c+p}super(n),this.name="ParseError",Object.setPrototypeOf(this,_.prototype),this.position=o,o!=null&&l!=null&&(this.length=l-o),this.rawMessage=e}}var cc=/([A-Z])/g,B0=t=>t.replace(cc,"-$1").toLowerCase(),dc={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},mc=/[&><"']/g,Fe=t=>String(t).replace(mc,e=>dc[e]),Vr=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?Vr(t.body[0]):t:t.type==="font"?Vr(t.body):t,fc=new Set(["mathord","textord","atom"]),gt=t=>fc.has(Vr(t).type),pc=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},i0={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function hc(t){if("default"in t)return t.default;var e=t.type,r=Array.isArray(e)?e[0]:e;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class L0{constructor(e){e===void 0&&(e={}),e=e||{};for(var r of Object.keys(i0)){var n=i0[r],o=e[r];this[r]=o!==void 0?n.processor?n.processor(o):o:hc(n)}}reportNonstrict(e,r,n){var o=this.strict;if(typeof o=="function"&&(o=o(e,r,n)),!(!o||o==="ignore")){if(o===!0||o==="error")throw new _("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+e+"]"),n);o==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+o+"': "+r+" ["+e+"]"))}}useStrictBehavior(e,r,n){var o=this.strict;if(typeof o=="function")try{o=o(e,r,n)}catch{o="error"}return!o||o==="ignore"?!1:o===!0||o==="error"?!0:o==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+o+"': "+r+" ["+e+"]")),!1)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var r=pc(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class xt{constructor(e,r,n){this.id=e,this.size=r,this.cramped=n}sup(){return ot[vc[this.id]]}sub(){return ot[gc[this.id]]}fracNum(){return ot[bc[this.id]]}fracDen(){return ot[yc[this.id]]}cramp(){return ot[wc[this.id]]}text(){return ot[kc[this.id]]}isTight(){return this.size>=2}}var N0=0,Yr=1,Xt=2,ht=3,br=4,tt=5,er=6,We=7,ot=[new xt(N0,0,!1),new xt(Yr,0,!0),new xt(Xt,1,!1),new xt(ht,1,!0),new xt(br,2,!1),new xt(tt,2,!0),new xt(er,3,!1),new xt(We,3,!0)],vc=[br,tt,br,tt,er,We,er,We],gc=[tt,tt,tt,tt,We,We,We,We],bc=[Xt,ht,br,tt,er,We,er,We],yc=[ht,ht,tt,tt,We,We,We,We],wc=[Yr,Yr,ht,ht,tt,tt,We,We],kc=[N0,Yr,Xt,ht,Xt,ht,Xt,ht],fe={DISPLAY:ot[N0],TEXT:ot[Xt],SCRIPT:ot[br],SCRIPTSCRIPT:ot[er]},s0=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function xc(t){for(var e=0;e<s0.length;e++)for(var r=s0[e],n=0;n<r.blocks.length;n++){var o=r.blocks[n];if(t>=o[0]&&t<=o[1])return r.name}return null}var $r=[];s0.forEach(t=>t.blocks.forEach(e=>$r.push(...e)));function dl(t){for(var e=0;e<$r.length;e+=2)if(t>=$r[e]&&t<=$r[e+1])return!0;return!1}var Re=t=>t+" "+t,jt=80,Cc=function(e,r){return"M95,"+(622+e+r)+`
52
47
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
53
48
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
54
49
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -59,7 +54,7 @@ c5.3,-9.3,12,-14,20,-14
59
54
  H400000v`+(40+e)+`H845.2724
60
55
  s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
61
56
  c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
62
- M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},nm=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
57
+ M`+(834+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},Tc=function(e,r){return"M263,"+(601+e+r)+`c0.7,0,18,39.7,52,119
63
58
  c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
64
59
  c340,-704.7,510.7,-1060.3,512,-1067
65
60
  l`+e/2.084+" -"+e+`
@@ -69,7 +64,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,
69
64
  c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
70
65
  s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
71
66
  c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
72
- M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},om=function(e,t){return"M983 "+(10+e+t)+`
67
+ M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},Ec=function(e,r){return"M983 "+(10+e+r)+`
73
68
  l`+e/3.13+" -"+e+`
74
69
  c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
75
70
  H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
@@ -78,7 +73,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
78
73
  c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
79
74
  c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
80
75
  c53.7,-170.3,84.5,-266.8,92.5,-289.5z
81
- M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},lm=function(e,t){return"M424,"+(2398+e+t)+`
76
+ M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},Mc=function(e,r){return"M424,"+(2398+e+r)+`
82
77
  c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
83
78
  c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
84
79
  s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
@@ -87,19 +82,19 @@ l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
87
82
  v`+(40+e)+`H1014.6
88
83
  s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
89
84
  c-2,6,-10,9,-24,9
90
- c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+t+`
91
- h400000v`+(40+e)+"h-400000z"},am=function(e,t){return"M473,"+(2713+e+t)+`
85
+ c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+r+`
86
+ h400000v`+(40+e)+"h-400000z"},Sc=function(e,r){return"M473,"+(2713+e+r)+`
92
87
  c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
93
88
  c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
94
89
  s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
95
90
  c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
96
91
  c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
97
92
  s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
98
- 606zM`+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"},im=function(e){var t=e/2;return"M400000 "+e+" H0 L"+t+" 0 l65 45 L145 "+(e-80)+" H400000z"},sm=function(e,t,n){var o=n-54-t-e;return"M702 "+(e+t)+"H400000"+(40+e)+`
93
+ 606zM`+(1001+e)+" "+r+"h400000v"+(40+e)+"H1017.7z"},Ac=function(e){var r=e/2;return"M400000 "+e+" H0 L"+r+" 0 l65 45 L145 "+(e-80)+" H400000z"},Bc=function(e,r,n){var o=n-54-r-e;return"M702 "+(e+r)+"H400000"+(40+e)+`
99
94
  H742v`+o+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
100
95
  h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
101
96
  c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
102
- 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},um=function(e,t,n){t=1e3*t;var o="";switch(e){case"sqrtMain":o=rm(t,Sr);break;case"sqrtSize1":o=nm(t,Sr);break;case"sqrtSize2":o=om(t,Sr);break;case"sqrtSize3":o=lm(t,Sr);break;case"sqrtSize4":o=am(t,Sr);break;case"sqrtTall":o=sm(t,Sr,n)}return o},cm=function(e,t){switch(e){case"⎜":return Ue("M291 0 H417 V"+t+" H291z");case"∣":return Ue("M145 0 H188 V"+t+" H145z");case"∥":return Ue("M145 0 H188 V"+t+" H145z")+Ue("M367 0 H410 V"+t+" H367z");case"⎟":return Ue("M457 0 H583 V"+t+" H457z");case"⎢":return Ue("M319 0 H403 V"+t+" H319z");case"⎥":return Ue("M263 0 H347 V"+t+" H263z");case"⎪":return Ue("M384 0 H504 V"+t+" H384z");case"⏐":return Ue("M312 0 H355 V"+t+" H312z");case"‖":return Ue("M257 0 H300 V"+t+" H257z")+Ue("M478 0 H521 V"+t+" H478z");default:return""}},R0={doubleleftarrow:`M262 157
97
+ 219 661 l218 661zM702 `+r+"H400000v"+(40+e)+"H742z"},Lc=function(e,r,n){r=1e3*r;var o="";switch(e){case"sqrtMain":o=Cc(r,jt);break;case"sqrtSize1":o=Tc(r,jt);break;case"sqrtSize2":o=Ec(r,jt);break;case"sqrtSize3":o=Mc(r,jt);break;case"sqrtSize4":o=Sc(r,jt);break;case"sqrtTall":o=Bc(r,jt,n)}return o},Nc=function(e,r){switch(e){case"⎜":return Re("M291 0 H417 V"+r+" H291z");case"∣":return Re("M145 0 H188 V"+r+" H145z");case"∥":return Re("M145 0 H188 V"+r+" H145z")+Re("M367 0 H410 V"+r+" H367z");case"⎟":return Re("M457 0 H583 V"+r+" H457z");case"⎢":return Re("M319 0 H403 V"+r+" H319z");case"⎥":return Re("M263 0 H347 V"+r+" H263z");case"⎪":return Re("M384 0 H504 V"+r+" H384z");case"⏐":return Re("M312 0 H355 V"+r+" H312z");case"‖":return Re("M257 0 H300 V"+r+" H257z")+Re("M478 0 H521 V"+r+" H478z");default:return""}},Na={doubleleftarrow:`M262 157
103
98
  l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
104
99
  0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
105
100
  14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
@@ -145,10 +140,10 @@ m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9
145
140
  v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
146
141
  -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
147
142
  -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
148
- 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:Ue("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Ue("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Ue("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Ue("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
143
+ 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:Re("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Re("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Re("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Re("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
149
144
  -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
150
145
  c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
151
- 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:Ue("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:`M200428 334
146
+ 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:Re("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:`M200428 334
152
147
  c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
153
148
  -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
154
149
  311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
@@ -197,7 +192,7 @@ m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown
197
192
  m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
198
193
  15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
199
194
  -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
200
- 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:Ue("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Ue("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Ue("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
195
+ 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:Re("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Re("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Re("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
201
196
  1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
202
197
  -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
203
198
  -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
@@ -270,49 +265,49 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`
270
265
  c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
271
266
  -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
272
267
  c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
273
- M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},dm=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v1759 h347 v-84
274
- H403z M403 1759 V0 H319 V1759 v`+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v1759 H0 v84 H347z
275
- M347 1759 V0 H263 V1759 v`+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
276
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
277
- c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
278
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
279
- c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z
280
- M367 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
281
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
282
- c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+` v1715 h263 v84 H319z
283
- MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+` v1799 H0 v-84 H319z
284
- MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v602 h84z
285
- M403 1759 V0 H319 V1759 v`+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v602 h84z
286
- M347 1759 V0 h-84 V1759 v`+t+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
268
+ M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Ic=function(e,r){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 h347 v-84
269
+ H403z M403 1759 V0 H319 V1759 v`+r+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z
270
+ M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15
271
+ c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15
272
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+" v585 h43z";case"doublevert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15
273
+ c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15
274
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+` v585 h43z
275
+ M367 15 v585 v`+r+` v585 c2.667,10,9.667,15,21,15
276
+ c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15
277
+ c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+r+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+r+` v1715 h263 v84 H319z
278
+ MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+r+` v1799 H0 v-84 H319z
279
+ MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v602 h84z
280
+ M403 1759 V0 H319 V1759 v`+r+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v602 h84z
281
+ M347 1759 V0 h-84 V1759 v`+r+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
287
282
  c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
288
- -36,557 l0,`+(t+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
283
+ -36,557 l0,`+(r+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
289
284
  949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
290
285
  c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
291
286
  -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
292
- l0,-`+(t+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
287
+ l0,-`+(r+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
293
288
  -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
294
289
  63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
295
- c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(t+9)+`
290
+ c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(r+9)+`
296
291
  c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
297
292
  c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
298
293
  c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
299
294
  c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
300
- l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
301
- -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Fr{constructor(e){this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var Dl={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},fm={ex:!0,em:!0,mu:!0},Zs=function(e){return typeof e!="string"&&(e=e.unit),e in Dl||e in fm||e==="ex"},Ie=function(e,t){var n;if(e.unit in Dl)n=Dl[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")n=t.fontMetrics().cssEmPerMu;else{var o;if(t.style.isTight()?o=t.havingStyle(t.style.text()):o=t,e.unit==="ex")n=o.fontMetrics().xHeight;else if(e.unit==="em")n=o.fontMetrics().quad;else throw new _("Invalid unit: '"+e.unit+"'");o!==t&&(n*=o.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},Y=function(e){return+e.toFixed(4)+"em"},Yt=function(e){return e.filter(t=>t).join(" ")},eu=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var o=t.getColor();o&&(this.style.color=o)}},tu=function(e){var t=document.createElement(e);t.className=Yt(this.classes);for(var n of Object.keys(this.style))t.style[n]=this.style[n];for(var o of Object.keys(this.attributes))t.setAttribute(o,this.attributes[o]);for(var l=0;l<this.children.length;l++)t.appendChild(this.children[l].toNode());return t},mm=/[\s"'>/=\x00-\x1f]/,ru=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+Ye(Yt(this.classes))+'"');var n="";for(var o of Object.keys(this.style))n+=ua(o)+":"+this.style[o]+";";n&&(t+=' style="'+Ye(n)+'"');for(var l of Object.keys(this.attributes)){if(mm.test(l))throw new _("Invalid attribute name '"+l+"'");t+=" "+l+'="'+Ye(this.attributes[l])+'"'}t+=">";for(var i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+="</"+e+">",t};class $r{constructor(e,t,n,o){eu.call(this,e,n,o),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return tu.call(this,"span")}toMarkup(){return ru.call(this,"span")}}class po{constructor(e,t,n,o){eu.call(this,t,o),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return tu.call(this,"a")}toMarkup(){return ru.call(this,"a")}}class hm{constructor(e,t,n){this.alt=t,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t of Object.keys(this.style))e.style[t]=this.style[t];return e}toMarkup(){var e='<img src="'+Ye(this.src)+'"'+(' alt="'+Ye(this.alt)+'"'),t="";for(var n of Object.keys(this.style))t+=ua(n)+":"+this.style[n]+";";return t&&(e+=' style="'+Ye(t)+'"'),e+="'/>",e}}var pm={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class ut{constructor(e,t,n,o,l,i,s,u){this.text=e,this.height=t||0,this.depth=n||0,this.italic=o||0,this.skew=l||0,this.width=i||0,this.classes=s||[],this.style=u||{},this.maxFontSize=0;var d=tm(this.text.charCodeAt(0));d&&this.classes.push(d+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=pm[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=Y(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=Yt(this.classes));for(var n of Object.keys(this.style))t=t||document.createElement("span"),t.style[n]=this.style[n];return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=Ye(Yt(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+Y(this.italic)+";");for(var o of Object.keys(this.style))n+=ua(o)+":"+this.style[o]+";";n&&(e=!0,t+=' style="'+Ye(n)+'"');var l=Ye(this.text);return e?(t+=">",t+=l,t+="</span>",t):l}}class zt{constructor(e,t){this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);for(var o=0;o<this.children.length;o++)t.appendChild(this.children[o].toNode());return t}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t of Object.keys(this.attributes))e+=" "+t+'="'+Ye(this.attributes[t])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class Jt{constructor(e,t){this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",R0[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+Ye(this.alternate)+'"/>':'<path d="'+Ye(R0[this.pathName])+'"/>'}}class Ol{constructor(e){this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);return t}toMarkup(){var e="<line";for(var t of Object.keys(this.attributes))e+=" "+t+'="'+Ye(this.attributes[t])+'"';return e+="/>",e}}function gm(r){if(r instanceof ut)return r;throw new Error("Expected symbolNode but got "+String(r)+".")}function vm(r){if(r instanceof $r)return r;throw new Error("Expected span<HtmlDomNode> but got "+String(r)+".")}var bm=r=>r instanceof $r||r instanceof po||r instanceof Fr,wt={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Tn={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},P0={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function ym(r,e){wt[r]=e}function fa(r,e,t){if(!wt[e])throw new Error("Font metrics not found for font: "+e+".");var n=r.charCodeAt(0),o=wt[e][n];if(!o&&r[0]in P0&&(n=P0[r[0]].charCodeAt(0),o=wt[e][n]),!o&&t==="text"&&Qs(n)&&(o=wt[e][77]),o)return{depth:o[0],height:o[1],italic:o[2],skew:o[3],width:o[4]}}var Jo={};function wm(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Jo[e]){var t=Jo[e]={cssEmPerMu:Tn.quad[e]/18};for(var n in Tn)Tn.hasOwnProperty(n)&&(t[n]=Tn[n][e])}return Jo[e]}var km={bin:1,close:1,inner:1,open:1,punct:1,rel:1},xm={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Se={math:{},text:{}};function c(r,e,t,n,o,l){Se[r][o]={font:e,group:t,replace:n},l&&n&&(Se[r][n]=Se[r][o])}var f="math",F="text",g="main",x="ams",Ae="accent-token",Q="bin",tt="close",qr="inner",ie="mathord",Fe="op-token",ct="open",pn="punct",C="rel",Rt="spacing",S="textord";c(f,g,C,"≡","\\equiv",!0);c(f,g,C,"≺","\\prec",!0);c(f,g,C,"≻","\\succ",!0);c(f,g,C,"∼","\\sim",!0);c(f,g,C,"⊥","\\perp");c(f,g,C,"⪯","\\preceq",!0);c(f,g,C,"⪰","\\succeq",!0);c(f,g,C,"≃","\\simeq",!0);c(f,g,C,"∣","\\mid",!0);c(f,g,C,"≪","\\ll",!0);c(f,g,C,"≫","\\gg",!0);c(f,g,C,"≍","\\asymp",!0);c(f,g,C,"∥","\\parallel");c(f,g,C,"⋈","\\bowtie",!0);c(f,g,C,"⌣","\\smile",!0);c(f,g,C,"⊑","\\sqsubseteq",!0);c(f,g,C,"⊒","\\sqsupseteq",!0);c(f,g,C,"≐","\\doteq",!0);c(f,g,C,"⌢","\\frown",!0);c(f,g,C,"∋","\\ni",!0);c(f,g,C,"∝","\\propto",!0);c(f,g,C,"⊢","\\vdash",!0);c(f,g,C,"⊣","\\dashv",!0);c(f,g,C,"∋","\\owns");c(f,g,pn,".","\\ldotp");c(f,g,pn,"⋅","\\cdotp");c(f,g,pn,"⋅","·");c(F,g,S,"⋅","·");c(f,g,S,"#","\\#");c(F,g,S,"#","\\#");c(f,g,S,"&","\\&");c(F,g,S,"&","\\&");c(f,g,S,"ℵ","\\aleph",!0);c(f,g,S,"∀","\\forall",!0);c(f,g,S,"ℏ","\\hbar",!0);c(f,g,S,"∃","\\exists",!0);c(f,g,S,"∇","\\nabla",!0);c(f,g,S,"♭","\\flat",!0);c(f,g,S,"ℓ","\\ell",!0);c(f,g,S,"♮","\\natural",!0);c(f,g,S,"♣","\\clubsuit",!0);c(f,g,S,"℘","\\wp",!0);c(f,g,S,"♯","\\sharp",!0);c(f,g,S,"♢","\\diamondsuit",!0);c(f,g,S,"ℜ","\\Re",!0);c(f,g,S,"♡","\\heartsuit",!0);c(f,g,S,"ℑ","\\Im",!0);c(f,g,S,"♠","\\spadesuit",!0);c(f,g,S,"§","\\S",!0);c(F,g,S,"§","\\S");c(f,g,S,"¶","\\P",!0);c(F,g,S,"¶","\\P");c(f,g,S,"†","\\dag");c(F,g,S,"†","\\dag");c(F,g,S,"†","\\textdagger");c(f,g,S,"‡","\\ddag");c(F,g,S,"‡","\\ddag");c(F,g,S,"‡","\\textdaggerdbl");c(f,g,tt,"⎱","\\rmoustache",!0);c(f,g,ct,"⎰","\\lmoustache",!0);c(f,g,tt,"⟯","\\rgroup",!0);c(f,g,ct,"⟮","\\lgroup",!0);c(f,g,Q,"∓","\\mp",!0);c(f,g,Q,"⊖","\\ominus",!0);c(f,g,Q,"⊎","\\uplus",!0);c(f,g,Q,"⊓","\\sqcap",!0);c(f,g,Q,"∗","\\ast");c(f,g,Q,"⊔","\\sqcup",!0);c(f,g,Q,"◯","\\bigcirc",!0);c(f,g,Q,"∙","\\bullet",!0);c(f,g,Q,"‡","\\ddagger");c(f,g,Q,"≀","\\wr",!0);c(f,g,Q,"⨿","\\amalg");c(f,g,Q,"&","\\And");c(f,g,C,"⟵","\\longleftarrow",!0);c(f,g,C,"⇐","\\Leftarrow",!0);c(f,g,C,"⟸","\\Longleftarrow",!0);c(f,g,C,"⟶","\\longrightarrow",!0);c(f,g,C,"⇒","\\Rightarrow",!0);c(f,g,C,"⟹","\\Longrightarrow",!0);c(f,g,C,"↔","\\leftrightarrow",!0);c(f,g,C,"⟷","\\longleftrightarrow",!0);c(f,g,C,"⇔","\\Leftrightarrow",!0);c(f,g,C,"⟺","\\Longleftrightarrow",!0);c(f,g,C,"↦","\\mapsto",!0);c(f,g,C,"⟼","\\longmapsto",!0);c(f,g,C,"↗","\\nearrow",!0);c(f,g,C,"↩","\\hookleftarrow",!0);c(f,g,C,"↪","\\hookrightarrow",!0);c(f,g,C,"↘","\\searrow",!0);c(f,g,C,"↼","\\leftharpoonup",!0);c(f,g,C,"⇀","\\rightharpoonup",!0);c(f,g,C,"↙","\\swarrow",!0);c(f,g,C,"↽","\\leftharpoondown",!0);c(f,g,C,"⇁","\\rightharpoondown",!0);c(f,g,C,"↖","\\nwarrow",!0);c(f,g,C,"⇌","\\rightleftharpoons",!0);c(f,x,C,"≮","\\nless",!0);c(f,x,C,"","\\@nleqslant");c(f,x,C,"","\\@nleqq");c(f,x,C,"⪇","\\lneq",!0);c(f,x,C,"≨","\\lneqq",!0);c(f,x,C,"","\\@lvertneqq");c(f,x,C,"⋦","\\lnsim",!0);c(f,x,C,"⪉","\\lnapprox",!0);c(f,x,C,"⊀","\\nprec",!0);c(f,x,C,"⋠","\\npreceq",!0);c(f,x,C,"⋨","\\precnsim",!0);c(f,x,C,"⪹","\\precnapprox",!0);c(f,x,C,"≁","\\nsim",!0);c(f,x,C,"","\\@nshortmid");c(f,x,C,"∤","\\nmid",!0);c(f,x,C,"⊬","\\nvdash",!0);c(f,x,C,"⊭","\\nvDash",!0);c(f,x,C,"⋪","\\ntriangleleft");c(f,x,C,"⋬","\\ntrianglelefteq",!0);c(f,x,C,"⊊","\\subsetneq",!0);c(f,x,C,"","\\@varsubsetneq");c(f,x,C,"⫋","\\subsetneqq",!0);c(f,x,C,"","\\@varsubsetneqq");c(f,x,C,"≯","\\ngtr",!0);c(f,x,C,"","\\@ngeqslant");c(f,x,C,"","\\@ngeqq");c(f,x,C,"⪈","\\gneq",!0);c(f,x,C,"≩","\\gneqq",!0);c(f,x,C,"","\\@gvertneqq");c(f,x,C,"⋧","\\gnsim",!0);c(f,x,C,"⪊","\\gnapprox",!0);c(f,x,C,"⊁","\\nsucc",!0);c(f,x,C,"⋡","\\nsucceq",!0);c(f,x,C,"⋩","\\succnsim",!0);c(f,x,C,"⪺","\\succnapprox",!0);c(f,x,C,"≆","\\ncong",!0);c(f,x,C,"","\\@nshortparallel");c(f,x,C,"∦","\\nparallel",!0);c(f,x,C,"⊯","\\nVDash",!0);c(f,x,C,"⋫","\\ntriangleright");c(f,x,C,"⋭","\\ntrianglerighteq",!0);c(f,x,C,"","\\@nsupseteqq");c(f,x,C,"⊋","\\supsetneq",!0);c(f,x,C,"","\\@varsupsetneq");c(f,x,C,"⫌","\\supsetneqq",!0);c(f,x,C,"","\\@varsupsetneqq");c(f,x,C,"⊮","\\nVdash",!0);c(f,x,C,"⪵","\\precneqq",!0);c(f,x,C,"⪶","\\succneqq",!0);c(f,x,C,"","\\@nsubseteqq");c(f,x,Q,"⊴","\\unlhd");c(f,x,Q,"⊵","\\unrhd");c(f,x,C,"↚","\\nleftarrow",!0);c(f,x,C,"↛","\\nrightarrow",!0);c(f,x,C,"⇍","\\nLeftarrow",!0);c(f,x,C,"⇏","\\nRightarrow",!0);c(f,x,C,"↮","\\nleftrightarrow",!0);c(f,x,C,"⇎","\\nLeftrightarrow",!0);c(f,x,C,"△","\\vartriangle");c(f,x,S,"ℏ","\\hslash");c(f,x,S,"▽","\\triangledown");c(f,x,S,"◊","\\lozenge");c(f,x,S,"Ⓢ","\\circledS");c(f,x,S,"®","\\circledR");c(F,x,S,"®","\\circledR");c(f,x,S,"∡","\\measuredangle",!0);c(f,x,S,"∄","\\nexists");c(f,x,S,"℧","\\mho");c(f,x,S,"Ⅎ","\\Finv",!0);c(f,x,S,"⅁","\\Game",!0);c(f,x,S,"‵","\\backprime");c(f,x,S,"▲","\\blacktriangle");c(f,x,S,"▼","\\blacktriangledown");c(f,x,S,"■","\\blacksquare");c(f,x,S,"⧫","\\blacklozenge");c(f,x,S,"★","\\bigstar");c(f,x,S,"∢","\\sphericalangle",!0);c(f,x,S,"∁","\\complement",!0);c(f,x,S,"ð","\\eth",!0);c(F,g,S,"ð","ð");c(f,x,S,"╱","\\diagup");c(f,x,S,"╲","\\diagdown");c(f,x,S,"□","\\square");c(f,x,S,"□","\\Box");c(f,x,S,"◊","\\Diamond");c(f,x,S,"¥","\\yen",!0);c(F,x,S,"¥","\\yen",!0);c(f,x,S,"✓","\\checkmark",!0);c(F,x,S,"✓","\\checkmark");c(f,x,S,"ℶ","\\beth",!0);c(f,x,S,"ℸ","\\daleth",!0);c(f,x,S,"ℷ","\\gimel",!0);c(f,x,S,"ϝ","\\digamma",!0);c(f,x,S,"ϰ","\\varkappa");c(f,x,ct,"┌","\\@ulcorner",!0);c(f,x,tt,"┐","\\@urcorner",!0);c(f,x,ct,"└","\\@llcorner",!0);c(f,x,tt,"┘","\\@lrcorner",!0);c(f,x,C,"≦","\\leqq",!0);c(f,x,C,"⩽","\\leqslant",!0);c(f,x,C,"⪕","\\eqslantless",!0);c(f,x,C,"≲","\\lesssim",!0);c(f,x,C,"⪅","\\lessapprox",!0);c(f,x,C,"≊","\\approxeq",!0);c(f,x,Q,"⋖","\\lessdot");c(f,x,C,"⋘","\\lll",!0);c(f,x,C,"≶","\\lessgtr",!0);c(f,x,C,"⋚","\\lesseqgtr",!0);c(f,x,C,"⪋","\\lesseqqgtr",!0);c(f,x,C,"≑","\\doteqdot");c(f,x,C,"≓","\\risingdotseq",!0);c(f,x,C,"≒","\\fallingdotseq",!0);c(f,x,C,"∽","\\backsim",!0);c(f,x,C,"⋍","\\backsimeq",!0);c(f,x,C,"⫅","\\subseteqq",!0);c(f,x,C,"⋐","\\Subset",!0);c(f,x,C,"⊏","\\sqsubset",!0);c(f,x,C,"≼","\\preccurlyeq",!0);c(f,x,C,"⋞","\\curlyeqprec",!0);c(f,x,C,"≾","\\precsim",!0);c(f,x,C,"⪷","\\precapprox",!0);c(f,x,C,"⊲","\\vartriangleleft");c(f,x,C,"⊴","\\trianglelefteq");c(f,x,C,"⊨","\\vDash",!0);c(f,x,C,"⊪","\\Vvdash",!0);c(f,x,C,"⌣","\\smallsmile");c(f,x,C,"⌢","\\smallfrown");c(f,x,C,"≏","\\bumpeq",!0);c(f,x,C,"≎","\\Bumpeq",!0);c(f,x,C,"≧","\\geqq",!0);c(f,x,C,"⩾","\\geqslant",!0);c(f,x,C,"⪖","\\eqslantgtr",!0);c(f,x,C,"≳","\\gtrsim",!0);c(f,x,C,"⪆","\\gtrapprox",!0);c(f,x,Q,"⋗","\\gtrdot");c(f,x,C,"⋙","\\ggg",!0);c(f,x,C,"≷","\\gtrless",!0);c(f,x,C,"⋛","\\gtreqless",!0);c(f,x,C,"⪌","\\gtreqqless",!0);c(f,x,C,"≖","\\eqcirc",!0);c(f,x,C,"≗","\\circeq",!0);c(f,x,C,"≜","\\triangleq",!0);c(f,x,C,"∼","\\thicksim");c(f,x,C,"≈","\\thickapprox");c(f,x,C,"⫆","\\supseteqq",!0);c(f,x,C,"⋑","\\Supset",!0);c(f,x,C,"⊐","\\sqsupset",!0);c(f,x,C,"≽","\\succcurlyeq",!0);c(f,x,C,"⋟","\\curlyeqsucc",!0);c(f,x,C,"≿","\\succsim",!0);c(f,x,C,"⪸","\\succapprox",!0);c(f,x,C,"⊳","\\vartriangleright");c(f,x,C,"⊵","\\trianglerighteq");c(f,x,C,"⊩","\\Vdash",!0);c(f,x,C,"∣","\\shortmid");c(f,x,C,"∥","\\shortparallel");c(f,x,C,"≬","\\between",!0);c(f,x,C,"⋔","\\pitchfork",!0);c(f,x,C,"∝","\\varpropto");c(f,x,C,"◀","\\blacktriangleleft");c(f,x,C,"∴","\\therefore",!0);c(f,x,C,"∍","\\backepsilon");c(f,x,C,"▶","\\blacktriangleright");c(f,x,C,"∵","\\because",!0);c(f,x,C,"⋘","\\llless");c(f,x,C,"⋙","\\gggtr");c(f,x,Q,"⊲","\\lhd");c(f,x,Q,"⊳","\\rhd");c(f,x,C,"≂","\\eqsim",!0);c(f,g,C,"⋈","\\Join");c(f,x,C,"≑","\\Doteq",!0);c(f,x,Q,"∔","\\dotplus",!0);c(f,x,Q,"∖","\\smallsetminus");c(f,x,Q,"⋒","\\Cap",!0);c(f,x,Q,"⋓","\\Cup",!0);c(f,x,Q,"⩞","\\doublebarwedge",!0);c(f,x,Q,"⊟","\\boxminus",!0);c(f,x,Q,"⊞","\\boxplus",!0);c(f,x,Q,"⋇","\\divideontimes",!0);c(f,x,Q,"⋉","\\ltimes",!0);c(f,x,Q,"⋊","\\rtimes",!0);c(f,x,Q,"⋋","\\leftthreetimes",!0);c(f,x,Q,"⋌","\\rightthreetimes",!0);c(f,x,Q,"⋏","\\curlywedge",!0);c(f,x,Q,"⋎","\\curlyvee",!0);c(f,x,Q,"⊝","\\circleddash",!0);c(f,x,Q,"⊛","\\circledast",!0);c(f,x,Q,"⋅","\\centerdot");c(f,x,Q,"⊺","\\intercal",!0);c(f,x,Q,"⋒","\\doublecap");c(f,x,Q,"⋓","\\doublecup");c(f,x,Q,"⊠","\\boxtimes",!0);c(f,x,C,"⇢","\\dashrightarrow",!0);c(f,x,C,"⇠","\\dashleftarrow",!0);c(f,x,C,"⇇","\\leftleftarrows",!0);c(f,x,C,"⇆","\\leftrightarrows",!0);c(f,x,C,"⇚","\\Lleftarrow",!0);c(f,x,C,"↞","\\twoheadleftarrow",!0);c(f,x,C,"↢","\\leftarrowtail",!0);c(f,x,C,"↫","\\looparrowleft",!0);c(f,x,C,"⇋","\\leftrightharpoons",!0);c(f,x,C,"↶","\\curvearrowleft",!0);c(f,x,C,"↺","\\circlearrowleft",!0);c(f,x,C,"↰","\\Lsh",!0);c(f,x,C,"⇈","\\upuparrows",!0);c(f,x,C,"↿","\\upharpoonleft",!0);c(f,x,C,"⇃","\\downharpoonleft",!0);c(f,g,C,"⊶","\\origof",!0);c(f,g,C,"⊷","\\imageof",!0);c(f,x,C,"⊸","\\multimap",!0);c(f,x,C,"↭","\\leftrightsquigarrow",!0);c(f,x,C,"⇉","\\rightrightarrows",!0);c(f,x,C,"⇄","\\rightleftarrows",!0);c(f,x,C,"↠","\\twoheadrightarrow",!0);c(f,x,C,"↣","\\rightarrowtail",!0);c(f,x,C,"↬","\\looparrowright",!0);c(f,x,C,"↷","\\curvearrowright",!0);c(f,x,C,"↻","\\circlearrowright",!0);c(f,x,C,"↱","\\Rsh",!0);c(f,x,C,"⇊","\\downdownarrows",!0);c(f,x,C,"↾","\\upharpoonright",!0);c(f,x,C,"⇂","\\downharpoonright",!0);c(f,x,C,"⇝","\\rightsquigarrow",!0);c(f,x,C,"⇝","\\leadsto");c(f,x,C,"⇛","\\Rrightarrow",!0);c(f,x,C,"↾","\\restriction");c(f,g,S,"‘","`");c(f,g,S,"$","\\$");c(F,g,S,"$","\\$");c(F,g,S,"$","\\textdollar");c(f,g,S,"%","\\%");c(F,g,S,"%","\\%");c(f,g,S,"_","\\_");c(F,g,S,"_","\\_");c(F,g,S,"_","\\textunderscore");c(f,g,S,"∠","\\angle",!0);c(f,g,S,"∞","\\infty",!0);c(f,g,S,"′","\\prime");c(f,g,S,"△","\\triangle");c(f,g,S,"Γ","\\Gamma",!0);c(f,g,S,"Δ","\\Delta",!0);c(f,g,S,"Θ","\\Theta",!0);c(f,g,S,"Λ","\\Lambda",!0);c(f,g,S,"Ξ","\\Xi",!0);c(f,g,S,"Π","\\Pi",!0);c(f,g,S,"Σ","\\Sigma",!0);c(f,g,S,"Υ","\\Upsilon",!0);c(f,g,S,"Φ","\\Phi",!0);c(f,g,S,"Ψ","\\Psi",!0);c(f,g,S,"Ω","\\Omega",!0);c(f,g,S,"A","Α");c(f,g,S,"B","Β");c(f,g,S,"E","Ε");c(f,g,S,"Z","Ζ");c(f,g,S,"H","Η");c(f,g,S,"I","Ι");c(f,g,S,"K","Κ");c(f,g,S,"M","Μ");c(f,g,S,"N","Ν");c(f,g,S,"O","Ο");c(f,g,S,"P","Ρ");c(f,g,S,"T","Τ");c(f,g,S,"X","Χ");c(f,g,S,"¬","\\neg",!0);c(f,g,S,"¬","\\lnot");c(f,g,S,"⊤","\\top");c(f,g,S,"⊥","\\bot");c(f,g,S,"∅","\\emptyset");c(f,x,S,"∅","\\varnothing");c(f,g,ie,"α","\\alpha",!0);c(f,g,ie,"β","\\beta",!0);c(f,g,ie,"γ","\\gamma",!0);c(f,g,ie,"δ","\\delta",!0);c(f,g,ie,"ϵ","\\epsilon",!0);c(f,g,ie,"ζ","\\zeta",!0);c(f,g,ie,"η","\\eta",!0);c(f,g,ie,"θ","\\theta",!0);c(f,g,ie,"ι","\\iota",!0);c(f,g,ie,"κ","\\kappa",!0);c(f,g,ie,"λ","\\lambda",!0);c(f,g,ie,"μ","\\mu",!0);c(f,g,ie,"ν","\\nu",!0);c(f,g,ie,"ξ","\\xi",!0);c(f,g,ie,"ο","\\omicron",!0);c(f,g,ie,"π","\\pi",!0);c(f,g,ie,"ρ","\\rho",!0);c(f,g,ie,"σ","\\sigma",!0);c(f,g,ie,"τ","\\tau",!0);c(f,g,ie,"υ","\\upsilon",!0);c(f,g,ie,"ϕ","\\phi",!0);c(f,g,ie,"χ","\\chi",!0);c(f,g,ie,"ψ","\\psi",!0);c(f,g,ie,"ω","\\omega",!0);c(f,g,ie,"ε","\\varepsilon",!0);c(f,g,ie,"ϑ","\\vartheta",!0);c(f,g,ie,"ϖ","\\varpi",!0);c(f,g,ie,"ϱ","\\varrho",!0);c(f,g,ie,"ς","\\varsigma",!0);c(f,g,ie,"φ","\\varphi",!0);c(f,g,Q,"∗","*",!0);c(f,g,Q,"+","+");c(f,g,Q,"−","-",!0);c(f,g,Q,"⋅","\\cdot",!0);c(f,g,Q,"∘","\\circ",!0);c(f,g,Q,"÷","\\div",!0);c(f,g,Q,"±","\\pm",!0);c(f,g,Q,"×","\\times",!0);c(f,g,Q,"∩","\\cap",!0);c(f,g,Q,"∪","\\cup",!0);c(f,g,Q,"∖","\\setminus",!0);c(f,g,Q,"∧","\\land");c(f,g,Q,"∨","\\lor");c(f,g,Q,"∧","\\wedge",!0);c(f,g,Q,"∨","\\vee",!0);c(f,g,S,"√","\\surd");c(f,g,ct,"⟨","\\langle",!0);c(f,g,ct,"∣","\\lvert");c(f,g,ct,"∥","\\lVert");c(f,g,tt,"?","?");c(f,g,tt,"!","!");c(f,g,tt,"⟩","\\rangle",!0);c(f,g,tt,"∣","\\rvert");c(f,g,tt,"∥","\\rVert");c(f,g,C,"=","=");c(f,g,C,":",":");c(f,g,C,"≈","\\approx",!0);c(f,g,C,"≅","\\cong",!0);c(f,g,C,"≥","\\ge");c(f,g,C,"≥","\\geq",!0);c(f,g,C,"←","\\gets");c(f,g,C,">","\\gt",!0);c(f,g,C,"∈","\\in",!0);c(f,g,C,"","\\@not");c(f,g,C,"⊂","\\subset",!0);c(f,g,C,"⊃","\\supset",!0);c(f,g,C,"⊆","\\subseteq",!0);c(f,g,C,"⊇","\\supseteq",!0);c(f,x,C,"⊈","\\nsubseteq",!0);c(f,x,C,"⊉","\\nsupseteq",!0);c(f,g,C,"⊨","\\models");c(f,g,C,"←","\\leftarrow",!0);c(f,g,C,"≤","\\le");c(f,g,C,"≤","\\leq",!0);c(f,g,C,"<","\\lt",!0);c(f,g,C,"→","\\rightarrow",!0);c(f,g,C,"→","\\to");c(f,x,C,"≱","\\ngeq",!0);c(f,x,C,"≰","\\nleq",!0);c(f,g,Rt," ","\\ ");c(f,g,Rt," ","\\space");c(f,g,Rt," ","\\nobreakspace");c(F,g,Rt," ","\\ ");c(F,g,Rt," "," ");c(F,g,Rt," ","\\space");c(F,g,Rt," ","\\nobreakspace");c(f,g,Rt,null,"\\nobreak");c(f,g,Rt,null,"\\allowbreak");c(f,g,pn,",",",");c(f,g,pn,";",";");c(f,x,Q,"⊼","\\barwedge",!0);c(f,x,Q,"⊻","\\veebar",!0);c(f,g,Q,"⊙","\\odot",!0);c(f,g,Q,"⊕","\\oplus",!0);c(f,g,Q,"⊗","\\otimes",!0);c(f,g,S,"∂","\\partial",!0);c(f,g,Q,"⊘","\\oslash",!0);c(f,x,Q,"⊚","\\circledcirc",!0);c(f,x,Q,"⊡","\\boxdot",!0);c(f,g,Q,"△","\\bigtriangleup");c(f,g,Q,"▽","\\bigtriangledown");c(f,g,Q,"†","\\dagger");c(f,g,Q,"⋄","\\diamond");c(f,g,Q,"⋆","\\star");c(f,g,Q,"◃","\\triangleleft");c(f,g,Q,"▹","\\triangleright");c(f,g,ct,"{","\\{");c(F,g,S,"{","\\{");c(F,g,S,"{","\\textbraceleft");c(f,g,tt,"}","\\}");c(F,g,S,"}","\\}");c(F,g,S,"}","\\textbraceright");c(f,g,ct,"{","\\lbrace");c(f,g,tt,"}","\\rbrace");c(f,g,ct,"[","\\lbrack",!0);c(F,g,S,"[","\\lbrack",!0);c(f,g,tt,"]","\\rbrack",!0);c(F,g,S,"]","\\rbrack",!0);c(f,g,ct,"(","\\lparen",!0);c(f,g,tt,")","\\rparen",!0);c(F,g,S,"<","\\textless",!0);c(F,g,S,">","\\textgreater",!0);c(f,g,ct,"⌊","\\lfloor",!0);c(f,g,tt,"⌋","\\rfloor",!0);c(f,g,ct,"⌈","\\lceil",!0);c(f,g,tt,"⌉","\\rceil",!0);c(f,g,S,"\\","\\backslash");c(f,g,S,"∣","|");c(f,g,S,"∣","\\vert");c(F,g,S,"|","\\textbar",!0);c(f,g,S,"∥","\\|");c(f,g,S,"∥","\\Vert");c(F,g,S,"∥","\\textbardbl");c(F,g,S,"~","\\textasciitilde");c(F,g,S,"\\","\\textbackslash");c(F,g,S,"^","\\textasciicircum");c(f,g,C,"↑","\\uparrow",!0);c(f,g,C,"⇑","\\Uparrow",!0);c(f,g,C,"↓","\\downarrow",!0);c(f,g,C,"⇓","\\Downarrow",!0);c(f,g,C,"↕","\\updownarrow",!0);c(f,g,C,"⇕","\\Updownarrow",!0);c(f,g,Fe,"∐","\\coprod");c(f,g,Fe,"⋁","\\bigvee");c(f,g,Fe,"⋀","\\bigwedge");c(f,g,Fe,"⨄","\\biguplus");c(f,g,Fe,"⋂","\\bigcap");c(f,g,Fe,"⋃","\\bigcup");c(f,g,Fe,"∫","\\int");c(f,g,Fe,"∫","\\intop");c(f,g,Fe,"∬","\\iint");c(f,g,Fe,"∭","\\iiint");c(f,g,Fe,"∏","\\prod");c(f,g,Fe,"∑","\\sum");c(f,g,Fe,"⨂","\\bigotimes");c(f,g,Fe,"⨁","\\bigoplus");c(f,g,Fe,"⨀","\\bigodot");c(f,g,Fe,"∮","\\oint");c(f,g,Fe,"∯","\\oiint");c(f,g,Fe,"∰","\\oiiint");c(f,g,Fe,"⨆","\\bigsqcup");c(f,g,Fe,"∫","\\smallint");c(F,g,qr,"…","\\textellipsis");c(f,g,qr,"…","\\mathellipsis");c(F,g,qr,"…","\\ldots",!0);c(f,g,qr,"…","\\ldots",!0);c(f,g,qr,"⋯","\\@cdots",!0);c(f,g,qr,"⋱","\\ddots",!0);c(f,g,S,"⋮","\\varvdots");c(F,g,S,"⋮","\\varvdots");c(f,g,Ae,"ˊ","\\acute");c(f,g,Ae,"ˋ","\\grave");c(f,g,Ae,"¨","\\ddot");c(f,g,Ae,"~","\\tilde");c(f,g,Ae,"ˉ","\\bar");c(f,g,Ae,"˘","\\breve");c(f,g,Ae,"ˇ","\\check");c(f,g,Ae,"^","\\hat");c(f,g,Ae,"⃗","\\vec");c(f,g,Ae,"˙","\\dot");c(f,g,Ae,"˚","\\mathring");c(f,g,ie,"","\\@imath");c(f,g,ie,"","\\@jmath");c(f,g,S,"ı","ı");c(f,g,S,"ȷ","ȷ");c(F,g,S,"ı","\\i",!0);c(F,g,S,"ȷ","\\j",!0);c(F,g,S,"ß","\\ss",!0);c(F,g,S,"æ","\\ae",!0);c(F,g,S,"œ","\\oe",!0);c(F,g,S,"ø","\\o",!0);c(F,g,S,"Æ","\\AE",!0);c(F,g,S,"Œ","\\OE",!0);c(F,g,S,"Ø","\\O",!0);c(F,g,Ae,"ˊ","\\'");c(F,g,Ae,"ˋ","\\`");c(F,g,Ae,"ˆ","\\^");c(F,g,Ae,"˜","\\~");c(F,g,Ae,"ˉ","\\=");c(F,g,Ae,"˘","\\u");c(F,g,Ae,"˙","\\.");c(F,g,Ae,"¸","\\c");c(F,g,Ae,"˚","\\r");c(F,g,Ae,"ˇ","\\v");c(F,g,Ae,"¨",'\\"');c(F,g,Ae,"˝","\\H");c(F,g,Ae,"◯","\\textcircled");var nu={"--":!0,"---":!0,"``":!0,"''":!0};c(F,g,S,"–","--",!0);c(F,g,S,"–","\\textendash");c(F,g,S,"—","---",!0);c(F,g,S,"—","\\textemdash");c(F,g,S,"‘","`",!0);c(F,g,S,"‘","\\textquoteleft");c(F,g,S,"’","'",!0);c(F,g,S,"’","\\textquoteright");c(F,g,S,"“","``",!0);c(F,g,S,"“","\\textquotedblleft");c(F,g,S,"”","''",!0);c(F,g,S,"”","\\textquotedblright");c(f,g,S,"°","\\degree",!0);c(F,g,S,"°","\\degree");c(F,g,S,"°","\\textdegree",!0);c(f,g,S,"£","\\pounds");c(f,g,S,"£","\\mathsterling",!0);c(F,g,S,"£","\\pounds");c(F,g,S,"£","\\textsterling",!0);c(f,x,S,"✠","\\maltese");c(F,x,S,"✠","\\maltese");var H0='0123456789/@."';for(var Xo=0;Xo<H0.length;Xo++){var V0=H0.charAt(Xo);c(f,g,S,V0,V0)}var F0='0123456789!@*()-=+";:?/.,';for(var jo=0;jo<F0.length;jo++){var $0=F0.charAt(jo);c(F,g,S,$0,$0)}var Qn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var Qo=0;Qo<Qn.length;Qo++){var En=Qn.charAt(Qo);c(f,g,ie,En,En),c(F,g,S,En,En)}c(f,x,S,"C","ℂ");c(F,x,S,"C","ℂ");c(f,x,S,"H","ℍ");c(F,x,S,"H","ℍ");c(f,x,S,"N","ℕ");c(F,x,S,"N","ℕ");c(f,x,S,"P","ℙ");c(F,x,S,"P","ℙ");c(f,x,S,"Q","ℚ");c(F,x,S,"Q","ℚ");c(f,x,S,"R","ℝ");c(F,x,S,"R","ℝ");c(f,x,S,"Z","ℤ");c(F,x,S,"Z","ℤ");c(f,g,ie,"h","ℎ");c(F,g,ie,"h","ℎ");var de="";for(var je=0;je<Qn.length;je++){var De=Qn.charAt(je);de=String.fromCharCode(55349,56320+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56372+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56424+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56580+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56684+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56736+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56788+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56840+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56944+je),c(f,g,ie,De,de),c(F,g,S,De,de),je<26&&(de=String.fromCharCode(55349,56632+je),c(f,g,ie,De,de),c(F,g,S,De,de),de=String.fromCharCode(55349,56476+je),c(f,g,ie,De,de),c(F,g,S,De,de))}de="𝕜";c(f,g,ie,"k",de);c(F,g,S,"k",de);for(var rr=0;rr<10;rr++){var $t=rr.toString();de=String.fromCharCode(55349,57294+rr),c(f,g,ie,$t,de),c(F,g,S,$t,de),de=String.fromCharCode(55349,57314+rr),c(f,g,ie,$t,de),c(F,g,S,$t,de),de=String.fromCharCode(55349,57324+rr),c(f,g,ie,$t,de),c(F,g,S,$t,de),de=String.fromCharCode(55349,57334+rr),c(f,g,ie,$t,de),c(F,g,S,$t,de)}var Rl="ÐÞþ";for(var Zo=0;Zo<Rl.length;Zo++){var Sn=Rl.charAt(Zo);c(f,g,ie,Sn,Sn),c(F,g,S,Sn,Sn)}var Mn=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],q0=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],Cm=(r,e)=>{var t=r.charCodeAt(0),n=r.charCodeAt(1),o=(t-55296)*1024+(n-56320)+65536,l=e==="math"?0:1;if(119808<=o&&o<120484){var i=Math.floor((o-119808)/26);return[Mn[i][2],Mn[i][l]]}else if(120782<=o&&o<=120831){var s=Math.floor((o-120782)/10);return[q0[s][2],q0[s][l]]}else{if(o===120485||o===120486)return[Mn[0][2],Mn[0][l]];if(120486<o&&o<120782)return["",""];throw new _("Unsupported character: "+r)}},go=function(e,t,n){if(Se[n][e]){var o=Se[n][e].replace;o&&(e=o)}return{value:e,metrics:fa(e,t,n)}},Ze=function(e,t,n,o,l){var i=go(e,t,n),s=i.metrics;e=i.value;var u;if(s){var d=s.italic;(n==="text"||o&&o.font==="mathit")&&(d=0),u=new ut(e,s.height,s.depth,d,s.skew,s.width,l)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+n+"'")),u=new ut(e,0,0,0,0,0,l);if(o){u.maxFontSize=o.sizeMultiplier,o.style.isTight()&&u.classes.push("mtight");var m=o.getColor();m&&(u.style.color=m)}return u},ma=function(e,t,n,o){return o===void 0&&(o=[]),n.font==="boldsymbol"&&go(e,"Main-Bold",t).metrics?Ze(e,"Main-Bold",t,n,o.concat(["mathbf"])):e==="\\"||Se[t][e].font==="main"?Ze(e,"Main-Regular",t,n,o):Ze(e,"AMS-Regular",t,n,o.concat(["amsrm"]))},Tm=function(e,t,n,o,l){return l!=="textord"&&go(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},vo=function(e,t,n){var o=e.mode,l=e.text,i=["mord"],s=o==="math"||o==="text"&&t.font,u=s?t.font:t.fontFamily,d="",m="";if(l.charCodeAt(0)===55349&&([d,m]=Cm(l,o)),d.length>0)return Ze(l,d,o,t,i.concat(m));if(u){var h,p;if(u==="boldsymbol"){var v=Tm(l,o,t,i,n);h=v.fontName,p=[v.fontClass]}else s?(h=Pl[u].fontName,p=[u]):(h=An(u,t.fontWeight,t.fontShape),p=[u,t.fontWeight,t.fontShape]);if(go(l,h,o).metrics)return Ze(l,h,o,t,i.concat(p));if(nu.hasOwnProperty(l)&&h.slice(0,10)==="Typewriter"){for(var b=[],w=0;w<l.length;w++)b.push(Ze(l[w],h,o,t,i.concat(p)));return Pt(b)}}if(n==="mathord")return Ze(l,"Math-Italic",o,t,i.concat(["mathnormal"]));if(n==="textord"){var k=Se[o][l]&&Se[o][l].font;if(k==="ams"){var T=An("amsrm",t.fontWeight,t.fontShape);return Ze(l,T,o,t,i.concat("amsrm",t.fontWeight,t.fontShape))}else if(k==="main"||!k){var E=An("textrm",t.fontWeight,t.fontShape);return Ze(l,E,o,t,i.concat(t.fontWeight,t.fontShape))}else{var M=An(k,t.fontWeight,t.fontShape);return Ze(l,M,o,t,i.concat(M,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},Em=(r,e)=>{if(Yt(r.classes)!==Yt(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize||r.italic!==0&&r.hasClass("mathnormal"))return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var n of Object.keys(r.style))if(r.style[n]!==e.style[n])return!1;for(var o of Object.keys(e.style))if(r.style[o]!==e.style[o])return!1;return!0},ou=r=>{for(var e=0;e<r.length-1;e++){var t=r[e],n=r[e+1];t instanceof ut&&n instanceof ut&&Em(t,n)&&(t.text+=n.text,t.height=Math.max(t.height,n.height),t.depth=Math.max(t.depth,n.depth),t.italic=n.italic,r.splice(e+1,1),e--)}return r},ha=function(e){for(var t=0,n=0,o=0,l=0;l<e.children.length;l++){var i=e.children[l];i.height>t&&(t=i.height),i.depth>n&&(n=i.depth),i.maxFontSize>o&&(o=i.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=o},U=function(e,t,n,o){var l=new $r(e,t,n,o);return ha(l),l},Xt=(r,e,t,n)=>new $r(r,e,t,n),Rr=function(e,t,n){var o=U([e],[],t);return o.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),o.style.borderBottomWidth=Y(o.height),o.maxFontSize=1,o},Sm=function(e,t,n,o){var l=new po(e,t,n,o);return ha(l),l},Pt=function(e){var t=new Fr(e);return ha(t),t},Pr=function(e,t){return e instanceof Fr?U([],[e],t):e},Mm=function(e){if(e.positionType==="individualShift"){for(var t=e.children,n=[t[0]],o=-t[0].shift-t[0].elem.depth,l=o,i=1;i<t.length;i++){var s=-t[i].shift-l-t[i].elem.depth,u=s-(t[i-1].elem.height+t[i-1].elem.depth);l=l+s,n.push({type:"kern",size:u}),n.push(t[i])}return{children:n,depth:o}}var d;if(e.positionType==="top"){for(var m=e.positionData,h=0;h<e.children.length;h++){var p=e.children[h];m-=p.type==="kern"?p.size:p.elem.height+p.elem.depth}d=m}else if(e.positionType==="bottom")d=-e.positionData;else{var v=e.children[0];if(v.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")d=-v.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")d=-v.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:d}},xe=function(e,t){for(var{children:n,depth:o}=Mm(e),l=0,i=0;i<n.length;i++){var s=n[i];if(s.type==="elem"){var u=s.elem;l=Math.max(l,u.maxFontSize,u.height)}}l+=2;var d=U(["pstrut"],[]);d.style.height=Y(l);for(var m=[],h=o,p=o,v=o,b=0;b<n.length;b++){var w=n[b];if(w.type==="kern")v+=w.size;else{var k=w.elem,T=w.wrapperClasses||[],E=w.wrapperStyle||{},M=U(T,[d,k],void 0,E);M.style.top=Y(-l-v-k.depth),w.marginLeft&&(M.style.marginLeft=w.marginLeft),w.marginRight&&(M.style.marginRight=w.marginRight),m.push(M),v+=k.height+k.depth}h=Math.min(h,v),p=Math.max(p,v)}var B=U(["vlist"],m);B.style.height=Y(p);var D;if(h<0){var z=U([],[]),W=U(["vlist"],[z]);W.style.height=Y(-h);var H=U(["vlist-s"],[new ut("​")]);D=[U(["vlist-r"],[B,H]),U(["vlist-r"],[W])]}else D=[U(["vlist-r"],[B])];var A=U(["vlist-t"],D);return D.length===2&&A.classes.push("vlist-t2"),A.height=p,A.depth=-h,A},lu=(r,e)=>{var t=U(["mspace"],[],e),n=Ie(r,e);return t.style.marginRight=Y(n),t},An=function(e,t,n){var o="";switch(e){case"amsrm":o="AMS";break;case"textrm":o="Main";break;case"textsf":o="SansSerif";break;case"texttt":o="Typewriter";break;default:o=e}var l;return t==="textbf"&&n==="textit"?l="BoldItalic":t==="textbf"?l="Bold":t==="textit"?l="Italic":l="Regular",o+"-"+l},Pl={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},au={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},iu=function(e,t){var[n,o,l]=au[e],i=new Jt(n),s=new zt([i],{width:Y(o),height:Y(l),style:"width:"+Y(o),viewBox:"0 0 "+1e3*o+" "+1e3*l,preserveAspectRatio:"xMinYMin"}),u=Xt(["overlay"],[s],t);return u.height=l,u.style.height=Y(l),u.style.width=Y(o),u},Ne={number:3,unit:"mu"},nr={number:4,unit:"mu"},At={number:5,unit:"mu"},Am={mord:{mop:Ne,mbin:nr,mrel:At,minner:Ne},mop:{mord:Ne,mop:Ne,mrel:At,minner:Ne},mbin:{mord:nr,mop:nr,mopen:nr,minner:nr},mrel:{mord:At,mop:At,mopen:At,minner:At},mopen:{},mclose:{mop:Ne,mbin:nr,mrel:At,minner:Ne},mpunct:{mord:Ne,mop:Ne,mrel:At,mopen:Ne,mclose:Ne,mpunct:Ne,minner:Ne},minner:{mord:Ne,mop:Ne,mbin:nr,mrel:At,mopen:Ne,mpunct:Ne,minner:Ne}},Bm={mord:{mop:Ne},mop:{mord:Ne,mop:Ne},mbin:{},mrel:{},mopen:{},mclose:{mop:Ne},mpunct:{},minner:{mop:Ne}},su={},Zn={},eo={};function j(r){for(var{type:e,names:t,props:n,handler:o,htmlBuilder:l,mathmlBuilder:i}=r,s={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:o},u=0;u<t.length;++u)su[t[u]]=s;e&&(l&&(Zn[e]=l),i&&(eo[e]=i))}function vr(r){var{type:e,htmlBuilder:t,mathmlBuilder:n}=r;j({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:n})}var to=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},He=function(e){return e.type==="ordgroup"?e.body:[e]},Nm=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Lm=new Set(["rightmost","mrel","mclose","mpunct"]),Im={display:fe.DISPLAY,text:fe.TEXT,script:fe.SCRIPT,scriptscript:fe.SCRIPTSCRIPT},zm={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ge=function(e,t,n,o){o===void 0&&(o=[null,null]);for(var l=[],i=0;i<e.length;i++){var s=Ce(e[i],t);if(s instanceof Fr){var u=s.children;l.push(...u)}else l.push(s)}if(ou(l),!n)return l;var d=t;if(e.length===1){var m=e[0];m.type==="sizing"?d=t.havingSize(m.size):m.type==="styling"&&(d=t.havingStyle(Im[m.style]))}var h=U([o[0]||"leftmost"],[],t),p=U([o[1]||"rightmost"],[],t),v=n==="root";return Hl(l,(b,w)=>{var k=w.classes[0],T=b.classes[0];k==="mbin"&&Lm.has(T)?w.classes[0]="mord":T==="mbin"&&Nm.has(k)&&(b.classes[0]="mord")},{node:h},p,v),Hl(l,(b,w)=>{var k,T,E=Fl(w),M=Fl(b),B=E&&M?b.hasClass("mtight")?(k=Bm[E])==null?void 0:k[M]:(T=Am[E])==null?void 0:T[M]:null;if(B)return lu(B,d)},{node:h},p,v),l},Hl=function(e,t,n,o,l){o&&e.push(o);for(var i=0;i<e.length;i++){var s=e[i],u=uu(s);if(u){Hl(u.children,t,n,null,l);continue}var d=!s.hasClass("mspace");if(d){var m=t(s,n.node);m&&(n.insertAfter?n.insertAfter(m):(e.unshift(m),i++))}d?n.node=s:l&&s.hasClass("newline")&&(n.node=U(["leftmost"])),n.insertAfter=(h=>p=>{e.splice(h+1,0,p),i++})(i)}o&&e.pop()},uu=function(e){return e instanceof Fr||e instanceof po||e instanceof $r&&e.hasClass("enclosing")?e:null},Vl=function(e,t){var n=uu(e);if(n){var o=n.children;if(o.length){if(t==="right")return Vl(o[o.length-1],"right");if(t==="left")return Vl(o[0],"left")}}return e},Fl=function(e,t){if(!e)return null;t&&(e=Vl(e,t));var n=e.classes[0];return zm[n]||null},sn=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return U(t.concat(n))},Ce=function(e,t,n){if(!e)return U();if(Zn[e.type]){var o=Zn[e.type](e,t);if(n&&t.size!==n.size){o=U(t.sizingClasses(n),[o],t);var l=t.sizeMultiplier/n.sizeMultiplier;o.height*=l,o.depth*=l}return o}else throw new _("Got group of unknown type: '"+e.type+"'")};function Bn(r,e){var t=U(["base"],r,e),n=U(["strut"]);return n.style.height=Y(t.height+t.depth),t.depth&&(n.style.verticalAlign=Y(-t.depth)),t.children.unshift(n),t}function $l(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var n=Ge(r,e,"root"),o;n.length===2&&n[1].hasClass("tag")&&(o=n.pop());for(var l=[],i=[],s=0;s<n.length;s++)if(i.push(n[s]),n[s].hasClass("mbin")||n[s].hasClass("mrel")||n[s].hasClass("allowbreak")){for(var u=!1;s<n.length-1&&n[s+1].hasClass("mspace")&&!n[s+1].hasClass("newline");)s++,i.push(n[s]),n[s].hasClass("nobreak")&&(u=!0);u||(l.push(Bn(i,e)),i=[])}else n[s].hasClass("newline")&&(i.pop(),i.length>0&&(l.push(Bn(i,e)),i=[]),l.push(n[s]));i.length>0&&l.push(Bn(i,e));var d;t?(d=Bn(Ge(t,e,!0),e),d.classes=["tag"],l.push(d)):o&&l.push(o);var m=U(["katex-html"],l);if(m.setAttribute("aria-hidden","true"),d){var h=d.children[0];h.style.height=Y(m.height+m.depth),m.depth&&(h.style.verticalAlign=Y(-m.depth))}return m}function cu(r){return new Fr(r)}class G{constructor(e,t,n){this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=Yt(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Ve&&this.children[n+1]instanceof Ve){for(var o=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Ve;)o+=this.children[++n].toText();e.appendChild(new Ve(o).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=Ye(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+Ye(Yt(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Ve{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ye(this.toText())}toText(){return this.text}}class du{constructor(e){this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Y(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Y(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Dm=new Set(["\\imath","\\jmath"]),Om=new Set(["mrow","mtable"]),pt=function(e,t,n){return Se[t][e]&&Se[t][e].replace&&e.charCodeAt(0)!==55349&&!(nu.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Se[t][e].replace),new Ve(e)},pa=function(e){return e.length===1?e[0]:new G("mrow",e)},ga=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var n=t.font;if(!n||n==="mathnormal")return null;var o=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var l=e.text;if(Dm.has(l))return null;if(Se[o][l]){var i=Se[o][l].replace;i&&(l=i)}var s=Pl[n].fontName;return fa(l,s,o)?Pl[n].variant:null};function el(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof Ve&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof Ve&&t.text===","}else return!1}var dt=function(e,t,n){if(e.length===1){var o=Ee(e[0],t);return n&&o instanceof G&&o.type==="mo"&&(o.setAttribute("lspace","0em"),o.setAttribute("rspace","0em")),[o]}for(var l=[],i,s=0;s<e.length;s++){var u=Ee(e[s],t);if(u instanceof G&&i instanceof G){if(u.type==="mtext"&&i.type==="mtext"&&u.getAttribute("mathvariant")===i.getAttribute("mathvariant")){i.children.push(...u.children);continue}else if(u.type==="mn"&&i.type==="mn"){i.children.push(...u.children);continue}else if(el(u)&&i.type==="mn"){i.children.push(...u.children);continue}else if(u.type==="mn"&&el(i))u.children=[...i.children,...u.children],l.pop();else if((u.type==="msup"||u.type==="msub")&&u.children.length>=1&&(i.type==="mn"||el(i))){var d=u.children[0];d instanceof G&&d.type==="mn"&&(d.children=[...i.children,...d.children],l.pop())}else if(i.type==="mi"&&i.children.length===1){var m=i.children[0];if(m instanceof Ve&&m.text==="̸"&&(u.type==="mo"||u.type==="mi"||u.type==="mn")){var h=u.children[0];h instanceof Ve&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),l.pop())}}}l.push(u),i=u}return l},jt=function(e,t,n){return pa(dt(e,t,n))},Ee=function(e,t){if(!e)return new G("mrow");if(eo[e.type]){var n=eo[e.type](e,t);return n}else throw new _("Got group of unknown type: '"+e.type+"'")};function U0(r,e,t,n,o){var l=dt(r,t),i;l.length===1&&l[0]instanceof G&&Om.has(l[0].type)?i=l[0]:i=new G("mrow",l);var s=new G("annotation",[new Ve(e)]);s.setAttribute("encoding","application/x-tex");var u=new G("semantics",[i,s]),d=new G("math",[u]);d.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&d.setAttribute("display","block");var m=o?"katex":"katex-mathml";return U([m],[d])}var Rm=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],W0=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],_0=function(e,t){return t.size<2?e:Rm[e-1][t.size-1]};class Nt{constructor(e){this.style=e.style,this.color=e.color,this.size=e.size||Nt.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=W0[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(t,e),new Nt(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:_0(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:W0[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=_0(Nt.BASESIZE,e);return this.size===t&&this.textSize===Nt.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Nt.BASESIZE?["sizing","reset-size"+this.size,"size"+Nt.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=wm(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Nt.BASESIZE=6;var fu=function(e){return new Nt({style:e.displayMode?fe.DISPLAY:fe.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},mu=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=U(n,[e])}return e},Pm=function(e,t,n){var o=fu(n),l;if(n.output==="mathml")return U0(e,t,o,n.displayMode,!0);if(n.output==="html"){var i=$l(e,o);l=U(["katex"],[i])}else{var s=U0(e,t,o,n.displayMode,!1),u=$l(e,o);l=U(["katex"],[s,u])}return mu(l,n)},Hm=function(e,t,n){var o=fu(n),l=$l(e,o),i=U(["katex"],[l]);return mu(i,n)},Vm={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},bo=function(e){var t=new G("mo",[new Ve(Vm[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Fm={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},$m=new Set(["widehat","widecheck","widetilde","utilde"]),yo=function(e,t){function n(){var s=4e5,u=e.label.slice(1);if($m.has(u)){var d=e,m=d.base.type==="ordgroup"?d.base.body.length:1,h,p,v;if(m>5)u==="widehat"||u==="widecheck"?(h=420,s=2364,v=.42,p=u+"4"):(h=312,s=2340,v=.34,p="tilde4");else{var b=[1,1,2,2,3,3][m];u==="widehat"||u==="widecheck"?(s=[0,1062,2364,2364,2364][b],h=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],p=u+b):(s=[0,600,1033,2339,2340][b],h=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],p="tilde"+b)}var w=new Jt(p),k=new zt([w],{width:"100%",height:Y(v),viewBox:"0 0 "+s+" "+h,preserveAspectRatio:"none"});return{span:Xt([],[k],t),minWidth:0,height:v}}else{var T=[],E=Fm[u],[M,B,D]=E,z=D/1e3,W=M.length,H,A;if(W===1){var R=E[3];H=["hide-tail"],A=[R]}else if(W===2)H=["halfarrow-left","halfarrow-right"],A=["xMinYMin","xMaxYMin"];else if(W===3)H=["brace-left","brace-center","brace-right"],A=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
302
- `+W+" children.");for(var K=0;K<W;K++){var J=new Jt(M[K]),te=new zt([J],{width:"400em",height:Y(z),viewBox:"0 0 "+s+" "+D,preserveAspectRatio:A[K]+" slice"}),Z=Xt([H[K]],[te],t);if(W===1)return{span:Z,minWidth:B,height:z};Z.style.height=Y(z),T.push(Z)}return{span:U(["stretchy"],T,t),minWidth:B,height:z}}}var{span:o,minWidth:l,height:i}=n();return o.height=i,o.style.height=Y(i),l>0&&(o.style.minWidth=Y(l)),o},qm=function(e,t,n,o,l){var i,s=e.height+e.depth+n+o;if(/fbox|color|angl/.test(t)){if(i=U(["stretchy",t],[],l),t==="fbox"){var u=l.color&&l.getColor();u&&(i.style.borderColor=u)}}else{var d=[];/^[bx]cancel$/.test(t)&&d.push(new Ol({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&d.push(new Ol({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var m=new zt(d,{width:"100%",height:Y(s)});i=Xt([],[m],l)}return i.height=s,i.style.height=Y(s),i};function he(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function wo(r){var e=ko(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function ko(r){return r&&(r.type==="atom"||xm.hasOwnProperty(r.type))?r:null}var hu=r=>{if(r instanceof ut)return r;if(bm(r)&&r.children.length===1)return hu(r.children[0])},va=(r,e)=>{var t,n,o;r&&r.type==="supsub"?(n=he(r.base,"accent"),t=n.base,r.base=t,o=vm(Ce(r,e)),r.base=n):(n=he(r,"accent"),t=n.base);var l=Ce(t,e.havingCrampedStyle()),i=n.isShifty&&Ot(t),s=0;if(i){var u,d;s=(u=(d=hu(l))==null?void 0:d.skew)!=null?u:0}var m=n.label==="\\c",h=m?l.height+l.depth:Math.min(l.height,e.fontMetrics().xHeight),p;if(n.isStretchy)p=yo(n,e),p=xe({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"elem",elem:p,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+Y(2*s)+")",marginLeft:Y(2*s)}:void 0}]});else{var v,b;n.label==="\\vec"?(v=iu("vec",e),b=au.vec[1]):(v=vo({mode:n.mode,text:n.label},e,"textord"),v=gm(v),v.italic=0,b=v.width,m&&(h+=v.depth)),p=U(["accent-body"],[v]);var w=n.label==="\\textcircled";w&&(p.classes.push("accent-full"),h=l.height);var k=s;w||(k-=b/2),p.style.left=Y(k),n.label==="\\textcircled"&&(p.style.top=".2em"),p=xe({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:-h},{type:"elem",elem:p}]})}var T=U(["mord","accent"],[p],e);return o?(o.children[0]=T,o.height=Math.max(T.height,o.height),o.classes[0]="mord",o):T},pu=(r,e)=>{var t=r.isStretchy?bo(r.label):new G("mo",[pt(r.label,r.mode)]),n=new G("mover",[Ee(r.base,e),t]);return n.setAttribute("accent","true"),n},Um=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));j({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(r,e)=>{var t=to(e[0]),n=!Um.test(r.funcName),o=!n||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:n,isShifty:o,base:t}},htmlBuilder:va,mathmlBuilder:pu});j({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],n=r.parser.mode;return n==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:va,mathmlBuilder:pu});j({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,o=e[0];return{type:"accentUnder",mode:t.mode,label:n,base:o}},htmlBuilder:(r,e)=>{var t=Ce(r.base,e),n=yo(r,e),o=r.label==="\\utilde"?.12:0,l=xe({positionType:"top",positionData:t.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:t}]});return U(["mord","accentunder"],[l],e)},mathmlBuilder:(r,e)=>{var t=bo(r.label),n=new G("munder",[Ee(r.base,e),t]);return n.setAttribute("accentunder","true"),n}});var Nn=r=>{var e=new G("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};j({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n,funcName:o}=r;return{type:"xArrow",mode:n.mode,label:o,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,n=e.havingStyle(t.sup()),o=Pr(Ce(r.body,n,e),e),l=r.label.slice(0,2)==="\\x"?"x":"cd";o.classes.push(l+"-arrow-pad");var i;r.below&&(n=e.havingStyle(t.sub()),i=Pr(Ce(r.below,n,e),e),i.classes.push(l+"-arrow-pad"));var s=yo(r,e),u=-e.fontMetrics().axisHeight+.5*s.height,d=-e.fontMetrics().axisHeight-.5*s.height-.111;(o.depth>.25||r.label==="\\xleftequilibrium")&&(d-=o.depth);var m;if(i){var h=-e.fontMetrics().axisHeight+i.height+.5*s.height+.111;m=xe({positionType:"individualShift",children:[{type:"elem",elem:o,shift:d},{type:"elem",elem:s,shift:u},{type:"elem",elem:i,shift:h}]})}else m=xe({positionType:"individualShift",children:[{type:"elem",elem:o,shift:d},{type:"elem",elem:s,shift:u}]});return m.children[0].children[0].children[1].classes.push("svg-align"),U(["mrel","x-arrow"],[m],e)},mathmlBuilder(r,e){var t=bo(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(r.body){var o=Nn(Ee(r.body,e));if(r.below){var l=Nn(Ee(r.below,e));n=new G("munderover",[t,l,o])}else n=new G("mover",[t,o])}else if(r.below){var i=Nn(Ee(r.below,e));n=new G("munder",[t,i])}else n=Nn(),n=new G("mover",[t,n]);return n}});function gu(r,e){var t=Ge(r.body,e,!0);return U([r.mclass],t,e)}function vu(r,e){var t,n=dt(r.body,e);return r.mclass==="minner"?t=new G("mpadded",n):r.mclass==="mord"?r.isCharacterBox?(t=n[0],t.type="mi"):t=new G("mi",n):(r.isCharacterBox?(t=n[0],t.type="mo"):t=new G("mo",n),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}j({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:n}=r,o=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+n.slice(5),body:He(o),isCharacterBox:Ot(o)}},htmlBuilder:gu,mathmlBuilder:vu});var xo=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};j({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:xo(e[0]),body:He(e[1]),isCharacterBox:Ot(e[1])}}});j({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:n}=r,o=e[1],l=e[0],i;n!=="\\stackrel"?i=xo(o):i="mrel";var s={type:"op",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:He(o)},u={type:"supsub",mode:l.mode,base:s,sup:n==="\\underset"?null:l,sub:n==="\\underset"?l:null};return{type:"mclass",mode:t.mode,mclass:i,body:[u],isCharacterBox:Ot(u)}},htmlBuilder:gu,mathmlBuilder:vu});j({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:xo(e[0]),body:He(e[0])}},htmlBuilder(r,e){var t=Ge(r.body,e,!0),n=U([r.mclass],t,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(r,e){var t=dt(r.body,e),n=new G("mstyle",t);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var Wm={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},G0=()=>({type:"styling",body:[],mode:"math",style:"display"}),K0=r=>r.type==="textord"&&r.text==="@",_m=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;function Gm(r,e,t){var n=Wm[r];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var o=t.callFunction("\\\\cdleft",[e[0]],[]),l={type:"atom",text:n,mode:"math",family:"rel"},i=t.callFunction("\\Big",[l],[]),s=t.callFunction("\\\\cdright",[e[1]],[]),u={type:"ordgroup",mode:"math",body:[o,i,s]};return t.callFunction("\\\\cdparent",[u],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var d={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[d],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Km(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new _("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var n=[],o=[n],l=0;l<e.length;l++){for(var i=e[l],s=G0(),u=0;u<i.length;u++)if(!K0(i[u]))s.body.push(i[u]);else{n.push(s),u+=1;var d=wo(i[u]).text,m=new Array(2);if(m[0]={type:"ordgroup",mode:"math",body:[]},m[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(d))if("<>AV".includes(d))for(var h=0;h<2;h++){for(var p=!0,v=u+1;v<i.length;v++){if(_m(i[v],d)){p=!1,u=v;break}if(K0(i[v]))throw new _("Missing a "+d+" character to complete a CD arrow.",i[v]);m[h].body.push(i[v])}if(p)throw new _("Missing a "+d+" character to complete a CD arrow.",i[u])}else throw new _('Expected one of "<>AV=|." after @',i[u]);var b=Gm(d,m,r),w={type:"styling",body:[b],mode:"math",style:"display"};n.push(w),s=G0()}l%2===0?n.push(s):n.shift(),n=[],o.push(n)}r.gullet.endGroup(),r.gullet.endGroup();var k=new Array(o[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:o,arraystretch:1,addJot:!0,rowGaps:[null],cols:k,colSeparationType:"CD",hLinesBeforeRow:new Array(o.length+1).fill([])}}j({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"cdlabel",mode:t.mode,side:n.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),n=Pr(Ce(r.label,t,e),e);return n.classes.push("cd-label-"+r.side),n.style.bottom=Y(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(r,e){var t=new G("mrow",[Ee(r.label,e)]);return t=new G("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new G("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});j({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=Pr(Ce(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new G("mrow",[Ee(r.fragment,e)])}});j({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,n=he(e[0],"ordgroup"),o=n.body,l="",i=0;i<o.length;i++){var s=he(o[i],"textord");l+=s.text}var u=parseInt(l),d;if(isNaN(u))throw new _("\\@char has non-numeric argument "+l);if(u<0||u>=1114111)throw new _("\\@char with invalid code point "+l);return u<=65535?d=String.fromCharCode(u):(u-=65536,d=String.fromCharCode((u>>10)+55296,(u&1023)+56320)),{type:"textord",mode:t.mode,text:d}}});var bu=(r,e)=>{var t=Ge(r.body,e.withColor(r.color),!1);return Pt(t)},yu=(r,e)=>{var t=dt(r.body,e.withColor(r.color)),n=new G("mstyle",t);return n.setAttribute("mathcolor",r.color),n};j({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,n=he(e[0],"color-token").color,o=e[1];return{type:"color",mode:t.mode,color:n,body:He(o)}},htmlBuilder:bu,mathmlBuilder:yu});j({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:n}=r,o=he(e[0],"color-token").color;t.gullet.macros.set("\\current@color",o);var l=t.parseExpression(!0,n);return{type:"color",mode:t.mode,color:o,body:l}},htmlBuilder:bu,mathmlBuilder:yu});j({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:n}=r,o=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,l=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:l,size:o&&he(o,"size").value}},htmlBuilder(r,e){var t=U(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=Y(Ie(r.size,e)))),t},mathmlBuilder(r,e){var t=new G("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",Y(Ie(r.size,e)))),t}});var ql={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},wu=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new _("Expected a control sequence",r);return e},Ym=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},ku=(r,e,t,n)=>{var o=r.gullet.macros.get(t.text);o==null&&(t.noexpand=!0,o={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,o,n)};j({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var n=e.fetch();if(ql[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=ql[n.text]),he(e.parseFunction(),"internal");throw new _("Invalid token after macro prefix",n)}});j({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=e.gullet.popToken(),o=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new _("Expected a control sequence",n);for(var l=0,i,s=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){i=e.gullet.future(),s[l].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new _('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==l+1)throw new _('Argument number "'+n.text+'" out of order');l++,s.push([])}else{if(n.text==="EOF")throw new _("Expected a macro definition");s[l].push(n.text)}var{tokens:u}=e.gullet.consumeArg();return i&&u.unshift(i),(t==="\\edef"||t==="\\xdef")&&(u=e.gullet.expandTokens(u),u.reverse()),e.gullet.macros.set(o,{tokens:u,numArgs:l,delimiters:s},t===ql[t]),{type:"internal",mode:e.mode}}});j({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=wu(e.gullet.popToken());e.gullet.consumeSpaces();var o=Ym(e);return ku(e,n,o,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});j({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=wu(e.gullet.popToken()),o=e.gullet.popToken(),l=e.gullet.popToken();return ku(e,n,l,t==="\\\\globalfuture"),e.gullet.pushToken(l),e.gullet.pushToken(o),{type:"internal",mode:e.mode}}});var Yr=function(e,t,n){var o=Se.math[e]&&Se.math[e].replace,l=fa(o||e,t,n);if(!l)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return l},ba=function(e,t,n,o){var l=n.havingBaseStyle(t),i=U(o.concat(l.sizingClasses(n)),[e],n),s=l.sizeMultiplier/n.sizeMultiplier;return i.height*=s,i.depth*=s,i.maxFontSize=l.sizeMultiplier,i},xu=function(e,t,n){var o=t.havingBaseStyle(n),l=(1-t.sizeMultiplier/o.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Y(l),e.height-=l,e.depth+=l},Jm=function(e,t,n,o,l,i){var s=Ze(e,"Main-Regular",l,o),u=ba(s,t,o,i);return xu(u,o,t),u},Xm=function(e,t,n,o){return Ze(e,"Size"+t+"-Regular",n,o)},Cu=function(e,t,n,o,l,i){var s=Xm(e,t,l,o),u=ba(U(["delimsizing","size"+t],[s],o),fe.TEXT,o,i);return n&&xu(u,o,fe.TEXT),u},tl=function(e,t,n){var o;t==="Size1-Regular"?o="delim-size1":o="delim-size4";var l=U(["delimsizinginner",o],[U([],[Ze(e,t,n)])]);return{type:"elem",elem:l}},rl=function(e,t,n){var o=wt["Size4-Regular"][e.charCodeAt(0)]?wt["Size4-Regular"][e.charCodeAt(0)][4]:wt["Size1-Regular"][e.charCodeAt(0)][4],l=new Jt("inner",cm(e,Math.round(1e3*t))),i=new zt([l],{width:Y(o),height:Y(t),style:"width:"+Y(o),viewBox:"0 0 "+1e3*o+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),s=Xt([],[i],n);return s.height=t,s.style.height=Y(t),s.style.width=Y(o),{type:"elem",elem:s}},Ul=.008,Ln={type:"kern",size:-1*Ul},jm=new Set(["|","\\lvert","\\rvert","\\vert"]),Qm=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Tu=function(e,t,n,o,l,i){var s,u,d,m,h="",p=0;s=d=m=e,u=null;var v="Size1-Regular";e==="\\uparrow"?d=m="⏐":e==="\\Uparrow"?d=m="‖":e==="\\downarrow"?s=d="⏐":e==="\\Downarrow"?s=d="‖":e==="\\updownarrow"?(s="\\uparrow",d="⏐",m="\\downarrow"):e==="\\Updownarrow"?(s="\\Uparrow",d="‖",m="\\Downarrow"):jm.has(e)?(d="∣",h="vert",p=333):Qm.has(e)?(d="∥",h="doublevert",p=556):e==="["||e==="\\lbrack"?(s="⎡",d="⎢",m="⎣",v="Size4-Regular",h="lbrack",p=667):e==="]"||e==="\\rbrack"?(s="⎤",d="⎥",m="⎦",v="Size4-Regular",h="rbrack",p=667):e==="\\lfloor"||e==="⌊"?(d=s="⎢",m="⎣",v="Size4-Regular",h="lfloor",p=667):e==="\\lceil"||e==="⌈"?(s="⎡",d=m="⎢",v="Size4-Regular",h="lceil",p=667):e==="\\rfloor"||e==="⌋"?(d=s="⎥",m="⎦",v="Size4-Regular",h="rfloor",p=667):e==="\\rceil"||e==="⌉"?(s="⎤",d=m="⎥",v="Size4-Regular",h="rceil",p=667):e==="("||e==="\\lparen"?(s="⎛",d="⎜",m="⎝",v="Size4-Regular",h="lparen",p=875):e===")"||e==="\\rparen"?(s="⎞",d="⎟",m="⎠",v="Size4-Regular",h="rparen",p=875):e==="\\{"||e==="\\lbrace"?(s="⎧",u="⎨",m="⎩",d="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(s="⎫",u="⎬",m="⎭",d="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(s="⎧",m="⎩",d="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(s="⎫",m="⎭",d="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(s="⎧",m="⎭",d="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(s="⎫",m="⎩",d="⎪",v="Size4-Regular");var b=Yr(s,v,l),w=b.height+b.depth,k=Yr(d,v,l),T=k.height+k.depth,E=Yr(m,v,l),M=E.height+E.depth,B=0,D=1;if(u!==null){var z=Yr(u,v,l);B=z.height+z.depth,D=2}var W=w+M+B,H=Math.max(0,Math.ceil((t-W)/(D*T))),A=W+H*D*T,R=o.fontMetrics().axisHeight;n&&(R*=o.sizeMultiplier);var K=A/2-R,J=[];if(h.length>0){var te=A-w-M,Z=Math.round(A*1e3),le=dm(h,Math.round(te*1e3)),ee=new Jt(h,le),we=Y(p/1e3),pe=Y(Z/1e3),se=new zt([ee],{width:we,height:pe,viewBox:"0 0 "+p+" "+Z}),I=Xt([],[se],o);I.height=Z/1e3,I.style.width=we,I.style.height=pe,J.push({type:"elem",elem:I})}else{if(J.push(tl(m,v,l)),J.push(Ln),u===null){var P=A-w-M+2*Ul;J.push(rl(d,P,o))}else{var V=(A-w-M-B)/2+2*Ul;J.push(rl(d,V,o)),J.push(Ln),J.push(tl(u,v,l)),J.push(Ln),J.push(rl(d,V,o))}J.push(Ln),J.push(tl(s,v,l))}var q=o.havingBaseStyle(fe.TEXT),ae=xe({positionType:"bottom",positionData:K,children:J});return ba(U(["delimsizing","mult"],[ae],q),fe.TEXT,o,i)},nl=80,ol=.08,ll=function(e,t,n,o,l){var i=um(e,o,n),s=new Jt(e,i),u=new zt([s],{width:"400em",height:Y(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return Xt(["hide-tail"],[u],l)},Zm=function(e,t){var n=t.havingBaseSizing(),o=Bu("\\surd",e*n.sizeMultiplier,Au,n),l=n.sizeMultiplier,i=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),s,u=0,d=0,m=0,h;return o.type==="small"?(m=1e3+1e3*i+nl,e<1?l=1:e<1.4&&(l=.7),u=(1+i+ol)/l,d=(1+i)/l,s=ll("sqrtMain",u,m,i,t),s.style.minWidth="0.853em",h=.833/l):o.type==="large"?(m=(1e3+nl)*Qr[o.size],d=(Qr[o.size]+i)/l,u=(Qr[o.size]+i+ol)/l,s=ll("sqrtSize"+o.size,u,m,i,t),s.style.minWidth="1.02em",h=1/l):(u=e+i+ol,d=e+i,m=Math.floor(1e3*e+i)+nl,s=ll("sqrtTall",u,m,i,t),s.style.minWidth="0.742em",h=1.056),s.height=d,s.style.height=Y(u),{span:s,advanceWidth:h,ruleWidth:(t.fontMetrics().sqrtRuleThickness+i)*l}},Eu=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),eh=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Su=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Qr=[0,1.2,1.8,2.4,3],Mu=function(e,t,n,o,l){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),Eu.has(e)||Su.has(e))return Cu(e,t,!1,n,o,l);if(eh.has(e))return Tu(e,Qr[t],!1,n,o,l);throw new _("Illegal delimiter: '"+e+"'")},th=[{type:"small",style:fe.SCRIPTSCRIPT},{type:"small",style:fe.SCRIPT},{type:"small",style:fe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],rh=[{type:"small",style:fe.SCRIPTSCRIPT},{type:"small",style:fe.SCRIPT},{type:"small",style:fe.TEXT},{type:"stack"}],Au=[{type:"small",style:fe.SCRIPTSCRIPT},{type:"small",style:fe.SCRIPT},{type:"small",style:fe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],nh=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var t=e.type;throw new Error("Add support for delim type '"+t+"' here.")},Bu=function(e,t,n,o){for(var l=Math.min(2,3-o.style.size),i=l;i<n.length;i++){var s=n[i];if(s.type==="stack")break;var u=Yr(e,nh(s),"math"),d=u.height+u.depth;if(s.type==="small"){var m=o.havingBaseStyle(s.style);d*=m.sizeMultiplier}if(d>t)return s}return n[n.length-1]},Wl=function(e,t,n,o,l,i){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var s;Su.has(e)?s=th:Eu.has(e)?s=Au:s=rh;var u=Bu(e,t,s,o);return u.type==="small"?Jm(e,u.style,n,o,l,i):u.type==="large"?Cu(e,u.size,n,o,l,i):Tu(e,t,n,o,l,i)},al=function(e,t,n,o,l,i){var s=o.fontMetrics().axisHeight*o.sizeMultiplier,u=901,d=5/o.fontMetrics().ptPerEm,m=Math.max(t-s,n+s),h=Math.max(m/500*u,2*m-d);return Wl(e,h,!0,o,l,i)},Y0={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},oh=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function Co(r,e){var t=ko(r);if(t&&oh.has(t.text))return t;throw t?new _("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new _("Invalid delimiter type '"+r.type+"'",r)}j({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(r,e)=>{var t=Co(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:Y0[r.funcName].size,mclass:Y0[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?U([r.mclass]):Mu(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(pt(r.delim,r.mode));var t=new G("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var n=Y(Qr[r.size]);return t.setAttribute("minsize",n),t.setAttribute("maxsize",n),t}});function J0(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}j({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new _("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:Co(e[0],r).text,color:t}}});j({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=Co(e[0],r),n=r.parser;++n.leftrightDepth;var o=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var l=he(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:o,left:t.text,right:l.delim,rightColor:l.color}},htmlBuilder:(r,e)=>{J0(r);for(var t=Ge(r.body,e,!0,["mopen","mclose"]),n=0,o=0,l=!1,i=0;i<t.length;i++)t[i].isMiddle?l=!0:(n=Math.max(t[i].height,n),o=Math.max(t[i].depth,o));n*=e.sizeMultiplier,o*=e.sizeMultiplier;var s;if(r.left==="."?s=sn(e,["mopen"]):s=al(r.left,n,o,e,r.mode,["mopen"]),t.unshift(s),l)for(var u=1;u<t.length;u++){var d=t[u],m=d.isMiddle;m&&(t[u]=al(m.delim,n,o,m.options,r.mode,[]))}var h;if(r.right===".")h=sn(e,["mclose"]);else{var p=r.rightColor?e.withColor(r.rightColor):e;h=al(r.right,n,o,p,r.mode,["mclose"])}return t.push(h),U(["minner"],t,e)},mathmlBuilder:(r,e)=>{J0(r);var t=dt(r.body,e);if(r.left!=="."){var n=new G("mo",[pt(r.left,r.mode)]);n.setAttribute("fence","true"),t.unshift(n)}if(r.right!=="."){var o=new G("mo",[pt(r.right,r.mode)]);o.setAttribute("fence","true"),r.rightColor&&o.setAttribute("mathcolor",r.rightColor),t.push(o)}return pa(t)}});j({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=Co(e[0],r);if(!r.parser.leftrightDepth)throw new _("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=sn(e,[]);else{t=Mu(r.delim,1,e,r.mode,[]);var n={delim:r.delim,options:e};t.isMiddle=n}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?pt("|","text"):pt(r.delim,r.mode),n=new G("mo",[t]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var To=(r,e)=>{var t=Pr(Ce(r.body,e),e),n=r.label.slice(1),o=e.sizeMultiplier,l,i=0,s=Ot(r.body);if(n==="sout")l=U(["stretchy","sout"]),l.height=e.fontMetrics().defaultRuleThickness/o,i=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var u=Ie({number:.6,unit:"pt"},e),d=Ie({number:.35,unit:"ex"},e),m=e.havingBaseSizing();o=o/m.sizeMultiplier;var h=t.height+t.depth+u+d;t.style.paddingLeft=Y(h/2+u);var p=Math.floor(1e3*h*o),v=im(p),b=new zt([new Jt("phase",v)],{width:"400em",height:Y(p/1e3),viewBox:"0 0 400000 "+p,preserveAspectRatio:"xMinYMin slice"});l=Xt(["hide-tail"],[b],e),l.style.height=Y(h),i=t.depth+u+d}else{/cancel/.test(n)?s||t.classes.push("cancel-pad"):n==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var w=0,k=0,T=0;/box/.test(n)?(T=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(n==="colorbox"?0:T),k=w):n==="angl"?(T=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*T,k=Math.max(0,.25-t.depth)):(w=s?.2:0,k=w),l=qm(t,n,w,k,e),/fbox|boxed|fcolorbox/.test(n)?(l.style.borderStyle="solid",l.style.borderWidth=Y(T)):n==="angl"&&T!==.049&&(l.style.borderTopWidth=Y(T),l.style.borderRightWidth=Y(T)),i=t.depth+k,r.backgroundColor&&(l.style.backgroundColor=r.backgroundColor,r.borderColor&&(l.style.borderColor=r.borderColor))}var E;if(r.backgroundColor)E=xe({positionType:"individualShift",children:[{type:"elem",elem:l,shift:i},{type:"elem",elem:t,shift:0}]});else{var M=/cancel|phase/.test(n)?["svg-align"]:[];E=xe({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:l,shift:i,wrapperClasses:M}]})}return/cancel/.test(n)&&(E.height=t.height,E.depth=t.depth),/cancel/.test(n)&&!s?U(["mord","cancel-lap"],[E],e):U(["mord"],[E],e)},Eo=(r,e)=>{var t=0,n=new G(r.label.includes("colorbox")?"mpadded":"menclose",[Ee(r.body,e)]);switch(r.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*t+"pt"),n.setAttribute("height","+"+2*t+"pt"),n.setAttribute("lspace",t+"pt"),n.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var o=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+Y(o)+" solid "+r.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&n.setAttribute("mathbackground",r.backgroundColor),n};j({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:n,funcName:o}=r,l=he(e[0],"color-token").color,i=e[1];return{type:"enclose",mode:n.mode,label:o,backgroundColor:l,body:i}},htmlBuilder:To,mathmlBuilder:Eo});j({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:n,funcName:o}=r,l=he(e[0],"color-token").color,i=he(e[1],"color-token").color,s=e[2];return{type:"enclose",mode:n.mode,label:o,backgroundColor:i,borderColor:l,body:s}},htmlBuilder:To,mathmlBuilder:Eo});j({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}});j({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r,o=e[0];return{type:"enclose",mode:t.mode,label:n,body:o}},htmlBuilder:To,mathmlBuilder:Eo});j({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r;t.mode==="math"&&t.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var o=e[0];return{type:"enclose",mode:t.mode,label:n,body:o}},htmlBuilder:To,mathmlBuilder:Eo});j({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var Nu={};function Ct(r){for(var{type:e,names:t,props:n,handler:o,htmlBuilder:l,mathmlBuilder:i}=r,s={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:o},u=0;u<t.length;++u)Nu[t[u]]=s;l&&(Zn[e]=l),i&&(eo[e]=i)}var Lu={};function y(r,e){Lu[r]=e}class nt{constructor(e,t,n){this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new nt(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class it{constructor(e,t){this.text=e,this.loc=t}range(e,t){return new it(t,nt.range(this,e))}}function X0(r){var e=[];r.consumeSpaces();var t=r.fetch().text;for(t==="\\relax"&&(r.consume(),r.consumeSpaces(),t=r.fetch().text);t==="\\hline"||t==="\\hdashline";)r.consume(),e.push(t==="\\hdashline"),r.consumeSpaces(),t=r.fetch().text;return e}var So=r=>{var e=r.parser.settings;if(!e.displayMode)throw new _("{"+r.envName+"} can be used only in display mode.")},lh=new Set(["gather","gather*"]);function ya(r){if(!r.includes("ed"))return!r.includes("*")}function Zt(r,e,t){var{hskipBeforeAndAfter:n,addJot:o,cols:l,arraystretch:i,colSeparationType:s,autoTag:u,singleRow:d,emptySingleRow:m,maxNumCols:h,leqno:p}=e;if(r.gullet.beginGroup(),d||r.gullet.macros.set("\\cr","\\\\\\relax"),!i){var v=r.gullet.expandMacroAsText("\\arraystretch");if(v==null)i=1;else if(i=parseFloat(v),!i||i<0)throw new _("Invalid \\arraystretch: "+v)}r.gullet.beginGroup();var b=[],w=[b],k=[],T=[],E=u!=null?[]:void 0;function M(){u&&r.gullet.macros.set("\\@eqnsw","1",!0)}function B(){E&&(r.gullet.macros.get("\\df@tag")?(E.push(r.subparse([new it("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):E.push(!!u&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(M(),T.push(X0(r));;){var D=r.parseExpression(!1,d?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup();var z={type:"ordgroup",mode:r.mode,body:D};t&&(z={type:"styling",mode:r.mode,style:t,body:[z]}),b.push(z);var W=r.fetch().text;if(W==="&"){if(h&&b.length===h){if(d||s)throw new _("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(W==="\\end"){B(),b.length===1&&z.type==="styling"&&z.body.length===1&&z.body[0].type==="ordgroup"&&z.body[0].body.length===0&&(w.length>1||!m)&&w.pop(),T.length<w.length+1&&T.push([]);break}else if(W==="\\\\"){r.consume();var H=void 0;r.gullet.future().text!==" "&&(H=r.parseSizeGroup(!0)),k.push(H?H.value:null),B(),T.push(X0(r)),b=[],w.push(b),M()}else throw new _("Expected & or \\\\ or \\cr or \\end",r.nextToken)}return r.gullet.endGroup(),r.gullet.endGroup(),{type:"array",mode:r.mode,addJot:o,arraystretch:i,body:w,cols:l,rowGaps:k,hskipBeforeAndAfter:n,hLinesBeforeRow:T,colSeparationType:s,tags:E,leqno:p}}function wa(r){return r.slice(0,1)==="d"?"display":"text"}var Tt=function(e,t){var n,o,l=e.body.length,i=e.hLinesBeforeRow,s=0,u=new Array(l),d=[],m=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),h=1/t.fontMetrics().ptPerEm,p=5*h;if(e.colSeparationType&&e.colSeparationType==="small"){var v=t.havingStyle(fe.SCRIPT).sizeMultiplier;p=.2778*(v/t.sizeMultiplier)}var b=e.colSeparationType==="CD"?Ie({number:3,unit:"ex"},t):12*h,w=3*h,k=e.arraystretch*b,T=.7*k,E=.3*k,M=0;function B(yr){for(var wr=0;wr<yr.length;++wr)wr>0&&(M+=.25),d.push({pos:M,isDashed:yr[wr]})}for(B(i[0]),n=0;n<e.body.length;++n){var D=e.body[n],z=T,W=E;s<D.length&&(s=D.length);var H=new Array(D.length);for(o=0;o<D.length;++o){var A=Ce(D[o],t);W<A.depth&&(W=A.depth),z<A.height&&(z=A.height),H[o]=A}var R=e.rowGaps[n],K=0;R&&(K=Ie(R,t),K>0&&(K+=E,W<K&&(W=K),K=0)),e.addJot&&n<e.body.length-1&&(W+=w),H.height=z,H.depth=W,M+=z,H.pos=M,M+=W+K,u[n]=H,B(i[n+1])}var J=M/2+t.fontMetrics().axisHeight,te=e.cols||[],Z=[],le,ee,we=[];if(e.tags&&e.tags.some(yr=>yr))for(n=0;n<l;++n){var pe=u[n],se=pe.pos-J,I=e.tags[n],P=void 0;I===!0?P=U(["eqn-num"],[],t):I===!1?P=U([],[],t):P=U([],Ge(I,t,!0),t),P.depth=pe.depth,P.height=pe.height,we.push({type:"elem",elem:P,shift:se})}for(o=0,ee=0;o<s||ee<te.length;++o,++ee){for(var V,q=te[ee],ae=!0;((ge=q)==null?void 0:ge.type)==="separator";){var ge;if(ae||(le=U(["arraycolsep"],[]),le.style.width=Y(t.fontMetrics().doubleRuleSep),Z.push(le)),q.separator==="|"||q.separator===":"){var ne=q.separator==="|"?"solid":"dashed",N=U(["vertical-separator"],[],t);N.style.height=Y(M),N.style.borderRightWidth=Y(m),N.style.borderRightStyle=ne,N.style.margin="0 "+Y(-m/2);var O=M-J;O&&(N.style.verticalAlign=Y(-O)),Z.push(N)}else throw new _("Invalid separator type: "+q.separator);ee++,q=te[ee],ae=!1}if(!(o>=s)){var $=void 0;if(o>0||e.hskipBeforeAndAfter){var X,oe;$=(X=(oe=q)==null?void 0:oe.pregap)!=null?X:p,$!==0&&(le=U(["arraycolsep"],[]),le.style.width=Y($),Z.push(le))}var ve=[];for(n=0;n<l;++n){var Be=u[n],$e=Be[o];if($e){var ot=Be.pos-J;$e.depth=Be.depth,$e.height=Be.height,ve.push({type:"elem",elem:$e,shift:ot})}}var Xe=xe({positionType:"individualShift",children:ve}),ue=U(["col-align-"+(((V=q)==null?void 0:V.align)||"c")],[Xe]);if(Z.push(ue),o<s-1||e.hskipBeforeAndAfter){var me,Re;$=(me=(Re=q)==null?void 0:Re.postgap)!=null?me:p,$!==0&&(le=U(["arraycolsep"],[]),le.style.width=Y($),Z.push(le))}}}var Ke=U(["mtable"],Z);if(d.length>0){for(var St=Rr("hline",t,m),Ht=Rr("hdashline",t,m),Mt=[{type:"elem",elem:Ke,shift:0}];d.length>0;){var br=d.pop(),vn=br.pos-J;br.isDashed?Mt.push({type:"elem",elem:Ht,shift:vn}):Mt.push({type:"elem",elem:St,shift:vn})}Ke=xe({positionType:"individualShift",children:Mt})}if(we.length===0)return U(["mord"],[Ke],t);var Lo=xe({positionType:"individualShift",children:we}),Wr=U(["tag"],[Lo],t);return Pt([Ke,Wr])},ah={c:"center ",l:"left ",r:"right "},Et=function(e,t){for(var n=[],o=new G("mtd",[],["mtr-glue"]),l=new G("mtd",[],["mml-eqn-num"]),i=0;i<e.body.length;i++){for(var s=e.body[i],u=[],d=0;d<s.length;d++)u.push(new G("mtd",[Ee(s[d],t)]));e.tags&&e.tags[i]&&(u.unshift(o),u.push(o),e.leqno?u.unshift(l):u.push(l)),n.push(new G("mtr",u))}var m=new G("mtable",n),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);m.setAttribute("rowspacing",Y(h));var p="",v="";if(e.cols&&e.cols.length>0){var b=e.cols,w="",k=!1,T=0,E=b.length;b[0].type==="separator"&&(p+="top ",T=1),b[b.length-1].type==="separator"&&(p+="bottom ",E-=1);for(var M=T;M<E;M++){var B=b[M];B.type==="align"?(v+=ah[B.align],k&&(w+="none "),k=!0):B.type==="separator"&&k&&(w+=B.separator==="|"?"solid ":"dashed ",k=!1)}m.setAttribute("columnalign",v.trim()),/[sd]/.test(w)&&m.setAttribute("columnlines",w.trim())}if(e.colSeparationType==="align"){for(var D=e.cols||[],z="",W=1;W<D.length;W++)z+=W%2?"0em ":"1em ";m.setAttribute("columnspacing",z.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?m.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?m.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?m.setAttribute("columnspacing","0.5em"):m.setAttribute("columnspacing","1em");var H="",A=e.hLinesBeforeRow;p+=A[0].length>0?"left ":"",p+=A[A.length-1].length>0?"right ":"";for(var R=1;R<A.length-1;R++)H+=A[R].length===0?"none ":A[R][0]?"dashed ":"solid ";return/[sd]/.test(H)&&m.setAttribute("rowlines",H.trim()),p!==""&&(m=new G("menclose",[m]),m.setAttribute("notation",p.trim())),e.arraystretch&&e.arraystretch<1&&(m=new G("mstyle",[m]),m.setAttribute("scriptlevel","1")),m},Iu=function(e,t){e.envName.includes("ed")||So(e);var n=[],o=e.envName.includes("at")?"alignat":"align",l=e.envName==="split",i=Zt(e.parser,{cols:n,addJot:!0,autoTag:l?void 0:ya(e.envName),emptySingleRow:!0,colSeparationType:o,maxNumCols:l?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,u=0,d={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var m="",h=0;h<t[0].body.length;h++){var p=he(t[0].body[h],"textord");m+=p.text}s=Number(m),u=s*2}var v=!u;i.body.forEach(function(T){for(var E=1;E<T.length;E+=2){var M=he(T[E],"styling"),B=he(M.body[0],"ordgroup");B.body.unshift(d)}if(v)u<T.length&&(u=T.length);else{var D=T.length/2;if(s<D)throw new _("Too many math in a row: "+("expected "+s+", but got "+D),T[0])}});for(var b=0;b<u;++b){var w="r",k=0;b%2===1?w="l":b>0&&v&&(k=1),n[b]={type:"align",align:w,pregap:k,postgap:0}}return i.colSeparationType=v?"align":"alignat",i};Ct({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=ko(e[0]),n=t?[e[0]]:he(e[0],"ordgroup").body,o=n.map(function(i){var s=wo(i),u=s.text;if("lcr".includes(u))return{type:"align",align:u};if(u==="|")return{type:"separator",separator:"|"};if(u===":")return{type:"separator",separator:":"};throw new _("Unknown column alignment: "+u,i)}),l={cols:o,hskipBeforeAndAfter:!0,maxNumCols:o.length};return Zt(r.parser,l,wa(r.envName))},htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var o=r.parser;if(o.consumeSpaces(),o.fetch().text==="["){if(o.consume(),o.consumeSpaces(),t=o.fetch().text,!"lcr".includes(t))throw new _("Expected l or c or r",o.nextToken);o.consume(),o.consumeSpaces(),o.expect("]"),o.consume(),n.cols=[{type:"align",align:t}]}}var l=Zt(r.parser,n,wa(r.envName)),i=Math.max(0,...l.body.map(s=>s.length));return l.cols=new Array(i).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[l],left:e[0],right:e[1],rightColor:void 0}:l},htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=Zt(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=ko(e[0]),n=t?[e[0]]:he(e[0],"ordgroup").body,o=n.map(function(s){var u=wo(s),d=u.text;if("lc".includes(d))return{type:"align",align:d};throw new _("Unknown column alignment: "+d,s)});if(o.length>1)throw new _("{subarray} can contain only one column");var l={cols:o,hskipBeforeAndAfter:!1,arraystretch:.5},i=Zt(r.parser,l,"script");if(i.body.length>0&&i.body[0].length>1)throw new _("{subarray} can contain only one column");return i},htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=Zt(r.parser,e,wa(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.includes("r")?".":"\\{",right:r.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Iu,htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){lh.has(r.envName)&&So(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:ya(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return Zt(r.parser,e,"display")},htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Iu,htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){So(r);var e={autoTag:ya(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return Zt(r.parser,e,"display")},htmlBuilder:Tt,mathmlBuilder:Et});Ct({type:"array",names:["CD"],props:{numArgs:0},handler(r){return So(r),Km(r.parser)},htmlBuilder:Tt,mathmlBuilder:Et});y("\\nonumber","\\gdef\\@eqnsw{0}");y("\\notag","\\nonumber");j({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new _(r.funcName+" valid only within array environment")}});var j0=Nu;j({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:n}=r,o=e[0];if(o.type!=="ordgroup")throw new _("Invalid environment name",o);for(var l="",i=0;i<o.body.length;++i)l+=he(o.body[i],"textord").text;if(n==="\\begin"){if(!j0.hasOwnProperty(l))throw new _("No such environment: "+l,o);var s=j0[l],{args:u,optArgs:d}=t.parseArguments("\\begin{"+l+"}",s),m={mode:t.mode,envName:l,parser:t},h=s.handler(m,u,d);t.expect("\\end",!1);var p=t.nextToken,v=he(t.parseFunction(),"environment");if(v.name!==l)throw new _("Mismatch: \\begin{"+l+"} matched by \\end{"+v.name+"}",p);return h}return{type:"environment",mode:t.mode,name:l,nameGroup:o}}});var zu=(r,e)=>{var t=r.font,n=e.withFont(t);return Ce(r.body,n)},Du=(r,e)=>{var t=r.font,n=e.withFont(t);return Ee(r.body,n)},Q0={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};j({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,o=to(e[0]),l=n;return l in Q0&&(l=Q0[l]),{type:"font",mode:t.mode,font:l.slice(1),body:o}},htmlBuilder:zu,mathmlBuilder:Du});j({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"mclass",mode:t.mode,mclass:xo(n),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:n}],isCharacterBox:Ot(n)}}});j({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,breakOnTokenText:o}=r,{mode:l}=t,i=t.parseExpression(!0,o),s="math"+n.slice(1);return{type:"font",mode:l,font:s,body:{type:"ordgroup",mode:t.mode,body:i}}},htmlBuilder:zu,mathmlBuilder:Du});var ih=(r,e)=>{var t=e.style,n=t.fracNum(),o=t.fracDen(),l;l=e.havingStyle(n);var i=Ce(r.numer,l,e);if(r.continued){var s=8.5/e.fontMetrics().ptPerEm,u=3.5/e.fontMetrics().ptPerEm;i.height=i.height<s?s:i.height,i.depth=i.depth<u?u:i.depth}l=e.havingStyle(o);var d=Ce(r.denom,l,e),m,h,p;r.hasBarLine?(r.barSize?(h=Ie(r.barSize,e),m=Rr("frac-line",e,h)):m=Rr("frac-line",e),h=m.height,p=m.height):(m=null,h=0,p=e.fontMetrics().defaultRuleThickness);var v,b,w;t.size===fe.DISPLAY.size?(v=e.fontMetrics().num1,h>0?b=3*p:b=7*p,w=e.fontMetrics().denom1):(h>0?(v=e.fontMetrics().num2,b=p):(v=e.fontMetrics().num3,b=3*p),w=e.fontMetrics().denom2);var k;if(m){var E=e.fontMetrics().axisHeight;v-i.depth-(E+.5*h)<b&&(v+=b-(v-i.depth-(E+.5*h))),E-.5*h-(d.height-w)<b&&(w+=b-(E-.5*h-(d.height-w)));var M=-(E-.5*h);k=xe({positionType:"individualShift",children:[{type:"elem",elem:d,shift:w},{type:"elem",elem:m,shift:M},{type:"elem",elem:i,shift:-v}]})}else{var T=v-i.depth-(d.height-w);T<b&&(v+=.5*(b-T),w+=.5*(b-T)),k=xe({positionType:"individualShift",children:[{type:"elem",elem:d,shift:w},{type:"elem",elem:i,shift:-v}]})}l=e.havingStyle(t),k.height*=l.sizeMultiplier/e.sizeMultiplier,k.depth*=l.sizeMultiplier/e.sizeMultiplier;var B;t.size===fe.DISPLAY.size?B=e.fontMetrics().delim1:t.size===fe.SCRIPTSCRIPT.size?B=e.havingStyle(fe.SCRIPT).fontMetrics().delim2:B=e.fontMetrics().delim2;var D,z;return r.leftDelim==null?D=sn(e,["mopen"]):D=Wl(r.leftDelim,B,!0,e.havingStyle(t),r.mode,["mopen"]),r.continued?z=U([]):r.rightDelim==null?z=sn(e,["mclose"]):z=Wl(r.rightDelim,B,!0,e.havingStyle(t),r.mode,["mclose"]),U(["mord"].concat(l.sizingClasses(e)),[D,U(["mfrac"],[k]),z],e)},sh=(r,e)=>{var t=new G("mfrac",[Ee(r.numer,e),Ee(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var n=Ie(r.barSize,e);t.setAttribute("linethickness",Y(n))}if(r.leftDelim!=null||r.rightDelim!=null){var o=[];if(r.leftDelim!=null){var l=new G("mo",[new Ve(r.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}if(o.push(t),r.rightDelim!=null){var i=new G("mo",[new Ve(r.rightDelim.replace("\\",""))]);i.setAttribute("fence","true"),o.push(i)}return pa(o)}return t},Ou=(r,e)=>{if(!e)return r;var t={type:"styling",mode:r.mode,style:e,body:[r]};return t};j({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,o=e[0],l=e[1],i,s=null,u=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":i=!0;break;case"\\\\atopfrac":i=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i=!1,s="(",u=")";break;case"\\\\bracefrac":i=!1,s="\\{",u="\\}";break;case"\\\\brackfrac":i=!1,s="[",u="]";break;default:throw new Error("Unrecognized genfrac command")}var d=n==="\\cfrac",m=null;return d||n.startsWith("\\d")?m="display":n.startsWith("\\t")&&(m="text"),Ou({type:"genfrac",mode:t.mode,numer:o,denom:l,continued:d,hasBarLine:i,leftDelim:s,rightDelim:u,barSize:null},m)},htmlBuilder:ih,mathmlBuilder:sh});j({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:n}=r,o;switch(t){case"\\over":o="\\frac";break;case"\\choose":o="\\binom";break;case"\\atop":o="\\\\atopfrac";break;case"\\brace":o="\\\\bracefrac";break;case"\\brack":o="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:o,token:n}}});var Z0=["display","text","script","scriptscript"],ei=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};j({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,n=e[4],o=e[5],l=to(e[0]),i=l.type==="atom"&&l.family==="open"?ei(l.text):null,s=to(e[1]),u=s.type==="atom"&&s.family==="close"?ei(s.text):null,d=he(e[2],"size"),m,h=null;d.isBlank?m=!0:(h=d.value,m=h.number>0);var p=null,v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=he(v.body[0],"textord");p=Z0[Number(b.text)]}}else v=he(v,"textord"),p=Z0[Number(v.text)];return Ou({type:"genfrac",mode:t.mode,numer:n,denom:o,continued:!1,hasBarLine:m,barSize:h,leftDelim:i,rightDelim:u},p)}});j({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:n,token:o}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:he(e[0],"size").value,token:o}}});j({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:n}=r,o=e[0],l=he(e[1],"infix").size;if(!l)throw new Error("\\\\abovefrac expected size, but got "+String(l));var i=e[2],s=l.number>0;return{type:"genfrac",mode:t.mode,numer:o,denom:i,continued:!1,hasBarLine:s,barSize:l,leftDelim:null,rightDelim:null}}});var Ru=(r,e)=>{var t=e.style,n,o;r.type==="supsub"?(n=r.sup?Ce(r.sup,e.havingStyle(t.sup()),e):Ce(r.sub,e.havingStyle(t.sub()),e),o=he(r.base,"horizBrace")):o=he(r,"horizBrace");var l=Ce(o.base,e.havingBaseStyle(fe.DISPLAY)),i=yo(o,e),s;if(o.isOver?(s=xe({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]}),s.children[0].children[0].children[1].classes.push("svg-align")):(s=xe({positionType:"bottom",positionData:l.depth+.1+i.height,children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]}),s.children[0].children[0].children[0].classes.push("svg-align")),n){var u=U(["minner",o.isOver?"mover":"munder"],[s],e);o.isOver?s=xe({positionType:"firstBaseline",children:[{type:"elem",elem:u},{type:"kern",size:.2},{type:"elem",elem:n}]}):s=xe({positionType:"bottom",positionData:u.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:u}]})}return U(["minner",o.isOver?"mover":"munder"],[s],e)},uh=(r,e)=>{var t=bo(r.label);return new G(r.isOver?"mover":"munder",[Ee(r.base,e),t])};j({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"horizBrace",mode:t.mode,label:n,isOver:n.includes("\\over"),base:e[0]}},htmlBuilder:Ru,mathmlBuilder:uh});j({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[1],o=he(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:t.mode,href:o,body:He(n)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=Ge(r.body,e,!1);return Sm(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=jt(r.body,e);return t instanceof G||(t=new G("mrow",[t])),t.setAttribute("href",r.href),t}});j({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=he(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:n}))return t.formatUnsupportedCmd("\\url");for(var o=[],l=0;l<n.length;l++){var i=n[l];i==="~"&&(i="\\textasciitilde"),o.push({type:"textord",mode:"text",text:i})}var s={type:"text",mode:t.mode,font:"\\texttt",body:o};return{type:"href",mode:t.mode,href:n,body:He(s)}}});j({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(r,e){var{parser:t}=r;return{type:"hbox",mode:t.mode,body:He(e[0])}},htmlBuilder(r,e){var t=Ge(r.body,e,!1);return Pt(t)},mathmlBuilder(r,e){return new G("mrow",dt(r.body,e))}});j({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,token:o}=r,l=he(e[0],"raw").string,i=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var s,u={};switch(n){case"\\htmlClass":u.class=l,s={command:"\\htmlClass",class:l};break;case"\\htmlId":u.id=l,s={command:"\\htmlId",id:l};break;case"\\htmlStyle":u.style=l,s={command:"\\htmlStyle",style:l};break;case"\\htmlData":{for(var d=l.split(","),m=0;m<d.length;m++){var h=d[m],p=h.indexOf("=");if(p<0)throw new _("\\htmlData key/value '"+h+"' missing equals sign");var v=h.slice(0,p),b=h.slice(p+1);u["data-"+v.trim()]=b}s={command:"\\htmlData",attributes:u};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(s)?{type:"html",mode:t.mode,attributes:u,body:He(i)}:t.formatUnsupportedCmd(n)},htmlBuilder:(r,e)=>{var t=Ge(r.body,e,!1),n=["enclosing"];r.attributes.class&&n.push(...r.attributes.class.trim().split(/\s+/));var o=U(n,t,e);for(var l in r.attributes)l!=="class"&&r.attributes.hasOwnProperty(l)&&o.setAttribute(l,r.attributes[l]);return o},mathmlBuilder:(r,e)=>jt(r.body,e)});j({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:He(e[0]),mathml:He(e[1])}},htmlBuilder:(r,e)=>{var t=Ge(r.html,e,!1);return Pt(t)},mathmlBuilder:(r,e)=>jt(r.mathml,e)});var il=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new _("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!Zs(n))throw new _("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};j({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:n}=r,o={number:0,unit:"em"},l={number:.9,unit:"em"},i={number:0,unit:"em"},s="";if(t[0])for(var u=he(t[0],"raw").string,d=u.split(","),m=0;m<d.length;m++){var h=d[m].split("=");if(h.length===2){var p=h[1].trim();switch(h[0].trim()){case"alt":s=p;break;case"width":o=il(p);break;case"height":l=il(p);break;case"totalheight":i=il(p);break;default:throw new _("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var v=he(e[0],"url").url;return s===""&&(s=v,s=s.replace(/^.*[\\/]/,""),s=s.substring(0,s.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:v})?{type:"includegraphics",mode:n.mode,alt:s,width:o,height:l,totalheight:i,src:v}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(r,e)=>{var t=Ie(r.height,e),n=0;r.totalheight.number>0&&(n=Ie(r.totalheight,e)-t);var o=0;r.width.number>0&&(o=Ie(r.width,e));var l={height:Y(t+n)};o>0&&(l.width=Y(o)),n>0&&(l.verticalAlign=Y(-n));var i=new hm(r.src,r.alt,l);return i.height=t,i.depth=n,i},mathmlBuilder:(r,e)=>{var t=new G("mglyph",[]);t.setAttribute("alt",r.alt);var n=Ie(r.height,e),o=0;if(r.totalheight.number>0&&(o=Ie(r.totalheight,e)-n,t.setAttribute("valign",Y(-o))),t.setAttribute("height",Y(n+o)),r.width.number>0){var l=Ie(r.width,e);t.setAttribute("width",Y(l))}return t.setAttribute("src",r.src),t}});j({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,o=he(e[0],"size");if(t.settings.strict){var l=n[1]==="m",i=o.value.unit==="mu";l?(i||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+o.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):i&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:o.value}},htmlBuilder(r,e){return lu(r.dimension,e)},mathmlBuilder(r,e){var t=Ie(r.dimension,e);return new du(t)}});j({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,o=e[0];return{type:"lap",mode:t.mode,alignment:n.slice(5),body:o}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=U([],[Ce(r.body,e)]),t=U(["inner"],[t],e)):t=U(["inner"],[Ce(r.body,e)]);var n=U(["fix"],[]),o=U([r.alignment],[t,n],e),l=U(["strut"]);return l.style.height=Y(o.height+o.depth),o.depth&&(l.style.verticalAlign=Y(-o.depth)),o.children.unshift(l),o=U(["thinbox"],[o],e),U(["mord","vbox"],[o],e)},mathmlBuilder:(r,e)=>{var t=new G("mpadded",[Ee(r.body,e)]);if(r.alignment!=="rlap"){var n=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",n+"width")}return t.setAttribute("width","0px"),t}});j({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:n}=r,o=n.mode;n.switchMode("math");var l=t==="\\("?"\\)":"$",i=n.parseExpression(!1,l);return n.expect(l),n.switchMode(o),{type:"styling",mode:n.mode,style:"text",body:i}}});j({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new _("Mismatched "+r.funcName)}});var ti=(r,e)=>{switch(e.style.size){case fe.DISPLAY.size:return r.display;case fe.TEXT.size:return r.text;case fe.SCRIPT.size:return r.script;case fe.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};j({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:He(e[0]),text:He(e[1]),script:He(e[2]),scriptscript:He(e[3])}},htmlBuilder:(r,e)=>{var t=ti(r,e),n=Ge(t,e,!1);return Pt(n)},mathmlBuilder:(r,e)=>{var t=ti(r,e);return jt(t,e)}});var Pu=(r,e,t,n,o,l,i)=>{r=U([],[r]);var s=t&&Ot(t),u,d;if(e){var m=Ce(e,n.havingStyle(o.sup()),n);d={elem:m,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-m.depth)}}if(t){var h=Ce(t,n.havingStyle(o.sub()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-h.height)}}var p;if(d&&u){var v=n.fontMetrics().bigOpSpacing5+u.elem.height+u.elem.depth+u.kern+r.depth+i;p=xe({positionType:"bottom",positionData:v,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:u.elem,marginLeft:Y(-l)},{type:"kern",size:u.kern},{type:"elem",elem:r},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Y(l)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(u){var b=r.height-i;p=xe({positionType:"top",positionData:b,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:u.elem,marginLeft:Y(-l)},{type:"kern",size:u.kern},{type:"elem",elem:r}]})}else if(d){var w=r.depth+i;p=xe({positionType:"bottom",positionData:w,children:[{type:"elem",elem:r},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Y(l)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return r;var k=[p];if(u&&l!==0&&!s){var T=U(["mspace"],[],n);T.style.marginRight=Y(l),k.unshift(T)}return U(["mop","op-limits"],k,n)},Hu=new Set(["\\smallint"]),Ur=(r,e)=>{var t,n,o=!1,l;r.type==="supsub"?(t=r.sup,n=r.sub,l=he(r.base,"op"),o=!0):l=he(r,"op");var i=e.style,s=!1;i.size===fe.DISPLAY.size&&l.symbol&&!Hu.has(l.name)&&(s=!0);var u;if(l.symbol){var d=s?"Size2-Regular":"Size1-Regular",m="";if((l.name==="\\oiint"||l.name==="\\oiiint")&&(m=l.name.slice(1),l.name=m==="oiint"?"\\iint":"\\iiint"),u=Ze(l.name,d,"math",e,["mop","op-symbol",s?"large-op":"small-op"]),m.length>0){var h=u.italic,p=iu(m+"Size"+(s?"2":"1"),e);u=xe({positionType:"individualShift",children:[{type:"elem",elem:u,shift:0},{type:"elem",elem:p,shift:s?.08:0}]}),l.name="\\"+m,u.classes.unshift("mop"),u.italic=h}}else if(l.body){var v=Ge(l.body,e,!0);v.length===1&&v[0]instanceof ut?(u=v[0],u.classes[0]="mop"):u=U(["mop"],v,e)}else{for(var b=[],w=1;w<l.name.length;w++)b.push(ma(l.name[w],l.mode,e));u=U(["mop"],b,e)}var k=0,T=0;return(u instanceof ut||l.name==="\\oiint"||l.name==="\\oiiint")&&!l.suppressBaseShift&&(k=(u.height-u.depth)/2-e.fontMetrics().axisHeight,T=u.italic||0),o?Pu(u,t,n,e,i,T,k):(k&&(u.style.position="relative",u.style.top=Y(k)),u)},gn=(r,e)=>{var t;if(r.symbol)t=new G("mo",[pt(r.name,r.mode)]),Hu.has(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new G("mo",dt(r.body,e));else{t=new G("mi",[new Ve(r.name.slice(1))]);var n=new G("mo",[pt("⁡","text")]);r.parentIsSupSub?t=new G("mrow",[t,n]):t=cu([t,n])}return t},ch={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};j({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:n}=r,o=n;return o.length===1&&(o=ch[o]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:o}},htmlBuilder:Ur,mathmlBuilder:gn});j({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:He(n)}},htmlBuilder:Ur,mathmlBuilder:gn});var dh={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};j({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Ur,mathmlBuilder:gn});j({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Ur,mathmlBuilder:gn});j({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,n=t;return n.length===1&&(n=dh[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:Ur,mathmlBuilder:gn});var Vu=(r,e)=>{var t,n,o=!1,l;r.type==="supsub"?(t=r.sup,n=r.sub,l=he(r.base,"operatorname"),o=!0):l=he(r,"operatorname");var i;if(l.body.length>0){for(var s=l.body.map(h=>{var p="text"in h?h.text:void 0;return typeof p=="string"?{type:"textord",mode:h.mode,text:p}:h}),u=Ge(s,e.withFont("mathrm"),!0),d=0;d<u.length;d++){var m=u[d];m instanceof ut&&(m.text=m.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}i=U(["mop"],u,e)}else i=U(["mop"],[],e);return o?Pu(i,t,n,e,e.style,0,0):i},fh=(r,e)=>{for(var t=dt(r.body,e.withFont("mathrm")),n=!0,o=0;o<t.length;o++){var l=t[o];if(!(l instanceof du))if(l instanceof G)switch(l.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var i=l.children[0];l.children.length===1&&i instanceof Ve?i.text=i.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var s=t.map(m=>m.toText()).join("");t=[new Ve(s)]}var u=new G("mi",t);u.setAttribute("mathvariant","normal");var d=new G("mo",[pt("⁡","text")]);return r.parentIsSupSub?new G("mrow",[u,d]):cu([u,d])};j({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,o=e[0];return{type:"operatorname",mode:t.mode,body:He(o),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Vu,mathmlBuilder:fh});y("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");vr({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?Pt(Ge(r.body,e,!1)):U(["mord"],Ge(r.body,e,!0),e)},mathmlBuilder(r,e){return jt(r.body,e,!0)}});j({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,n=e[0];return{type:"overline",mode:t.mode,body:n}},htmlBuilder(r,e){var t=Ce(r.body,e.havingCrampedStyle()),n=Rr("overline-line",e),o=e.fontMetrics().defaultRuleThickness,l=xe({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*o},{type:"elem",elem:n},{type:"kern",size:o}]});return U(["mord","overline"],[l],e)},mathmlBuilder(r,e){var t=new G("mo",[new Ve("‾")]);t.setAttribute("stretchy","true");var n=new G("mover",[Ee(r.body,e),t]);return n.setAttribute("accent","true"),n}});j({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"phantom",mode:t.mode,body:He(n)}},htmlBuilder:(r,e)=>{var t=Ge(r.body,e.withPhantom(),!1);return Pt(t)},mathmlBuilder:(r,e)=>{var t=dt(r.body,e);return new G("mphantom",t)}});y("\\hphantom","\\smash{\\phantom{#1}}");j({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"vphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=U(["inner"],[Ce(r.body,e.withPhantom())]),n=U(["fix"],[]);return U(["mord","rlap"],[t,n],e)},mathmlBuilder:(r,e)=>{var t=dt(He(r.body),e),n=new G("mphantom",t),o=new G("mpadded",[n]);return o.setAttribute("width","0px"),o}});j({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,n=he(e[0],"size").value,o=e[1];return{type:"raisebox",mode:t.mode,dy:n,body:o}},htmlBuilder(r,e){var t=Ce(r.body,e),n=Ie(r.dy,e);return xe({positionType:"shift",positionData:-n,children:[{type:"elem",elem:t}]})},mathmlBuilder(r,e){var t=new G("mpadded",[Ee(r.body,e)]),n=r.dy.number+r.dy.unit;return t.setAttribute("voffset",n),t}});j({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}});j({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:n}=r,o=t[0],l=he(e[0],"size"),i=he(e[1],"size");return{type:"rule",mode:n.mode,shift:o&&he(o,"size").value,width:l.value,height:i.value}},htmlBuilder(r,e){var t=U(["mord","rule"],[],e),n=Ie(r.width,e),o=Ie(r.height,e),l=r.shift?Ie(r.shift,e):0;return t.style.borderRightWidth=Y(n),t.style.borderTopWidth=Y(o),t.style.bottom=Y(l),t.width=n,t.height=o+l,t.depth=-l,t.maxFontSize=o*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=Ie(r.width,e),n=Ie(r.height,e),o=r.shift?Ie(r.shift,e):0,l=e.color&&e.getColor()||"black",i=new G("mspace");i.setAttribute("mathbackground",l),i.setAttribute("width",Y(t)),i.setAttribute("height",Y(n));var s=new G("mpadded",[i]);return o>=0?s.setAttribute("height",Y(o)):(s.setAttribute("height",Y(o)),s.setAttribute("depth",Y(-o))),s.setAttribute("voffset",Y(o)),s}});function Fu(r,e,t){for(var n=Ge(r,e,!1),o=e.sizeMultiplier/t.sizeMultiplier,l=0;l<n.length;l++){var i=n[l].classes.indexOf("sizing");i<0?Array.prototype.push.apply(n[l].classes,e.sizingClasses(t)):n[l].classes[i+1]==="reset-size"+e.size&&(n[l].classes[i+1]="reset-size"+t.size),n[l].height*=o,n[l].depth*=o}return Pt(n)}var ri=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],mh=(r,e)=>{var t=e.havingSize(r.size);return Fu(r.body,t,e)};j({type:"sizing",names:ri,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:n,parser:o}=r,l=o.parseExpression(!1,t);return{type:"sizing",mode:o.mode,size:ri.indexOf(n)+1,body:l}},htmlBuilder:mh,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),n=dt(r.body,t),o=new G("mstyle",n);return o.setAttribute("mathsize",Y(t.sizeMultiplier)),o}});j({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:n}=r,o=!1,l=!1,i=t[0]&&he(t[0],"ordgroup");if(i)for(var s="",u=0;u<i.body.length;++u){var d=i.body[u];if(s=wo(d).text,s==="t")o=!0;else if(s==="b")l=!0;else{o=!1,l=!1;break}}else o=!0,l=!0;var m=e[0];return{type:"smash",mode:n.mode,body:m,smashHeight:o,smashDepth:l}},htmlBuilder:(r,e)=>{var t=U([],[Ce(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0),r.smashDepth&&(t.depth=0),r.smashHeight&&r.smashDepth)return U(["mord","smash"],[t],e);if(t.children)for(var n=0;n<t.children.length;n++)r.smashHeight&&(t.children[n].height=0),r.smashDepth&&(t.children[n].depth=0);var o=xe({positionType:"firstBaseline",children:[{type:"elem",elem:t}]});return U(["mord"],[o],e)},mathmlBuilder:(r,e)=>{var t=new G("mpadded",[Ee(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}});j({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n}=r,o=t[0],l=e[0];return{type:"sqrt",mode:n.mode,body:l,index:o}},htmlBuilder(r,e){var t=Ce(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=Pr(t,e);var n=e.fontMetrics(),o=n.defaultRuleThickness,l=o;e.style.id<fe.TEXT.id&&(l=e.fontMetrics().xHeight);var i=o+l/4,s=t.height+t.depth+i+o,{span:u,ruleWidth:d,advanceWidth:m}=Zm(s,e),h=u.height-d;h>t.height+t.depth+i&&(i=(i+h-t.height-t.depth)/2);var p=u.height-t.height-i-d;t.style.paddingLeft=Y(m);var v=xe({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+p)},{type:"elem",elem:u},{type:"kern",size:d}]});if(r.index){var b=e.havingStyle(fe.SCRIPTSCRIPT),w=Ce(r.index,b,e),k=.6*(v.height-v.depth),T=xe({positionType:"shift",positionData:-k,children:[{type:"elem",elem:w}]}),E=U(["root"],[T]);return U(["mord","sqrt"],[E,v],e)}else return U(["mord","sqrt"],[v],e)},mathmlBuilder(r,e){var{body:t,index:n}=r;return n?new G("mroot",[Ee(t,e),Ee(n,e)]):new G("msqrt",[Ee(t,e)])}});var ni={display:fe.DISPLAY,text:fe.TEXT,script:fe.SCRIPT,scriptscript:fe.SCRIPTSCRIPT};j({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:n,parser:o}=r,l=o.parseExpression(!0,t),i=n.slice(1,n.length-5);return{type:"styling",mode:o.mode,style:i,body:l}},htmlBuilder(r,e){var t=ni[r.style],n=e.havingStyle(t).withFont("");return Fu(r.body,n,e)},mathmlBuilder(r,e){var t=ni[r.style],n=e.havingStyle(t),o=dt(r.body,n),l=new G("mstyle",o),i={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},s=i[r.style];return l.setAttribute("scriptlevel",s[0]),l.setAttribute("displaystyle",s[1]),l}});var hh=function(e,t){var n=e.base;if(n)if(n.type==="op"){var o=n.limits&&(t.style.size===fe.DISPLAY.size||n.alwaysHandleSupSub);return o?Ur:null}else if(n.type==="operatorname"){var l=n.alwaysHandleSupSub&&(t.style.size===fe.DISPLAY.size||n.limits);return l?Vu:null}else{if(n.type==="accent")return Ot(n.base)?va:null;if(n.type==="horizBrace"){var i=!e.sub;return i===n.isOver?Ru:null}else return null}else return null};vr({type:"supsub",htmlBuilder(r,e){var t=hh(r,e);if(t)return t(r,e);var{base:n,sup:o,sub:l}=r,i=Ce(n,e),s,u,d=e.fontMetrics(),m=0,h=0,p=n&&Ot(n);if(o){var v=e.havingStyle(e.style.sup());s=Ce(o,v,e),p||(m=i.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(l){var b=e.havingStyle(e.style.sub());u=Ce(l,b,e),p||(h=i.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var w;e.style===fe.DISPLAY?w=d.sup1:e.style.cramped?w=d.sup3:w=d.sup2;var k=e.sizeMultiplier,T=Y(.5/d.ptPerEm/k),E=null;if(u){var M=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(i instanceof ut||M)&&(E=Y(-i.italic))}var B;if(s&&u){m=Math.max(m,w,s.depth+.25*d.xHeight),h=Math.max(h,d.sub2);var D=d.defaultRuleThickness,z=4*D;if(m-s.depth-(u.height-h)<z){h=z-(m-s.depth)+u.height;var W=.8*d.xHeight-(m-s.depth);W>0&&(m+=W,h-=W)}var H=[{type:"elem",elem:u,shift:h,marginRight:T,marginLeft:E},{type:"elem",elem:s,shift:-m,marginRight:T}];B=xe({positionType:"individualShift",children:H})}else if(u){h=Math.max(h,d.sub1,u.height-.8*d.xHeight);var A=[{type:"elem",elem:u,marginLeft:E,marginRight:T}];B=xe({positionType:"shift",positionData:h,children:A})}else if(s)m=Math.max(m,w,s.depth+.25*d.xHeight),B=xe({positionType:"shift",positionData:-m,children:[{type:"elem",elem:s,marginRight:T}]});else throw new Error("supsub must have either sup or sub.");var R=Fl(i,"right")||"mord";return U([R],[i,U(["msupsub"],[B])],e)},mathmlBuilder(r,e){var t=!1,n,o;r.base&&r.base.type==="horizBrace"&&(o=!!r.sup,o===r.base.isOver&&(t=!0,n=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var l=[Ee(r.base,e)];r.sub&&l.push(Ee(r.sub,e)),r.sup&&l.push(Ee(r.sup,e));var i;if(t)i=n?"mover":"munder";else if(r.sub)if(r.sup){var d=r.base;d&&d.type==="op"&&d.limits&&e.style===fe.DISPLAY||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(e.style===fe.DISPLAY||d.limits)?i="munderover":i="msubsup"}else{var u=r.base;u&&u.type==="op"&&u.limits&&(e.style===fe.DISPLAY||u.alwaysHandleSupSub)||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(u.limits||e.style===fe.DISPLAY)?i="munder":i="msub"}else{var s=r.base;s&&s.type==="op"&&s.limits&&(e.style===fe.DISPLAY||s.alwaysHandleSupSub)||s&&s.type==="operatorname"&&s.alwaysHandleSupSub&&(s.limits||e.style===fe.DISPLAY)?i="mover":i="msup"}return new G(i,l)}});vr({type:"atom",htmlBuilder(r,e){return ma(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new G("mo",[pt(r.text,r.mode)]);if(r.family==="bin"){var n=ga(r,e);n==="bold-italic"&&t.setAttribute("mathvariant",n)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});var $u={mi:"italic",mn:"normal",mtext:"normal"};vr({type:"mathord",htmlBuilder(r,e){return vo(r,e,"mathord")},mathmlBuilder(r,e){var t=new G("mi",[pt(r.text,r.mode,e)]),n=ga(r,e)||"italic";return n!==$u[t.type]&&t.setAttribute("mathvariant",n),t}});vr({type:"textord",htmlBuilder(r,e){return vo(r,e,"textord")},mathmlBuilder(r,e){var t=pt(r.text,r.mode,e),n=ga(r,e)||"normal",o;return r.mode==="text"?o=new G("mtext",[t]):/[0-9]/.test(r.text)?o=new G("mn",[t]):r.text==="\\prime"?o=new G("mo",[t]):o=new G("mi",[t]),n!==$u[o.type]&&o.setAttribute("mathvariant",n),o}});var sl={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},ul={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};vr({type:"spacing",htmlBuilder(r,e){if(ul.hasOwnProperty(r.text)){var t=ul[r.text].className||"";if(r.mode==="text"){var n=vo(r,e,"textord");return n.classes.push(t),n}else return U(["mspace",t],[ma(r.text,r.mode,e)],e)}else{if(sl.hasOwnProperty(r.text))return U(["mspace",sl[r.text]],[],e);throw new _('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(ul.hasOwnProperty(r.text))t=new G("mtext",[new Ve(" ")]);else{if(sl.hasOwnProperty(r.text))return new G("mspace");throw new _('Unknown type of space "'+r.text+'"')}return t}});var oi=()=>{var r=new G("mtd",[]);return r.setAttribute("width","50%"),r};vr({type:"tag",mathmlBuilder(r,e){var t=new G("mtable",[new G("mtr",[oi(),new G("mtd",[jt(r.body,e)]),oi(),new G("mtd",[jt(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});var li={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},ai={"\\textbf":"textbf","\\textmd":"textmd"},ph={"\\textit":"textit","\\textup":"textup"},ii=(r,e)=>{var t=r.font;if(t){if(li[t])return e.withTextFontFamily(li[t]);if(ai[t])return e.withTextFontWeight(ai[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(ph[t])};j({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,o=e[0];return{type:"text",mode:t.mode,body:He(o),font:n}},htmlBuilder(r,e){var t=ii(r,e),n=Ge(r.body,t,!0);return U(["mord","text"],n,t)},mathmlBuilder(r,e){var t=ii(r,e);return jt(r.body,t)}});j({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=Ce(r.body,e),n=Rr("underline-line",e),o=e.fontMetrics().defaultRuleThickness,l=xe({positionType:"top",positionData:t.height,children:[{type:"kern",size:o},{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:t}]});return U(["mord","underline"],[l],e)},mathmlBuilder(r,e){var t=new G("mo",[new Ve("‾")]);t.setAttribute("stretchy","true");var n=new G("munder",[Ee(r.body,e),t]);return n.setAttribute("accentunder","true"),n}});j({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=Ce(r.body,e),n=e.fontMetrics().axisHeight,o=.5*(t.height-n-(t.depth+n));return xe({positionType:"shift",positionData:o,children:[{type:"elem",elem:t}]})},mathmlBuilder(r,e){var t=new G("mpadded",[Ee(r.body,e)],["vcenter"]);return new G("mrow",[t])}});j({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new _("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=si(r),n=[],o=e.havingStyle(e.style.text()),l=0;l<t.length;l++){var i=t[l];i==="~"&&(i="\\textasciitilde"),n.push(Ze(i,"Typewriter-Regular",r.mode,o,["mord","texttt"]))}return U(["mord","text"].concat(o.sizingClasses(e)),ou(n),o)},mathmlBuilder(r,e){var t=new Ve(si(r)),n=new G("mtext",[t]);return n.setAttribute("mathvariant","monospace"),n}});var si=r=>r.body.replace(/ /g,r.star?"␣":" "),_t=su,qu=`[ \r
303
- ]`,gh="\\\\[a-zA-Z@]+",vh="\\\\[^\uD800-\uDFFF]",bh="("+gh+")"+qu+"*",yh=`\\\\(
295
+ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
296
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class lr{constructor(e){this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),r=0;r<this.children.length;r++)e.appendChild(this.children[r].toNode());return e}toMarkup(){for(var e="",r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e}toText(){var e=r=>r.toText();return this.children.map(e).join("")}}var u0={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},zc={ex:!0,em:!0,mu:!0},ml=function(e){return typeof e!="string"&&(e=e.unit),e in u0||e in zc||e==="ex"},Ae=function(e,r){var n;if(e.unit in u0)n=u0[e.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(e.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var o;if(r.style.isTight()?o=r.havingStyle(r.style.text()):o=r,e.unit==="ex")n=o.fontMetrics().xHeight;else if(e.unit==="em")n=o.fontMetrics().quad;else throw new _("Invalid unit: '"+e.unit+"'");o!==r&&(n*=o.sizeMultiplier/r.sizeMultiplier)}return Math.min(e.number*n,r.maxSize)},j=function(e){return+e.toFixed(4)+"em"},At=function(e){return e.filter(r=>r).join(" ")},fl=function(e,r,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var o=r.getColor();o&&(this.style.color=o)}},pl=function(e){var r=document.createElement(e);r.className=At(this.classes);for(var n of Object.keys(this.style))r.style[n]=this.style[n];for(var o of Object.keys(this.attributes))r.setAttribute(o,this.attributes[o]);for(var l=0;l<this.children.length;l++)r.appendChild(this.children[l].toNode());return r},Dc=/[\s"'>/=\x00-\x1f]/,hl=function(e){var r="<"+e;this.classes.length&&(r+=' class="'+Fe(At(this.classes))+'"');var n="";for(var o of Object.keys(this.style))n+=B0(o)+":"+this.style[o]+";";n&&(r+=' style="'+Fe(n)+'"');for(var l of Object.keys(this.attributes)){if(Dc.test(l))throw new _("Invalid attribute name '"+l+"'");r+=" "+l+'="'+Fe(this.attributes[l])+'"'}r+=">";for(var i=0;i<this.children.length;i++)r+=this.children[i].toMarkup();return r+="</"+e+">",r};class ir{constructor(e,r,n,o){fl.call(this,e,n,o),this.children=r||[]}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return this.classes.includes(e)}toNode(){return pl.call(this,"span")}toMarkup(){return hl.call(this,"span")}}class sn{constructor(e,r,n,o){fl.call(this,r,o),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return this.classes.includes(e)}toNode(){return pl.call(this,"a")}toMarkup(){return hl.call(this,"a")}}class Hc{constructor(e,r,n){this.alt=r,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var r of Object.keys(this.style))e.style[r]=this.style[r];return e}toMarkup(){var e='<img src="'+Fe(this.src)+'"'+(' alt="'+Fe(this.alt)+'"'),r="";for(var n of Object.keys(this.style))r+=B0(n)+":"+this.style[n]+";";return r&&(e+=' style="'+Fe(r)+'"'),e+="'/>",e}}var Rc={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Qe{constructor(e,r,n,o,l,i,s,c){this.text=e,this.height=r||0,this.depth=n||0,this.italic=o||0,this.skew=l||0,this.width=i||0,this.classes=s||[],this.style=c||{},this.maxFontSize=0;var m=xc(this.text.charCodeAt(0));m&&this.classes.push(m+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Rc[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),r=null;this.italic>0&&(r=document.createElement("span"),r.style.marginRight=j(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=At(this.classes));for(var n of Object.keys(this.style))r=r||document.createElement("span"),r.style[n]=this.style[n];return r?(r.appendChild(e),r):e}toMarkup(){var e=!1,r="<span";this.classes.length&&(e=!0,r+=' class="',r+=Fe(At(this.classes)),r+='"');var n="";this.italic>0&&(n+="margin-right:"+j(this.italic)+";");for(var o of Object.keys(this.style))n+=B0(o)+":"+this.style[o]+";";n&&(e=!0,r+=' style="'+Fe(n)+'"');var l=Fe(this.text);return e?(r+=">",r+=l,r+="</span>",r):l}}class vt{constructor(e,r){this.children=e||[],this.attributes=r||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"svg");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);for(var o=0;o<this.children.length;o++)r.appendChild(this.children[o].toNode());return r}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var r of Object.keys(this.attributes))e+=" "+r+'="'+Fe(this.attributes[r])+'"';e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class Bt{constructor(e,r){this.pathName=e,this.alternate=r}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"path");return this.alternate?r.setAttribute("d",this.alternate):r.setAttribute("d",Na[this.pathName]),r}toMarkup(){return this.alternate?'<path d="'+Fe(this.alternate)+'"/>':'<path d="'+Fe(Na[this.pathName])+'"/>'}}class c0{constructor(e){this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"line");for(var n of Object.keys(this.attributes))r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var e="<line";for(var r of Object.keys(this.attributes))e+=" "+r+'="'+Fe(this.attributes[r])+'"';return e+="/>",e}}function Pc(t){if(t instanceof Qe)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function Oc(t){if(t instanceof ir)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var Vc=t=>t instanceof ir||t instanceof sn||t instanceof lr,lt={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Br={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Ia={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function $c(t,e){lt[t]=e}function I0(t,e,r){if(!lt[e])throw new Error("Font metrics not found for font: "+e+".");var n=t.charCodeAt(0),o=lt[e][n];if(!o&&t[0]in Ia&&(n=Ia[t[0]].charCodeAt(0),o=lt[e][n]),!o&&r==="text"&&dl(n)&&(o=lt[e][77]),o)return{depth:o[0],height:o[1],italic:o[2],skew:o[3],width:o[4]}}var Hn={};function Fc(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!Hn[e]){var r=Hn[e]={cssEmPerMu:Br.quad[e]/18};for(var n in Br)Br.hasOwnProperty(n)&&(r[n]=Br[n][e])}return Hn[e]}var qc={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Uc={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ce={math:{},text:{}};function u(t,e,r,n,o,l){Ce[t][o]={font:e,group:r,replace:n},l&&n&&(Ce[t][n]=Ce[t][o])}var d="math",O="text",h="main",x="ams",Ee="accent-token",ee="bin",Ge="close",sr="inner",ie="mathord",ze="op-token",Ze="open",Cr="punct",C="rel",bt="spacing",A="textord";u(d,h,C,"≡","\\equiv",!0);u(d,h,C,"≺","\\prec",!0);u(d,h,C,"≻","\\succ",!0);u(d,h,C,"∼","\\sim",!0);u(d,h,C,"⊥","\\perp");u(d,h,C,"⪯","\\preceq",!0);u(d,h,C,"⪰","\\succeq",!0);u(d,h,C,"≃","\\simeq",!0);u(d,h,C,"∣","\\mid",!0);u(d,h,C,"≪","\\ll",!0);u(d,h,C,"≫","\\gg",!0);u(d,h,C,"≍","\\asymp",!0);u(d,h,C,"∥","\\parallel");u(d,h,C,"⋈","\\bowtie",!0);u(d,h,C,"⌣","\\smile",!0);u(d,h,C,"⊑","\\sqsubseteq",!0);u(d,h,C,"⊒","\\sqsupseteq",!0);u(d,h,C,"≐","\\doteq",!0);u(d,h,C,"⌢","\\frown",!0);u(d,h,C,"∋","\\ni",!0);u(d,h,C,"∝","\\propto",!0);u(d,h,C,"⊢","\\vdash",!0);u(d,h,C,"⊣","\\dashv",!0);u(d,h,C,"∋","\\owns");u(d,h,Cr,".","\\ldotp");u(d,h,Cr,"⋅","\\cdotp");u(d,h,Cr,"⋅","·");u(O,h,A,"⋅","·");u(d,h,A,"#","\\#");u(O,h,A,"#","\\#");u(d,h,A,"&","\\&");u(O,h,A,"&","\\&");u(d,h,A,"ℵ","\\aleph",!0);u(d,h,A,"∀","\\forall",!0);u(d,h,A,"ℏ","\\hbar",!0);u(d,h,A,"∃","\\exists",!0);u(d,h,A,"∇","\\nabla",!0);u(d,h,A,"♭","\\flat",!0);u(d,h,A,"ℓ","\\ell",!0);u(d,h,A,"♮","\\natural",!0);u(d,h,A,"♣","\\clubsuit",!0);u(d,h,A,"℘","\\wp",!0);u(d,h,A,"♯","\\sharp",!0);u(d,h,A,"♢","\\diamondsuit",!0);u(d,h,A,"ℜ","\\Re",!0);u(d,h,A,"♡","\\heartsuit",!0);u(d,h,A,"ℑ","\\Im",!0);u(d,h,A,"♠","\\spadesuit",!0);u(d,h,A,"§","\\S",!0);u(O,h,A,"§","\\S");u(d,h,A,"¶","\\P",!0);u(O,h,A,"¶","\\P");u(d,h,A,"†","\\dag");u(O,h,A,"†","\\dag");u(O,h,A,"†","\\textdagger");u(d,h,A,"‡","\\ddag");u(O,h,A,"‡","\\ddag");u(O,h,A,"‡","\\textdaggerdbl");u(d,h,Ge,"⎱","\\rmoustache",!0);u(d,h,Ze,"⎰","\\lmoustache",!0);u(d,h,Ge,"⟯","\\rgroup",!0);u(d,h,Ze,"⟮","\\lgroup",!0);u(d,h,ee,"∓","\\mp",!0);u(d,h,ee,"⊖","\\ominus",!0);u(d,h,ee,"⊎","\\uplus",!0);u(d,h,ee,"⊓","\\sqcap",!0);u(d,h,ee,"∗","\\ast");u(d,h,ee,"⊔","\\sqcup",!0);u(d,h,ee,"◯","\\bigcirc",!0);u(d,h,ee,"∙","\\bullet",!0);u(d,h,ee,"‡","\\ddagger");u(d,h,ee,"≀","\\wr",!0);u(d,h,ee,"⨿","\\amalg");u(d,h,ee,"&","\\And");u(d,h,C,"⟵","\\longleftarrow",!0);u(d,h,C,"⇐","\\Leftarrow",!0);u(d,h,C,"⟸","\\Longleftarrow",!0);u(d,h,C,"⟶","\\longrightarrow",!0);u(d,h,C,"⇒","\\Rightarrow",!0);u(d,h,C,"⟹","\\Longrightarrow",!0);u(d,h,C,"↔","\\leftrightarrow",!0);u(d,h,C,"⟷","\\longleftrightarrow",!0);u(d,h,C,"⇔","\\Leftrightarrow",!0);u(d,h,C,"⟺","\\Longleftrightarrow",!0);u(d,h,C,"↦","\\mapsto",!0);u(d,h,C,"⟼","\\longmapsto",!0);u(d,h,C,"↗","\\nearrow",!0);u(d,h,C,"↩","\\hookleftarrow",!0);u(d,h,C,"↪","\\hookrightarrow",!0);u(d,h,C,"↘","\\searrow",!0);u(d,h,C,"↼","\\leftharpoonup",!0);u(d,h,C,"⇀","\\rightharpoonup",!0);u(d,h,C,"↙","\\swarrow",!0);u(d,h,C,"↽","\\leftharpoondown",!0);u(d,h,C,"⇁","\\rightharpoondown",!0);u(d,h,C,"↖","\\nwarrow",!0);u(d,h,C,"⇌","\\rightleftharpoons",!0);u(d,x,C,"≮","\\nless",!0);u(d,x,C,"","\\@nleqslant");u(d,x,C,"","\\@nleqq");u(d,x,C,"⪇","\\lneq",!0);u(d,x,C,"≨","\\lneqq",!0);u(d,x,C,"","\\@lvertneqq");u(d,x,C,"⋦","\\lnsim",!0);u(d,x,C,"⪉","\\lnapprox",!0);u(d,x,C,"⊀","\\nprec",!0);u(d,x,C,"⋠","\\npreceq",!0);u(d,x,C,"⋨","\\precnsim",!0);u(d,x,C,"⪹","\\precnapprox",!0);u(d,x,C,"≁","\\nsim",!0);u(d,x,C,"","\\@nshortmid");u(d,x,C,"∤","\\nmid",!0);u(d,x,C,"⊬","\\nvdash",!0);u(d,x,C,"⊭","\\nvDash",!0);u(d,x,C,"⋪","\\ntriangleleft");u(d,x,C,"⋬","\\ntrianglelefteq",!0);u(d,x,C,"⊊","\\subsetneq",!0);u(d,x,C,"","\\@varsubsetneq");u(d,x,C,"⫋","\\subsetneqq",!0);u(d,x,C,"","\\@varsubsetneqq");u(d,x,C,"≯","\\ngtr",!0);u(d,x,C,"","\\@ngeqslant");u(d,x,C,"","\\@ngeqq");u(d,x,C,"⪈","\\gneq",!0);u(d,x,C,"≩","\\gneqq",!0);u(d,x,C,"","\\@gvertneqq");u(d,x,C,"⋧","\\gnsim",!0);u(d,x,C,"⪊","\\gnapprox",!0);u(d,x,C,"⊁","\\nsucc",!0);u(d,x,C,"⋡","\\nsucceq",!0);u(d,x,C,"⋩","\\succnsim",!0);u(d,x,C,"⪺","\\succnapprox",!0);u(d,x,C,"≆","\\ncong",!0);u(d,x,C,"","\\@nshortparallel");u(d,x,C,"∦","\\nparallel",!0);u(d,x,C,"⊯","\\nVDash",!0);u(d,x,C,"⋫","\\ntriangleright");u(d,x,C,"⋭","\\ntrianglerighteq",!0);u(d,x,C,"","\\@nsupseteqq");u(d,x,C,"⊋","\\supsetneq",!0);u(d,x,C,"","\\@varsupsetneq");u(d,x,C,"⫌","\\supsetneqq",!0);u(d,x,C,"","\\@varsupsetneqq");u(d,x,C,"⊮","\\nVdash",!0);u(d,x,C,"⪵","\\precneqq",!0);u(d,x,C,"⪶","\\succneqq",!0);u(d,x,C,"","\\@nsubseteqq");u(d,x,ee,"⊴","\\unlhd");u(d,x,ee,"⊵","\\unrhd");u(d,x,C,"↚","\\nleftarrow",!0);u(d,x,C,"↛","\\nrightarrow",!0);u(d,x,C,"⇍","\\nLeftarrow",!0);u(d,x,C,"⇏","\\nRightarrow",!0);u(d,x,C,"↮","\\nleftrightarrow",!0);u(d,x,C,"⇎","\\nLeftrightarrow",!0);u(d,x,C,"△","\\vartriangle");u(d,x,A,"ℏ","\\hslash");u(d,x,A,"▽","\\triangledown");u(d,x,A,"◊","\\lozenge");u(d,x,A,"Ⓢ","\\circledS");u(d,x,A,"®","\\circledR");u(O,x,A,"®","\\circledR");u(d,x,A,"∡","\\measuredangle",!0);u(d,x,A,"∄","\\nexists");u(d,x,A,"℧","\\mho");u(d,x,A,"Ⅎ","\\Finv",!0);u(d,x,A,"⅁","\\Game",!0);u(d,x,A,"‵","\\backprime");u(d,x,A,"▲","\\blacktriangle");u(d,x,A,"▼","\\blacktriangledown");u(d,x,A,"■","\\blacksquare");u(d,x,A,"⧫","\\blacklozenge");u(d,x,A,"★","\\bigstar");u(d,x,A,"∢","\\sphericalangle",!0);u(d,x,A,"∁","\\complement",!0);u(d,x,A,"ð","\\eth",!0);u(O,h,A,"ð","ð");u(d,x,A,"╱","\\diagup");u(d,x,A,"╲","\\diagdown");u(d,x,A,"□","\\square");u(d,x,A,"□","\\Box");u(d,x,A,"◊","\\Diamond");u(d,x,A,"¥","\\yen",!0);u(O,x,A,"¥","\\yen",!0);u(d,x,A,"✓","\\checkmark",!0);u(O,x,A,"✓","\\checkmark");u(d,x,A,"ℶ","\\beth",!0);u(d,x,A,"ℸ","\\daleth",!0);u(d,x,A,"ℷ","\\gimel",!0);u(d,x,A,"ϝ","\\digamma",!0);u(d,x,A,"ϰ","\\varkappa");u(d,x,Ze,"┌","\\@ulcorner",!0);u(d,x,Ge,"┐","\\@urcorner",!0);u(d,x,Ze,"└","\\@llcorner",!0);u(d,x,Ge,"┘","\\@lrcorner",!0);u(d,x,C,"≦","\\leqq",!0);u(d,x,C,"⩽","\\leqslant",!0);u(d,x,C,"⪕","\\eqslantless",!0);u(d,x,C,"≲","\\lesssim",!0);u(d,x,C,"⪅","\\lessapprox",!0);u(d,x,C,"≊","\\approxeq",!0);u(d,x,ee,"⋖","\\lessdot");u(d,x,C,"⋘","\\lll",!0);u(d,x,C,"≶","\\lessgtr",!0);u(d,x,C,"⋚","\\lesseqgtr",!0);u(d,x,C,"⪋","\\lesseqqgtr",!0);u(d,x,C,"≑","\\doteqdot");u(d,x,C,"≓","\\risingdotseq",!0);u(d,x,C,"≒","\\fallingdotseq",!0);u(d,x,C,"∽","\\backsim",!0);u(d,x,C,"⋍","\\backsimeq",!0);u(d,x,C,"⫅","\\subseteqq",!0);u(d,x,C,"⋐","\\Subset",!0);u(d,x,C,"⊏","\\sqsubset",!0);u(d,x,C,"≼","\\preccurlyeq",!0);u(d,x,C,"⋞","\\curlyeqprec",!0);u(d,x,C,"≾","\\precsim",!0);u(d,x,C,"⪷","\\precapprox",!0);u(d,x,C,"⊲","\\vartriangleleft");u(d,x,C,"⊴","\\trianglelefteq");u(d,x,C,"⊨","\\vDash",!0);u(d,x,C,"⊪","\\Vvdash",!0);u(d,x,C,"⌣","\\smallsmile");u(d,x,C,"⌢","\\smallfrown");u(d,x,C,"≏","\\bumpeq",!0);u(d,x,C,"≎","\\Bumpeq",!0);u(d,x,C,"≧","\\geqq",!0);u(d,x,C,"⩾","\\geqslant",!0);u(d,x,C,"⪖","\\eqslantgtr",!0);u(d,x,C,"≳","\\gtrsim",!0);u(d,x,C,"⪆","\\gtrapprox",!0);u(d,x,ee,"⋗","\\gtrdot");u(d,x,C,"⋙","\\ggg",!0);u(d,x,C,"≷","\\gtrless",!0);u(d,x,C,"⋛","\\gtreqless",!0);u(d,x,C,"⪌","\\gtreqqless",!0);u(d,x,C,"≖","\\eqcirc",!0);u(d,x,C,"≗","\\circeq",!0);u(d,x,C,"≜","\\triangleq",!0);u(d,x,C,"∼","\\thicksim");u(d,x,C,"≈","\\thickapprox");u(d,x,C,"⫆","\\supseteqq",!0);u(d,x,C,"⋑","\\Supset",!0);u(d,x,C,"⊐","\\sqsupset",!0);u(d,x,C,"≽","\\succcurlyeq",!0);u(d,x,C,"⋟","\\curlyeqsucc",!0);u(d,x,C,"≿","\\succsim",!0);u(d,x,C,"⪸","\\succapprox",!0);u(d,x,C,"⊳","\\vartriangleright");u(d,x,C,"⊵","\\trianglerighteq");u(d,x,C,"⊩","\\Vdash",!0);u(d,x,C,"∣","\\shortmid");u(d,x,C,"∥","\\shortparallel");u(d,x,C,"≬","\\between",!0);u(d,x,C,"⋔","\\pitchfork",!0);u(d,x,C,"∝","\\varpropto");u(d,x,C,"◀","\\blacktriangleleft");u(d,x,C,"∴","\\therefore",!0);u(d,x,C,"∍","\\backepsilon");u(d,x,C,"▶","\\blacktriangleright");u(d,x,C,"∵","\\because",!0);u(d,x,C,"⋘","\\llless");u(d,x,C,"⋙","\\gggtr");u(d,x,ee,"⊲","\\lhd");u(d,x,ee,"⊳","\\rhd");u(d,x,C,"≂","\\eqsim",!0);u(d,h,C,"⋈","\\Join");u(d,x,C,"≑","\\Doteq",!0);u(d,x,ee,"∔","\\dotplus",!0);u(d,x,ee,"∖","\\smallsetminus");u(d,x,ee,"⋒","\\Cap",!0);u(d,x,ee,"⋓","\\Cup",!0);u(d,x,ee,"⩞","\\doublebarwedge",!0);u(d,x,ee,"⊟","\\boxminus",!0);u(d,x,ee,"⊞","\\boxplus",!0);u(d,x,ee,"⋇","\\divideontimes",!0);u(d,x,ee,"⋉","\\ltimes",!0);u(d,x,ee,"⋊","\\rtimes",!0);u(d,x,ee,"⋋","\\leftthreetimes",!0);u(d,x,ee,"⋌","\\rightthreetimes",!0);u(d,x,ee,"⋏","\\curlywedge",!0);u(d,x,ee,"⋎","\\curlyvee",!0);u(d,x,ee,"⊝","\\circleddash",!0);u(d,x,ee,"⊛","\\circledast",!0);u(d,x,ee,"⋅","\\centerdot");u(d,x,ee,"⊺","\\intercal",!0);u(d,x,ee,"⋒","\\doublecap");u(d,x,ee,"⋓","\\doublecup");u(d,x,ee,"⊠","\\boxtimes",!0);u(d,x,C,"⇢","\\dashrightarrow",!0);u(d,x,C,"⇠","\\dashleftarrow",!0);u(d,x,C,"⇇","\\leftleftarrows",!0);u(d,x,C,"⇆","\\leftrightarrows",!0);u(d,x,C,"⇚","\\Lleftarrow",!0);u(d,x,C,"↞","\\twoheadleftarrow",!0);u(d,x,C,"↢","\\leftarrowtail",!0);u(d,x,C,"↫","\\looparrowleft",!0);u(d,x,C,"⇋","\\leftrightharpoons",!0);u(d,x,C,"↶","\\curvearrowleft",!0);u(d,x,C,"↺","\\circlearrowleft",!0);u(d,x,C,"↰","\\Lsh",!0);u(d,x,C,"⇈","\\upuparrows",!0);u(d,x,C,"↿","\\upharpoonleft",!0);u(d,x,C,"⇃","\\downharpoonleft",!0);u(d,h,C,"⊶","\\origof",!0);u(d,h,C,"⊷","\\imageof",!0);u(d,x,C,"⊸","\\multimap",!0);u(d,x,C,"↭","\\leftrightsquigarrow",!0);u(d,x,C,"⇉","\\rightrightarrows",!0);u(d,x,C,"⇄","\\rightleftarrows",!0);u(d,x,C,"↠","\\twoheadrightarrow",!0);u(d,x,C,"↣","\\rightarrowtail",!0);u(d,x,C,"↬","\\looparrowright",!0);u(d,x,C,"↷","\\curvearrowright",!0);u(d,x,C,"↻","\\circlearrowright",!0);u(d,x,C,"↱","\\Rsh",!0);u(d,x,C,"⇊","\\downdownarrows",!0);u(d,x,C,"↾","\\upharpoonright",!0);u(d,x,C,"⇂","\\downharpoonright",!0);u(d,x,C,"⇝","\\rightsquigarrow",!0);u(d,x,C,"⇝","\\leadsto");u(d,x,C,"⇛","\\Rrightarrow",!0);u(d,x,C,"↾","\\restriction");u(d,h,A,"‘","`");u(d,h,A,"$","\\$");u(O,h,A,"$","\\$");u(O,h,A,"$","\\textdollar");u(d,h,A,"%","\\%");u(O,h,A,"%","\\%");u(d,h,A,"_","\\_");u(O,h,A,"_","\\_");u(O,h,A,"_","\\textunderscore");u(d,h,A,"∠","\\angle",!0);u(d,h,A,"∞","\\infty",!0);u(d,h,A,"′","\\prime");u(d,h,A,"△","\\triangle");u(d,h,A,"Γ","\\Gamma",!0);u(d,h,A,"Δ","\\Delta",!0);u(d,h,A,"Θ","\\Theta",!0);u(d,h,A,"Λ","\\Lambda",!0);u(d,h,A,"Ξ","\\Xi",!0);u(d,h,A,"Π","\\Pi",!0);u(d,h,A,"Σ","\\Sigma",!0);u(d,h,A,"Υ","\\Upsilon",!0);u(d,h,A,"Φ","\\Phi",!0);u(d,h,A,"Ψ","\\Psi",!0);u(d,h,A,"Ω","\\Omega",!0);u(d,h,A,"A","Α");u(d,h,A,"B","Β");u(d,h,A,"E","Ε");u(d,h,A,"Z","Ζ");u(d,h,A,"H","Η");u(d,h,A,"I","Ι");u(d,h,A,"K","Κ");u(d,h,A,"M","Μ");u(d,h,A,"N","Ν");u(d,h,A,"O","Ο");u(d,h,A,"P","Ρ");u(d,h,A,"T","Τ");u(d,h,A,"X","Χ");u(d,h,A,"¬","\\neg",!0);u(d,h,A,"¬","\\lnot");u(d,h,A,"⊤","\\top");u(d,h,A,"⊥","\\bot");u(d,h,A,"∅","\\emptyset");u(d,x,A,"∅","\\varnothing");u(d,h,ie,"α","\\alpha",!0);u(d,h,ie,"β","\\beta",!0);u(d,h,ie,"γ","\\gamma",!0);u(d,h,ie,"δ","\\delta",!0);u(d,h,ie,"ϵ","\\epsilon",!0);u(d,h,ie,"ζ","\\zeta",!0);u(d,h,ie,"η","\\eta",!0);u(d,h,ie,"θ","\\theta",!0);u(d,h,ie,"ι","\\iota",!0);u(d,h,ie,"κ","\\kappa",!0);u(d,h,ie,"λ","\\lambda",!0);u(d,h,ie,"μ","\\mu",!0);u(d,h,ie,"ν","\\nu",!0);u(d,h,ie,"ξ","\\xi",!0);u(d,h,ie,"ο","\\omicron",!0);u(d,h,ie,"π","\\pi",!0);u(d,h,ie,"ρ","\\rho",!0);u(d,h,ie,"σ","\\sigma",!0);u(d,h,ie,"τ","\\tau",!0);u(d,h,ie,"υ","\\upsilon",!0);u(d,h,ie,"ϕ","\\phi",!0);u(d,h,ie,"χ","\\chi",!0);u(d,h,ie,"ψ","\\psi",!0);u(d,h,ie,"ω","\\omega",!0);u(d,h,ie,"ε","\\varepsilon",!0);u(d,h,ie,"ϑ","\\vartheta",!0);u(d,h,ie,"ϖ","\\varpi",!0);u(d,h,ie,"ϱ","\\varrho",!0);u(d,h,ie,"ς","\\varsigma",!0);u(d,h,ie,"φ","\\varphi",!0);u(d,h,ee,"∗","*",!0);u(d,h,ee,"+","+");u(d,h,ee,"−","-",!0);u(d,h,ee,"⋅","\\cdot",!0);u(d,h,ee,"∘","\\circ",!0);u(d,h,ee,"÷","\\div",!0);u(d,h,ee,"±","\\pm",!0);u(d,h,ee,"×","\\times",!0);u(d,h,ee,"∩","\\cap",!0);u(d,h,ee,"∪","\\cup",!0);u(d,h,ee,"∖","\\setminus",!0);u(d,h,ee,"∧","\\land");u(d,h,ee,"∨","\\lor");u(d,h,ee,"∧","\\wedge",!0);u(d,h,ee,"∨","\\vee",!0);u(d,h,A,"√","\\surd");u(d,h,Ze,"⟨","\\langle",!0);u(d,h,Ze,"∣","\\lvert");u(d,h,Ze,"∥","\\lVert");u(d,h,Ge,"?","?");u(d,h,Ge,"!","!");u(d,h,Ge,"⟩","\\rangle",!0);u(d,h,Ge,"∣","\\rvert");u(d,h,Ge,"∥","\\rVert");u(d,h,C,"=","=");u(d,h,C,":",":");u(d,h,C,"≈","\\approx",!0);u(d,h,C,"≅","\\cong",!0);u(d,h,C,"≥","\\ge");u(d,h,C,"≥","\\geq",!0);u(d,h,C,"←","\\gets");u(d,h,C,">","\\gt",!0);u(d,h,C,"∈","\\in",!0);u(d,h,C,"","\\@not");u(d,h,C,"⊂","\\subset",!0);u(d,h,C,"⊃","\\supset",!0);u(d,h,C,"⊆","\\subseteq",!0);u(d,h,C,"⊇","\\supseteq",!0);u(d,x,C,"⊈","\\nsubseteq",!0);u(d,x,C,"⊉","\\nsupseteq",!0);u(d,h,C,"⊨","\\models");u(d,h,C,"←","\\leftarrow",!0);u(d,h,C,"≤","\\le");u(d,h,C,"≤","\\leq",!0);u(d,h,C,"<","\\lt",!0);u(d,h,C,"→","\\rightarrow",!0);u(d,h,C,"→","\\to");u(d,x,C,"≱","\\ngeq",!0);u(d,x,C,"≰","\\nleq",!0);u(d,h,bt," ","\\ ");u(d,h,bt," ","\\space");u(d,h,bt," ","\\nobreakspace");u(O,h,bt," ","\\ ");u(O,h,bt," "," ");u(O,h,bt," ","\\space");u(O,h,bt," ","\\nobreakspace");u(d,h,bt,null,"\\nobreak");u(d,h,bt,null,"\\allowbreak");u(d,h,Cr,",",",");u(d,h,Cr,";",";");u(d,x,ee,"⊼","\\barwedge",!0);u(d,x,ee,"⊻","\\veebar",!0);u(d,h,ee,"⊙","\\odot",!0);u(d,h,ee,"⊕","\\oplus",!0);u(d,h,ee,"⊗","\\otimes",!0);u(d,h,A,"∂","\\partial",!0);u(d,h,ee,"⊘","\\oslash",!0);u(d,x,ee,"⊚","\\circledcirc",!0);u(d,x,ee,"⊡","\\boxdot",!0);u(d,h,ee,"△","\\bigtriangleup");u(d,h,ee,"▽","\\bigtriangledown");u(d,h,ee,"†","\\dagger");u(d,h,ee,"⋄","\\diamond");u(d,h,ee,"⋆","\\star");u(d,h,ee,"◃","\\triangleleft");u(d,h,ee,"▹","\\triangleright");u(d,h,Ze,"{","\\{");u(O,h,A,"{","\\{");u(O,h,A,"{","\\textbraceleft");u(d,h,Ge,"}","\\}");u(O,h,A,"}","\\}");u(O,h,A,"}","\\textbraceright");u(d,h,Ze,"{","\\lbrace");u(d,h,Ge,"}","\\rbrace");u(d,h,Ze,"[","\\lbrack",!0);u(O,h,A,"[","\\lbrack",!0);u(d,h,Ge,"]","\\rbrack",!0);u(O,h,A,"]","\\rbrack",!0);u(d,h,Ze,"(","\\lparen",!0);u(d,h,Ge,")","\\rparen",!0);u(O,h,A,"<","\\textless",!0);u(O,h,A,">","\\textgreater",!0);u(d,h,Ze,"⌊","\\lfloor",!0);u(d,h,Ge,"⌋","\\rfloor",!0);u(d,h,Ze,"⌈","\\lceil",!0);u(d,h,Ge,"⌉","\\rceil",!0);u(d,h,A,"\\","\\backslash");u(d,h,A,"∣","|");u(d,h,A,"∣","\\vert");u(O,h,A,"|","\\textbar",!0);u(d,h,A,"∥","\\|");u(d,h,A,"∥","\\Vert");u(O,h,A,"∥","\\textbardbl");u(O,h,A,"~","\\textasciitilde");u(O,h,A,"\\","\\textbackslash");u(O,h,A,"^","\\textasciicircum");u(d,h,C,"↑","\\uparrow",!0);u(d,h,C,"⇑","\\Uparrow",!0);u(d,h,C,"↓","\\downarrow",!0);u(d,h,C,"⇓","\\Downarrow",!0);u(d,h,C,"↕","\\updownarrow",!0);u(d,h,C,"⇕","\\Updownarrow",!0);u(d,h,ze,"∐","\\coprod");u(d,h,ze,"⋁","\\bigvee");u(d,h,ze,"⋀","\\bigwedge");u(d,h,ze,"⨄","\\biguplus");u(d,h,ze,"⋂","\\bigcap");u(d,h,ze,"⋃","\\bigcup");u(d,h,ze,"∫","\\int");u(d,h,ze,"∫","\\intop");u(d,h,ze,"∬","\\iint");u(d,h,ze,"∭","\\iiint");u(d,h,ze,"∏","\\prod");u(d,h,ze,"∑","\\sum");u(d,h,ze,"⨂","\\bigotimes");u(d,h,ze,"⨁","\\bigoplus");u(d,h,ze,"⨀","\\bigodot");u(d,h,ze,"∮","\\oint");u(d,h,ze,"∯","\\oiint");u(d,h,ze,"∰","\\oiiint");u(d,h,ze,"⨆","\\bigsqcup");u(d,h,ze,"∫","\\smallint");u(O,h,sr,"…","\\textellipsis");u(d,h,sr,"…","\\mathellipsis");u(O,h,sr,"…","\\ldots",!0);u(d,h,sr,"…","\\ldots",!0);u(d,h,sr,"⋯","\\@cdots",!0);u(d,h,sr,"⋱","\\ddots",!0);u(d,h,A,"⋮","\\varvdots");u(O,h,A,"⋮","\\varvdots");u(d,h,Ee,"ˊ","\\acute");u(d,h,Ee,"ˋ","\\grave");u(d,h,Ee,"¨","\\ddot");u(d,h,Ee,"~","\\tilde");u(d,h,Ee,"ˉ","\\bar");u(d,h,Ee,"˘","\\breve");u(d,h,Ee,"ˇ","\\check");u(d,h,Ee,"^","\\hat");u(d,h,Ee,"⃗","\\vec");u(d,h,Ee,"˙","\\dot");u(d,h,Ee,"˚","\\mathring");u(d,h,ie,"","\\@imath");u(d,h,ie,"","\\@jmath");u(d,h,A,"ı","ı");u(d,h,A,"ȷ","ȷ");u(O,h,A,"ı","\\i",!0);u(O,h,A,"ȷ","\\j",!0);u(O,h,A,"ß","\\ss",!0);u(O,h,A,"æ","\\ae",!0);u(O,h,A,"œ","\\oe",!0);u(O,h,A,"ø","\\o",!0);u(O,h,A,"Æ","\\AE",!0);u(O,h,A,"Œ","\\OE",!0);u(O,h,A,"Ø","\\O",!0);u(O,h,Ee,"ˊ","\\'");u(O,h,Ee,"ˋ","\\`");u(O,h,Ee,"ˆ","\\^");u(O,h,Ee,"˜","\\~");u(O,h,Ee,"ˉ","\\=");u(O,h,Ee,"˘","\\u");u(O,h,Ee,"˙","\\.");u(O,h,Ee,"¸","\\c");u(O,h,Ee,"˚","\\r");u(O,h,Ee,"ˇ","\\v");u(O,h,Ee,"¨",'\\"');u(O,h,Ee,"˝","\\H");u(O,h,Ee,"◯","\\textcircled");var vl={"--":!0,"---":!0,"``":!0,"''":!0};u(O,h,A,"–","--",!0);u(O,h,A,"–","\\textendash");u(O,h,A,"—","---",!0);u(O,h,A,"—","\\textemdash");u(O,h,A,"‘","`",!0);u(O,h,A,"‘","\\textquoteleft");u(O,h,A,"’","'",!0);u(O,h,A,"’","\\textquoteright");u(O,h,A,"“","``",!0);u(O,h,A,"“","\\textquotedblleft");u(O,h,A,"”","''",!0);u(O,h,A,"”","\\textquotedblright");u(d,h,A,"°","\\degree",!0);u(O,h,A,"°","\\degree");u(O,h,A,"°","\\textdegree",!0);u(d,h,A,"£","\\pounds");u(d,h,A,"£","\\mathsterling",!0);u(O,h,A,"£","\\pounds");u(O,h,A,"£","\\textsterling",!0);u(d,x,A,"✠","\\maltese");u(O,x,A,"✠","\\maltese");var za='0123456789/@."';for(var Rn=0;Rn<za.length;Rn++){var Da=za.charAt(Rn);u(d,h,A,Da,Da)}var Ha='0123456789!@*()-=+";:?/.,';for(var Pn=0;Pn<Ha.length;Pn++){var Ra=Ha.charAt(Pn);u(O,h,A,Ra,Ra)}var jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var On=0;On<jr.length;On++){var Lr=jr.charAt(On);u(d,h,ie,Lr,Lr),u(O,h,A,Lr,Lr)}u(d,x,A,"C","ℂ");u(O,x,A,"C","ℂ");u(d,x,A,"H","ℍ");u(O,x,A,"H","ℍ");u(d,x,A,"N","ℕ");u(O,x,A,"N","ℕ");u(d,x,A,"P","ℙ");u(O,x,A,"P","ℙ");u(d,x,A,"Q","ℚ");u(O,x,A,"Q","ℚ");u(d,x,A,"R","ℝ");u(O,x,A,"R","ℝ");u(d,x,A,"Z","ℤ");u(O,x,A,"Z","ℤ");u(d,h,ie,"h","ℎ");u(O,h,ie,"h","ℎ");var me="";for(var Ue=0;Ue<jr.length;Ue++){var Be=jr.charAt(Ue);me=String.fromCharCode(55349,56320+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56372+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56424+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56580+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56684+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56736+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56788+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56840+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56944+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),Ue<26&&(me=String.fromCharCode(55349,56632+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me),me=String.fromCharCode(55349,56476+Ue),u(d,h,ie,Be,me),u(O,h,A,Be,me))}me="𝕜";u(d,h,ie,"k",me);u(O,h,A,"k",me);for(var Ht=0;Ht<10;Ht++){var Ct=Ht.toString();me=String.fromCharCode(55349,57294+Ht),u(d,h,ie,Ct,me),u(O,h,A,Ct,me),me=String.fromCharCode(55349,57314+Ht),u(d,h,ie,Ct,me),u(O,h,A,Ct,me),me=String.fromCharCode(55349,57324+Ht),u(d,h,ie,Ct,me),u(O,h,A,Ct,me),me=String.fromCharCode(55349,57334+Ht),u(d,h,ie,Ct,me),u(O,h,A,Ct,me)}var d0="ÐÞþ";for(var Vn=0;Vn<d0.length;Vn++){var Nr=d0.charAt(Vn);u(d,h,ie,Nr,Nr),u(O,h,A,Nr,Nr)}var Ir=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Pa=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],_c=(t,e)=>{var r=t.charCodeAt(0),n=t.charCodeAt(1),o=(r-55296)*1024+(n-56320)+65536,l=e==="math"?0:1;if(119808<=o&&o<120484){var i=Math.floor((o-119808)/26);return[Ir[i][2],Ir[i][l]]}else if(120782<=o&&o<=120831){var s=Math.floor((o-120782)/10);return[Pa[s][2],Pa[s][l]]}else{if(o===120485||o===120486)return[Ir[0][2],Ir[0][l]];if(120486<o&&o<120782)return["",""];throw new _("Unsupported character: "+t)}},un=function(e,r,n){if(Ce[n][e]){var o=Ce[n][e].replace;o&&(e=o)}return{value:e,metrics:I0(e,r,n)}},_e=function(e,r,n,o,l){var i=un(e,r,n),s=i.metrics;e=i.value;var c;if(s){var m=s.italic;(n==="text"||o&&o.font==="mathit")&&(m=0),c=new Qe(e,s.height,s.depth,m,s.skew,s.width,l)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+r+"' and mode '"+n+"'")),c=new Qe(e,0,0,0,0,0,l);if(o){c.maxFontSize=o.sizeMultiplier,o.style.isTight()&&c.classes.push("mtight");var p=o.getColor();p&&(c.style.color=p)}return c},z0=function(e,r,n,o){return o===void 0&&(o=[]),n.font==="boldsymbol"&&un(e,"Main-Bold",r).metrics?_e(e,"Main-Bold",r,n,o.concat(["mathbf"])):e==="\\"||Ce[r][e].font==="main"?_e(e,"Main-Regular",r,n,o):_e(e,"AMS-Regular",r,n,o.concat(["amsrm"]))},Wc=function(e,r,n,o,l){return l!=="textord"&&un(e,"Math-BoldItalic",r).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},cn=function(e,r,n){var o=e.mode,l=e.text,i=["mord"],s=o==="math"||o==="text"&&r.font,c=s?r.font:r.fontFamily,m="",p="";if(l.charCodeAt(0)===55349&&([m,p]=_c(l,o)),m.length>0)return _e(l,m,o,r,i.concat(p));if(c){var f,g;if(c==="boldsymbol"){var b=Wc(l,o,r,i,n);f=b.fontName,g=[b.fontClass]}else s?(f=m0[c].fontName,g=[c]):(f=zr(c,r.fontWeight,r.fontShape),g=[c,r.fontWeight,r.fontShape]);if(un(l,f,o).metrics)return _e(l,f,o,r,i.concat(g));if(vl.hasOwnProperty(l)&&f.slice(0,10)==="Typewriter"){for(var v=[],w=0;w<l.length;w++)v.push(_e(l[w],f,o,r,i.concat(g)));return yt(v)}}if(n==="mathord")return _e(l,"Math-Italic",o,r,i.concat(["mathnormal"]));if(n==="textord"){var k=Ce[o][l]&&Ce[o][l].font;if(k==="ams"){var T=zr("amsrm",r.fontWeight,r.fontShape);return _e(l,T,o,r,i.concat("amsrm",r.fontWeight,r.fontShape))}else if(k==="main"||!k){var M=zr("textrm",r.fontWeight,r.fontShape);return _e(l,M,o,r,i.concat(r.fontWeight,r.fontShape))}else{var E=zr(k,r.fontWeight,r.fontShape);return _e(l,E,o,r,i.concat(E,r.fontWeight,r.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},Gc=(t,e)=>{if(At(t.classes)!==At(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var r=t.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n of Object.keys(t.style))if(t.style[n]!==e.style[n])return!1;for(var o of Object.keys(e.style))if(t.style[o]!==e.style[o])return!1;return!0},gl=t=>{for(var e=0;e<t.length-1;e++){var r=t[e],n=t[e+1];r instanceof Qe&&n instanceof Qe&&Gc(r,n)&&(r.text+=n.text,r.height=Math.max(r.height,n.height),r.depth=Math.max(r.depth,n.depth),r.italic=n.italic,t.splice(e+1,1),e--)}return t},D0=function(e){for(var r=0,n=0,o=0,l=0;l<e.children.length;l++){var i=e.children[l];i.height>r&&(r=i.height),i.depth>n&&(n=i.depth),i.maxFontSize>o&&(o=i.maxFontSize)}e.height=r,e.depth=n,e.maxFontSize=o},$=function(e,r,n,o){var l=new ir(e,r,n,o);return D0(l),l},Lt=(t,e,r,n)=>new ir(t,e,r,n),tr=function(e,r,n){var o=$([e],[],r);return o.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),o.style.borderBottomWidth=j(o.height),o.maxFontSize=1,o},Kc=function(e,r,n,o){var l=new sn(e,r,n,o);return D0(l),l},yt=function(e){var r=new lr(e);return D0(r),r},rr=function(e,r){return e instanceof lr?$([],[e],r):e},Yc=function(e){if(e.positionType==="individualShift"){for(var r=e.children,n=[r[0]],o=-r[0].shift-r[0].elem.depth,l=o,i=1;i<r.length;i++){var s=-r[i].shift-l-r[i].elem.depth,c=s-(r[i-1].elem.height+r[i-1].elem.depth);l=l+s,n.push({type:"kern",size:c}),n.push(r[i])}return{children:n,depth:o}}var m;if(e.positionType==="top"){for(var p=e.positionData,f=0;f<e.children.length;f++){var g=e.children[f];p-=g.type==="kern"?g.size:g.elem.height+g.elem.depth}m=p}else if(e.positionType==="bottom")m=-e.positionData;else{var b=e.children[0];if(b.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")m=-b.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")m=-b.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:m}},ye=function(e,r){for(var{children:n,depth:o}=Yc(e),l=0,i=0;i<n.length;i++){var s=n[i];if(s.type==="elem"){var c=s.elem;l=Math.max(l,c.maxFontSize,c.height)}}l+=2;var m=$(["pstrut"],[]);m.style.height=j(l);for(var p=[],f=o,g=o,b=o,v=0;v<n.length;v++){var w=n[v];if(w.type==="kern")b+=w.size;else{var k=w.elem,T=w.wrapperClasses||[],M=w.wrapperStyle||{},E=$(T,[m,k],void 0,M);E.style.top=j(-l-b-k.depth),w.marginLeft&&(E.style.marginLeft=w.marginLeft),w.marginRight&&(E.style.marginRight=w.marginRight),p.push(E),b+=k.height+k.depth}f=Math.min(f,b),g=Math.max(g,b)}var S=$(["vlist"],p);S.style.height=j(g);var B;if(f<0){var z=$([],[]),F=$(["vlist"],[z]);F.style.height=j(-f);var P=$(["vlist-s"],[new Qe("​")]);B=[$(["vlist-r"],[S,P]),$(["vlist-r"],[F])]}else B=[$(["vlist-r"],[S])];var N=$(["vlist-t"],B);return B.length===2&&N.classes.push("vlist-t2"),N.height=g,N.depth=-f,N},bl=(t,e)=>{var r=$(["mspace"],[],e),n=Ae(t,e);return r.style.marginRight=j(n),r},zr=function(e,r,n){var o="";switch(e){case"amsrm":o="AMS";break;case"textrm":o="Main";break;case"textsf":o="SansSerif";break;case"texttt":o="Typewriter";break;default:o=e}var l;return r==="textbf"&&n==="textit"?l="BoldItalic":r==="textbf"?l="Bold":r==="textit"?l="Italic":l="Regular",o+"-"+l},m0={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},yl={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},wl=function(e,r){var[n,o,l]=yl[e],i=new Bt(n),s=new vt([i],{width:j(o),height:j(l),style:"width:"+j(o),viewBox:"0 0 "+1e3*o+" "+1e3*l,preserveAspectRatio:"xMinYMin"}),c=Lt(["overlay"],[s],r);return c.height=l,c.style.height=j(l),c.style.width=j(o),c},Se={number:3,unit:"mu"},Rt={number:4,unit:"mu"},mt={number:5,unit:"mu"},jc={mord:{mop:Se,mbin:Rt,mrel:mt,minner:Se},mop:{mord:Se,mop:Se,mrel:mt,minner:Se},mbin:{mord:Rt,mop:Rt,mopen:Rt,minner:Rt},mrel:{mord:mt,mop:mt,mopen:mt,minner:mt},mopen:{},mclose:{mop:Se,mbin:Rt,mrel:mt,minner:Se},mpunct:{mord:Se,mop:Se,mrel:mt,mopen:Se,mclose:Se,mpunct:Se,minner:Se},minner:{mord:Se,mop:Se,mbin:Rt,mrel:mt,mopen:Se,mpunct:Se,minner:Se}},Xc={mord:{mop:Se},mop:{mord:Se,mop:Se},mbin:{},mrel:{},mopen:{},mclose:{mop:Se},mpunct:{},minner:{mop:Se}},kl={},Xr={},Jr={};function Z(t){for(var{type:e,names:r,props:n,handler:o,htmlBuilder:l,mathmlBuilder:i}=t,s={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:o},c=0;c<r.length;++c)kl[r[c]]=s;e&&(l&&(Xr[e]=l),i&&(Jr[e]=i))}function Ft(t){var{type:e,htmlBuilder:r,mathmlBuilder:n}=t;Z({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:r,mathmlBuilder:n})}var Qr=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Ne=function(e){return e.type==="ordgroup"?e.body:[e]},Jc=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Qc=new Set(["rightmost","mrel","mclose","mpunct"]),Zc={display:fe.DISPLAY,text:fe.TEXT,script:fe.SCRIPT,scriptscript:fe.SCRIPTSCRIPT},e1={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ve=function(e,r,n,o){o===void 0&&(o=[null,null]);for(var l=[],i=0;i<e.length;i++){var s=we(e[i],r);if(s instanceof lr){var c=s.children;l.push(...c)}else l.push(s)}if(gl(l),!n)return l;var m=r;if(e.length===1){var p=e[0];p.type==="sizing"?m=r.havingSize(p.size):p.type==="styling"&&(m=r.havingStyle(Zc[p.style]))}var f=$([o[0]||"leftmost"],[],r),g=$([o[1]||"rightmost"],[],r),b=n==="root";return f0(l,(v,w)=>{var k=w.classes[0],T=v.classes[0];k==="mbin"&&Qc.has(T)?w.classes[0]="mord":T==="mbin"&&Jc.has(k)&&(v.classes[0]="mord")},{node:f},g,b),f0(l,(v,w)=>{var k,T,M=h0(w),E=h0(v),S=M&&E?v.hasClass("mtight")?(k=Xc[M])==null?void 0:k[E]:(T=jc[M])==null?void 0:T[E]:null;if(S)return bl(S,m)},{node:f},g,b),l},f0=function(e,r,n,o,l){o&&e.push(o);for(var i=0;i<e.length;i++){var s=e[i],c=xl(s);if(c){f0(c.children,r,n,null,l);continue}var m=!s.hasClass("mspace");if(m){var p=r(s,n.node);p&&(n.insertAfter?n.insertAfter(p):(e.unshift(p),i++))}m?n.node=s:l&&s.hasClass("newline")&&(n.node=$(["leftmost"])),n.insertAfter=(f=>g=>{e.splice(f+1,0,g),i++})(i)}o&&e.pop()},xl=function(e){return e instanceof lr||e instanceof sn||e instanceof ir&&e.hasClass("enclosing")?e:null},p0=function(e,r){var n=xl(e);if(n){var o=n.children;if(o.length){if(r==="right")return p0(o[o.length-1],"right");if(r==="left")return p0(o[0],"left")}}return e},h0=function(e,r){if(!e)return null;r&&(e=p0(e,r));var n=e.classes[0];return e1[n]||null},yr=function(e,r){var n=["nulldelimiter"].concat(e.baseSizingClasses());return $(r.concat(n))},we=function(e,r,n){if(!e)return $();if(Xr[e.type]){var o=Xr[e.type](e,r);if(n&&r.size!==n.size){o=$(r.sizingClasses(n),[o],r);var l=r.sizeMultiplier/n.sizeMultiplier;o.height*=l,o.depth*=l}return o}else throw new _("Got group of unknown type: '"+e.type+"'")};function Dr(t,e){var r=$(["base"],t,e),n=$(["strut"]);return n.style.height=j(r.height+r.depth),r.depth&&(n.style.verticalAlign=j(-r.depth)),r.children.unshift(n),r}function v0(t,e){var r=null;t.length===1&&t[0].type==="tag"&&(r=t[0].tag,t=t[0].body);var n=Ve(t,e,"root"),o;n.length===2&&n[1].hasClass("tag")&&(o=n.pop());for(var l=[],i=[],s=0;s<n.length;s++)if(i.push(n[s]),n[s].hasClass("mbin")||n[s].hasClass("mrel")||n[s].hasClass("allowbreak")){for(var c=!1;s<n.length-1&&n[s+1].hasClass("mspace")&&!n[s+1].hasClass("newline");)s++,i.push(n[s]),n[s].hasClass("nobreak")&&(c=!0);c||(l.push(Dr(i,e)),i=[])}else n[s].hasClass("newline")&&(i.pop(),i.length>0&&(l.push(Dr(i,e)),i=[]),l.push(n[s]));i.length>0&&l.push(Dr(i,e));var m;r?(m=Dr(Ve(r,e,!0),e),m.classes=["tag"],l.push(m)):o&&l.push(o);var p=$(["katex-html"],l);if(p.setAttribute("aria-hidden","true"),m){var f=m.children[0];f.style.height=j(p.height+p.depth),p.depth&&(f.style.verticalAlign=j(-p.depth))}return p}function Cl(t){return new lr(t)}class W{constructor(e,r,n){this.type=e,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(e,r){this.attributes[e]=r}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&e.setAttribute(r,this.attributes[r]);this.classes.length>0&&(e.className=At(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Ie&&this.children[n+1]instanceof Ie){for(var o=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Ie;)o+=this.children[++n].toText();e.appendChild(new Ie(o).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(e+=" "+r+'="',e+=Fe(this.attributes[r]),e+='"');this.classes.length>0&&(e+=' class ="'+Fe(At(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Ie{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Fe(this.toText())}toText(){return this.text}}class Tl{constructor(e){this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",j(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+j(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var t1=new Set(["\\imath","\\jmath"]),r1=new Set(["mrow","mtable"]),nt=function(e,r,n){return Ce[r][e]&&Ce[r][e].replace&&e.charCodeAt(0)!==55349&&!(vl.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Ce[r][e].replace),new Ie(e)},H0=function(e){return e.length===1?e[0]:new W("mrow",e)},R0=function(e,r){if(r.fontFamily==="texttt")return"monospace";if(r.fontFamily==="textsf")return r.fontShape==="textit"&&r.fontWeight==="textbf"?"sans-serif-bold-italic":r.fontShape==="textit"?"sans-serif-italic":r.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(r.fontShape==="textit"&&r.fontWeight==="textbf")return"bold-italic";if(r.fontShape==="textit")return"italic";if(r.fontWeight==="textbf")return"bold";var n=r.font;if(!n||n==="mathnormal")return null;var o=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var l=e.text;if(t1.has(l))return null;if(Ce[o][l]){var i=Ce[o][l].replace;i&&(l=i)}var s=m0[n].fontName;return I0(l,s,o)?m0[n].variant:null};function $n(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Ie&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var r=t.children[0];return r instanceof Ie&&r.text===","}else return!1}var et=function(e,r,n){if(e.length===1){var o=xe(e[0],r);return n&&o instanceof W&&o.type==="mo"&&(o.setAttribute("lspace","0em"),o.setAttribute("rspace","0em")),[o]}for(var l=[],i,s=0;s<e.length;s++){var c=xe(e[s],r);if(c instanceof W&&i instanceof W){if(c.type==="mtext"&&i.type==="mtext"&&c.getAttribute("mathvariant")===i.getAttribute("mathvariant")){i.children.push(...c.children);continue}else if(c.type==="mn"&&i.type==="mn"){i.children.push(...c.children);continue}else if($n(c)&&i.type==="mn"){i.children.push(...c.children);continue}else if(c.type==="mn"&&$n(i))c.children=[...i.children,...c.children],l.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(i.type==="mn"||$n(i))){var m=c.children[0];m instanceof W&&m.type==="mn"&&(m.children=[...i.children,...m.children],l.pop())}else if(i.type==="mi"&&i.children.length===1){var p=i.children[0];if(p instanceof Ie&&p.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var f=c.children[0];f instanceof Ie&&f.text.length>0&&(f.text=f.text.slice(0,1)+"̸"+f.text.slice(1),l.pop())}}}l.push(c),i=c}return l},Nt=function(e,r,n){return H0(et(e,r,n))},xe=function(e,r){if(!e)return new W("mrow");if(Jr[e.type]){var n=Jr[e.type](e,r);return n}else throw new _("Got group of unknown type: '"+e.type+"'")};function Oa(t,e,r,n,o){var l=et(t,r),i;l.length===1&&l[0]instanceof W&&r1.has(l[0].type)?i=l[0]:i=new W("mrow",l);var s=new W("annotation",[new Ie(e)]);s.setAttribute("encoding","application/x-tex");var c=new W("semantics",[i,s]),m=new W("math",[c]);m.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&m.setAttribute("display","block");var p=o?"katex":"katex-mathml";return $([p],[m])}var n1=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Va=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],$a=function(e,r){return r.size<2?e:n1[e-1][r.size-1]};class ft{constructor(e){this.style=e.style,this.color=e.color,this.size=e.size||ft.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Va[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(r,e),new ft(r)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:$a(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Va[e-1]})}havingBaseStyle(e){e=e||this.style.text();var r=$a(ft.BASESIZE,e);return this.size===r&&this.textSize===ft.BASESIZE&&this.style===e?this:this.extend({style:e,size:r})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==ft.BASESIZE?["sizing","reset-size"+this.size,"size"+ft.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Fc(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}ft.BASESIZE=6;var El=function(e){return new ft({style:e.displayMode?fe.DISPLAY:fe.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Ml=function(e,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),e=$(n,[e])}return e},a1=function(e,r,n){var o=El(n),l;if(n.output==="mathml")return Oa(e,r,o,n.displayMode,!0);if(n.output==="html"){var i=v0(e,o);l=$(["katex"],[i])}else{var s=Oa(e,r,o,n.displayMode,!1),c=v0(e,o);l=$(["katex"],[s,c])}return Ml(l,n)},o1=function(e,r,n){var o=El(n),l=v0(e,o),i=$(["katex"],[l]);return Ml(i,n)},l1={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},dn=function(e){var r=new W("mo",[new Ie(l1[e.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},i1={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},s1=new Set(["widehat","widecheck","widetilde","utilde"]),mn=function(e,r){function n(){var s=4e5,c=e.label.slice(1);if(s1.has(c)){var m=e,p=m.base.type==="ordgroup"?m.base.body.length:1,f,g,b;if(p>5)c==="widehat"||c==="widecheck"?(f=420,s=2364,b=.42,g=c+"4"):(f=312,s=2340,b=.34,g="tilde4");else{var v=[1,1,2,2,3,3][p];c==="widehat"||c==="widecheck"?(s=[0,1062,2364,2364,2364][v],f=[0,239,300,360,420][v],b=[0,.24,.3,.3,.36,.42][v],g=c+v):(s=[0,600,1033,2339,2340][v],f=[0,260,286,306,312][v],b=[0,.26,.286,.3,.306,.34][v],g="tilde"+v)}var w=new Bt(g),k=new vt([w],{width:"100%",height:j(b),viewBox:"0 0 "+s+" "+f,preserveAspectRatio:"none"});return{span:Lt([],[k],r),minWidth:0,height:b}}else{var T=[],M=i1[c],[E,S,B]=M,z=B/1e3,F=E.length,P,N;if(F===1){var H=M[3];P=["hide-tail"],N=[H]}else if(F===2)P=["halfarrow-left","halfarrow-right"],N=["xMinYMin","xMaxYMin"];else if(F===3)P=["brace-left","brace-center","brace-right"],N=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
297
+ `+F+" children.");for(var G=0;G<F;G++){var X=new Bt(E[G]),ae=new vt([X],{width:"400em",height:j(z),viewBox:"0 0 "+s+" "+B,preserveAspectRatio:N[G]+" slice"}),re=Lt([P[G]],[ae],r);if(F===1)return{span:re,minWidth:S,height:z};re.style.height=j(z),T.push(re)}return{span:$(["stretchy"],T,r),minWidth:S,height:z}}}var{span:o,minWidth:l,height:i}=n();return o.height=i,o.style.height=j(i),l>0&&(o.style.minWidth=j(l)),o},u1=function(e,r,n,o,l){var i,s=e.height+e.depth+n+o;if(/fbox|color|angl/.test(r)){if(i=$(["stretchy",r],[],l),r==="fbox"){var c=l.color&&l.getColor();c&&(i.style.borderColor=c)}}else{var m=[];/^[bx]cancel$/.test(r)&&m.push(new c0({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&m.push(new c0({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var p=new vt(m,{width:"100%",height:j(s)});i=Lt([],[p],l)}return i.height=s,i.style.height=j(s),i};function he(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function fn(t){var e=pn(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function pn(t){return t&&(t.type==="atom"||Uc.hasOwnProperty(t.type))?t:null}var Sl=t=>{if(t instanceof Qe)return t;if(Vc(t)&&t.children.length===1)return Sl(t.children[0])},P0=(t,e)=>{var r,n,o;t&&t.type==="supsub"?(n=he(t.base,"accent"),r=n.base,t.base=r,o=Oc(we(t,e)),t.base=n):(n=he(t,"accent"),r=n.base);var l=we(r,e.havingCrampedStyle()),i=n.isShifty&&gt(r),s=0;if(i){var c,m;s=(c=(m=Sl(l))==null?void 0:m.skew)!=null?c:0}var p=n.label==="\\c",f=p?l.height+l.depth:Math.min(l.height,e.fontMetrics().xHeight),g;if(n.isStretchy)g=mn(n,e),g=ye({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+j(2*s)+")",marginLeft:j(2*s)}:void 0}]});else{var b,v;n.label==="\\vec"?(b=wl("vec",e),v=yl.vec[1]):(b=cn({mode:n.mode,text:n.label},e,"textord"),b=Pc(b),b.italic=0,v=b.width,p&&(f+=b.depth)),g=$(["accent-body"],[b]);var w=n.label==="\\textcircled";w&&(g.classes.push("accent-full"),f=l.height);var k=s;w||(k-=v/2),g.style.left=j(k),n.label==="\\textcircled"&&(g.style.top=".2em"),g=ye({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:-f},{type:"elem",elem:g}]})}var T=$(["mord","accent"],[g],e);return o?(o.children[0]=T,o.height=Math.max(T.height,o.height),o.classes[0]="mord",o):T},Al=(t,e)=>{var r=t.isStretchy?dn(t.label):new W("mo",[nt(t.label,t.mode)]),n=new W("mover",[xe(t.base,e),r]);return n.setAttribute("accent","true"),n},c1=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Z({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var r=Qr(e[0]),n=!c1.test(t.funcName),o=!n||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:n,isShifty:o,base:r}},htmlBuilder:P0,mathmlBuilder:Al});Z({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var r=e[0],n=t.parser.mode;return n==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:t.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:P0,mathmlBuilder:Al});Z({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:r,funcName:n}=t,o=e[0];return{type:"accentUnder",mode:r.mode,label:n,base:o}},htmlBuilder:(t,e)=>{var r=we(t.base,e),n=mn(t,e),o=t.label==="\\utilde"?.12:0,l=ye({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:o},{type:"elem",elem:r}]});return $(["mord","accentunder"],[l],e)},mathmlBuilder:(t,e)=>{var r=dn(t.label),n=new W("munder",[xe(t.base,e),r]);return n.setAttribute("accentunder","true"),n}});var Hr=t=>{var e=new W("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Z({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,r){var{parser:n,funcName:o}=t;return{type:"xArrow",mode:n.mode,label:o,body:e[0],below:r[0]}},htmlBuilder(t,e){var r=e.style,n=e.havingStyle(r.sup()),o=rr(we(t.body,n,e),e),l=t.label.slice(0,2)==="\\x"?"x":"cd";o.classes.push(l+"-arrow-pad");var i;t.below&&(n=e.havingStyle(r.sub()),i=rr(we(t.below,n,e),e),i.classes.push(l+"-arrow-pad"));var s=mn(t,e),c=-e.fontMetrics().axisHeight+.5*s.height,m=-e.fontMetrics().axisHeight-.5*s.height-.111;(o.depth>.25||t.label==="\\xleftequilibrium")&&(m-=o.depth);var p;if(i){var f=-e.fontMetrics().axisHeight+i.height+.5*s.height+.111;p=ye({positionType:"individualShift",children:[{type:"elem",elem:o,shift:m},{type:"elem",elem:s,shift:c},{type:"elem",elem:i,shift:f}]})}else p=ye({positionType:"individualShift",children:[{type:"elem",elem:o,shift:m},{type:"elem",elem:s,shift:c}]});return p.children[0].children[0].children[1].classes.push("svg-align"),$(["mrel","x-arrow"],[p],e)},mathmlBuilder(t,e){var r=dn(t.label);r.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(t.body){var o=Hr(xe(t.body,e));if(t.below){var l=Hr(xe(t.below,e));n=new W("munderover",[r,l,o])}else n=new W("mover",[r,o])}else if(t.below){var i=Hr(xe(t.below,e));n=new W("munder",[r,i])}else n=Hr(),n=new W("mover",[r,n]);return n}});function Bl(t,e){var r=Ve(t.body,e,!0);return $([t.mclass],r,e)}function Ll(t,e){var r,n=et(t.body,e);return t.mclass==="minner"?r=new W("mpadded",n):t.mclass==="mord"?t.isCharacterBox?(r=n[0],r.type="mi"):r=new W("mi",n):(t.isCharacterBox?(r=n[0],r.type="mo"):r=new W("mo",n),t.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):t.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):t.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}Z({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:r,funcName:n}=t,o=e[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:Ne(o),isCharacterBox:gt(o)}},htmlBuilder:Bl,mathmlBuilder:Ll});var hn=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Z({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:r}=t;return{type:"mclass",mode:r.mode,mclass:hn(e[0]),body:Ne(e[1]),isCharacterBox:gt(e[1])}}});Z({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:r,funcName:n}=t,o=e[1],l=e[0],i;n!=="\\stackrel"?i=hn(o):i="mrel";var s={type:"op",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:Ne(o)},c={type:"supsub",mode:l.mode,base:s,sup:n==="\\underset"?null:l,sub:n==="\\underset"?l:null};return{type:"mclass",mode:r.mode,mclass:i,body:[c],isCharacterBox:gt(c)}},htmlBuilder:Bl,mathmlBuilder:Ll});Z({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:r}=t;return{type:"pmb",mode:r.mode,mclass:hn(e[0]),body:Ne(e[0])}},htmlBuilder(t,e){var r=Ve(t.body,e,!0),n=$([t.mclass],r,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(t,e){var r=et(t.body,e),n=new W("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var d1={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Fa=()=>({type:"styling",body:[],mode:"math",style:"display"}),qa=t=>t.type==="textord"&&t.text==="@",m1=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function f1(t,e,r){var n=d1[t];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var o=r.callFunction("\\\\cdleft",[e[0]],[]),l={type:"atom",text:n,mode:"math",family:"rel"},i=r.callFunction("\\Big",[l],[]),s=r.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[o,i,s]};return r.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var m={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[m],[])}default:return{type:"textord",text:" ",mode:"math"}}}function p1(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var r=t.fetch().text;if(r==="&"||r==="\\\\")t.consume();else if(r==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new _("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var n=[],o=[n],l=0;l<e.length;l++){for(var i=e[l],s=Fa(),c=0;c<i.length;c++)if(!qa(i[c]))s.body.push(i[c]);else{n.push(s),c+=1;var m=fn(i[c]).text,p=new Array(2);if(p[0]={type:"ordgroup",mode:"math",body:[]},p[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(m))if("<>AV".includes(m))for(var f=0;f<2;f++){for(var g=!0,b=c+1;b<i.length;b++){if(m1(i[b],m)){g=!1,c=b;break}if(qa(i[b]))throw new _("Missing a "+m+" character to complete a CD arrow.",i[b]);p[f].body.push(i[b])}if(g)throw new _("Missing a "+m+" character to complete a CD arrow.",i[c])}else throw new _('Expected one of "<>AV=|." after @',i[c]);var v=f1(m,p,t),w={type:"styling",body:[v],mode:"math",style:"display"};n.push(w),s=Fa()}l%2===0?n.push(s):n.shift(),n=[],o.push(n)}t.gullet.endGroup(),t.gullet.endGroup();var k=new Array(o[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:o,arraystretch:1,addJot:!0,rowGaps:[null],cols:k,colSeparationType:"CD",hLinesBeforeRow:new Array(o.length+1).fill([])}}Z({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:r,funcName:n}=t;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:e[0]}},htmlBuilder(t,e){var r=e.havingStyle(e.style.sup()),n=rr(we(t.label,r,e),e);return n.classes.push("cd-label-"+t.side),n.style.bottom=j(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(t,e){var r=new W("mrow",[xe(t.label,e)]);return r=new W("mpadded",[r]),r.setAttribute("width","0"),t.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new W("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});Z({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:r}=t;return{type:"cdlabelparent",mode:r.mode,fragment:e[0]}},htmlBuilder(t,e){var r=rr(we(t.fragment,e),e);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(t,e){return new W("mrow",[xe(t.fragment,e)])}});Z({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:r}=t,n=he(e[0],"ordgroup"),o=n.body,l="",i=0;i<o.length;i++){var s=he(o[i],"textord");l+=s.text}var c=parseInt(l),m;if(isNaN(c))throw new _("\\@char has non-numeric argument "+l);if(c<0||c>=1114111)throw new _("\\@char with invalid code point "+l);return c<=65535?m=String.fromCharCode(c):(c-=65536,m=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:r.mode,text:m}}});var Nl=(t,e)=>{var r=Ve(t.body,e.withColor(t.color),!1);return yt(r)},Il=(t,e)=>{var r=et(t.body,e.withColor(t.color)),n=new W("mstyle",r);return n.setAttribute("mathcolor",t.color),n};Z({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:r}=t,n=he(e[0],"color-token").color,o=e[1];return{type:"color",mode:r.mode,color:n,body:Ne(o)}},htmlBuilder:Nl,mathmlBuilder:Il});Z({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:r,breakOnTokenText:n}=t,o=he(e[0],"color-token").color;r.gullet.macros.set("\\current@color",o);var l=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:o,body:l}},htmlBuilder:Nl,mathmlBuilder:Il});Z({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,r){var{parser:n}=t,o=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,l=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:l,size:o&&he(o,"size").value}},htmlBuilder(t,e){var r=$(["mspace"],[],e);return t.newLine&&(r.classes.push("newline"),t.size&&(r.style.marginTop=j(Ae(t.size,e)))),r},mathmlBuilder(t,e){var r=new W("mspace");return t.newLine&&(r.setAttribute("linebreak","newline"),t.size&&r.setAttribute("height",j(Ae(t.size,e)))),r}});var g0={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},zl=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new _("Expected a control sequence",t);return e},h1=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},Dl=(t,e,r,n)=>{var o=t.gullet.macros.get(r.text);o==null&&(r.noexpand=!0,o={tokens:[r],numArgs:0,unexpandable:!t.gullet.isExpandable(r.text)}),t.gullet.macros.set(e,o,n)};Z({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:r}=t;e.consumeSpaces();var n=e.fetch();if(g0[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=g0[n.text]),he(e.parseFunction(),"internal");throw new _("Invalid token after macro prefix",n)}});Z({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:r}=t,n=e.gullet.popToken(),o=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new _("Expected a control sequence",n);for(var l=0,i,s=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){i=e.gullet.future(),s[l].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new _('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==l+1)throw new _('Argument number "'+n.text+'" out of order');l++,s.push([])}else{if(n.text==="EOF")throw new _("Expected a macro definition");s[l].push(n.text)}var{tokens:c}=e.gullet.consumeArg();return i&&c.unshift(i),(r==="\\edef"||r==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(o,{tokens:c,numArgs:l,delimiters:s},r===g0[r]),{type:"internal",mode:e.mode}}});Z({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:r}=t,n=zl(e.gullet.popToken());e.gullet.consumeSpaces();var o=h1(e);return Dl(e,n,o,r==="\\\\globallet"),{type:"internal",mode:e.mode}}});Z({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:r}=t,n=zl(e.gullet.popToken()),o=e.gullet.popToken(),l=e.gullet.popToken();return Dl(e,n,l,r==="\\\\globalfuture"),e.gullet.pushToken(l),e.gullet.pushToken(o),{type:"internal",mode:e.mode}}});var pr=function(e,r,n){var o=Ce.math[e]&&Ce.math[e].replace,l=I0(o||e,r,n);if(!l)throw new Error("Unsupported symbol "+e+" and font size "+r+".");return l},O0=function(e,r,n,o){var l=n.havingBaseStyle(r),i=$(o.concat(l.sizingClasses(n)),[e],n),s=l.sizeMultiplier/n.sizeMultiplier;return i.height*=s,i.depth*=s,i.maxFontSize=l.sizeMultiplier,i},Hl=function(e,r,n){var o=r.havingBaseStyle(n),l=(1-r.sizeMultiplier/o.sizeMultiplier)*r.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=j(l),e.height-=l,e.depth+=l},v1=function(e,r,n,o,l,i){var s=_e(e,"Main-Regular",l,o),c=O0(s,r,o,i);return Hl(c,o,r),c},g1=function(e,r,n,o){return _e(e,"Size"+r+"-Regular",n,o)},Rl=function(e,r,n,o,l,i){var s=g1(e,r,l,o),c=O0($(["delimsizing","size"+r],[s],o),fe.TEXT,o,i);return n&&Hl(c,o,fe.TEXT),c},Fn=function(e,r,n){var o;r==="Size1-Regular"?o="delim-size1":o="delim-size4";var l=$(["delimsizinginner",o],[$([],[_e(e,r,n)])]);return{type:"elem",elem:l}},qn=function(e,r,n){var o=lt["Size4-Regular"][e.charCodeAt(0)]?lt["Size4-Regular"][e.charCodeAt(0)][4]:lt["Size1-Regular"][e.charCodeAt(0)][4],l=new Bt("inner",Nc(e,Math.round(1e3*r))),i=new vt([l],{width:j(o),height:j(r),style:"width:"+j(o),viewBox:"0 0 "+1e3*o+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),s=Lt([],[i],n);return s.height=r,s.style.height=j(r),s.style.width=j(o),{type:"elem",elem:s}},b0=.008,Rr={type:"kern",size:-1*b0},b1=new Set(["|","\\lvert","\\rvert","\\vert"]),y1=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Pl=function(e,r,n,o,l,i){var s,c,m,p,f="",g=0;s=m=p=e,c=null;var b="Size1-Regular";e==="\\uparrow"?m=p="⏐":e==="\\Uparrow"?m=p="‖":e==="\\downarrow"?s=m="⏐":e==="\\Downarrow"?s=m="‖":e==="\\updownarrow"?(s="\\uparrow",m="⏐",p="\\downarrow"):e==="\\Updownarrow"?(s="\\Uparrow",m="‖",p="\\Downarrow"):b1.has(e)?(m="∣",f="vert",g=333):y1.has(e)?(m="∥",f="doublevert",g=556):e==="["||e==="\\lbrack"?(s="⎡",m="⎢",p="⎣",b="Size4-Regular",f="lbrack",g=667):e==="]"||e==="\\rbrack"?(s="⎤",m="⎥",p="⎦",b="Size4-Regular",f="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(m=s="⎢",p="⎣",b="Size4-Regular",f="lfloor",g=667):e==="\\lceil"||e==="⌈"?(s="⎡",m=p="⎢",b="Size4-Regular",f="lceil",g=667):e==="\\rfloor"||e==="⌋"?(m=s="⎥",p="⎦",b="Size4-Regular",f="rfloor",g=667):e==="\\rceil"||e==="⌉"?(s="⎤",m=p="⎥",b="Size4-Regular",f="rceil",g=667):e==="("||e==="\\lparen"?(s="⎛",m="⎜",p="⎝",b="Size4-Regular",f="lparen",g=875):e===")"||e==="\\rparen"?(s="⎞",m="⎟",p="⎠",b="Size4-Regular",f="rparen",g=875):e==="\\{"||e==="\\lbrace"?(s="⎧",c="⎨",p="⎩",m="⎪",b="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(s="⎫",c="⎬",p="⎭",m="⎪",b="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(s="⎧",p="⎩",m="⎪",b="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(s="⎫",p="⎭",m="⎪",b="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(s="⎧",p="⎭",m="⎪",b="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(s="⎫",p="⎩",m="⎪",b="Size4-Regular");var v=pr(s,b,l),w=v.height+v.depth,k=pr(m,b,l),T=k.height+k.depth,M=pr(p,b,l),E=M.height+M.depth,S=0,B=1;if(c!==null){var z=pr(c,b,l);S=z.height+z.depth,B=2}var F=w+E+S,P=Math.max(0,Math.ceil((r-F)/(B*T))),N=F+P*B*T,H=o.fontMetrics().axisHeight;n&&(H*=o.sizeMultiplier);var G=N/2-H,X=[];if(f.length>0){var ae=N-w-E,re=Math.round(N*1e3),ce=Ic(f,Math.round(ae*1e3)),ne=new Bt(f,ce),ge=j(g/1e3),ve=j(re/1e3),se=new vt([ne],{width:ge,height:ve,viewBox:"0 0 "+g+" "+re}),R=Lt([],[se],o);R.height=re/1e3,R.style.width=ge,R.style.height=ve,X.push({type:"elem",elem:R})}else{if(X.push(Fn(p,b,l)),X.push(Rr),c===null){var Y=N-w-E+2*b0;X.push(qn(m,Y,o))}else{var K=(N-w-E-S)/2+2*b0;X.push(qn(m,K,o)),X.push(Rr),X.push(Fn(c,b,l)),X.push(Rr),X.push(qn(m,K,o))}X.push(Rr),X.push(Fn(s,b,l))}var q=o.havingBaseStyle(fe.TEXT),U=ye({positionType:"bottom",positionData:G,children:X});return O0($(["delimsizing","mult"],[U],q),fe.TEXT,o,i)},Un=80,_n=.08,Wn=function(e,r,n,o,l){var i=Lc(e,o,n),s=new Bt(e,i),c=new vt([s],{width:"400em",height:j(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return Lt(["hide-tail"],[c],l)},w1=function(e,r){var n=r.havingBaseSizing(),o=ql("\\surd",e*n.sizeMultiplier,Fl,n),l=n.sizeMultiplier,i=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),s,c=0,m=0,p=0,f;return o.type==="small"?(p=1e3+1e3*i+Un,e<1?l=1:e<1.4&&(l=.7),c=(1+i+_n)/l,m=(1+i)/l,s=Wn("sqrtMain",c,p,i,r),s.style.minWidth="0.853em",f=.833/l):o.type==="large"?(p=(1e3+Un)*hr[o.size],m=(hr[o.size]+i)/l,c=(hr[o.size]+i+_n)/l,s=Wn("sqrtSize"+o.size,c,p,i,r),s.style.minWidth="1.02em",f=1/l):(c=e+i+_n,m=e+i,p=Math.floor(1e3*e+i)+Un,s=Wn("sqrtTall",c,p,i,r),s.style.minWidth="0.742em",f=1.056),s.height=m,s.style.height=j(c),{span:s,advanceWidth:f,ruleWidth:(r.fontMetrics().sqrtRuleThickness+i)*l}},Ol=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),k1=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Vl=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),hr=[0,1.2,1.8,2.4,3],$l=function(e,r,n,o,l){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),Ol.has(e)||Vl.has(e))return Rl(e,r,!1,n,o,l);if(k1.has(e))return Pl(e,hr[r],!1,n,o,l);throw new _("Illegal delimiter: '"+e+"'")},x1=[{type:"small",style:fe.SCRIPTSCRIPT},{type:"small",style:fe.SCRIPT},{type:"small",style:fe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],C1=[{type:"small",style:fe.SCRIPTSCRIPT},{type:"small",style:fe.SCRIPT},{type:"small",style:fe.TEXT},{type:"stack"}],Fl=[{type:"small",style:fe.SCRIPTSCRIPT},{type:"small",style:fe.SCRIPT},{type:"small",style:fe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],T1=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var r=e.type;throw new Error("Add support for delim type '"+r+"' here.")},ql=function(e,r,n,o){for(var l=Math.min(2,3-o.style.size),i=l;i<n.length;i++){var s=n[i];if(s.type==="stack")break;var c=pr(e,T1(s),"math"),m=c.height+c.depth;if(s.type==="small"){var p=o.havingBaseStyle(s.style);m*=p.sizeMultiplier}if(m>r)return s}return n[n.length-1]},y0=function(e,r,n,o,l,i){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var s;Vl.has(e)?s=x1:Ol.has(e)?s=Fl:s=C1;var c=ql(e,r,s,o);return c.type==="small"?v1(e,c.style,n,o,l,i):c.type==="large"?Rl(e,c.size,n,o,l,i):Pl(e,r,n,o,l,i)},Gn=function(e,r,n,o,l,i){var s=o.fontMetrics().axisHeight*o.sizeMultiplier,c=901,m=5/o.fontMetrics().ptPerEm,p=Math.max(r-s,n+s),f=Math.max(p/500*c,2*p-m);return y0(e,f,!0,o,l,i)},Ua={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},E1=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function vn(t,e){var r=pn(t);if(r&&E1.has(r.text))return r;throw r?new _("Invalid delimiter '"+r.text+"' after '"+e.funcName+"'",t):new _("Invalid delimiter type '"+t.type+"'",t)}Z({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var r=vn(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:Ua[t.funcName].size,mclass:Ua[t.funcName].mclass,delim:r.text}},htmlBuilder:(t,e)=>t.delim==="."?$([t.mclass]):$l(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(nt(t.delim,t.mode));var r=new W("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=j(hr[t.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function _a(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Z({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var r=t.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new _("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:vn(e[0],t).text,color:r}}});Z({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var r=vn(e[0],t),n=t.parser;++n.leftrightDepth;var o=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var l=he(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:o,left:r.text,right:l.delim,rightColor:l.color}},htmlBuilder:(t,e)=>{_a(t);for(var r=Ve(t.body,e,!0,["mopen","mclose"]),n=0,o=0,l=!1,i=0;i<r.length;i++)r[i].isMiddle?l=!0:(n=Math.max(r[i].height,n),o=Math.max(r[i].depth,o));n*=e.sizeMultiplier,o*=e.sizeMultiplier;var s;if(t.left==="."?s=yr(e,["mopen"]):s=Gn(t.left,n,o,e,t.mode,["mopen"]),r.unshift(s),l)for(var c=1;c<r.length;c++){var m=r[c],p=m.isMiddle;p&&(r[c]=Gn(p.delim,n,o,p.options,t.mode,[]))}var f;if(t.right===".")f=yr(e,["mclose"]);else{var g=t.rightColor?e.withColor(t.rightColor):e;f=Gn(t.right,n,o,g,t.mode,["mclose"])}return r.push(f),$(["minner"],r,e)},mathmlBuilder:(t,e)=>{_a(t);var r=et(t.body,e);if(t.left!=="."){var n=new W("mo",[nt(t.left,t.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(t.right!=="."){var o=new W("mo",[nt(t.right,t.mode)]);o.setAttribute("fence","true"),t.rightColor&&o.setAttribute("mathcolor",t.rightColor),r.push(o)}return H0(r)}});Z({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var r=vn(e[0],t);if(!t.parser.leftrightDepth)throw new _("\\middle without preceding \\left",r);return{type:"middle",mode:t.parser.mode,delim:r.text}},htmlBuilder:(t,e)=>{var r;if(t.delim===".")r=yr(e,[]);else{r=$l(t.delim,1,e,t.mode,[]);var n={delim:t.delim,options:e};r.isMiddle=n}return r},mathmlBuilder:(t,e)=>{var r=t.delim==="\\vert"||t.delim==="|"?nt("|","text"):nt(t.delim,t.mode),n=new W("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var gn=(t,e)=>{var r=rr(we(t.body,e),e),n=t.label.slice(1),o=e.sizeMultiplier,l,i=0,s=gt(t.body);if(n==="sout")l=$(["stretchy","sout"]),l.height=e.fontMetrics().defaultRuleThickness/o,i=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var c=Ae({number:.6,unit:"pt"},e),m=Ae({number:.35,unit:"ex"},e),p=e.havingBaseSizing();o=o/p.sizeMultiplier;var f=r.height+r.depth+c+m;r.style.paddingLeft=j(f/2+c);var g=Math.floor(1e3*f*o),b=Ac(g),v=new vt([new Bt("phase",b)],{width:"400em",height:j(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});l=Lt(["hide-tail"],[v],e),l.style.height=j(f),i=r.depth+c+m}else{/cancel/.test(n)?s||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var w=0,k=0,T=0;/box/.test(n)?(T=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(n==="colorbox"?0:T),k=w):n==="angl"?(T=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*T,k=Math.max(0,.25-r.depth)):(w=s?.2:0,k=w),l=u1(r,n,w,k,e),/fbox|boxed|fcolorbox/.test(n)?(l.style.borderStyle="solid",l.style.borderWidth=j(T)):n==="angl"&&T!==.049&&(l.style.borderTopWidth=j(T),l.style.borderRightWidth=j(T)),i=r.depth+k,t.backgroundColor&&(l.style.backgroundColor=t.backgroundColor,t.borderColor&&(l.style.borderColor=t.borderColor))}var M;if(t.backgroundColor)M=ye({positionType:"individualShift",children:[{type:"elem",elem:l,shift:i},{type:"elem",elem:r,shift:0}]});else{var E=/cancel|phase/.test(n)?["svg-align"]:[];M=ye({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:l,shift:i,wrapperClasses:E}]})}return/cancel/.test(n)&&(M.height=r.height,M.depth=r.depth),/cancel/.test(n)&&!s?$(["mord","cancel-lap"],[M],e):$(["mord"],[M],e)},bn=(t,e)=>{var r=0,n=new W(t.label.includes("colorbox")?"mpadded":"menclose",[xe(t.body,e)]);switch(t.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),t.label==="\\fcolorbox"){var o=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+j(o)+" solid "+t.borderColor)}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&n.setAttribute("mathbackground",t.backgroundColor),n};Z({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,r){var{parser:n,funcName:o}=t,l=he(e[0],"color-token").color,i=e[1];return{type:"enclose",mode:n.mode,label:o,backgroundColor:l,body:i}},htmlBuilder:gn,mathmlBuilder:bn});Z({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,r){var{parser:n,funcName:o}=t,l=he(e[0],"color-token").color,i=he(e[1],"color-token").color,s=e[2];return{type:"enclose",mode:n.mode,label:o,backgroundColor:i,borderColor:l,body:s}},htmlBuilder:gn,mathmlBuilder:bn});Z({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:r}=t;return{type:"enclose",mode:r.mode,label:"\\fbox",body:e[0]}}});Z({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(t,e){var{parser:r,funcName:n}=t,o=e[0];return{type:"enclose",mode:r.mode,label:n,body:o}},htmlBuilder:gn,mathmlBuilder:bn});Z({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:r,funcName:n}=t;r.mode==="math"&&r.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var o=e[0];return{type:"enclose",mode:r.mode,label:n,body:o}},htmlBuilder:gn,mathmlBuilder:bn});Z({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:r}=t;return{type:"enclose",mode:r.mode,label:"\\angl",body:e[0]}}});var Ul={};function it(t){for(var{type:e,names:r,props:n,handler:o,htmlBuilder:l,mathmlBuilder:i}=t,s={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:o},c=0;c<r.length;++c)Ul[r[c]]=s;l&&(Xr[e]=l),i&&(Jr[e]=i)}var _l={};function y(t,e){_l[t]=e}class Ye{constructor(e,r,n){this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new Ye(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}}class Je{constructor(e,r){this.text=e,this.loc=r}range(e,r){return new Je(r,Ye.range(this,e))}}function Wa(t){var e=[];t.consumeSpaces();var r=t.fetch().text;for(r==="\\relax"&&(t.consume(),t.consumeSpaces(),r=t.fetch().text);r==="\\hline"||r==="\\hdashline";)t.consume(),e.push(r==="\\hdashline"),t.consumeSpaces(),r=t.fetch().text;return e}var yn=t=>{var e=t.parser.settings;if(!e.displayMode)throw new _("{"+t.envName+"} can be used only in display mode.")},M1=new Set(["gather","gather*"]);function V0(t){if(!t.includes("ed"))return!t.includes("*")}function It(t,e,r){var{hskipBeforeAndAfter:n,addJot:o,cols:l,arraystretch:i,colSeparationType:s,autoTag:c,singleRow:m,emptySingleRow:p,maxNumCols:f,leqno:g}=e;if(t.gullet.beginGroup(),m||t.gullet.macros.set("\\cr","\\\\\\relax"),!i){var b=t.gullet.expandMacroAsText("\\arraystretch");if(b==null)i=1;else if(i=parseFloat(b),!i||i<0)throw new _("Invalid \\arraystretch: "+b)}t.gullet.beginGroup();var v=[],w=[v],k=[],T=[],M=c!=null?[]:void 0;function E(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function S(){M&&(t.gullet.macros.get("\\df@tag")?(M.push(t.subparse([new Je("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):M.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(E(),T.push(Wa(t));;){var B=t.parseExpression(!1,m?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup();var z={type:"ordgroup",mode:t.mode,body:B};r&&(z={type:"styling",mode:t.mode,style:r,body:[z]}),v.push(z);var F=t.fetch().text;if(F==="&"){if(f&&v.length===f){if(m||s)throw new _("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(F==="\\end"){S(),v.length===1&&z.type==="styling"&&z.body.length===1&&z.body[0].type==="ordgroup"&&z.body[0].body.length===0&&(w.length>1||!p)&&w.pop(),T.length<w.length+1&&T.push([]);break}else if(F==="\\\\"){t.consume();var P=void 0;t.gullet.future().text!==" "&&(P=t.parseSizeGroup(!0)),k.push(P?P.value:null),S(),T.push(Wa(t)),v=[],w.push(v),E()}else throw new _("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:o,arraystretch:i,body:w,cols:l,rowGaps:k,hskipBeforeAndAfter:n,hLinesBeforeRow:T,colSeparationType:s,tags:M,leqno:g}}function $0(t){return t.slice(0,1)==="d"?"display":"text"}var st=function(e,r){var n,o,l=e.body.length,i=e.hLinesBeforeRow,s=0,c=new Array(l),m=[],p=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),f=1/r.fontMetrics().ptPerEm,g=5*f;if(e.colSeparationType&&e.colSeparationType==="small"){var b=r.havingStyle(fe.SCRIPT).sizeMultiplier;g=.2778*(b/r.sizeMultiplier)}var v=e.colSeparationType==="CD"?Ae({number:3,unit:"ex"},r):12*f,w=3*f,k=e.arraystretch*v,T=.7*k,M=.3*k,E=0;function S(Ut){for(var _t=0;_t<Ut.length;++_t)_t>0&&(E+=.25),m.push({pos:E,isDashed:Ut[_t]})}for(S(i[0]),n=0;n<e.body.length;++n){var B=e.body[n],z=T,F=M;s<B.length&&(s=B.length);var P=new Array(B.length);for(o=0;o<B.length;++o){var N=we(B[o],r);F<N.depth&&(F=N.depth),z<N.height&&(z=N.height),P[o]=N}var H=e.rowGaps[n],G=0;H&&(G=Ae(H,r),G>0&&(G+=M,F<G&&(F=G),G=0)),e.addJot&&n<e.body.length-1&&(F+=w),P.height=z,P.depth=F,E+=z,P.pos=E,E+=F+G,c[n]=P,S(i[n+1])}var X=E/2+r.fontMetrics().axisHeight,ae=e.cols||[],re=[],ce,ne,ge=[];if(e.tags&&e.tags.some(Ut=>Ut))for(n=0;n<l;++n){var ve=c[n],se=ve.pos-X,R=e.tags[n],Y=void 0;R===!0?Y=$(["eqn-num"],[],r):R===!1?Y=$([],[],r):Y=$([],Ve(R,r,!0),r),Y.depth=ve.depth,Y.height=ve.height,ge.push({type:"elem",elem:Y,shift:se})}for(o=0,ne=0;o<s||ne<ae.length;++o,++ne){for(var K,q=ae[ne],U=!0;((te=q)==null?void 0:te.type)==="separator";){var te;if(U||(ce=$(["arraycolsep"],[]),ce.style.width=j(r.fontMetrics().doubleRuleSep),re.push(ce)),q.separator==="|"||q.separator===":"){var J=q.separator==="|"?"solid":"dashed",L=$(["vertical-separator"],[],r);L.style.height=j(E),L.style.borderRightWidth=j(p),L.style.borderRightStyle=J,L.style.margin="0 "+j(-p/2);var D=E-X;D&&(L.style.verticalAlign=j(-D)),re.push(L)}else throw new _("Invalid separator type: "+q.separator);ne++,q=ae[ne],U=!1}if(!(o>=s)){var V=void 0;if(o>0||e.hskipBeforeAndAfter){var Q,le;V=(Q=(le=q)==null?void 0:le.pregap)!=null?Q:g,V!==0&&(ce=$(["arraycolsep"],[]),ce.style.width=j(V),re.push(ce))}var be=[];for(n=0;n<l;++n){var Me=c[n],De=Me[o];if(De){var je=Me.pos-X;De.depth=Me.depth,De.height=Me.height,be.push({type:"elem",elem:De,shift:je})}}var qe=ye({positionType:"individualShift",children:be}),ue=$(["col-align-"+(((K=q)==null?void 0:K.align)||"c")],[qe]);if(re.push(ue),o<s-1||e.hskipBeforeAndAfter){var pe,Le;V=(pe=(Le=q)==null?void 0:Le.postgap)!=null?pe:g,V!==0&&(ce=$(["arraycolsep"],[]),ce.style.width=j(V),re.push(ce))}}}var $e=$(["mtable"],re);if(m.length>0){for(var ct=tr("hline",r,p),wt=tr("hdashline",r,p),dt=[{type:"elem",elem:$e,shift:0}];m.length>0;){var qt=m.pop(),Er=qt.pos-X;qt.isDashed?dt.push({type:"elem",elem:wt,shift:Er}):dt.push({type:"elem",elem:ct,shift:Er})}$e=ye({positionType:"individualShift",children:dt})}if(ge.length===0)return $(["mord"],[$e],r);var Tn=ye({positionType:"individualShift",children:ge}),cr=$(["tag"],[Tn],r);return yt([$e,cr])},S1={c:"center ",l:"left ",r:"right "},ut=function(e,r){for(var n=[],o=new W("mtd",[],["mtr-glue"]),l=new W("mtd",[],["mml-eqn-num"]),i=0;i<e.body.length;i++){for(var s=e.body[i],c=[],m=0;m<s.length;m++)c.push(new W("mtd",[xe(s[m],r)]));e.tags&&e.tags[i]&&(c.unshift(o),c.push(o),e.leqno?c.unshift(l):c.push(l)),n.push(new W("mtr",c))}var p=new W("mtable",n),f=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);p.setAttribute("rowspacing",j(f));var g="",b="";if(e.cols&&e.cols.length>0){var v=e.cols,w="",k=!1,T=0,M=v.length;v[0].type==="separator"&&(g+="top ",T=1),v[v.length-1].type==="separator"&&(g+="bottom ",M-=1);for(var E=T;E<M;E++){var S=v[E];S.type==="align"?(b+=S1[S.align],k&&(w+="none "),k=!0):S.type==="separator"&&k&&(w+=S.separator==="|"?"solid ":"dashed ",k=!1)}p.setAttribute("columnalign",b.trim()),/[sd]/.test(w)&&p.setAttribute("columnlines",w.trim())}if(e.colSeparationType==="align"){for(var B=e.cols||[],z="",F=1;F<B.length;F++)z+=F%2?"0em ":"1em ";p.setAttribute("columnspacing",z.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?p.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?p.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?p.setAttribute("columnspacing","0.5em"):p.setAttribute("columnspacing","1em");var P="",N=e.hLinesBeforeRow;g+=N[0].length>0?"left ":"",g+=N[N.length-1].length>0?"right ":"";for(var H=1;H<N.length-1;H++)P+=N[H].length===0?"none ":N[H][0]?"dashed ":"solid ";return/[sd]/.test(P)&&p.setAttribute("rowlines",P.trim()),g!==""&&(p=new W("menclose",[p]),p.setAttribute("notation",g.trim())),e.arraystretch&&e.arraystretch<1&&(p=new W("mstyle",[p]),p.setAttribute("scriptlevel","1")),p},Wl=function(e,r){e.envName.includes("ed")||yn(e);var n=[],o=e.envName.includes("at")?"alignat":"align",l=e.envName==="split",i=It(e.parser,{cols:n,addJot:!0,autoTag:l?void 0:V0(e.envName),emptySingleRow:!0,colSeparationType:o,maxNumCols:l?2:void 0,leqno:e.parser.settings.leqno},"display"),s=0,c=0,m={type:"ordgroup",mode:e.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var p="",f=0;f<r[0].body.length;f++){var g=he(r[0].body[f],"textord");p+=g.text}s=Number(p),c=s*2}var b=!c;i.body.forEach(function(T){for(var M=1;M<T.length;M+=2){var E=he(T[M],"styling"),S=he(E.body[0],"ordgroup");S.body.unshift(m)}if(b)c<T.length&&(c=T.length);else{var B=T.length/2;if(s<B)throw new _("Too many math in a row: "+("expected "+s+", but got "+B),T[0])}});for(var v=0;v<c;++v){var w="r",k=0;v%2===1?w="l":v>0&&b&&(k=1),n[v]={type:"align",align:w,pregap:k,postgap:0}}return i.colSeparationType=b?"align":"alignat",i};it({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var r=pn(e[0]),n=r?[e[0]]:he(e[0],"ordgroup").body,o=n.map(function(i){var s=fn(i),c=s.text;if("lcr".includes(c))return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new _("Unknown column alignment: "+c,i)}),l={cols:o,hskipBeforeAndAfter:!0,maxNumCols:o.length};return It(t.parser,l,$0(t.envName))},htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(t.envName.charAt(t.envName.length-1)==="*"){var o=t.parser;if(o.consumeSpaces(),o.fetch().text==="["){if(o.consume(),o.consumeSpaces(),r=o.fetch().text,!"lcr".includes(r))throw new _("Expected l or c or r",o.nextToken);o.consume(),o.consumeSpaces(),o.expect("]"),o.consume(),n.cols=[{type:"align",align:r}]}}var l=It(t.parser,n,$0(t.envName)),i=Math.max(0,...l.body.map(s=>s.length));return l.cols=new Array(i).fill({type:"align",align:r}),e?{type:"leftright",mode:t.mode,body:[l],left:e[0],right:e[1],rightColor:void 0}:l},htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},r=It(t.parser,e,"script");return r.colSeparationType="small",r},htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var r=pn(e[0]),n=r?[e[0]]:he(e[0],"ordgroup").body,o=n.map(function(s){var c=fn(s),m=c.text;if("lc".includes(m))return{type:"align",align:m};throw new _("Unknown column alignment: "+m,s)});if(o.length>1)throw new _("{subarray} can contain only one column");var l={cols:o,hskipBeforeAndAfter:!1,arraystretch:.5},i=It(t.parser,l,"script");if(i.body.length>0&&i.body[0].length>1)throw new _("{subarray} can contain only one column");return i},htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=It(t.parser,e,$0(t.envName));return{type:"leftright",mode:t.mode,body:[r],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Wl,htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){M1.has(t.envName)&&yn(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:V0(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return It(t.parser,e,"display")},htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Wl,htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){yn(t);var e={autoTag:V0(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return It(t.parser,e,"display")},htmlBuilder:st,mathmlBuilder:ut});it({type:"array",names:["CD"],props:{numArgs:0},handler(t){return yn(t),p1(t.parser)},htmlBuilder:st,mathmlBuilder:ut});y("\\nonumber","\\gdef\\@eqnsw{0}");y("\\notag","\\nonumber");Z({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new _(t.funcName+" valid only within array environment")}});var Ga=Ul;Z({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:r,funcName:n}=t,o=e[0];if(o.type!=="ordgroup")throw new _("Invalid environment name",o);for(var l="",i=0;i<o.body.length;++i)l+=he(o.body[i],"textord").text;if(n==="\\begin"){if(!Ga.hasOwnProperty(l))throw new _("No such environment: "+l,o);var s=Ga[l],{args:c,optArgs:m}=r.parseArguments("\\begin{"+l+"}",s),p={mode:r.mode,envName:l,parser:r},f=s.handler(p,c,m);r.expect("\\end",!1);var g=r.nextToken,b=he(r.parseFunction(),"environment");if(b.name!==l)throw new _("Mismatch: \\begin{"+l+"} matched by \\end{"+b.name+"}",g);return f}return{type:"environment",mode:r.mode,name:l,nameGroup:o}}});var Gl=(t,e)=>{var r=t.font,n=e.withFont(r);return we(t.body,n)},Kl=(t,e)=>{var r=t.font,n=e.withFont(r);return xe(t.body,n)},Ka={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Z({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:r,funcName:n}=t,o=Qr(e[0]),l=n;return l in Ka&&(l=Ka[l]),{type:"font",mode:r.mode,font:l.slice(1),body:o}},htmlBuilder:Gl,mathmlBuilder:Kl});Z({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"mclass",mode:r.mode,mclass:hn(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:gt(n)}}});Z({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:r,funcName:n,breakOnTokenText:o}=t,{mode:l}=r,i=r.parseExpression(!0,o),s="math"+n.slice(1);return{type:"font",mode:l,font:s,body:{type:"ordgroup",mode:r.mode,body:i}}},htmlBuilder:Gl,mathmlBuilder:Kl});var A1=(t,e)=>{var r=e.style,n=r.fracNum(),o=r.fracDen(),l;l=e.havingStyle(n);var i=we(t.numer,l,e);if(t.continued){var s=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;i.height=i.height<s?s:i.height,i.depth=i.depth<c?c:i.depth}l=e.havingStyle(o);var m=we(t.denom,l,e),p,f,g;t.hasBarLine?(t.barSize?(f=Ae(t.barSize,e),p=tr("frac-line",e,f)):p=tr("frac-line",e),f=p.height,g=p.height):(p=null,f=0,g=e.fontMetrics().defaultRuleThickness);var b,v,w;r.size===fe.DISPLAY.size?(b=e.fontMetrics().num1,f>0?v=3*g:v=7*g,w=e.fontMetrics().denom1):(f>0?(b=e.fontMetrics().num2,v=g):(b=e.fontMetrics().num3,v=3*g),w=e.fontMetrics().denom2);var k;if(p){var M=e.fontMetrics().axisHeight;b-i.depth-(M+.5*f)<v&&(b+=v-(b-i.depth-(M+.5*f))),M-.5*f-(m.height-w)<v&&(w+=v-(M-.5*f-(m.height-w)));var E=-(M-.5*f);k=ye({positionType:"individualShift",children:[{type:"elem",elem:m,shift:w},{type:"elem",elem:p,shift:E},{type:"elem",elem:i,shift:-b}]})}else{var T=b-i.depth-(m.height-w);T<v&&(b+=.5*(v-T),w+=.5*(v-T)),k=ye({positionType:"individualShift",children:[{type:"elem",elem:m,shift:w},{type:"elem",elem:i,shift:-b}]})}l=e.havingStyle(r),k.height*=l.sizeMultiplier/e.sizeMultiplier,k.depth*=l.sizeMultiplier/e.sizeMultiplier;var S;r.size===fe.DISPLAY.size?S=e.fontMetrics().delim1:r.size===fe.SCRIPTSCRIPT.size?S=e.havingStyle(fe.SCRIPT).fontMetrics().delim2:S=e.fontMetrics().delim2;var B,z;return t.leftDelim==null?B=yr(e,["mopen"]):B=y0(t.leftDelim,S,!0,e.havingStyle(r),t.mode,["mopen"]),t.continued?z=$([]):t.rightDelim==null?z=yr(e,["mclose"]):z=y0(t.rightDelim,S,!0,e.havingStyle(r),t.mode,["mclose"]),$(["mord"].concat(l.sizingClasses(e)),[B,$(["mfrac"],[k]),z],e)},B1=(t,e)=>{var r=new W("mfrac",[xe(t.numer,e),xe(t.denom,e)]);if(!t.hasBarLine)r.setAttribute("linethickness","0px");else if(t.barSize){var n=Ae(t.barSize,e);r.setAttribute("linethickness",j(n))}if(t.leftDelim!=null||t.rightDelim!=null){var o=[];if(t.leftDelim!=null){var l=new W("mo",[new Ie(t.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}if(o.push(r),t.rightDelim!=null){var i=new W("mo",[new Ie(t.rightDelim.replace("\\",""))]);i.setAttribute("fence","true"),o.push(i)}return H0(o)}return r},Yl=(t,e)=>{if(!e)return t;var r={type:"styling",mode:t.mode,style:e,body:[t]};return r};Z({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:r,funcName:n}=t,o=e[0],l=e[1],i,s=null,c=null;switch(n){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":i=!0;break;case"\\\\atopfrac":i=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i=!1,s="(",c=")";break;case"\\\\bracefrac":i=!1,s="\\{",c="\\}";break;case"\\\\brackfrac":i=!1,s="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}var m=n==="\\cfrac",p=null;return m||n.startsWith("\\d")?p="display":n.startsWith("\\t")&&(p="text"),Yl({type:"genfrac",mode:r.mode,numer:o,denom:l,continued:m,hasBarLine:i,leftDelim:s,rightDelim:c,barSize:null},p)},htmlBuilder:A1,mathmlBuilder:B1});Z({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:r,token:n}=t,o;switch(r){case"\\over":o="\\frac";break;case"\\choose":o="\\binom";break;case"\\atop":o="\\\\atopfrac";break;case"\\brace":o="\\\\bracefrac";break;case"\\brack":o="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:o,token:n}}});var Ya=["display","text","script","scriptscript"],ja=function(e){var r=null;return e.length>0&&(r=e,r=r==="."?null:r),r};Z({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:r}=t,n=e[4],o=e[5],l=Qr(e[0]),i=l.type==="atom"&&l.family==="open"?ja(l.text):null,s=Qr(e[1]),c=s.type==="atom"&&s.family==="close"?ja(s.text):null,m=he(e[2],"size"),p,f=null;m.isBlank?p=!0:(f=m.value,p=f.number>0);var g=null,b=e[3];if(b.type==="ordgroup"){if(b.body.length>0){var v=he(b.body[0],"textord");g=Ya[Number(v.text)]}}else b=he(b,"textord"),g=Ya[Number(b.text)];return Yl({type:"genfrac",mode:r.mode,numer:n,denom:o,continued:!1,hasBarLine:p,barSize:f,leftDelim:i,rightDelim:c},g)}});Z({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:r,funcName:n,token:o}=t;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:he(e[0],"size").value,token:o}}});Z({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:r,funcName:n}=t,o=e[0],l=he(e[1],"infix").size;if(!l)throw new Error("\\\\abovefrac expected size, but got "+String(l));var i=e[2],s=l.number>0;return{type:"genfrac",mode:r.mode,numer:o,denom:i,continued:!1,hasBarLine:s,barSize:l,leftDelim:null,rightDelim:null}}});var jl=(t,e)=>{var r=e.style,n,o;t.type==="supsub"?(n=t.sup?we(t.sup,e.havingStyle(r.sup()),e):we(t.sub,e.havingStyle(r.sub()),e),o=he(t.base,"horizBrace")):o=he(t,"horizBrace");var l=we(o.base,e.havingBaseStyle(fe.DISPLAY)),i=mn(o,e),s;if(o.isOver?(s=ye({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:i}]}),s.children[0].children[0].children[1].classes.push("svg-align")):(s=ye({positionType:"bottom",positionData:l.depth+.1+i.height,children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:l}]}),s.children[0].children[0].children[0].classes.push("svg-align")),n){var c=$(["minner",o.isOver?"mover":"munder"],[s],e);o.isOver?s=ye({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:n}]}):s=ye({positionType:"bottom",positionData:c.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:c}]})}return $(["minner",o.isOver?"mover":"munder"],[s],e)},L1=(t,e)=>{var r=dn(t.label);return new W(t.isOver?"mover":"munder",[xe(t.base,e),r])};Z({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(t,e){var{parser:r,funcName:n}=t;return{type:"horizBrace",mode:r.mode,label:n,isOver:n.includes("\\over"),base:e[0]}},htmlBuilder:jl,mathmlBuilder:L1});Z({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=e[1],o=he(e[0],"url").url;return r.settings.isTrusted({command:"\\href",url:o})?{type:"href",mode:r.mode,href:o,body:Ne(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var r=Ve(t.body,e,!1);return Kc(t.href,[],r,e)},mathmlBuilder:(t,e)=>{var r=Nt(t.body,e);return r instanceof W||(r=new W("mrow",[r])),r.setAttribute("href",t.href),r}});Z({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=he(e[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var o=[],l=0;l<n.length;l++){var i=n[l];i==="~"&&(i="\\textasciitilde"),o.push({type:"textord",mode:"text",text:i})}var s={type:"text",mode:r.mode,font:"\\texttt",body:o};return{type:"href",mode:r.mode,href:n,body:Ne(s)}}});Z({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(t,e){var{parser:r}=t;return{type:"hbox",mode:r.mode,body:Ne(e[0])}},htmlBuilder(t,e){var r=Ve(t.body,e,!1);return yt(r)},mathmlBuilder(t,e){return new W("mrow",et(t.body,e))}});Z({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(t,e)=>{var{parser:r,funcName:n,token:o}=t,l=he(e[0],"raw").string,i=e[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var s,c={};switch(n){case"\\htmlClass":c.class=l,s={command:"\\htmlClass",class:l};break;case"\\htmlId":c.id=l,s={command:"\\htmlId",id:l};break;case"\\htmlStyle":c.style=l,s={command:"\\htmlStyle",style:l};break;case"\\htmlData":{for(var m=l.split(","),p=0;p<m.length;p++){var f=m[p],g=f.indexOf("=");if(g<0)throw new _("\\htmlData key/value '"+f+"' missing equals sign");var b=f.slice(0,g),v=f.slice(g+1);c["data-"+b.trim()]=v}s={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(s)?{type:"html",mode:r.mode,attributes:c,body:Ne(i)}:r.formatUnsupportedCmd(n)},htmlBuilder:(t,e)=>{var r=Ve(t.body,e,!1),n=["enclosing"];t.attributes.class&&n.push(...t.attributes.class.trim().split(/\s+/));var o=$(n,r,e);for(var l in t.attributes)l!=="class"&&t.attributes.hasOwnProperty(l)&&o.setAttribute(l,t.attributes[l]);return o},mathmlBuilder:(t,e)=>Nt(t.body,e)});Z({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(t,e)=>{var{parser:r}=t;return{type:"htmlmathml",mode:r.mode,html:Ne(e[0]),mathml:Ne(e[1])}},htmlBuilder:(t,e)=>{var r=Ve(t.html,e,!1);return yt(r)},mathmlBuilder:(t,e)=>Nt(t.mathml,e)});var Kn=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!r)throw new _("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!ml(n))throw new _("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Z({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,r)=>{var{parser:n}=t,o={number:0,unit:"em"},l={number:.9,unit:"em"},i={number:0,unit:"em"},s="";if(r[0])for(var c=he(r[0],"raw").string,m=c.split(","),p=0;p<m.length;p++){var f=m[p].split("=");if(f.length===2){var g=f[1].trim();switch(f[0].trim()){case"alt":s=g;break;case"width":o=Kn(g);break;case"height":l=Kn(g);break;case"totalheight":i=Kn(g);break;default:throw new _("Invalid key: '"+f[0]+"' in \\includegraphics.")}}}var b=he(e[0],"url").url;return s===""&&(s=b,s=s.replace(/^.*[\\/]/,""),s=s.substring(0,s.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:b})?{type:"includegraphics",mode:n.mode,alt:s,width:o,height:l,totalheight:i,src:b}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var r=Ae(t.height,e),n=0;t.totalheight.number>0&&(n=Ae(t.totalheight,e)-r);var o=0;t.width.number>0&&(o=Ae(t.width,e));var l={height:j(r+n)};o>0&&(l.width=j(o)),n>0&&(l.verticalAlign=j(-n));var i=new Hc(t.src,t.alt,l);return i.height=r,i.depth=n,i},mathmlBuilder:(t,e)=>{var r=new W("mglyph",[]);r.setAttribute("alt",t.alt);var n=Ae(t.height,e),o=0;if(t.totalheight.number>0&&(o=Ae(t.totalheight,e)-n,r.setAttribute("valign",j(-o))),r.setAttribute("height",j(n+o)),t.width.number>0){var l=Ae(t.width,e);r.setAttribute("width",j(l))}return r.setAttribute("src",t.src),r}});Z({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:r,funcName:n}=t,o=he(e[0],"size");if(r.settings.strict){var l=n[1]==="m",i=o.value.unit==="mu";l?(i||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+o.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):i&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:o.value}},htmlBuilder(t,e){return bl(t.dimension,e)},mathmlBuilder(t,e){var r=Ae(t.dimension,e);return new Tl(r)}});Z({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:r,funcName:n}=t,o=e[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:o}},htmlBuilder:(t,e)=>{var r;t.alignment==="clap"?(r=$([],[we(t.body,e)]),r=$(["inner"],[r],e)):r=$(["inner"],[we(t.body,e)]);var n=$(["fix"],[]),o=$([t.alignment],[r,n],e),l=$(["strut"]);return l.style.height=j(o.height+o.depth),o.depth&&(l.style.verticalAlign=j(-o.depth)),o.children.unshift(l),o=$(["thinbox"],[o],e),$(["mord","vbox"],[o],e)},mathmlBuilder:(t,e)=>{var r=new W("mpadded",[xe(t.body,e)]);if(t.alignment!=="rlap"){var n=t.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});Z({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:r,parser:n}=t,o=n.mode;n.switchMode("math");var l=r==="\\("?"\\)":"$",i=n.parseExpression(!1,l);return n.expect(l),n.switchMode(o),{type:"styling",mode:n.mode,style:"text",body:i}}});Z({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new _("Mismatched "+t.funcName)}});var Xa=(t,e)=>{switch(e.style.size){case fe.DISPLAY.size:return t.display;case fe.TEXT.size:return t.text;case fe.SCRIPT.size:return t.script;case fe.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Z({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:r}=t;return{type:"mathchoice",mode:r.mode,display:Ne(e[0]),text:Ne(e[1]),script:Ne(e[2]),scriptscript:Ne(e[3])}},htmlBuilder:(t,e)=>{var r=Xa(t,e),n=Ve(r,e,!1);return yt(n)},mathmlBuilder:(t,e)=>{var r=Xa(t,e);return Nt(r,e)}});var Xl=(t,e,r,n,o,l,i)=>{t=$([],[t]);var s=r&&gt(r),c,m;if(e){var p=we(e,n.havingStyle(o.sup()),n);m={elem:p,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-p.depth)}}if(r){var f=we(r,n.havingStyle(o.sub()),n);c={elem:f,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-f.height)}}var g;if(m&&c){var b=n.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+i;g=ye({positionType:"bottom",positionData:b,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:j(-l)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:m.kern},{type:"elem",elem:m.elem,marginLeft:j(l)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else if(c){var v=t.height-i;g=ye({positionType:"top",positionData:v,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:j(-l)},{type:"kern",size:c.kern},{type:"elem",elem:t}]})}else if(m){var w=t.depth+i;g=ye({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:m.kern},{type:"elem",elem:m.elem,marginLeft:j(l)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]})}else return t;var k=[g];if(c&&l!==0&&!s){var T=$(["mspace"],[],n);T.style.marginRight=j(l),k.unshift(T)}return $(["mop","op-limits"],k,n)},Jl=new Set(["\\smallint"]),ur=(t,e)=>{var r,n,o=!1,l;t.type==="supsub"?(r=t.sup,n=t.sub,l=he(t.base,"op"),o=!0):l=he(t,"op");var i=e.style,s=!1;i.size===fe.DISPLAY.size&&l.symbol&&!Jl.has(l.name)&&(s=!0);var c;if(l.symbol){var m=s?"Size2-Regular":"Size1-Regular",p="";if((l.name==="\\oiint"||l.name==="\\oiiint")&&(p=l.name.slice(1),l.name=p==="oiint"?"\\iint":"\\iiint"),c=_e(l.name,m,"math",e,["mop","op-symbol",s?"large-op":"small-op"]),p.length>0){var f=c.italic,g=wl(p+"Size"+(s?"2":"1"),e);c=ye({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:s?.08:0}]}),l.name="\\"+p,c.classes.unshift("mop"),c.italic=f}}else if(l.body){var b=Ve(l.body,e,!0);b.length===1&&b[0]instanceof Qe?(c=b[0],c.classes[0]="mop"):c=$(["mop"],b,e)}else{for(var v=[],w=1;w<l.name.length;w++)v.push(z0(l.name[w],l.mode,e));c=$(["mop"],v,e)}var k=0,T=0;return(c instanceof Qe||l.name==="\\oiint"||l.name==="\\oiiint")&&!l.suppressBaseShift&&(k=(c.height-c.depth)/2-e.fontMetrics().axisHeight,T=c.italic||0),o?Xl(c,r,n,e,i,T,k):(k&&(c.style.position="relative",c.style.top=j(k)),c)},Tr=(t,e)=>{var r;if(t.symbol)r=new W("mo",[nt(t.name,t.mode)]),Jl.has(t.name)&&r.setAttribute("largeop","false");else if(t.body)r=new W("mo",et(t.body,e));else{r=new W("mi",[new Ie(t.name.slice(1))]);var n=new W("mo",[nt("⁡","text")]);t.parentIsSupSub?r=new W("mrow",[r,n]):r=Cl([r,n])}return r},N1={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Z({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:r,funcName:n}=t,o=n;return o.length===1&&(o=N1[o]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:o}},htmlBuilder:ur,mathmlBuilder:Tr});Z({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Ne(n)}},htmlBuilder:ur,mathmlBuilder:Tr});var I1={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Z({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:r}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:ur,mathmlBuilder:Tr});Z({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:r}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:ur,mathmlBuilder:Tr});Z({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(t){var{parser:e,funcName:r}=t,n=r;return n.length===1&&(n=I1[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:ur,mathmlBuilder:Tr});var Ql=(t,e)=>{var r,n,o=!1,l;t.type==="supsub"?(r=t.sup,n=t.sub,l=he(t.base,"operatorname"),o=!0):l=he(t,"operatorname");var i;if(l.body.length>0){for(var s=l.body.map(f=>{var g="text"in f?f.text:void 0;return typeof g=="string"?{type:"textord",mode:f.mode,text:g}:f}),c=Ve(s,e.withFont("mathrm"),!0),m=0;m<c.length;m++){var p=c[m];p instanceof Qe&&(p.text=p.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}i=$(["mop"],c,e)}else i=$(["mop"],[],e);return o?Xl(i,r,n,e,e.style,0,0):i},z1=(t,e)=>{for(var r=et(t.body,e.withFont("mathrm")),n=!0,o=0;o<r.length;o++){var l=r[o];if(!(l instanceof Tl))if(l instanceof W)switch(l.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var i=l.children[0];l.children.length===1&&i instanceof Ie?i.text=i.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var s=r.map(p=>p.toText()).join("");r=[new Ie(s)]}var c=new W("mi",r);c.setAttribute("mathvariant","normal");var m=new W("mo",[nt("⁡","text")]);return t.parentIsSupSub?new W("mrow",[c,m]):Cl([c,m])};Z({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:r,funcName:n}=t,o=e[0];return{type:"operatorname",mode:r.mode,body:Ne(o),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Ql,mathmlBuilder:z1});y("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Ft({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?yt(Ve(t.body,e,!1)):$(["mord"],Ve(t.body,e,!0),e)},mathmlBuilder(t,e){return Nt(t.body,e,!0)}});Z({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:r}=t,n=e[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(t,e){var r=we(t.body,e.havingCrampedStyle()),n=tr("overline-line",e),o=e.fontMetrics().defaultRuleThickness,l=ye({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*o},{type:"elem",elem:n},{type:"kern",size:o}]});return $(["mord","overline"],[l],e)},mathmlBuilder(t,e){var r=new W("mo",[new Ie("‾")]);r.setAttribute("stretchy","true");var n=new W("mover",[xe(t.body,e),r]);return n.setAttribute("accent","true"),n}});Z({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"phantom",mode:r.mode,body:Ne(n)}},htmlBuilder:(t,e)=>{var r=Ve(t.body,e.withPhantom(),!1);return yt(r)},mathmlBuilder:(t,e)=>{var r=et(t.body,e);return new W("mphantom",r)}});y("\\hphantom","\\smash{\\phantom{#1}}");Z({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(t,e)=>{var r=$(["inner"],[we(t.body,e.withPhantom())]),n=$(["fix"],[]);return $(["mord","rlap"],[r,n],e)},mathmlBuilder:(t,e)=>{var r=et(Ne(t.body),e),n=new W("mphantom",r),o=new W("mpadded",[n]);return o.setAttribute("width","0px"),o}});Z({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:r}=t,n=he(e[0],"size").value,o=e[1];return{type:"raisebox",mode:r.mode,dy:n,body:o}},htmlBuilder(t,e){var r=we(t.body,e),n=Ae(t.dy,e);return ye({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]})},mathmlBuilder(t,e){var r=new W("mpadded",[xe(t.body,e)]),n=t.dy.number+t.dy.unit;return r.setAttribute("voffset",n),r}});Z({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Z({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,r){var{parser:n}=t,o=r[0],l=he(e[0],"size"),i=he(e[1],"size");return{type:"rule",mode:n.mode,shift:o&&he(o,"size").value,width:l.value,height:i.value}},htmlBuilder(t,e){var r=$(["mord","rule"],[],e),n=Ae(t.width,e),o=Ae(t.height,e),l=t.shift?Ae(t.shift,e):0;return r.style.borderRightWidth=j(n),r.style.borderTopWidth=j(o),r.style.bottom=j(l),r.width=n,r.height=o+l,r.depth=-l,r.maxFontSize=o*1.125*e.sizeMultiplier,r},mathmlBuilder(t,e){var r=Ae(t.width,e),n=Ae(t.height,e),o=t.shift?Ae(t.shift,e):0,l=e.color&&e.getColor()||"black",i=new W("mspace");i.setAttribute("mathbackground",l),i.setAttribute("width",j(r)),i.setAttribute("height",j(n));var s=new W("mpadded",[i]);return o>=0?s.setAttribute("height",j(o)):(s.setAttribute("height",j(o)),s.setAttribute("depth",j(-o))),s.setAttribute("voffset",j(o)),s}});function Zl(t,e,r){for(var n=Ve(t,e,!1),o=e.sizeMultiplier/r.sizeMultiplier,l=0;l<n.length;l++){var i=n[l].classes.indexOf("sizing");i<0?Array.prototype.push.apply(n[l].classes,e.sizingClasses(r)):n[l].classes[i+1]==="reset-size"+e.size&&(n[l].classes[i+1]="reset-size"+r.size),n[l].height*=o,n[l].depth*=o}return yt(n)}var Ja=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],D1=(t,e)=>{var r=e.havingSize(t.size);return Zl(t.body,r,e)};Z({type:"sizing",names:Ja,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:r,funcName:n,parser:o}=t,l=o.parseExpression(!1,r);return{type:"sizing",mode:o.mode,size:Ja.indexOf(n)+1,body:l}},htmlBuilder:D1,mathmlBuilder:(t,e)=>{var r=e.havingSize(t.size),n=et(t.body,r),o=new W("mstyle",n);return o.setAttribute("mathsize",j(r.sizeMultiplier)),o}});Z({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,r)=>{var{parser:n}=t,o=!1,l=!1,i=r[0]&&he(r[0],"ordgroup");if(i)for(var s="",c=0;c<i.body.length;++c){var m=i.body[c];if(s=fn(m).text,s==="t")o=!0;else if(s==="b")l=!0;else{o=!1,l=!1;break}}else o=!0,l=!0;var p=e[0];return{type:"smash",mode:n.mode,body:p,smashHeight:o,smashDepth:l}},htmlBuilder:(t,e)=>{var r=$([],[we(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return r;if(t.smashHeight&&(r.height=0),t.smashDepth&&(r.depth=0),t.smashHeight&&t.smashDepth)return $(["mord","smash"],[r],e);if(r.children)for(var n=0;n<r.children.length;n++)t.smashHeight&&(r.children[n].height=0),t.smashDepth&&(r.children[n].depth=0);var o=ye({positionType:"firstBaseline",children:[{type:"elem",elem:r}]});return $(["mord"],[o],e)},mathmlBuilder:(t,e)=>{var r=new W("mpadded",[xe(t.body,e)]);return t.smashHeight&&r.setAttribute("height","0px"),t.smashDepth&&r.setAttribute("depth","0px"),r}});Z({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,r){var{parser:n}=t,o=r[0],l=e[0];return{type:"sqrt",mode:n.mode,body:l,index:o}},htmlBuilder(t,e){var r=we(t.body,e.havingCrampedStyle());r.height===0&&(r.height=e.fontMetrics().xHeight),r=rr(r,e);var n=e.fontMetrics(),o=n.defaultRuleThickness,l=o;e.style.id<fe.TEXT.id&&(l=e.fontMetrics().xHeight);var i=o+l/4,s=r.height+r.depth+i+o,{span:c,ruleWidth:m,advanceWidth:p}=w1(s,e),f=c.height-m;f>r.height+r.depth+i&&(i=(i+f-r.height-r.depth)/2);var g=c.height-r.height-i-m;r.style.paddingLeft=j(p);var b=ye({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+g)},{type:"elem",elem:c},{type:"kern",size:m}]});if(t.index){var v=e.havingStyle(fe.SCRIPTSCRIPT),w=we(t.index,v,e),k=.6*(b.height-b.depth),T=ye({positionType:"shift",positionData:-k,children:[{type:"elem",elem:w}]}),M=$(["root"],[T]);return $(["mord","sqrt"],[M,b],e)}else return $(["mord","sqrt"],[b],e)},mathmlBuilder(t,e){var{body:r,index:n}=t;return n?new W("mroot",[xe(r,e),xe(n,e)]):new W("msqrt",[xe(r,e)])}});var Qa={display:fe.DISPLAY,text:fe.TEXT,script:fe.SCRIPT,scriptscript:fe.SCRIPTSCRIPT};Z({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:r,funcName:n,parser:o}=t,l=o.parseExpression(!0,r),i=n.slice(1,n.length-5);return{type:"styling",mode:o.mode,style:i,body:l}},htmlBuilder(t,e){var r=Qa[t.style],n=e.havingStyle(r).withFont("");return Zl(t.body,n,e)},mathmlBuilder(t,e){var r=Qa[t.style],n=e.havingStyle(r),o=et(t.body,n),l=new W("mstyle",o),i={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},s=i[t.style];return l.setAttribute("scriptlevel",s[0]),l.setAttribute("displaystyle",s[1]),l}});var H1=function(e,r){var n=e.base;if(n)if(n.type==="op"){var o=n.limits&&(r.style.size===fe.DISPLAY.size||n.alwaysHandleSupSub);return o?ur:null}else if(n.type==="operatorname"){var l=n.alwaysHandleSupSub&&(r.style.size===fe.DISPLAY.size||n.limits);return l?Ql:null}else{if(n.type==="accent")return gt(n.base)?P0:null;if(n.type==="horizBrace"){var i=!e.sub;return i===n.isOver?jl:null}else return null}else return null};Ft({type:"supsub",htmlBuilder(t,e){var r=H1(t,e);if(r)return r(t,e);var{base:n,sup:o,sub:l}=t,i=we(n,e),s,c,m=e.fontMetrics(),p=0,f=0,g=n&&gt(n);if(o){var b=e.havingStyle(e.style.sup());s=we(o,b,e),g||(p=i.height-b.fontMetrics().supDrop*b.sizeMultiplier/e.sizeMultiplier)}if(l){var v=e.havingStyle(e.style.sub());c=we(l,v,e),g||(f=i.depth+v.fontMetrics().subDrop*v.sizeMultiplier/e.sizeMultiplier)}var w;e.style===fe.DISPLAY?w=m.sup1:e.style.cramped?w=m.sup3:w=m.sup2;var k=e.sizeMultiplier,T=j(.5/m.ptPerEm/k),M=null;if(c){var E=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(i instanceof Qe||E)&&(M=j(-i.italic))}var S;if(s&&c){p=Math.max(p,w,s.depth+.25*m.xHeight),f=Math.max(f,m.sub2);var B=m.defaultRuleThickness,z=4*B;if(p-s.depth-(c.height-f)<z){f=z-(p-s.depth)+c.height;var F=.8*m.xHeight-(p-s.depth);F>0&&(p+=F,f-=F)}var P=[{type:"elem",elem:c,shift:f,marginRight:T,marginLeft:M},{type:"elem",elem:s,shift:-p,marginRight:T}];S=ye({positionType:"individualShift",children:P})}else if(c){f=Math.max(f,m.sub1,c.height-.8*m.xHeight);var N=[{type:"elem",elem:c,marginLeft:M,marginRight:T}];S=ye({positionType:"shift",positionData:f,children:N})}else if(s)p=Math.max(p,w,s.depth+.25*m.xHeight),S=ye({positionType:"shift",positionData:-p,children:[{type:"elem",elem:s,marginRight:T}]});else throw new Error("supsub must have either sup or sub.");var H=h0(i,"right")||"mord";return $([H],[i,$(["msupsub"],[S])],e)},mathmlBuilder(t,e){var r=!1,n,o;t.base&&t.base.type==="horizBrace"&&(o=!!t.sup,o===t.base.isOver&&(r=!0,n=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var l=[xe(t.base,e)];t.sub&&l.push(xe(t.sub,e)),t.sup&&l.push(xe(t.sup,e));var i;if(r)i=n?"mover":"munder";else if(t.sub)if(t.sup){var m=t.base;m&&m.type==="op"&&m.limits&&e.style===fe.DISPLAY||m&&m.type==="operatorname"&&m.alwaysHandleSupSub&&(e.style===fe.DISPLAY||m.limits)?i="munderover":i="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===fe.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===fe.DISPLAY)?i="munder":i="msub"}else{var s=t.base;s&&s.type==="op"&&s.limits&&(e.style===fe.DISPLAY||s.alwaysHandleSupSub)||s&&s.type==="operatorname"&&s.alwaysHandleSupSub&&(s.limits||e.style===fe.DISPLAY)?i="mover":i="msup"}return new W(i,l)}});Ft({type:"atom",htmlBuilder(t,e){return z0(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var r=new W("mo",[nt(t.text,t.mode)]);if(t.family==="bin"){var n=R0(t,e);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else t.family==="punct"?r.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&r.setAttribute("stretchy","false");return r}});var ei={mi:"italic",mn:"normal",mtext:"normal"};Ft({type:"mathord",htmlBuilder(t,e){return cn(t,e,"mathord")},mathmlBuilder(t,e){var r=new W("mi",[nt(t.text,t.mode,e)]),n=R0(t,e)||"italic";return n!==ei[r.type]&&r.setAttribute("mathvariant",n),r}});Ft({type:"textord",htmlBuilder(t,e){return cn(t,e,"textord")},mathmlBuilder(t,e){var r=nt(t.text,t.mode,e),n=R0(t,e)||"normal",o;return t.mode==="text"?o=new W("mtext",[r]):/[0-9]/.test(t.text)?o=new W("mn",[r]):t.text==="\\prime"?o=new W("mo",[r]):o=new W("mi",[r]),n!==ei[o.type]&&o.setAttribute("mathvariant",n),o}});var Yn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},jn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ft({type:"spacing",htmlBuilder(t,e){if(jn.hasOwnProperty(t.text)){var r=jn[t.text].className||"";if(t.mode==="text"){var n=cn(t,e,"textord");return n.classes.push(r),n}else return $(["mspace",r],[z0(t.text,t.mode,e)],e)}else{if(Yn.hasOwnProperty(t.text))return $(["mspace",Yn[t.text]],[],e);throw new _('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var r;if(jn.hasOwnProperty(t.text))r=new W("mtext",[new Ie(" ")]);else{if(Yn.hasOwnProperty(t.text))return new W("mspace");throw new _('Unknown type of space "'+t.text+'"')}return r}});var Za=()=>{var t=new W("mtd",[]);return t.setAttribute("width","50%"),t};Ft({type:"tag",mathmlBuilder(t,e){var r=new W("mtable",[new W("mtr",[Za(),new W("mtd",[Nt(t.body,e)]),Za(),new W("mtd",[Nt(t.tag,e)])])]);return r.setAttribute("width","100%"),r}});var eo={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},to={"\\textbf":"textbf","\\textmd":"textmd"},R1={"\\textit":"textit","\\textup":"textup"},ro=(t,e)=>{var r=t.font;if(r){if(eo[r])return e.withTextFontFamily(eo[r]);if(to[r])return e.withTextFontWeight(to[r]);if(r==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(R1[r])};Z({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:r,funcName:n}=t,o=e[0];return{type:"text",mode:r.mode,body:Ne(o),font:n}},htmlBuilder(t,e){var r=ro(t,e),n=Ve(t.body,r,!0);return $(["mord","text"],n,r)},mathmlBuilder(t,e){var r=ro(t,e);return Nt(t.body,r)}});Z({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:r}=t;return{type:"underline",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=we(t.body,e),n=tr("underline-line",e),o=e.fontMetrics().defaultRuleThickness,l=ye({positionType:"top",positionData:r.height,children:[{type:"kern",size:o},{type:"elem",elem:n},{type:"kern",size:3*o},{type:"elem",elem:r}]});return $(["mord","underline"],[l],e)},mathmlBuilder(t,e){var r=new W("mo",[new Ie("‾")]);r.setAttribute("stretchy","true");var n=new W("munder",[xe(t.body,e),r]);return n.setAttribute("accentunder","true"),n}});Z({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:r}=t;return{type:"vcenter",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=we(t.body,e),n=e.fontMetrics().axisHeight,o=.5*(r.height-n-(r.depth+n));return ye({positionType:"shift",positionData:o,children:[{type:"elem",elem:r}]})},mathmlBuilder(t,e){var r=new W("mpadded",[xe(t.body,e)],["vcenter"]);return new W("mrow",[r])}});Z({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,r){throw new _("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var r=no(t),n=[],o=e.havingStyle(e.style.text()),l=0;l<r.length;l++){var i=r[l];i==="~"&&(i="\\textasciitilde"),n.push(_e(i,"Typewriter-Regular",t.mode,o,["mord","texttt"]))}return $(["mord","text"].concat(o.sizingClasses(e)),gl(n),o)},mathmlBuilder(t,e){var r=new Ie(no(t)),n=new W("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});var no=t=>t.body.replace(/ /g,t.star?"␣":" "),Et=kl,ti=`[ \r
298
+ ]`,P1="\\\\[a-zA-Z@]+",O1="\\\\[^\uD800-\uDFFF]",V1="("+P1+")"+ti+"*",$1=`\\\\(
304
299
  |[ \r ]+
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
- `,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=`
300
+ ?)[ \r ]*`,w0="[̀-ͯ]",F1=new RegExp(w0+"+$"),q1="("+ti+"+)|"+($1+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(w0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(w0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+V1)+("|"+O1+")");class ao{constructor(e,r){this.input=e,this.settings=r,this.tokenRegex=new RegExp(q1,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,r){this.catcodes[e]=r}lex(){var e=this.input,r=this.tokenRegex.lastIndex;if(r===e.length)return new Je("EOF",new Ye(this,r,r));var n=this.tokenRegex.exec(e);if(n===null||n.index!==r)throw new _("Unexpected character: '"+e[r]+"'",new Je(e[r],new Ye(this,r,r+1)));var o=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[o]===14){var l=e.indexOf(`
301
+ `,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 Je(o,new Ye(this,r,this.tokenRegex.lastIndex))}}class U1{constructor(e,r){e===void 0&&(e={}),r===void 0&&(r={}),this.current=r,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 r in e)e.hasOwnProperty(r)&&(e[r]==null?delete this.current[r]:this.current[r]=e[r])}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,r,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]=r)}else{var l=this.undefStack[this.undefStack.length-1];l&&!l.hasOwnProperty(e)&&(l[e]=this.current[e])}r==null?delete this.current[e]:this.current[e]=r}}var _1=_l;y("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});y("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});y("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});y("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});y("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var r=t.future();return e[0].length===1&&e[0][0].text===r.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});y("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");y("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var oo={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(t){var e=t.popToken(),r,n=0;if(e.text==="'")r=8,e=t.popToken();else if(e.text==='"')r=16,e=t.popToken();else if(e.text==="`")if(e=t.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 r=10;if(r){if(n=oo[e.text],n==null||n>=r)throw new _("Invalid base-"+r+" digit "+e.text);for(var o;(o=oo[t.future().text])!=null&&o<r;)n*=r,n+=o,t.popToken()}return"\\@char{"+n+"}"});var F0=(t,e,r,n)=>{var o=t.consumeArg().tokens;if(o.length!==1)throw new _("\\newcommand's first argument must be a macro name");var l=o[0].text,i=t.isDefined(l);if(i&&!e)throw new _("\\newcommand{"+l+"} attempting to redefine "+(l+"; use \\renewcommand"));if(!i&&!r)throw new _("\\renewcommand{"+l+"} when command "+l+" does not yet exist; use \\newcommand");var s=0;if(o=t.consumeArg().tokens,o.length===1&&o[0].text==="["){for(var c="",m=t.expandNextToken();m.text!=="]"&&m.text!=="EOF";)c+=m.text,m=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new _("Invalid number of arguments: "+c);s=parseInt(c),o=t.consumeArg().tokens}return i&&n||t.macros.set(l,{tokens:o,numArgs:s}),""};y("\\newcommand",t=>F0(t,!1,!0,!1));y("\\renewcommand",t=>F0(t,!0,!1,!1));y("\\providecommand",t=>F0(t,!0,!0,!0));y("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(r=>r.text).join("")),""});y("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(r=>r.text).join("")),""});y("\\show",t=>{var e=t.popToken(),r=e.text;return console.log(e,t.macros.get(r),Et[r],Ce.math[r],Ce.text[r]),""});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 lo={",":"\\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"},W1=new Set(["bin","rel"]);y("\\dots",function(t){var e="\\dotso",r=t.expandAfterFuture().text;return r in lo?e=lo[r]:(r.slice(0,4)==="\\not"||r in Ce.math&&W1.has(Ce.math[r].group))&&(e="\\dotsb"),e});var q0={")":!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(t){var e=t.future().text;return e in q0?"\\ldots\\,":"\\ldots"});y("\\dotsc",function(t){var e=t.future().text;return e in q0&&e!==","?"\\ldots\\,":"\\ldots"});y("\\cdots",function(t){var e=t.future().text;return e in q0?"\\@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",t=>{if(t.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 ri=j(lt["Main-Regular"][84][1]-.7*lt["Main-Regular"][65][1]);y("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+ri+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");y("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+ri+"}{\\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 ni=t=>e=>{var r=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 c=f=>g=>{t&&(g.macros.set("|",i),o.length&&g.macros.set("\\|",s));var b=f;if(!f&&o.length){var v=g.future();v.text==="|"&&(g.popToken(),b=!0)}return{tokens:b?o:n,numArgs:0}};e.macros.set("|",c(!1)),o.length&&e.macros.set("\\|",c(!0));var m=e.consumeArg().tokens,p=e.expandTokens([...l,...m,...r]);return e.macros.endGroup(),{tokens:p.reverse(),numArgs:0}};y("\\bra@ket",ni(!1));y("\\bra@set",ni(!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 ai={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class G1{constructor(e,r,n){this.settings=r,this.expansionCount=0,this.feed(e),this.macros=new U1(_1,r.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new ao(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 r,n,o;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:o,end:n}=this.consumeArg(["]"])}else({tokens:o,start:r,end:n}=this.consumeArg());return this.pushToken(new Je("EOF",n.loc)),this.pushTokens(o),new Je("",Ye.range(r,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var r=[],n=e&&e.length>0;n||this.consumeSpaces();var o=this.future(),l,i=0,s=0;do{if(l=this.popToken(),r.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){r.splice(-s,s);break}}else s=0}while(i!==0||n);return o.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:o,end:l}}consumeArgs(e,r){if(r){if(r.length!==e+1)throw new _("The length of delimiters doesn't match the number of args!");for(var n=r[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(r&&r[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 r=this.popToken(),n=r.text,o=r.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(r),!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 c=l[s];if(c.text==="#"){if(s===0)throw new _("Incomplete placeholder at end of macro body",c);if(c=l[--s],c.text==="#")l.splice(s+1,1);else if(/^[1-9]$/.test(c.text))l.splice(s,2,...i[+c.text-1]);else throw new _("Not a valid argument number",c)}}}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 Je(e)]):void 0}expandTokens(e){var r=[],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),r.push(o)}return this.countExpansion(r.length),r}expandMacroAsText(e){var r=this.expandMacro(e);return r&&r.map(n=>n.text).join("")}_getExpansion(e){var r=this.macros.get(e);if(r==null)return r;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var o=typeof r=="function"?r(this):r;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 ao(o,this.settings),c=[],m=s.lex();m.text!=="EOF";)c.push(m),m=s.lex();c.reverse();var p={tokens:c,numArgs:l};return p}return o}isDefined(e){return this.macros.has(e)||Et.hasOwnProperty(e)||Ce.math.hasOwnProperty(e)||Ce.text.hasOwnProperty(e)||ai.hasOwnProperty(e)}isExpandable(e){var r=this.macros.get(e);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Et.hasOwnProperty(e)&&!Et[e].primitive}}var io=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Pr=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Xn={"́":{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"}},so={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class wn{constructor(e,r){this.mode="math",this.gullet=new G1(e,r,this.mode),this.settings=r,this.leftrightDepth=0,this.nextToken=null}expect(e,r){if(r===void 0&&(r=!0),this.fetch().text!==e)throw new _("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());r&&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 r=this.nextToken;this.consume(),this.gullet.pushToken(new Je("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(e,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var o=this.fetch();if(wn.endOfExpression.has(o.text)||r&&o.text===r||e&&Et[o.text]&&Et[o.text].infix)break;var l=this.parseAtom(r);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 r=-1,n,o=0;o<e.length;o++){var l=e[o];if(l.type==="infix"){if(r!==-1)throw new _("only one infix operator per group",l.token);r=o,n=l.replaceWith}}if(r!==-1&&n){var i,s,c=e.slice(0,r),m=e.slice(r+1);c.length===1&&c[0].type==="ordgroup"?i=c[0]:i={type:"ordgroup",mode:this.mode,body:c},m.length===1&&m[0].type==="ordgroup"?s=m[0]:s={type:"ordgroup",mode:this.mode,body:m};var p;return n==="\\\\abovefrac"?p=this.callFunction(n,[i,e[r],s],[]):p=this.callFunction(n,[i,s],[]),[p]}else return e}handleSupSubscript(e){var r=this.fetch(),n=r.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+"'",r);return o}formatUnsupportedCmd(e){for(var r=[],n=0;n<e.length;n++)r.push({type:"textord",mode:"text",text:e[n]});var o={type:"text",mode:this.mode,body:r},l={type:"color",mode:this.mode,color:this.settings.errorColor,body:[o]};return l}parseAtom(e){var r=this.parseGroup("atom",e);if((r==null?void 0:r.type)==="internal"||this.mode==="text")return r;for(var n,o;;){this.consumeSpaces();var l=this.fetch();if(l.text==="\\limits"||l.text==="\\nolimits"){if(r&&r.type==="op"){var i=l.text==="\\limits";r.limits=i,r.alwaysHandleSupSub=!0}else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.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"},c=[s];for(this.consume();this.fetch().text==="'";)c.push(s),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:c}}else if(Pr[l.text]){var m=io.test(l.text),p=[];for(p.push(new Je(Pr[l.text])),this.consume();;){var f=this.fetch().text;if(!Pr[f]||io.test(f)!==m)break;p.unshift(new Je(Pr[f])),this.consume()}var g=this.subparse(p);m?o={type:"ordgroup",mode:"math",body:g}:n={type:"ordgroup",mode:"math",body:g}}else break}return n||o?{type:"supsub",mode:this.mode,base:r,sup:n,sub:o}:r}parseFunction(e,r){var n=this.fetch(),o=n.text,l=Et[o];if(!l)return null;if(this.consume(),r&&r!=="atom"&&!l.allowedInArgument)throw new _("Got function '"+o+"' with no arguments"+(r?" as "+r:""),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,r,n,o,l){var i={funcName:e,parser:this,token:o,breakOnTokenText:l},s=Et[e];if(s&&s.handler)return s.handler(i,r,n);throw new _("No function handler for "+e)}parseArguments(e,r){var n=r.numArgs+r.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var o=[],l=[],i=0;i<n;i++){var s=r.argTypes&&r.argTypes[i],c=i<r.numOptionalArgs;("primitive"in r&&r.primitive&&s==null||r.type==="sqrt"&&i===1&&l[0]==null)&&(s="primitive");var m=this.parseGroupOfType("argument to '"+e+"'",s,c);if(c)l.push(m);else if(m!=null)o.push(m);else throw new _("Null argument, please report this as a bug")}return{args:o,optArgs:l}}parseGroupOfType(e,r,n){switch(r){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,r);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,r){var n=this.gullet.scanArgument(r);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,r){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 "+r+": '"+n.text+"'",n);return n.range(o,l)}parseColorGroup(e){var r=this.parseStringGroup("color",e);if(r==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(r.text);if(!n)throw new _("Invalid color: '"+r.text+"'",r);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 r,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup("size",e),!r)return null;!e&&r.text.length===0&&(r.text="0pt",n=!0);var o=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!o)throw new _("Invalid size: '"+r.text+"'",r);var l={number:+(o[1]+o[2]),unit:o[3]};if(!ml(l))throw new _("Invalid unit: '"+l.unit+"'",r);return{type:"size",mode:this.mode,value:l,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var r=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;var n=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,r){var n=this.gullet.scanArgument(e);if(n==null)return null;var o=this.mode;r&&this.switchMode(r),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 r&&this.switchMode(o),i}parseGroup(e,r){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),c=this.fetch();this.expect(i),this.gullet.endGroup(),l={type:"ordgroup",mode:this.mode,loc:Ye.range(n,c),body:s,semisimple:o==="\\begingroup"||void 0}}else if(l=this.parseFunction(r,e)||this.parseSymbol(),l==null&&o[0]==="\\"&&!ai.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 r=e.length-1,n=0;n<r;++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<r&&s&&s.type==="textord"&&s.text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:Ye.range(o,s),text:"---"}),r-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:Ye.range(o,i),text:"--"}),r-=1)}(l==="'"||l==="`")&&i.text===l&&(e.splice(n,2,{type:"textord",mode:"text",loc:Ye.range(o,i),text:l+l}),r-=1)}}}}parseSymbol(){var e=this.fetch(),r=e.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var n=r.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 --
302
+ please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:o}}so.hasOwnProperty(r[0])&&!Ce[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+r[0]+'" used in math mode',e),r=so[r[0]]+r.slice(1));var l=F1.exec(r);l&&(r=r.substring(0,l.index),r==="i"?r="ı":r==="j"&&(r="ȷ"));var i;if(Ce[this.mode][r]){this.settings.strict&&this.mode==="math"&&d0.includes(r)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',e);var s=Ce[this.mode][r].group,c=Ye.range(e),m;if(qc.hasOwnProperty(s)){var p=s;m={type:"atom",mode:this.mode,family:p,loc:c,text:r}}else m={type:s,mode:this.mode,loc:c,text:r};i=m}else if(r.charCodeAt(0)>=128)this.settings.strict&&(dl(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),e)),i={type:"textord",mode:"text",loc:Ye.range(e),text:r};else return null;if(this.consume(),l)for(var f=0;f<l[0].length;f++){var g=l[0][f];if(!Xn[g])throw new _("Unknown accent ' "+g+"'",e);var b=Xn[g][this.mode]||Xn[g].text;if(!b)throw new _("Accent "+g+" unsupported in "+this.mode+" mode",e);i={type:"accent",mode:this.mode,loc:Ye.range(e),label:b,isStretchy:!1,isShifty:!0,base:i}}return i}}wn.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var U0=function(e,r){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new wn(e,r);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(!r.displayMode)throw new _("\\tag works only in display equations");o=[{type:"tag",mode:"text",body:o,tag:n.subparse([new Je("\\df@tag")])}]}return o},oi=function(e,r,n){r.textContent="";var o=_0(e,n).toNode();r.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."),oi=function(){throw new _("KaTeX doesn't work in quirks mode.")});var K1=function(e,r){var n=_0(e,r).toMarkup();return n},Y1=function(e,r){var n=new L0(r);return U0(e,n)},li=function(e,r,n){if(n.throwOnError||!(e instanceof _))throw e;var o=$(["katex-error"],[new Qe(r)]);return o.setAttribute("title",e.toString()),o.setAttribute("style","color:"+n.errorColor),o},_0=function(e,r){var n=new L0(r);try{var o=U0(e,n);return a1(o,e,n)}catch(l){return li(l,e,n)}},j1=function(e,r){var n=new L0(r);try{var o=U0(e,n);return o1(o,e,n)}catch(l){return li(l,e,n)}},X1="0.16.45",J1={Span:ir,Anchor:sn,SymbolNode:Qe,SvgNode:vt,PathNode:Bt,LineNode:c0},ii={version:X1,render:oi,renderToString:K1,ParseError:_,SETTINGS_SCHEMA:i0,__parse:Y1,__renderToDomTree:_0,__renderToHTMLTree:j1,__setFontMetrics:$c,__defineSymbol:u,__defineFunction:Z,__defineMacro:y,__domTree:J1};const Q1=Bo.BlockMath.extend({addNodeView(){const{katexOptions:t}=this.options;return({node:e,getPos:r})=>{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 m=Pe(n.attrs.commentIds);o.dataset.type="block-math",o.setAttribute("data-latex",n.attrs.latex),m.length>0?(o.setAttribute("data-comment-ids",JSON.stringify(m)),o.classList.add("pagely-comment-block"),m.length>1?o.setAttribute("data-comment-count",String(m.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{ii.render(n.attrs.latex,l,t),o.classList.remove("block-math-error")}catch{l.textContent=n.attrs.latex,o.classList.add("block-math-error")}}const c=m=>{var f,g;m.preventDefault(),m.stopPropagation();const p=r();p!=null&&((g=(f=this.options).onClick)==null||g.call(f,n,p))};return this.options.onClick&&o.addEventListener("click",c),i(),s(),{dom:o,update:m=>{if(m.type!==n.type)return!1;const p=m.attrs.latex!==n.attrs.latex;return n=m,i(),p&&s(),!0},destroy(){o.removeEventListener("click",c)}}}}}),Z1=Te.Extension.create({name:"Mathematics",addOptions(){return{inlineOptions:void 0,blockOptions:void 0,katexOptions:void 0}},addExtensions(){return[Q1.configure({...this.options.blockOptions,katexOptions:this.options.katexOptions}),Bo.InlineMath.configure({...this.options.inlineOptions,katexOptions:this.options.katexOptions})]}}),ed=["paragraph","heading","blockquote","bulletList","orderedList","listItem","taskList","taskItem","codeBlock","table","tableRow","tableCell","tableHeader","image","mermaidBlock","dotFlowPadBlock","blockMath","embedView"],si=Te.Extension.create({name:"commentBlock",addGlobalAttributes(){return[{types:ed,attributes:{commentIds:{default:[],parseHTML:t=>Pe(t.getAttribute("data-comment-ids")),renderHTML:t=>{const e=Pe(t.commentIds);if(e.length===0)return{};const r={"data-comment-ids":JSON.stringify(e),class:"pagely-comment-block"};return e.length>1&&(r["data-comment-count"]=String(e.length)),r}}}}]}});function td(t){return t.filter(e=>e.type.name!=="commentMark")}function ui(t){const e=td(t.marks);if(t.isText)return t.mark(e);const r=Array.isArray(t.attrs.commentIds)&&t.attrs.commentIds.length>0?{...t.attrs,commentIds:[]}:t.attrs,n=[];return t.content.forEach(o=>{n.push(ui(o))}),t.type.create(r,qr.Fragment.fromArray(n),e)}function rd(t){const e=[];return t.content.forEach(r=>{e.push(ui(r))}),new qr.Slice(qr.Fragment.fromArray(e),t.openStart,t.openEnd)}const ci=Te.Mark.create({name:"commentMark",priority:1001,inclusive:!1,addAttributes(){return{commentIds:{default:[],parseHTML:t=>Pe(t.getAttribute("data-comment-ids")),renderHTML:t=>({"data-comment-ids":JSON.stringify(Pe(t.commentIds))})}}},parseHTML(){return[{tag:"span[data-comment-ids]"}]},renderHTML({HTMLAttributes:t}){const e=Pe(t["data-comment-ids"]),r={class:"pagely-comment-inline"};return e.length>1&&(r["data-comment-count"]=String(e.length)),["span",Te.mergeAttributes(r,t),0]},addProseMirrorPlugins(){return[new rt.Plugin({key:new rt.PluginKey("commentPasteStrip"),props:{transformPasted(t){return rd(t)}}})]}});function uo(t,e){const r=Pe(e.attrs.commentIds);if(r.length>0){t.classList.add("pagely-comment-block"),t.setAttribute("data-comment-ids",JSON.stringify(r)),r.length>1?t.setAttribute("data-comment-count",String(r.length)):t.removeAttribute("data-comment-count");return}t.classList.remove("pagely-comment-block"),t.removeAttribute("data-comment-ids"),t.removeAttribute("data-comment-count")}class nd extends fr.TableView{constructor(e,r,n){super(e,r),uo(this.dom,e)}update(e){return super.update(e)?(uo(this.dom,e),!0):!1}}const ad={class:"eb-shell"},od={class:"eb-label"},ld={key:0,class:"eb-copy-tip"},id={key:0,class:"eb-copy-tip"},sd={class:"eb-label"},W0=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(t,{expose:e,emit:r}){const n=r,o=a.ref(!1),l=a.ref(!1);let i=null,s=null;function c(g){const b=g==="source"?o:l,v=g==="source"?i:s;v&&clearTimeout(v),b.value=!0;const w=setTimeout(()=>{b.value=!1,g==="source"?i=null:s=null},1500);g==="source"?i=w:s=w}function m(){n("update:fullscreen",!0)}function p(){n("copy-source")}function f(){n("copy-image")}return e({showCopyTip:c}),a.onBeforeUnmount(()=>{i&&clearTimeout(i),s&&clearTimeout(s)}),(g,b)=>(a.openBlock(),a.createElementBlock("div",ad,[a.createElementVNode("div",{class:"eb-toolbar",onMousedown:b[0]||(b[0]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",od,a.toDisplayString(t.label),1),a.renderSlot(g.$slots,"toolbar-before-actions"),b[2]||(b[2]=a.createElementVNode("div",{class:"eb-spacer"},null,-1)),a.renderSlot(g.$slots,"toolbar-extra"),t.canCopyImage?(a.openBlock(),a.createElementBlock("button",{key:0,class:"eb-btn",type:"button",title:"复制为图片",onClick:f},[a.createVNode(a.unref(I.Image),{size:14,"stroke-width":1.4}),l.value?(a.openBlock(),a.createElementBlock("span",ld,"已复制")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),t.canCopySource?(a.openBlock(),a.createElementBlock("button",{key:1,class:"eb-btn",type:"button",title:"复制源码",onClick:p},[a.createVNode(a.unref(I.Copy),{size:14,"stroke-width":1.4}),o.value?(a.openBlock(),a.createElementBlock("span",id,"已复制")):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),t.canFullscreen?(a.openBlock(),a.createElementBlock("button",{key:2,class:"eb-btn",type:"button",title:"全屏",onClick:m},[a.createVNode(a.unref(I.Maximize2),{size:14,"stroke-width":1.4})])):a.createCommentVNode("",!0)],32),a.renderSlot(g.$slots,"inline"),t.canFullscreen?(a.openBlock(),a.createBlock(ln,{key:0,open:t.fullscreen,"before-close":t.beforeCloseFullscreen,"close-label":t.fullscreenCloseLabel,"onUpdate:open":b[1]||(b[1]=v=>n("update:fullscreen",v))},{toolbar:a.withCtx(()=>[a.createElementVNode("span",sd,a.toDisplayString(t.label),1)]),body:a.withCtx(()=>[a.renderSlot(g.$slots,"fullscreen")]),_:3},8,["open","before-close","close-label"])):a.createCommentVNode("",!0)]))}}),ud={key:1,class:"dfp-preview-overlay"},cd=a.defineComponent({__name:"DotFlowPadBlockView",props:{decorations:{},selected:{type:Boolean},updateAttributes:{type:Function},deleteNode:{type:Function},node:{},view:{},getPos:{},innerDecorations:{},editor:{},extension:{},HTMLAttributes:{}},setup(t){const e=t,{commentAttrs:r,commentClass:n}=xr(()=>e.node.attrs),o=a.ref(null),l=a.ref(null),i=a.ref(null),s=a.ref(null),c=a.ref(!1),m=a.ref(null),{copyPngToClipboard:p}=rn(),f=a.computed(()=>e.editor.isEditable),g=a.ref(!1);a.onMounted(()=>a.nextTick(()=>{g.value=!0,f.value&&e.node.attrs.autoOpen&&(a.nextTick(()=>w()),v({autoOpen:!1}))}));const b=a.computed(()=>{try{return JSON.parse(e.node.attrs.data)}catch{return{nodes:[],edges:[]}}});a.watch(b,S=>{!c.value&&o.value&&(o.value.setData(S),setTimeout(()=>{var B,z;return(z=(B=o.value)==null?void 0:B.fitView)==null?void 0:z.call(B)},100))});function v(S){var N,H;const B=(N=e.getPos)==null?void 0:N.call(e);if(B===void 0||!((H=e.editor)!=null&&H.view))return;const{state:z,dispatch:F}=e.editor.view,P=z.doc.nodeAt(B);P&&F(z.tr.setNodeMarkup(B,void 0,{...P.attrs,...S}))}function w(){c.value=!0}function k(){f.value&&w()}function T(){var B;if(!f.value)return;const S=(B=l.value)==null?void 0:B.getData();S&&(v({data:JSON.stringify(S)}),a.nextTick(()=>{var z;(z=o.value)==null||z.setData(S),setTimeout(()=>{var F,P;return(P=(F=o.value)==null?void 0:F.fitView)==null?void 0:P.call(F)},100)}))}async function M(){var S;try{await navigator.clipboard.writeText(e.node.attrs.data),(S=m.value)==null||S.showCopyTip("source")}catch{}}async function E(){var z;const S=c.value?s.value:i.value;await p(()=>tl(S))&&((z=m.value)==null||z.showCopyTip("image"))}return(S,B)=>(a.openBlock(),a.createBlock(a.unref(Oe.NodeViewWrapper),a.mergeProps({"data-type":"dot-flow-pad",class:a.unref(n)},a.unref(r)),{default:a.withCtx(()=>[a.createVNode(W0,{ref_key:"shellRef",ref:m,class:"dot-flow-pad-block-wrap",label:"画板",fullscreen:c.value,"onUpdate:fullscreen":B[0]||(B[0]=z=>c.value=z),"before-close-fullscreen":T,"can-copy-source":!0,"can-copy-image":!0,"can-fullscreen":!0,onCopySource:M,onCopyImage:E},{inline:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"inlineWrap",ref:i,class:"dfp-canvas-wrap dfp-preview",onClick:k},[g.value?(a.openBlock(),a.createBlock(a.unref(fa.DotFlowPad),{key:0,ref_key:"inlineRef",ref:o,"initial-data":b.value,readonly:!0,class:"dfp-preview-canvas"},null,8,["initial-data"])):a.createCommentVNode("",!0),f.value?(a.openBlock(),a.createElementBlock("div",ud,[a.createVNode(a.unref(I.Maximize2),{size:20,"stroke-width":1.4}),B[1]||(B[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"},[c.value?(a.openBlock(),a.createBlock(a.unref(fa.DotFlowPad),{key:0,ref_key:"fullscreenRef",ref:l,"initial-data":b.value,readonly:!f.value},null,8,["initial-data","readonly"])):a.createCommentVNode("",!0)],512)]),_:1},8,["fullscreen"])]),_:1},16,["class"]))}}),at=(t,e)=>{const r=t.__vccOpts||t;for(const[n,o]of e)r[n]=o;return r},dd=at(cd,[["__scopeId","data-v-9cffdd9d"]]),di=Te.Node.create({name:"dotFlowPadBlock",content:"",marks:"",group:"block",atom:!0,defining:!0,isolating:!0,addAttributes(){return{data:{default:JSON.stringify({nodes:[],edges:[]}),parseHTML:t=>t.getAttribute("data-graph")??JSON.stringify({nodes:[],edges:[]}),renderHTML:t=>({"data-graph":t.data})},autoOpen:{default:!1,parseHTML:()=>!1,renderHTML:()=>({})}}},parseHTML(){return[{tag:'div[data-type="dot-flow-pad"]'}]},renderHTML({HTMLAttributes:t}){return["div",Te.mergeAttributes(t,{"data-type":"dot-flow-pad"})]},addNodeView(){return Oe.VueNodeViewRenderer(dd)},addCommands(){return{insertDotFlowPadBlock:()=>({commands:t})=>t.insertContent({type:this.name,attrs:{data:JSON.stringify({nodes:[],edges:[]}),autoOpen:!0}})}}}),md='.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}',fd=".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}",pd='.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}',hd=".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}",vd=".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}",gd=`
308
303
  html,body{margin:0;background:#fff;}
309
304
  body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;}
310
305
  .pagely-md-preview{max-width:860px;margin:0 auto;padding:28px 40px 56px;}
311
306
  .pagely-md-preview .ProseMirror>*:hover{background:none;}
312
307
  @media (max-width:640px){.pagely-md-preview{padding:22px 22px 44px;}.ProseMirror{font-size:14px;}}
313
- `,jh=[_h,Gh,Kh,Yh,Jh,Xh].join(`
314
- `);function Qh(r){return['<!doctype html><html><head><meta charset="utf-8"><base target="_blank">',"<style>",jh,"</style></head><body>",'<main class="pagely-md-preview"><article class="ProseMirror">',r,"</article></main>","</body></html>"].join("")}function pi(r){return{title:null,favicon:null,domain:Dr(r)}}function Zh(r,e){if(!e)return null;try{return new URL(e,r).href}catch{return null}}function ep(r,e){const n=Array.from(r.querySelectorAll("link[rel]")).find(i=>{var u;return(((u=i.getAttribute("rel"))==null?void 0:u.toLowerCase())??"").split(/\s+/).some(d=>["icon","shortcut","apple-touch-icon"].includes(d))}),o=Zh(e,(n==null?void 0:n.getAttribute("href"))??null);if(o)return o;const l=Dr(e);return l?`https://${l}/favicon.ico`:null}async function tp(r,e){var t,n;if(!Hr(r))return pi(r);try{const o=await fetch(r,{signal:e});if(!o.ok)throw new Error(`HTTP ${o.status}`);const l=await o.text(),i=new DOMParser().parseFromString(l,"text/html");return{title:((n=(t=i.querySelector("title"))==null?void 0:t.textContent)==null?void 0:n.trim())||null,favicon:ep(i,r),domain:Dr(r)}}catch{return pi(r)}}async function rp(r,e){const t=await fetch(r,{signal:e});if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.text()}function np(r){return Wn(dn(r))}function op(r){var e;return((e=cr({href:r.href,label:r.label,preferredView:r.view}))==null?void 0:e.view)??"link"}function dl(r){return r.label||Fn(r.href)||r.href}function lp(r){var t;if((t=navigator.clipboard)!=null&&t.writeText)return navigator.clipboard.writeText(r);const e=document.createElement("textarea");return e.value=r,e.style.cssText="position:fixed;opacity:0;pointer-events:none",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),Promise.resolve()}function ap(r){const e=a.computed(()=>r.getAttrs()),t=a.computed(()=>Yi(e.value.href,e.value.label)),n=a.computed(()=>op(e.value)),o=a.ref(null),l=a.ref(!1),i=a.ref(null),s=a.ref(!1),u=a.ref(null),d=a.ref(!1),m=a.ref(!1);let h=null,p=null,v=null;a.watch(()=>e.value.href,()=>{h==null||h.abort(),p==null||p.abort(),o.value=null,l.value=!1,i.value=null,s.value=!1,u.value=null});function b(){if(o.value||l.value)return;const z=e.value;if(z.href){if(t.value!=="url"){o.value={title:dl(z),favicon:null,domain:Dr(z.href)};return}h==null||h.abort(),h=new AbortController,l.value=!0,tp(z.href,h.signal).then(W=>{o.value=W}).catch(()=>{o.value={title:null,favicon:null,domain:Dr(z.href)}}).finally(()=>{l.value=!1})}}function w(){if(t.value!=="md"||i.value||s.value)return;const z=e.value;p==null||p.abort(),p=new AbortController,s.value=!0,u.value=null,rp(z.href,p.signal).then(W=>{i.value=np(W)}).catch(W=>{W instanceof DOMException&&W.name==="AbortError"||(u.value=`无法加载: ${dl(z)}`)}).finally(()=>{s.value=!1})}function k(z){r.updateAttrs({view:z})}async function T(){try{await lp(e.value.href),m.value=!0,v&&clearTimeout(v),v=setTimeout(()=>{m.value=!1,v=null},1500)}catch{}}function E(){const z=e.value,W=document.createElement("a");W.href=z.href,W.download=dl(z),W.rel="noopener noreferrer",document.body.appendChild(W),W.click(),document.body.removeChild(W)}function M(){window.open(e.value.href,"_blank","noopener,noreferrer")}function B(){var z;(z=r.replaceWithText)==null||z.call(r)}function D(z){d.value=z}return a.onBeforeUnmount(()=>{h==null||h.abort(),p==null||p.abort(),v&&clearTimeout(v)}),{fileType:t,currentView:n,metadata:o,metadataLoading:l,loadMetadataIfNeeded:b,mdHtml:i,mdLoading:s,mdError:u,loadMdIfNeeded:w,setView:k,copyLink:T,download:E,openInNewTab:M,removeLink:B,toggleFullscreen:D,fullscreen:d,copyTip:m}}const ip=["title"],sp=["title","onClick"],up=["title"],cp=a.defineComponent({__name:"EmbedViewToolbar",props:{label:{},currentView:{},fileType:{},canPreview:{type:Boolean},copyTip:{type:Boolean}},emits:["set-view","fullscreen","download","copy","open","remove"],setup(r){const e=r,t=[{view:"link",title:"链接视图",icon:L.Link2},{view:"card",title:"卡片视图",icon:L.LayoutPanelTop},{view:"preview",title:"预览视图",icon:L.Eye}],n=a.computed(()=>t.filter(l=>l.view!=="preview"||e.canPreview)),o=a.computed(()=>e.fileType==="pdf"||e.fileType==="md");return(l,i)=>(a.openBlock(),a.createElementBlock("div",{class:"pagely-embed-toolbar",onMousedown:i[5]||(i[5]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",{class:"pagely-embed-toolbar__label",title:r.label},a.toDisplayString(r.label),9,ip),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.value,s=>(a.openBlock(),a.createElementBlock("button",{key:s.view,class:a.normalizeClass(["pagely-embed-btn",{"is-active":r.currentView===s.view}]),type:"button",title:s.title,onClick:u=>l.$emit("set-view",s.view)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(s.icon),{size:16,"stroke-width":1.6}))],10,sp))),128)),i[6]||(i[6]=a.createElementVNode("span",{class:"pagely-embed-toolbar__sep"},null,-1)),o.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"pagely-embed-btn",type:"button",title:"全屏",onClick:i[0]||(i[0]=s=>l.$emit("fullscreen"))},[a.createVNode(a.unref(L.Maximize2),{size:16,"stroke-width":1.8})])):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"pagely-embed-btn",type:"button",title:"下载",onClick:i[1]||(i[1]=s=>l.$emit("download"))},[a.createVNode(a.unref(L.Download),{size:16,"stroke-width":1.8})])):a.createCommentVNode("",!0),o.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:2,class:"pagely-embed-btn",type:"button",title:"新窗口打开",onClick:i[2]||(i[2]=s=>l.$emit("open"))},[a.createVNode(a.unref(L.ExternalLink),{size:16,"stroke-width":1.8})])),a.createElementVNode("button",{class:"pagely-embed-btn",type:"button",title:r.copyTip?"已复制":"复制链接",onClick:i[3]||(i[3]=s=>l.$emit("copy"))},[r.copyTip?(a.openBlock(),a.createBlock(a.unref(L.Check),{key:0,size:16,"stroke-width":2})):(a.openBlock(),a.createBlock(a.unref(L.Copy),{key:1,size:16,"stroke-width":1.8}))],8,up),o.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:3,class:"pagely-embed-btn",type:"button",title:"移除链接",onClick:i[4]||(i[4]=s=>l.$emit("remove"))},[a.createVNode(a.unref(L.Link2Off),{size:16,"stroke-width":1.8})]))],32))}}),dp=["href"],fp={class:"pagely-embed-link__title"},mp={class:"pagely-embed-link__href"},hp=["title"],pp={class:"pagely-embed-card__icon"},gp=["src"],vp={class:"pagely-embed-card__body"},bp={class:"pagely-embed-card__title"},yp={class:"pagely-embed-card__meta"},wp={key:2,class:"pagely-embed-preview"},kp={key:0,class:"pagely-embed-error"},xp={key:1,class:"pagely-embed-preview__loading"},Cp=["srcdoc"],Tp=["title","src"],Ep={class:"eb-label"},Sp={class:"pagely-embed-fullscreen"},Mp={key:0,class:"pagely-embed-error"},Ap=["srcdoc"],Bp=["title","src"],Np=a.defineComponent({__name:"EmbedViewBlock",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(""),i=a.ref(!1),s=a.ref(!1),u=a.ref(!1),d=a.ref({});let m=null,h=null;const{fileType:p,currentView:v,metadata:b,metadataLoading:w,loadMetadataIfNeeded:k,mdHtml:T,mdLoading:E,mdError:M,loadMdIfNeeded:B,setView:D,copyLink:z,download:W,openInNewTab:H,removeLink:A,toggleFullscreen:R,fullscreen:K,copyTip:J}=ap({getAttrs:()=>e.node.attrs,updateAttrs:ue=>e.updateAttributes(ue),replaceWithText:Xe}),te=a.computed(()=>String(e.node.attrs.href??"")),Z=a.computed(()=>String(e.node.attrs.label||Fn(te.value)||te.value)),le=a.computed(()=>{var ue;return p.value==="url"&&!!((ue=b.value)!=null&&ue.favicon)&&!i.value}),ee=a.computed(()=>{var ue;return((ue=b.value)==null?void 0:ue.title)||Z.value||Fn(te.value)||te.value}),we=a.computed(()=>{var ue;return((ue=b.value)==null?void 0:ue.domain)||Dr(te.value)}),pe=a.computed(()=>Qh(T.value??"")),se=a.computed(()=>en(te.value,Z.value)),I=a.computed(()=>p.value==="pdf"?P(te.value,"#toolbar=0&navpanes=0&view=FitH"):te.value);function P(ue,me){return ue&&(ue.indexOf("#")===-1?ue+me:ue)}a.watch([v,p,te],()=>{l.value="",v.value==="card"&&k(),v.value==="preview"&&p.value==="md"&&B(),V()},{immediate:!0}),a.watch(te,()=>{i.value=!1});function V(){m&&(clearTimeout(m),m=null),!(v.value!=="preview"||p.value!=="url")&&(m=setTimeout(()=>{l.value="该网页不允许嵌入预览",m=null},2e3))}function q(){window.dispatchEvent(new CustomEvent("pagely:hide-selection-toolbar"))}function ae(){q(),h&&(clearTimeout(h),h=null),s.value=!0,a.nextTick(oe)}function ge(){h&&clearTimeout(h),h=setTimeout(()=>{u.value||(s.value=!1),h=null},120)}function ne(){ae()}function N(ue){var Re;const me=ue.relatedTarget;(Re=me==null?void 0:me.closest)!=null&&Re.call(me,".pagely-embed-toolbar")||ge()}function O(){u.value=!0,h&&(clearTimeout(h),h=null),q()}function $(ue){u.value=!1;const me=ue.relatedTarget,Re=X();me&&(Re!=null&&Re.contains(me))||ge()}function X(){const ue=o.value;return ue instanceof HTMLElement?ue:(ue==null?void 0:ue.$el)instanceof HTMLElement?ue.$el:null}function oe(){const ue=X();if(!ue)return;const me=ue.getBoundingClientRect(),Re=360,Ke=44,St=8,Ht=window.innerWidth;let Mt=me.left+me.width/2-Re/2;Mt=Math.max(8,Math.min(Mt,Ht-Re-8));const br=me.top>=Ke+St+8?me.top-Ke-St:me.bottom+St;d.value={position:"fixed",top:`${br}px`,left:`${Mt}px`,zIndex:"9998"}}function ve(){m&&(clearTimeout(m),m=null)}function Be(){l.value=`无法加载: ${Z.value}`,m&&(clearTimeout(m),m=null)}function $e(){p.value==="md"&&B(),R(!0)}function ot(){p.value==="url"?H():$e()}function Xe(){var Ht;const ue=(Ht=e.getPos)==null?void 0:Ht.call(e);if(typeof ue!="number")return;const{state:me,dispatch:Re}=e.editor.view,Ke=Z.value||te.value,St=me.schema.nodes.paragraph.create(null,Ke?me.schema.text(Ke):null);Re(me.tr.replaceWith(ue,ue+e.node.nodeSize,St).scrollIntoView()),e.editor.view.focus()}return a.onBeforeUnmount(()=>{m&&clearTimeout(m),h&&clearTimeout(h)}),(ue,me)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(a.unref(_e.NodeViewWrapper),a.mergeProps({ref_key:"rootRef",ref:o,class:["pagely-embed-block",[`pagely-embed-block--${a.unref(v)}`,{"is-selected":e.selected},a.unref(n)]],"data-type":"embed-view",contenteditable:"false"},a.unref(t),{onMouseenter:ne,onMouseleave:N,onMousedownCapture:q}),{default:a.withCtx(()=>{var Re;return[(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.withDirectives(a.createVNode(cp,{style:a.normalizeStyle(d.value),label:Z.value,"current-view":a.unref(v),"file-type":a.unref(p),"can-preview":se.value,"copy-tip":a.unref(J),onMouseenter:O,onMouseleave:$,onSetView:a.unref(D),onFullscreen:$e,onDownload:a.unref(W),onCopy:a.unref(z),onOpen:a.unref(H),onRemove:a.unref(A)},null,8,["style","label","current-view","file-type","can-preview","copy-tip","onSetView","onDownload","onCopy","onOpen","onRemove"]),[[a.vShow,s.value]])])),a.unref(v)==="link"?(a.openBlock(),a.createElementBlock("a",{key:0,class:"pagely-embed-link",href:te.value,target:"_blank",rel:"noopener noreferrer",onClick:me[0]||(me[0]=a.withModifiers((...Ke)=>a.unref(H)&&a.unref(H)(...Ke),["prevent"]))},[a.unref(p)!=="url"?(a.openBlock(),a.createBlock(a.unref(L.FileText),{key:0,class:"pagely-embed-link__icon",size:16,"stroke-width":1.5})):(a.openBlock(),a.createBlock(a.unref(L.Link),{key:1,class:"pagely-embed-link__icon",size:16,"stroke-width":1.5})),a.createElementVNode("span",fp,a.toDisplayString(Z.value),1),a.createElementVNode("span",mp,a.toDisplayString(te.value),1)],8,dp)):a.unref(v)==="card"?(a.openBlock(),a.createElementBlock("div",{key:1,class:"pagely-embed-card",title:te.value,onDblclick:a.withModifiers(ot,["prevent"])},[a.createElementVNode("div",pp,[le.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:((Re=a.unref(b))==null?void 0:Re.favicon)??"",alt:"",onError:me[1]||(me[1]=Ke=>i.value=!0)},null,40,gp)):a.unref(p)!=="url"?(a.openBlock(),a.createBlock(a.unref(L.FileText),{key:1,size:18,"stroke-width":1.5})):(a.openBlock(),a.createBlock(a.unref(L.Globe2),{key:2,size:18,"stroke-width":1.5}))]),a.createElementVNode("div",vp,[a.unref(w)?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[me[4]||(me[4]=a.createElementVNode("span",{class:"pagely-embed-skeleton pagely-embed-skeleton--title"},null,-1)),me[5]||(me[5]=a.createElementVNode("span",{class:"pagely-embed-skeleton pagely-embed-skeleton--meta"},null,-1))],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createElementVNode("span",bp,a.toDisplayString(ee.value),1),a.createElementVNode("span",yp,a.toDisplayString(we.value),1)],64))]),a.unref(p)!=="url"?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"pagely-embed-card__action",onClick:a.withModifiers($e,["stop"])},[a.createVNode(a.unref(L.Maximize2),{size:14,"stroke-width":1.6}),me[6]||(me[6]=a.createElementVNode("span",null,"全屏阅读",-1))])):a.createCommentVNode("",!0)],40,hp)):(a.openBlock(),a.createElementBlock("div",wp,[l.value||a.unref(M)?(a.openBlock(),a.createElementBlock("div",kp,[a.createElementVNode("span",null,a.toDisplayString(l.value||a.unref(M)),1),a.createElementVNode("button",{type:"button",class:"pagely-embed-error__action",onClick:me[2]||(me[2]=Ke=>a.unref(D)("card"))}," 切换为卡片视图 "),a.unref(p)==="url"?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"pagely-embed-error__action",onClick:me[3]||(me[3]=(...Ke)=>a.unref(H)&&a.unref(H)(...Ke))}," 新窗口打开 ")):a.createCommentVNode("",!0)])):a.unref(p)==="md"&&a.unref(E)?(a.openBlock(),a.createElementBlock("div",xp,[a.createVNode(a.unref(L.Loader2),{class:"pagely-embed-spin",size:18,"stroke-width":1.5})])):a.unref(p)==="md"?(a.openBlock(),a.createElementBlock("iframe",{key:2,class:"pagely-embed-iframe",title:"Markdown preview",srcdoc:pe.value,onLoad:ve,onError:Be},null,40,Cp)):(a.openBlock(),a.createElementBlock("iframe",{key:3,class:"pagely-embed-iframe",title:Z.value,src:I.value,referrerpolicy:"no-referrer-when-downgrade",onLoad:ve,onError:Be},null,40,Tp))]))]}),_:1},16,["class"]),a.unref(p)!=="url"?(a.openBlock(),a.createBlock(ho,{key:0,open:a.unref(K),"close-label":"关闭","onUpdate:open":a.unref(R)},{toolbar:a.withCtx(()=>[a.createElementVNode("span",Ep,a.toDisplayString(Z.value),1)]),body:a.withCtx(()=>[a.createElementVNode("div",Sp,[a.unref(M)?(a.openBlock(),a.createElementBlock("div",Mp,a.toDisplayString(a.unref(M)),1)):a.unref(p)==="md"?(a.openBlock(),a.createElementBlock("iframe",{key:1,class:"pagely-embed-iframe pagely-embed-iframe--fullscreen",title:"Markdown preview",srcdoc:pe.value},null,8,Ap)):(a.openBlock(),a.createElementBlock("iframe",{key:2,class:"pagely-embed-iframe pagely-embed-iframe--fullscreen",title:Z.value,src:te.value,referrerpolicy:"no-referrer-when-downgrade"},null,8,Bp))])]),_:1},8,["open","onUpdate:open"])):a.createCommentVNode("",!0)],64))}}),Zu=Me.Node.create({name:"embedView",group:"block",atom:!0,draggable:!0,addAttributes(){return{href:{default:"",parseHTML:r=>r.getAttribute("data-href")??"",renderHTML:r=>r.href?{"data-href":r.href}:{}},label:{default:"",parseHTML:r=>r.textContent??"",renderHTML:()=>({})},view:{default:"link",parseHTML:r=>{var e;return((e=cr({href:r.getAttribute("data-href")??"",label:r.textContent??"",preferredView:r.getAttribute("data-view")}))==null?void 0:e.view)??"link"},renderHTML:r=>{var e;return{"data-view":((e=cr({href:r.href??"",label:r.label??"",preferredView:r.view}))==null?void 0:e.view)??"link"}}}}},parseHTML(){return[{tag:'div[data-type="embed-view"]'}]},renderHTML({HTMLAttributes:r,node:e}){return["div",Me.mergeAttributes(r,{"data-type":"embed-view"}),e.attrs.label??""]},addNodeView(){return _e.VueNodeViewRenderer(Np)},addCommands(){return{insertEmbedView:r=>({commands:e})=>{const t=cr({href:r.href,label:r.label,preferredView:r.view});return t?e.insertContent({type:this.name,attrs:t}):!1}}}}),Lp=["src","alt","title"],gi=.1,vi=24,Ip=a.defineComponent({__name:"ImagePreviewDialog",props:{src:{},alt:{},title:{},baseWidth:{},baseHeight:{}},emits:["close"],setup(r,{emit:e}){const t=r,n=e,o=a.ref(1),l=a.ref({x:0,y:0}),i=a.ref(!1);let s=null;const u=a.computed(()=>({width:`${Math.max(1,t.baseWidth)*o.value}px`,transform:`translate(${l.value.x}px, ${l.value.y}px)`}));function d(k,T,E){return Math.min(E,Math.max(T,k))}function m(){const k=window.innerWidth*.9,T=window.innerHeight*.86,E=Math.max(1,t.baseWidth),M=Math.max(1,t.baseHeight);return Math.min(1,k/E,T/M)||1}function h(k){const T=k.deltaY<0?1.16:.86;o.value=d(o.value*T,gi,vi)}function p(k){k.button===0&&(s={startX:k.clientX,startY:k.clientY,startOffsetX:l.value.x,startOffsetY:l.value.y,previousCursor:document.body.style.cursor},i.value=!0,document.body.style.cursor="grabbing",window.addEventListener("pointermove",v),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b))}function v(k){s&&(l.value={x:s.startOffsetX+k.clientX-s.startX,y:s.startOffsetY+k.clientY-s.startY})}function b(){s&&(document.body.style.cursor=s.previousCursor,s=null,i.value=!1,window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b))}function w(k){k.key==="Escape"&&n("close")}return a.onMounted(()=>{o.value=d(m(),gi,vi),l.value={x:0,y:0},window.addEventListener("keydown",w)}),a.onBeforeUnmount(()=>{s&&(document.body.style.cursor=s.previousCursor),b(),window.removeEventListener("keydown",w)}),(k,T)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.createElementVNode("div",{class:"pagely-image-dialog",role:"dialog","aria-modal":"true",onMousedown:T[1]||(T[1]=a.withModifiers(E=>n("close"),["self"])),onWheel:a.withModifiers(h,["prevent"])},[a.createElementVNode("button",{class:"pagely-image-dialog-close",type:"button",title:"关闭",onClick:T[0]||(T[0]=E=>n("close"))},[a.createVNode(a.unref(L.X),{size:18,"stroke-width":1.8})]),a.createElementVNode("div",{class:a.normalizeClass(["pagely-image-dialog-stage",{"is-panning":i.value}])},[a.createElementVNode("img",{class:"pagely-image-dialog-img",src:r.src,alt:r.alt,title:r.title,style:a.normalizeStyle(u.value),draggable:"false",onWheel:a.withModifiers(h,["prevent"]),onPointerdown:a.withModifiers(p,["stop","prevent"])},null,44,Lp)],2)],32)]))}}),zp=gt(Ip,[["__scopeId","data-v-1cd0e251"]]),Dp=["src","alt","title"],Op=["onPointerdown"],bi=12,zn=100,Rp=a.defineComponent({__name:"ImageBlockView",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=["nw","ne","sw","se"],l=a.ref(null),i=a.ref(null),s=a.ref(null),u=a.ref(!1),d=a.ref(null),m=a.ref(null),h=a.ref(null),p=a.ref(!1);let v=null;const b=a.computed(()=>String(e.node.attrs.src??"")),w=a.computed(()=>e.node.attrs.alt??""),k=a.computed(()=>e.node.attrs.title??void 0),T=a.computed(()=>e.editor.isEditable),E=a.computed(()=>z(e.node.attrs.width)),M=a.computed(()=>E.value!==null),B=a.computed(()=>{const I=d.value??E.value;return I!==null?{width:`${I}%`}:m.value?{width:`${m.value}px`}:{}}),D=a.computed(()=>({width:ee(),height:we()}));function z(I){if(I==null||I==="")return null;const P=Number(I);return Number.isFinite(P)?W(P,bi,zn):null}function W(I,P,V){return Math.min(V,Math.max(P,I))}function H(I){return Math.round(I*10)/10}function A(){var P;const I=(P=e.getPos)==null?void 0:P.call(e);return typeof I=="number"?I:null}function R(I){if(I==null||I.preventDefault(),!T.value)return;const P=A();if(P===null)return;const{state:V,dispatch:q}=e.editor.view;q(V.tr.setSelection(mr.NodeSelection.create(V.doc,P))),e.editor.view.focus()}function K(){var I,P,V,q;return((I=l.value)==null?void 0:I.getBoundingClientRect().width)||((V=(P=i.value)==null?void 0:P.parentElement)==null?void 0:V.getBoundingClientRect().width)||((q=i.value)==null?void 0:q.getBoundingClientRect().width)||1}function J(I){const P=I.currentTarget;m.value=P.naturalWidth||null,h.value=P.naturalHeight||null}function te(I,P){var ae;if(!T.value)return;R(I);const V=K(),q=((ae=i.value)==null?void 0:ae.getBoundingClientRect().width)||V*(E.value??zn)/100;v={handle:P,startX:I.clientX,startWidthPx:q,containerWidth:V,previousCursor:document.body.style.cursor},u.value=!0,document.body.style.cursor=P==="nw"||P==="se"?"nwse-resize":"nesw-resize",window.addEventListener("pointermove",Z),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",le)}function Z(I){if(!v)return;const P=v.handle.includes("w")?-1:1,V=(I.clientX-v.startX)*P*2,q=W((v.startWidthPx+V)/v.containerWidth*100,bi,zn);d.value=H(q)}function le(){if(!v)return;const I=d.value??E.value??zn;e.updateAttributes({width:I}),document.body.style.cursor=v.previousCursor,v=null,u.value=!1,d.value=null,window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",le)}function ee(){var I,P;return m.value||((I=s.value)==null?void 0:I.naturalWidth)||((P=s.value)==null?void 0:P.getBoundingClientRect().width)||1}function we(){var I,P;return h.value||((I=s.value)==null?void 0:I.naturalHeight)||((P=s.value)==null?void 0:P.getBoundingClientRect().height)||1}function pe(){p.value=!0}function se(){p.value=!1}return a.onBeforeUnmount(()=>{v&&(document.body.style.cursor=v.previousCursor),se(),window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",le)}),(I,P)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(a.unref(_e.NodeViewWrapper),a.mergeProps({as:"figure","data-type":"image-block",class:["pagely-image-block",[{"is-selected":r.selected||u.value,"is-resizing":u.value},a.unref(n)]]},a.unref(t),{onClick:a.withModifiers(R,["stop"]),onDblclick:a.withModifiers(pe,["stop","prevent"])}),{default:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"rootRef",ref:l,class:"pagely-image-block-inner"},[a.createElementVNode("div",{ref_key:"frameRef",ref:i,class:a.normalizeClass(["pagely-image-frame",{"has-manual-width":M.value||u.value}]),style:a.normalizeStyle(B.value)},[a.createElementVNode("img",{ref_key:"imageRef",ref:s,class:"pagely-image",src:b.value,alt:w.value,title:k.value,draggable:"false",onLoad:J,onDblclick:a.withModifiers(pe,["stop","prevent"])},null,40,Dp),T.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},a.renderList(o,V=>a.createElementVNode("span",{key:V,class:a.normalizeClass(["pagely-image-resize-handle",`pagely-image-resize-handle--${V}`]),title:"Resize image",onPointerdown:a.withModifiers(q=>te(q,V),["stop","prevent"])},null,42,Op)),64)):a.createCommentVNode("",!0)],6)],512)]),_:1},16,["class"]),p.value?(a.openBlock(),a.createBlock(zp,{key:0,src:b.value,alt:w.value,title:k.value,"base-width":D.value.width,"base-height":D.value.height,onClose:se},null,8,["src","alt","title","base-width","base-height"])):a.createCommentVNode("",!0)],64))}}),Pp=gt(Rp,[["__scopeId","data-v-09322283"]]),Hp=12,Vp=100;function Gl(r){return Math.min(Vp,Math.max(Hp,r))}function Fp(r){const e=r.getAttribute("data-width");if(e){const o=Number(e);if(Number.isFinite(o))return Gl(o)}const n=r.style.width.match(/^(\d+(?:\.\d+)?)%$/);return n?Gl(Number(n[1])):null}function $p(r){if(r==null||r==="")return{style:"height: auto; max-width: 100%;"};const e=Number(r);if(!Number.isFinite(e))return{style:"height: auto; max-width: 100%;"};const t=Gl(e);return{"data-width":String(t),style:`width: ${t}%; height: auto; max-width: 100%;`}}const qp=Me.Node.create({name:"image",group:"block",atom:!0,draggable:!0,addAttributes(){return{src:{default:"",parseHTML:r=>r.getAttribute("src")??"",renderHTML:r=>r.src?{src:r.src}:{}},alt:{default:null,parseHTML:r=>r.getAttribute("alt"),renderHTML:r=>r.alt?{alt:r.alt}:{}},title:{default:null,parseHTML:r=>r.getAttribute("title"),renderHTML:r=>r.title?{title:r.title}:{}},width:{default:null,parseHTML:r=>Fp(r),renderHTML:r=>$p(r.width)}}},parseHTML(){return[{tag:"img[src]"}]},renderHTML({HTMLAttributes:r}){return["img",Me.mergeAttributes(r)]},addNodeView(){return _e.VueNodeViewRenderer(Pp)},addCommands(){return{insertImage:r=>({commands:e})=>e.insertContent({type:this.name,attrs:r})}}}),Up={key:0,class:"mermaid-error"},Wp=["innerHTML"],_p={class:"mermaid-fullscreen-panel"},Gp={key:0,class:"mermaid-error mermaid-error--fullscreen"},Kp={key:2,class:"mermaid-preview mermaid-preview--fullscreen"},Yp={key:0,class:"mermaid-error mermaid-error--fullscreen"},Jp=["innerHTML"];let Xp=0;const jp=a.defineComponent({__name:"MermaidBlockView",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(e.node.textContent),l=a.ref(!1),i=a.ref(""),s=a.ref(""),u=a.ref(null),d=a.ref(null),{copyPngToClipboard:m}=lo(),h=a.computed(()=>e.editor.isEditable),p=++Xp;let v=0;function b(){const M=document.createElement("div");return M.style.cssText=["position:fixed","left:-10000px","top:0","opacity:0","pointer-events:none","overflow:hidden","z-index:-1"].join(";"),document.body.appendChild(M),M}a.watch(()=>e.node.textContent,M=>{M!==o.value&&(o.value=M)});async function w(){const M=o.value.trim();if(!M){i.value="",s.value="";return}const B=++v,D=b();try{const{svg:z}=await Qc.render(`mermaid-preview-${p}-${B}`,M,D);if(B!==v)return;i.value=z,s.value=""}catch(z){if(B!==v)return;s.value=z instanceof Error?z.message:String(z),i.value=""}finally{D.remove()}}a.onMounted(()=>{w()}),a.watch(o,()=>{w()});async function k(){var M;try{await navigator.clipboard.writeText(o.value),(M=d.value)==null||M.showCopyTip("source")}catch{}}async function T(){var B;await m(()=>{var D;return((D=u.value)==null?void 0:D.querySelector(".mermaid-svg-container svg"))??null})&&((B=d.value)==null||B.showCopyTip("image"))}function E(M){var A,R;if(!h.value)return;o.value=M;const B=(A=e.getPos)==null?void 0:A.call(e);if(B===void 0||!((R=e.editor)!=null&&R.view))return;const{state:D,dispatch:z}=e.editor.view,W=D.doc.nodeAt(B);if(!W)return;const H=D.tr.replaceWith(B,B+W.nodeSize,W.type.create(W.attrs,M.length>0?D.schema.text(M):[]));H.setMeta("addToHistory",!0),z(H)}return(M,B)=>(a.openBlock(),a.createBlock(a.unref(_e.NodeViewWrapper),a.mergeProps({"data-type":"mermaid-block",class:a.unref(n)},a.unref(t)),{default:a.withCtx(()=>[a.createVNode(Ea,{ref_key:"shellRef",ref:d,class:"mermaid-block-wrap",label:"mermaid",fullscreen:l.value,"onUpdate:fullscreen":B[0]||(B[0]=D=>l.value=D),"can-copy-source":!0,"can-copy-image":!0,"can-fullscreen":!0,onCopySource:k,onCopyImage:T},{inline:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"previewWrap",ref:u,class:"mermaid-preview"},[s.value?(a.openBlock(),a.createElementBlock("div",Up,a.toDisplayString(s.value),1)):(a.openBlock(),a.createElementBlock("div",{key:1,class:"mermaid-svg-container",innerHTML:i.value},null,8,Wp))],512)]),fullscreen:a.withCtx(()=>[a.createElementVNode("div",_p,[s.value?(a.openBlock(),a.createElementBlock("div",Gp,a.toDisplayString(s.value),1)):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createBlock(a.unref(jc.MermaidEditorPanel),{key:1,code:o.value,"onUpdate:code":E},null,8,["code"])):(a.openBlock(),a.createElementBlock("div",Kp,[s.value?(a.openBlock(),a.createElementBlock("div",Yp,a.toDisplayString(s.value),1)):(a.openBlock(),a.createElementBlock("div",{key:1,class:"mermaid-svg-container",innerHTML:i.value},null,8,Jp))]))])]),_:1},8,["fullscreen"])]),_:1},16,["class"]))}}),ec=Me.Node.create({name:"mermaidBlock",content:"text*",marks:"",group:"block",code:!0,defining:!0,isolating:!0,parseHTML(){return[{tag:'pre[data-type="mermaid-block"]',preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:r}){return["pre",Me.mergeAttributes(r,{"data-type":"mermaid-block"}),0]},addNodeView(){return _e.VueNodeViewRenderer(jp)},addCommands(){return{insertMermaidBlock:(r=`graph TD
315
- A --> B`)=>({commands:e})=>e.insertContent({type:this.name,content:[{type:"text",text:r}]})}}}),Qp=a.defineComponent({__name:"MentionNode",props:_e.nodeViewProps,setup(r){const e=r,t=a.computed(()=>String(e.node.attrs.userId??"")),n=a.computed(()=>String(e.node.attrs.displayName??""));return(o,l)=>(a.openBlock(),a.createBlock(a.unref(_e.NodeViewWrapper),{as:"span",class:"pagely-mention-tag","data-mention-user-id":t.value,"data-mention-display-name":n.value},{default:a.withCtx(()=>[a.createTextVNode(" @"+a.toDisplayString(n.value),1)]),_:1},8,["data-mention-user-id","data-mention-display-name"]))}});function Zp(r){return(r.getAttribute("data-mention-display-name")??r.textContent??"").replace(/^@/,"")}const tc=Me.Node.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{userId:{default:"",parseHTML:r=>r.getAttribute("data-mention-user-id")??"",renderHTML:r=>r.userId?{"data-mention-user-id":r.userId}:{}},displayName:{default:"",parseHTML:r=>Zp(r),renderHTML:r=>r.displayName?{"data-mention-display-name":r.displayName}:{}}}},parseHTML(){return[{tag:"span[data-mention-user-id]"}]},renderHTML({HTMLAttributes:r}){const e=String(r["data-mention-display-name"]??"");return["span",Me.mergeAttributes({class:"pagely-mention-tag"},r),`@${e}`]},addNodeView(){return _e.VueNodeViewRenderer(Qp)},addCommands(){return{insertMention:r=>({commands:e})=>e.insertContent({type:this.name,attrs:r})}}}),e4=Me.Extension.create({name:"slashInsert",priority:1e3,addOptions(){return{onOpen:()=>{}}},addKeyboardShortcuts(){return{"/":({editor:r})=>{const{state:e,view:t}=r,{selection:n}=e;if(!n.empty)return!1;const{$from:o}=n,l=o.parent;if(!l.isTextblock||l.type.name==="codeBlock")return!1;for(let d=o.depth;d>0;d--){const m=o.node(d).type.name;if(m==="tableCell"||m==="tableHeader")return!1}const i=l.textBetween(0,o.parentOffset,void 0,"");if(i!==""&&!i.endsWith(" "))return!1;const s=t.coordsAtPos(o.pos),u=o.before(o.depth);return this.options.onOpen(u,new DOMRect(s.left,s.bottom,0,0)),!0}}}}),t4=/<(p|h[1-6]|ul|ol|li|table|tbody|thead|tr|td|th|blockquote)\b/i;function r4(r){return r?t4.test(r):!1}const n4=new Set(["tableCell","tableHeader"]);function o4(r,e){const t=r.clipboardData;if(!t)return null;const n=t.getData("text/plain")??"",o=t.getData("text/html")??"",l=o.length>0?o:null;return!n&&!l?null:{plainText:n,html:l,isRichHtml:r4(l),inlineOnly:l4(e)}}function l4(r){const{$from:e}=r.state.selection;for(let t=e.depth;t>=0;t--)if(n4.has(e.node(t).type.name))return!0;return!1}const a4="*/*";async function Sa(r){return URL.createObjectURL?{href:URL.createObjectURL(r),label:r.name}:null}function i4(r){var e;if(!((e=r==null?void 0:r.files)!=null&&e.length))return null;for(const t of Array.from(r.files))if(t.type.startsWith("image/"))return t;return null}function s4(r){var e,t;return r?(((e=r.getData("text/plain"))==null?void 0:e.length)??0)>0||(((t=r.getData("text/html"))==null?void 0:t.length)??0)>0:!1}function u4(r){return new Promise(e=>{const t=new FileReader;t.onload=()=>e(typeof t.result=="string"?t.result:null),t.onerror=()=>e(null),t.readAsDataURL(r)})}function c4(r){var e;return(e=r==null?void 0:r.files)!=null&&e.length?Array.from(r.files):[]}function d4(r){if(!r)return!1;if(r.types&&Array.from(r.types).includes("Files"))return!0;if(r.items){for(const e of Array.from(r.items))if(e.kind==="file")return!0}return!1}const f4=Me.Extension.create({name:"smartPaste",addOptions(){return{handlers:[],debug:!1}},addProseMirrorPlugins(){const r=this.editor,e=[...this.options.handlers].sort((o,l)=>o.priority-l.priority),t=this.options.fileUploadHandler,n=this.options.debug;return[new mr.Plugin({key:new mr.PluginKey("smartPaste"),props:{handleDOMEvents:{dragover(o,l){return d4(l.dataTransfer)&&(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect="copy")),!1}},handleDrop(o,l){const i=c4(l.dataTransfer);if(i.length===0)return!1;l.preventDefault(),l.stopPropagation();const s=o.posAtCoords({left:l.clientX,top:l.clientY}),u=r.chain().focus();return s&&u.setTextSelection(s.pos),u.run(),(async()=>{const d=t??Sa;for(const m of i){const h=await d(m);if(!(h!=null&&h.href))continue;const p=cr({href:h.href,label:h.label||m.name});p&&r.commands.insertEmbedView(p)}})(),!0},handlePaste(o,l){var d;if(window.__pagelySkipNextPaste){window.__pagelySkipNextPaste=!1;const m=((d=l.clipboardData)==null?void 0:d.getData("text/plain"))??"";return m?(o.pasteText(m),!0):!1}if(o.state.selection.$from.parent.type.name==="codeBlock")return!1;const s=i4(l.clipboardData);if(s&&!s4(l.clipboardData))return u4(s).then(m=>{m&&r.commands.insertImage({src:m})}),!0;const u=o4(l,o);if(!u)return!1;for(const m of e){let h=!1;try{h=m.detect(u)}catch(p){console.error(`[smartPaste] detect ${m.name} threw`,p);continue}if(h){n&&console.debug("[smartPaste] hit:",m.name);try{const p=m.transform(u);return p&&r.commands.insertContent(p,{parseOptions:{preserveWhitespace:!1}}),!0}catch(p){return console.error(`[smartPaste] transform ${m.name} threw`,p),!1}}}return!1}}})]}}),m4=new Set(["tableCell","tableHeader"]);function h4(r){for(let e=r.depth;e>0;e-=1)if(m4.has(r.node(e).type.name))return!0;return!1}const p4=Me.Extension.create({name:"tableCellEnter",priority:1e3,addProseMirrorPlugins(){const r=this.editor;return[new mr.Plugin({props:{handleKeyDown(e,t){return t.key!=="Enter"||t.shiftKey||t.ctrlKey||t.metaKey||t.altKey||t.isComposing||e.composing||e.state.selection instanceof gl.CellSelection||!h4(e.state.selection.$from)?!1:r.commands.setHardBreak()}}})]}}),rc={starterKit:["edit","view","comment"],table:["edit","view"],tableRow:["edit","view"],tableHeader:["edit","view"],tableCell:["edit","view"],taskList:["edit","view"],taskItem:["edit","view"],codeBlock:["edit","view"],mermaidBlock:["edit","view"],dotFlowPadBlock:["edit","view"],image:["edit","view"],mathematics:["edit","view"],textStyle:["edit","view"],color:["edit","view"],highlight:["edit","view"],autoLinkTitle:["edit","view"],embedView:["edit"],smartPaste:["edit"],slashInsert:["edit"],tableCellEnter:["edit"],commentMark:["edit","view"],commentBlock:["edit","view"],mention:["edit","view","comment"]};function nc(r,e){const t=rc[r];return t?t.includes(e):!0}function Ao(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oc(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const g4=[/^#{1,6}[ \t]/m,/^[ \t]*[-*+][ \t]+\S/m,/^[ \t]*\d+\.[ \t]+\S/m,/^[ \t]*>[ \t]/m,/^```/m],v4=/[。!?一-龥]\s*$/,b4=[/^[ \t]{2,}\S/,/[;{}]\s*$/,/\b(function|const|let|var|class|def|import|from|return|if|else|for|while|switch|public|private|interface|enum)\b/,/=>|!==|===|<=|>=/,/^\s*(\/\/|\/\*|#\s|--\s)/,/\b\w+\s*\([^)]*\)\s*\{/],y4=[[/^#!.*\b(bash|sh)\b/m,"bash"],[/^#!.*\bpython\b/m,"python"],[/\b(def\s+\w+|from\s+\w+\s+import)/m,"python"],[/\b(interface\s+\w+|:\s*(string|number|boolean)\b)/m,"typescript"],[/\b(function\s+\w+\s*\(|const\s+\w+\s*=\s*\(|=>)/m,"javascript"],[/\b(public\s+(static\s+)?class|System\.out\.println)/m,"java"],[/^\s*(SELECT|INSERT|UPDATE|DELETE)\s+/im,"sql"]];function w4(r){for(const[e,t]of y4)if(e.test(r))return t;return"plaintext"}const k4={name:"codeBlock",priority:160,detect(r){if(r.inlineOnly||r.isRichHtml)return!1;const e=r.plainText;for(const o of g4)if(o.test(e))return!1;const t=e.split(`
316
- `).filter(o=>o.trim().length>0);if(t.length<3||t.some(o=>v4.test(o)))return!1;let n=0;for(const o of t)b4.some(l=>l.test(o))&&n++;return n/t.length>=.75},transform(r){const e=w4(r.plainText),t=Ao(r.plainText.replace(/\n+$/,""));return`<pre data-type="code-block" data-language="${e}"><code>${t}</code></pre>`}};function ro(r){const e=r.trim();if(!e||!(e.startsWith("{")||e.startsWith("[")))return null;try{return{value:JSON.parse(e)}}catch{return null}}function yi(r){return Array.isArray(r)}function lc(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function wi(r){return lc(r)?yi(r.nodes)&&yi(r.edges):!1}function ki(r,e){return!lc(r)||typeof r.type=="string"&&r.type.length>0?r:{...r,type:e}}function x4(r){return{...r,nodes:r.nodes.map(e=>ki(e,"rect")),edges:r.edges.map(e=>ki(e,"polyline"))}}const C4={name:"dotFlowPad",priority:50,detect(r){if(r.inlineOnly||r.isRichHtml)return!1;const e=ro(r.plainText);return e!==null&&wi(e.value)},transform(r){const e=ro(r.plainText);if(!e||!wi(e.value))return"";const t=JSON.stringify(x4(e.value));return`<div data-type="dot-flow-pad" data-graph="${oc(t)}"></div>`}},T4=50,E4={name:"jsonCode",priority:210,detect(r){return r.inlineOnly||r.isRichHtml||r.plainText.trim().length<T4?!1:ro(r.plainText)!==null},transform(r){const e=ro(r.plainText);if(!e)return"";const t=JSON.stringify(e.value,null,2);return`<pre data-type="code-block" data-language="json"><code>${Ao(t)}</code></pre>`}},xi=/^\s*\$\$([\s\S]+?)\$\$\s*$/,S4=/^\s*\\begin\{([a-zA-Z*]+)\}([\s\S]+?)\\end\{\1\}\s*$/,M4={name:"latexBlock",priority:60,detect(r){if(r.inlineOnly||r.isRichHtml)return!1;const e=r.plainText;return xi.test(e)||S4.test(e)},transform(r){const e=r.plainText,t=e.match(xi),n=t?t[1].trim():e.trim();return`<div data-type="block-math" data-latex="${oc(n)}"></div>`}},A4=[/^#{1,6}[ \t]/m,/^[ \t]*[-*+][ \t]+\S/m,/^[ \t]*\d+\.[ \t]+\S/m,/^[ \t]*>[ \t]/m,/^[ \t]*-[ \t]\[[ xX]\][ \t]/m,/^```/m,/^[ \t]*[-*_]{3,}[ \t]*$/m],B4=[/\*\*[^*\n]+\*\*/,/\[[^\]\n]+?\]\([^)\n]+?\)/,/(^|[^`])`[^`\n]+`(?!`)/],N4={name:"markdown",priority:100,detect(r){if(r.isRichHtml)return!1;const e=r.plainText;if(!e||e.trim().length<2)return!1;for(const n of A4)if(n.test(e))return!0;let t=0;for(const n of B4)n.test(e)&&t++;return t>=2},transform(r){const e=dn(r.plainText);return r.inlineOnly?L4(e):e}};function L4(r){const e=document.createElement("template");return e.innerHTML=r,ac(e.content).join("<br>")}const I4=new Set(["P","H1","H2","H3","H4","H5","H6","UL","OL","LI","BLOCKQUOTE","PRE","HR","DIV","TABLE","THEAD","TBODY","TR","TD","TH"]);function ac(r){const e=[];for(const t of Array.from(r.childNodes)){if(t.nodeType===Node.TEXT_NODE){const o=t.textContent??"";o.trim().length>0&&e.push(o);continue}if(t.nodeType!==Node.ELEMENT_NODE)continue;const n=t;I4.has(n.tagName)?e.push(...ac(n)):e.push(n.outerHTML)}return e}const z4=["stateDiagram-v2","stateDiagram","sequenceDiagram","classDiagram","erDiagram","journey","gantt","pie","mindmap","timeline","gitGraph","quadrantChart","requirementDiagram","C4Context"],D4=["graph","flowchart"],O4=["TB","TD","BT","RL","LR"],R4=new RegExp(`^\\s*(?:${z4.join("|")})(?:\\s+|\\s*$)`),P4=new RegExp(`^\\s*(?:${D4.join("|")})\\s+(?:${O4.join("|")})\\b`),H4={name:"mermaid",priority:70,detect(r){if(r.inlineOnly||r.isRichHtml)return!1;const e=r.plainText;return R4.test(e)||P4.test(e)},transform(r){return`<pre data-type="mermaid-block">${Ao(r.plainText.trim())}</pre>`}},V4={name:"richHtml",priority:200,detect:r=>r.isRichHtml&&r.html!==null,transform:r=>Wn(r.html??"")};function Ci(r){const t=r.replace(/\r\n/g,`
308
+ `,bd=[md,fd,pd,hd,vd,gd].join(`
309
+ `);function yd(t){return['<!doctype html><html><head><meta charset="utf-8"><base target="_blank">',"<style>",bd,"</style></head><body>",'<main class="pagely-md-preview"><article class="ProseMirror">',t,"</article></main>","</body></html>"].join("")}function co(t){return{title:null,favicon:null,domain:Zt(t)}}function wd(t,e){if(!e)return null;try{return new URL(e,t).href}catch{return null}}function kd(t,e){const n=Array.from(t.querySelectorAll("link[rel]")).find(i=>{var c;return(((c=i.getAttribute("rel"))==null?void 0:c.toLowerCase())??"").split(/\s+/).some(m=>["icon","shortcut","apple-touch-icon"].includes(m))}),o=wd(e,(n==null?void 0:n.getAttribute("href"))??null);if(o)return o;const l=Zt(e);return l?`https://${l}/favicon.ico`:null}async function xd(t,e){var r,n;if(!nr(t))return co(t);try{const o=await fetch(t,{signal:e});if(!o.ok)throw new Error(`HTTP ${o.status}`);const l=await o.text(),i=new DOMParser().parseFromString(l,"text/html");return{title:((n=(r=i.querySelector("title"))==null?void 0:r.textContent)==null?void 0:n.trim())||null,favicon:kd(i,t),domain:Zt(t)}}catch{return co(t)}}async function Cd(t,e){const r=await fetch(t,{signal:e});if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.text()}function Td(t){return Kr(ar(t))}function Ed(t){var e;return((e=Vt({href:t.href,label:t.label,preferredView:t.view}))==null?void 0:e.view)??"link"}function Jn(t){return t.label||Ur(t.href)||t.href}function Md(t){var r;if((r=navigator.clipboard)!=null&&r.writeText)return navigator.clipboard.writeText(t);const e=document.createElement("textarea");return e.value=t,e.style.cssText="position:fixed;opacity:0;pointer-events:none",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),Promise.resolve()}function Sd(t){const e=a.computed(()=>t.getAttrs()),r=a.computed(()=>Ko(e.value.href,e.value.label)),n=a.computed(()=>Ed(e.value)),o=a.ref(null),l=a.ref(!1),i=a.ref(null),s=a.ref(!1),c=a.ref(null),m=a.ref(!1),p=a.ref(!1);let f=null,g=null,b=null;a.watch(()=>e.value.href,()=>{f==null||f.abort(),g==null||g.abort(),o.value=null,l.value=!1,i.value=null,s.value=!1,c.value=null});function v(){if(o.value||l.value)return;const z=e.value;if(z.href){if(r.value!=="url"){o.value={title:Jn(z),favicon:null,domain:Zt(z.href)};return}f==null||f.abort(),f=new AbortController,l.value=!0,xd(z.href,f.signal).then(F=>{o.value=F}).catch(()=>{o.value={title:null,favicon:null,domain:Zt(z.href)}}).finally(()=>{l.value=!1})}}function w(){if(r.value!=="md"||i.value||s.value)return;const z=e.value;g==null||g.abort(),g=new AbortController,s.value=!0,c.value=null,Cd(z.href,g.signal).then(F=>{i.value=Td(F)}).catch(F=>{F instanceof DOMException&&F.name==="AbortError"||(c.value=`无法加载: ${Jn(z)}`)}).finally(()=>{s.value=!1})}function k(z){t.updateAttrs({view:z})}async function T(){try{await Md(e.value.href),p.value=!0,b&&clearTimeout(b),b=setTimeout(()=>{p.value=!1,b=null},1500)}catch{}}function M(){const z=e.value,F=document.createElement("a");F.href=z.href,F.download=Jn(z),F.rel="noopener noreferrer",document.body.appendChild(F),F.click(),document.body.removeChild(F)}function E(){window.open(e.value.href,"_blank","noopener,noreferrer")}function S(){var z;(z=t.replaceWithText)==null||z.call(t)}function B(z){m.value=z}return a.onBeforeUnmount(()=>{f==null||f.abort(),g==null||g.abort(),b&&clearTimeout(b)}),{fileType:r,currentView:n,metadata:o,metadataLoading:l,loadMetadataIfNeeded:v,mdHtml:i,mdLoading:s,mdError:c,loadMdIfNeeded:w,setView:k,copyLink:T,download:M,openInNewTab:E,removeLink:S,toggleFullscreen:B,fullscreen:m,copyTip:p}}const Ad=["title"],Bd=["title","onClick"],Ld=["title"],Nd=a.defineComponent({__name:"EmbedViewToolbar",props:{label:{},currentView:{},fileType:{},canPreview:{type:Boolean},copyTip:{type:Boolean}},emits:["set-view","fullscreen","download","copy","open","remove"],setup(t){const e=t,r=[{view:"link",title:"链接视图",icon:I.Link2},{view:"card",title:"卡片视图",icon:I.LayoutPanelTop},{view:"preview",title:"预览视图",icon:I.Eye}],n=a.computed(()=>r.filter(l=>l.view!=="preview"||e.canPreview)),o=a.computed(()=>e.fileType==="pdf"||e.fileType==="md");return(l,i)=>(a.openBlock(),a.createElementBlock("div",{class:"pagely-embed-toolbar",onMousedown:i[5]||(i[5]=a.withModifiers(()=>{},["prevent"]))},[a.createElementVNode("span",{class:"pagely-embed-toolbar__label",title:t.label},a.toDisplayString(t.label),9,Ad),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.value,s=>(a.openBlock(),a.createElementBlock("button",{key:s.view,class:a.normalizeClass(["pagely-embed-btn",{"is-active":t.currentView===s.view}]),type:"button",title:s.title,onClick:c=>l.$emit("set-view",s.view)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(s.icon),{size:16,"stroke-width":1.6}))],10,Bd))),128)),i[6]||(i[6]=a.createElementVNode("span",{class:"pagely-embed-toolbar__sep"},null,-1)),o.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"pagely-embed-btn",type:"button",title:"全屏",onClick:i[0]||(i[0]=s=>l.$emit("fullscreen"))},[a.createVNode(a.unref(I.Maximize2),{size:16,"stroke-width":1.8})])):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"pagely-embed-btn",type:"button",title:"下载",onClick:i[1]||(i[1]=s=>l.$emit("download"))},[a.createVNode(a.unref(I.Download),{size:16,"stroke-width":1.8})])):a.createCommentVNode("",!0),o.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:2,class:"pagely-embed-btn",type:"button",title:"新窗口打开",onClick:i[2]||(i[2]=s=>l.$emit("open"))},[a.createVNode(a.unref(I.ExternalLink),{size:16,"stroke-width":1.8})])),a.createElementVNode("button",{class:"pagely-embed-btn",type:"button",title:t.copyTip?"已复制":"复制链接",onClick:i[3]||(i[3]=s=>l.$emit("copy"))},[t.copyTip?(a.openBlock(),a.createBlock(a.unref(I.Check),{key:0,size:16,"stroke-width":2})):(a.openBlock(),a.createBlock(a.unref(I.Copy),{key:1,size:16,"stroke-width":1.8}))],8,Ld),o.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:3,class:"pagely-embed-btn",type:"button",title:"移除链接",onClick:i[4]||(i[4]=s=>l.$emit("remove"))},[a.createVNode(a.unref(I.Link2Off),{size:16,"stroke-width":1.8})]))],32))}}),Id=["href"],zd={class:"pagely-embed-link__title"},Dd={class:"pagely-embed-link__href"},Hd=["title"],Rd={class:"pagely-embed-card__icon"},Pd=["src"],Od={class:"pagely-embed-card__body"},Vd={class:"pagely-embed-card__title"},$d={class:"pagely-embed-card__meta"},Fd={key:2,class:"pagely-embed-preview"},qd={key:0,class:"pagely-embed-error"},Ud={key:1,class:"pagely-embed-preview__loading"},_d=["srcdoc"],Wd=["title","src"],Gd={class:"eb-label"},Kd={class:"pagely-embed-fullscreen"},Yd={key:0,class:"pagely-embed-error"},jd=["srcdoc"],Xd=["title","src"],Jd=a.defineComponent({__name:"EmbedViewBlock",props:{decorations:{},selected:{type:Boolean},updateAttributes:{type:Function},deleteNode:{type:Function},node:{},view:{},getPos:{},innerDecorations:{},editor:{},extension:{},HTMLAttributes:{}},setup(t){const e=t,{commentAttrs:r,commentClass:n}=xr(()=>e.node.attrs),o=a.ref(null),l=a.ref(""),i=a.ref(!1),s=a.ref(!1),c=a.ref(!1),m=a.ref({});let p=null,f=null;const{fileType:g,currentView:b,metadata:v,metadataLoading:w,loadMetadataIfNeeded:k,mdHtml:T,mdLoading:M,mdError:E,loadMdIfNeeded:S,setView:B,copyLink:z,download:F,openInNewTab:P,removeLink:N,toggleFullscreen:H,fullscreen:G,copyTip:X}=Sd({getAttrs:()=>e.node.attrs,updateAttrs:ue=>e.updateAttributes(ue),replaceWithText:qe}),ae=a.computed(()=>String(e.node.attrs.href??"")),re=a.computed(()=>String(e.node.attrs.label||Ur(ae.value)||ae.value)),ce=a.computed(()=>{var ue;return g.value==="url"&&!!((ue=v.value)!=null&&ue.favicon)&&!i.value}),ne=a.computed(()=>{var ue;return((ue=v.value)==null?void 0:ue.title)||re.value||Ur(ae.value)||ae.value}),ge=a.computed(()=>{var ue;return((ue=v.value)==null?void 0:ue.domain)||Zt(ae.value)}),ve=a.computed(()=>yd(T.value??"")),se=a.computed(()=>gr(ae.value,re.value)),R=a.computed(()=>g.value==="pdf"?Y(ae.value,"#toolbar=0&navpanes=0&view=FitH"):ae.value);function Y(ue,pe){return ue&&(ue.indexOf("#")===-1?ue+pe:ue)}a.watch([b,g,ae],()=>{l.value="",b.value==="card"&&k(),b.value==="preview"&&g.value==="md"&&S(),K()},{immediate:!0}),a.watch(ae,()=>{i.value=!1});function K(){p&&(clearTimeout(p),p=null),!(b.value!=="preview"||g.value!=="url")&&(p=setTimeout(()=>{l.value="该网页不允许嵌入预览",p=null},2e3))}function q(){window.dispatchEvent(new CustomEvent("pagely:hide-selection-toolbar"))}function U(){q(),f&&(clearTimeout(f),f=null),s.value=!0,a.nextTick(le)}function te(){f&&clearTimeout(f),f=setTimeout(()=>{c.value||(s.value=!1),f=null},120)}function J(){U()}function L(ue){var Le;const pe=ue.relatedTarget;(Le=pe==null?void 0:pe.closest)!=null&&Le.call(pe,".pagely-embed-toolbar")||te()}function D(){c.value=!0,f&&(clearTimeout(f),f=null),q()}function V(ue){c.value=!1;const pe=ue.relatedTarget,Le=Q();pe&&(Le!=null&&Le.contains(pe))||te()}function Q(){const ue=o.value;return ue instanceof HTMLElement?ue:(ue==null?void 0:ue.$el)instanceof HTMLElement?ue.$el:null}function le(){const ue=Q();if(!ue)return;const pe=ue.getBoundingClientRect(),Le=360,$e=44,ct=8,wt=window.innerWidth;let dt=pe.left+pe.width/2-Le/2;dt=Math.max(8,Math.min(dt,wt-Le-8));const qt=pe.top>=$e+ct+8?pe.top-$e-ct:pe.bottom+ct;m.value={position:"fixed",top:`${qt}px`,left:`${dt}px`,zIndex:"9998"}}function be(){p&&(clearTimeout(p),p=null)}function Me(){l.value=`无法加载: ${re.value}`,p&&(clearTimeout(p),p=null)}function De(){g.value==="md"&&S(),H(!0)}function je(){g.value==="url"?P():De()}function qe(){var wt;const ue=(wt=e.getPos)==null?void 0:wt.call(e);if(typeof ue!="number")return;const{state:pe,dispatch:Le}=e.editor.view,$e=re.value||ae.value,ct=pe.schema.nodes.paragraph.create(null,$e?pe.schema.text($e):null);Le(pe.tr.replaceWith(ue,ue+e.node.nodeSize,ct).scrollIntoView()),e.editor.view.focus()}return a.onBeforeUnmount(()=>{p&&clearTimeout(p),f&&clearTimeout(f)}),(ue,pe)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(a.unref(Oe.NodeViewWrapper),a.mergeProps({ref_key:"rootRef",ref:o,class:["pagely-embed-block",[`pagely-embed-block--${a.unref(b)}`,{"is-selected":e.selected},a.unref(n)]],"data-type":"embed-view",contenteditable:"false"},a.unref(r),{onMouseenter:J,onMouseleave:L,onMousedownCapture:q}),{default:a.withCtx(()=>{var Le;return[(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.withDirectives(a.createVNode(Nd,{style:a.normalizeStyle(m.value),label:re.value,"current-view":a.unref(b),"file-type":a.unref(g),"can-preview":se.value,"copy-tip":a.unref(X),onMouseenter:D,onMouseleave:V,onSetView:a.unref(B),onFullscreen:De,onDownload:a.unref(F),onCopy:a.unref(z),onOpen:a.unref(P),onRemove:a.unref(N)},null,8,["style","label","current-view","file-type","can-preview","copy-tip","onSetView","onDownload","onCopy","onOpen","onRemove"]),[[a.vShow,s.value]])])),a.unref(b)==="link"?(a.openBlock(),a.createElementBlock("a",{key:0,class:"pagely-embed-link",href:ae.value,target:"_blank",rel:"noopener noreferrer",onClick:pe[0]||(pe[0]=a.withModifiers((...$e)=>a.unref(P)&&a.unref(P)(...$e),["prevent"]))},[a.unref(g)!=="url"?(a.openBlock(),a.createBlock(a.unref(I.FileText),{key:0,class:"pagely-embed-link__icon",size:16,"stroke-width":1.5})):(a.openBlock(),a.createBlock(a.unref(I.Link),{key:1,class:"pagely-embed-link__icon",size:16,"stroke-width":1.5})),a.createElementVNode("span",zd,a.toDisplayString(re.value),1),a.createElementVNode("span",Dd,a.toDisplayString(ae.value),1)],8,Id)):a.unref(b)==="card"?(a.openBlock(),a.createElementBlock("div",{key:1,class:"pagely-embed-card",title:ae.value,onDblclick:a.withModifiers(je,["prevent"])},[a.createElementVNode("div",Rd,[ce.value?(a.openBlock(),a.createElementBlock("img",{key:0,src:((Le=a.unref(v))==null?void 0:Le.favicon)??"",alt:"",onError:pe[1]||(pe[1]=$e=>i.value=!0)},null,40,Pd)):a.unref(g)!=="url"?(a.openBlock(),a.createBlock(a.unref(I.FileText),{key:1,size:18,"stroke-width":1.5})):(a.openBlock(),a.createBlock(a.unref(I.Globe2),{key:2,size:18,"stroke-width":1.5}))]),a.createElementVNode("div",Od,[a.unref(w)?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[pe[4]||(pe[4]=a.createElementVNode("span",{class:"pagely-embed-skeleton pagely-embed-skeleton--title"},null,-1)),pe[5]||(pe[5]=a.createElementVNode("span",{class:"pagely-embed-skeleton pagely-embed-skeleton--meta"},null,-1))],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createElementVNode("span",Vd,a.toDisplayString(ne.value),1),a.createElementVNode("span",$d,a.toDisplayString(ge.value),1)],64))]),a.unref(g)!=="url"?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"pagely-embed-card__action",onClick:a.withModifiers(De,["stop"])},[a.createVNode(a.unref(I.Maximize2),{size:14,"stroke-width":1.6}),pe[6]||(pe[6]=a.createElementVNode("span",null,"全屏阅读",-1))])):a.createCommentVNode("",!0)],40,Hd)):(a.openBlock(),a.createElementBlock("div",Fd,[l.value||a.unref(E)?(a.openBlock(),a.createElementBlock("div",qd,[a.createElementVNode("span",null,a.toDisplayString(l.value||a.unref(E)),1),a.createElementVNode("button",{type:"button",class:"pagely-embed-error__action",onClick:pe[2]||(pe[2]=$e=>a.unref(B)("card"))}," 切换为卡片视图 "),a.unref(g)==="url"?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"pagely-embed-error__action",onClick:pe[3]||(pe[3]=(...$e)=>a.unref(P)&&a.unref(P)(...$e))}," 新窗口打开 ")):a.createCommentVNode("",!0)])):a.unref(g)==="md"&&a.unref(M)?(a.openBlock(),a.createElementBlock("div",Ud,[a.createVNode(a.unref(I.Loader2),{class:"pagely-embed-spin",size:18,"stroke-width":1.5})])):a.unref(g)==="md"?(a.openBlock(),a.createElementBlock("iframe",{key:2,class:"pagely-embed-iframe",title:"Markdown preview",srcdoc:ve.value,onLoad:be,onError:Me},null,40,_d)):(a.openBlock(),a.createElementBlock("iframe",{key:3,class:"pagely-embed-iframe",title:re.value,src:R.value,referrerpolicy:"no-referrer-when-downgrade",onLoad:be,onError:Me},null,40,Wd))]))]}),_:1},16,["class"]),a.unref(g)!=="url"?(a.openBlock(),a.createBlock(ln,{key:0,open:a.unref(G),"close-label":"关闭","onUpdate:open":a.unref(H)},{toolbar:a.withCtx(()=>[a.createElementVNode("span",Gd,a.toDisplayString(re.value),1)]),body:a.withCtx(()=>[a.createElementVNode("div",Kd,[a.unref(E)?(a.openBlock(),a.createElementBlock("div",Yd,a.toDisplayString(a.unref(E)),1)):a.unref(g)==="md"?(a.openBlock(),a.createElementBlock("iframe",{key:1,class:"pagely-embed-iframe pagely-embed-iframe--fullscreen",title:"Markdown preview",srcdoc:ve.value},null,8,jd)):(a.openBlock(),a.createElementBlock("iframe",{key:2,class:"pagely-embed-iframe pagely-embed-iframe--fullscreen",title:re.value,src:ae.value,referrerpolicy:"no-referrer-when-downgrade"},null,8,Xd))])]),_:1},8,["open","onUpdate:open"])):a.createCommentVNode("",!0)],64))}}),mi=Te.Node.create({name:"embedView",group:"block",atom:!0,draggable:!0,addAttributes(){return{href:{default:"",parseHTML:t=>t.getAttribute("data-href")??"",renderHTML:t=>t.href?{"data-href":t.href}:{}},label:{default:"",parseHTML:t=>t.textContent??"",renderHTML:()=>({})},view:{default:"link",parseHTML:t=>{var e;return((e=Vt({href:t.getAttribute("data-href")??"",label:t.textContent??"",preferredView:t.getAttribute("data-view")}))==null?void 0:e.view)??"link"},renderHTML:t=>{var e;return{"data-view":((e=Vt({href:t.href??"",label:t.label??"",preferredView:t.view}))==null?void 0:e.view)??"link"}}}}},parseHTML(){return[{tag:'div[data-type="embed-view"]'}]},renderHTML({HTMLAttributes:t,node:e}){return["div",Te.mergeAttributes(t,{"data-type":"embed-view"}),e.attrs.label??""]},addNodeView(){return Oe.VueNodeViewRenderer(Jd)},addCommands(){return{insertEmbedView:t=>({commands:e})=>{const r=Vt({href:t.href,label:t.label,preferredView:t.view});return r?e.insertContent({type:this.name,attrs:r}):!1}}}}),Qd=["src","alt","title"],mo=.1,fo=24,Zd=a.defineComponent({__name:"ImagePreviewDialog",props:{src:{},alt:{},title:{},baseWidth:{},baseHeight:{}},emits:["close"],setup(t,{emit:e}){const r=t,n=e,o=a.ref(1),l=a.ref({x:0,y:0}),i=a.ref(!1);let s=null;const c=a.computed(()=>({width:`${Math.max(1,r.baseWidth)*o.value}px`,transform:`translate(${l.value.x}px, ${l.value.y}px)`}));function m(k,T,M){return Math.min(M,Math.max(T,k))}function p(){const k=window.innerWidth*.9,T=window.innerHeight*.86,M=Math.max(1,r.baseWidth),E=Math.max(1,r.baseHeight);return Math.min(1,k/M,T/E)||1}function f(k){const T=k.deltaY<0?1.16:.86;o.value=m(o.value*T,mo,fo)}function g(k){k.button===0&&(s={startX:k.clientX,startY:k.clientY,startOffsetX:l.value.x,startOffsetY:l.value.y,previousCursor:document.body.style.cursor},i.value=!0,document.body.style.cursor="grabbing",window.addEventListener("pointermove",b),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v))}function b(k){s&&(l.value={x:s.startOffsetX+k.clientX-s.startX,y:s.startOffsetY+k.clientY-s.startY})}function v(){s&&(document.body.style.cursor=s.previousCursor,s=null,i.value=!1,window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v))}function w(k){k.key==="Escape"&&n("close")}return a.onMounted(()=>{o.value=m(p(),mo,fo),l.value={x:0,y:0},window.addEventListener("keydown",w)}),a.onBeforeUnmount(()=>{s&&(document.body.style.cursor=s.previousCursor),v(),window.removeEventListener("keydown",w)}),(k,T)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.createElementVNode("div",{class:"pagely-image-dialog",role:"dialog","aria-modal":"true",onMousedown:T[1]||(T[1]=a.withModifiers(M=>n("close"),["self"])),onWheel:a.withModifiers(f,["prevent"])},[a.createElementVNode("button",{class:"pagely-image-dialog-close",type:"button",title:"关闭",onClick:T[0]||(T[0]=M=>n("close"))},[a.createVNode(a.unref(I.X),{size:18,"stroke-width":1.8})]),a.createElementVNode("div",{class:a.normalizeClass(["pagely-image-dialog-stage",{"is-panning":i.value}])},[a.createElementVNode("img",{class:"pagely-image-dialog-img",src:t.src,alt:t.alt,title:t.title,style:a.normalizeStyle(c.value),draggable:"false",onWheel:a.withModifiers(f,["prevent"]),onPointerdown:a.withModifiers(g,["stop","prevent"])},null,44,Qd)],2)],32)]))}}),em=at(Zd,[["__scopeId","data-v-1cd0e251"]]),tm=["src","alt","title"],rm=["onPointerdown"],po=12,Or=100,nm=a.defineComponent({__name:"ImageBlockView",props:{decorations:{},selected:{type:Boolean},updateAttributes:{type:Function},deleteNode:{type:Function},node:{},view:{},getPos:{},innerDecorations:{},editor:{},extension:{},HTMLAttributes:{}},setup(t){const e=t,{commentAttrs:r,commentClass:n}=xr(()=>e.node.attrs),o=["nw","ne","sw","se"],l=a.ref(null),i=a.ref(null),s=a.ref(null),c=a.ref(!1),m=a.ref(null),p=a.ref(null),f=a.ref(null),g=a.ref(!1);let b=null;const v=a.computed(()=>String(e.node.attrs.src??"")),w=a.computed(()=>e.node.attrs.attachmentId),k=a.ref(null),T=a.computed(()=>k.value||v.value),M=a.computed(()=>e.node.attrs.alt??""),E=a.computed(()=>e.node.attrs.title??void 0),S=a.computed(()=>e.editor.isEditable),B=a.computed(()=>N(e.node.attrs.width)),z=a.computed(()=>B.value!==null),F=a.computed(()=>{const U=m.value??B.value;return U!==null?{width:`${U}%`}:p.value?{width:`${p.value}px`}:{}}),P=a.computed(()=>({width:se(),height:R()}));function N(U){if(U==null||U==="")return null;const te=Number(U);return Number.isFinite(te)?H(te,po,Or):null}function H(U,te,J){return Math.min(J,Math.max(te,U))}function G(U){return Math.round(U*10)/10}function X(){var te;const U=(te=e.getPos)==null?void 0:te.call(e);return typeof U=="number"?U:null}function ae(U){if(U==null||U.preventDefault(),!S.value)return;const te=X();if(te===null)return;const{state:J,dispatch:L}=e.editor.view;L(J.tr.setSelection(rt.NodeSelection.create(J.doc,te))),e.editor.view.focus()}function re(){var U,te,J,L;return((U=l.value)==null?void 0:U.getBoundingClientRect().width)||((J=(te=i.value)==null?void 0:te.parentElement)==null?void 0:J.getBoundingClientRect().width)||((L=i.value)==null?void 0:L.getBoundingClientRect().width)||1}function ce(U){const te=U.currentTarget;p.value=te.naturalWidth||null,f.value=te.naturalHeight||null}function ne(U,te){var D;if(!S.value)return;ae(U);const J=re(),L=((D=i.value)==null?void 0:D.getBoundingClientRect().width)||J*(B.value??Or)/100;b={handle:te,startX:U.clientX,startWidthPx:L,containerWidth:J,previousCursor:document.body.style.cursor},c.value=!0,document.body.style.cursor=te==="nw"||te==="se"?"nwse-resize":"nesw-resize",window.addEventListener("pointermove",ge),window.addEventListener("pointerup",ve),window.addEventListener("pointercancel",ve)}function ge(U){if(!b)return;const te=b.handle.includes("w")?-1:1,J=(U.clientX-b.startX)*te*2,L=H((b.startWidthPx+J)/b.containerWidth*100,po,Or);m.value=G(L)}function ve(){if(!b)return;const U=m.value??B.value??Or;e.updateAttributes({width:U}),document.body.style.cursor=b.previousCursor,b=null,c.value=!1,m.value=null,window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)}function se(){var U,te;return p.value||((U=s.value)==null?void 0:U.naturalWidth)||((te=s.value)==null?void 0:te.getBoundingClientRect().width)||1}function R(){var U,te;return f.value||((U=s.value)==null?void 0:U.naturalHeight)||((te=s.value)==null?void 0:te.getBoundingClientRect().height)||1}function Y(){g.value=!0}function K(){g.value=!1}let q=0;return a.watch([w,v],async([U])=>{const te=++q;if(U==null||U===""){k.value=null;return}const J=e.extension.options.imageUrlResolver;if(!J){k.value=null;return}try{const L=await J(U);te===q&&(k.value=L||null)}catch(L){te===q&&(k.value=null),console.error("[pagely:image] resolve url failed",L)}},{immediate:!0}),a.onBeforeUnmount(()=>{q++,b&&(document.body.style.cursor=b.previousCursor),K(),window.removeEventListener("pointermove",ge),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)}),(U,te)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(a.unref(Oe.NodeViewWrapper),a.mergeProps({as:"figure","data-type":"image-block",class:["pagely-image-block",[{"is-selected":t.selected||c.value,"is-resizing":c.value},a.unref(n)]]},a.unref(r),{onClick:a.withModifiers(ae,["stop"]),onDblclick:a.withModifiers(Y,["stop","prevent"])}),{default:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"rootRef",ref:l,class:"pagely-image-block-inner"},[a.createElementVNode("div",{ref_key:"frameRef",ref:i,class:a.normalizeClass(["pagely-image-frame",{"has-manual-width":z.value||c.value}]),style:a.normalizeStyle(F.value)},[a.createElementVNode("img",{ref_key:"imageRef",ref:s,class:"pagely-image",src:T.value,alt:M.value,title:E.value,draggable:"false",onLoad:ce,onDblclick:a.withModifiers(Y,["stop","prevent"])},null,40,tm),S.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},a.renderList(o,J=>a.createElementVNode("span",{key:J,class:a.normalizeClass(["pagely-image-resize-handle",`pagely-image-resize-handle--${J}`]),title:"Resize image",onPointerdown:a.withModifiers(L=>ne(L,J),["stop","prevent"])},null,42,rm)),64)):a.createCommentVNode("",!0)],6)],512)]),_:1},16,["class"]),g.value?(a.openBlock(),a.createBlock(em,{key:0,src:T.value,alt:M.value,title:E.value,"base-width":P.value.width,"base-height":P.value.height,onClose:K},null,8,["src","alt","title","base-width","base-height"])):a.createCommentVNode("",!0)],64))}}),am=at(nm,[["__scopeId","data-v-4313780f"]]);function ho(t){return t.attachmentId!==null&&t.attachmentId!==void 0&&t.attachmentId!==""}const om=12,lm=100;function k0(t){return Math.min(lm,Math.max(om,t))}function im(t){const e=t.getAttribute("data-width");if(e){const o=Number(e);if(Number.isFinite(o))return k0(o)}const n=t.style.width.match(/^(\d+(?:\.\d+)?)%$/);return n?k0(Number(n[1])):null}function sm(t){if(t==null||t==="")return{style:"height: auto; max-width: 100%;"};const e=Number(t);if(!Number.isFinite(e))return{style:"height: auto; max-width: 100%;"};const r=k0(e);return{"data-width":String(r),style:`width: ${r}%; height: auto; max-width: 100%;`}}const um=Te.Node.create({name:"image",group:"block",atom:!0,draggable:!0,addOptions(){return{imageUrlResolver:void 0}},addAttributes(){return{src:{default:"",parseHTML:t=>t.getAttribute("src")??"",renderHTML:t=>ho(t)?{}:t.src?{src:t.src}:{}},attachmentId:{default:null,parseHTML:t=>t.getAttribute("data-attachment-id"),renderHTML:t=>ho(t)?{"data-attachment-id":String(t.attachmentId)}:{}},fileName:{default:null,parseHTML:t=>t.getAttribute("data-file-name"),renderHTML:t=>t.fileName?{"data-file-name":t.fileName}:{}},mimeType:{default:null,parseHTML:t=>t.getAttribute("data-mime-type"),renderHTML:t=>t.mimeType?{"data-mime-type":t.mimeType}:{}},alt:{default:null,parseHTML:t=>t.getAttribute("alt"),renderHTML:t=>t.alt?{alt:t.alt}:{}},title:{default:null,parseHTML:t=>t.getAttribute("title"),renderHTML:t=>t.title?{title:t.title}:{}},width:{default:null,parseHTML:t=>im(t),renderHTML:t=>sm(t.width)}}},parseHTML(){return[{tag:"img[data-attachment-id]"},{tag:"img[src]"}]},renderHTML({HTMLAttributes:t}){return["img",Te.mergeAttributes(t)]},addNodeView(){return Oe.VueNodeViewRenderer(am)},addCommands(){return{insertImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}}),cm={key:0,class:"mermaid-error"},dm=["innerHTML"],mm={class:"mermaid-fullscreen-panel"},fm={key:0,class:"mermaid-error mermaid-error--fullscreen"},pm={key:2,class:"mermaid-preview mermaid-preview--fullscreen"},hm={key:0,class:"mermaid-error mermaid-error--fullscreen"},vm=["innerHTML"];let gm=0;const bm=a.defineComponent({__name:"MermaidBlockView",props:{decorations:{},selected:{type:Boolean},updateAttributes:{type:Function},deleteNode:{type:Function},node:{},view:{},getPos:{},innerDecorations:{},editor:{},extension:{},HTMLAttributes:{}},setup(t){const e=t,{commentAttrs:r,commentClass:n}=xr(()=>e.node.attrs),o=a.ref(e.node.textContent),l=a.ref(!1),i=a.ref(""),s=a.ref(""),c=a.ref(null),m=a.ref(null),{copyPngToClipboard:p}=rn(),f=a.computed(()=>e.editor.isEditable),g=++gm;let b=0;function v(){const E=document.createElement("div");return E.style.cssText=["position:fixed","left:-10000px","top:0","opacity:0","pointer-events:none","overflow:hidden","z-index:-1"].join(";"),document.body.appendChild(E),E}a.watch(()=>e.node.textContent,E=>{E!==o.value&&(o.value=E)});async function w(){const E=o.value.trim();if(!E){i.value="",s.value="";return}const S=++b,B=v();try{const{svg:z}=await ks.render(`mermaid-preview-${g}-${S}`,E,B);if(S!==b)return;i.value=z,s.value=""}catch(z){if(S!==b)return;s.value=z instanceof Error?z.message:String(z),i.value=""}finally{B.remove()}}a.onMounted(()=>{w()}),a.watch(o,()=>{w()});async function k(){var E;try{await navigator.clipboard.writeText(o.value),(E=m.value)==null||E.showCopyTip("source")}catch{}}async function T(){var S;await p(()=>{var B;return((B=c.value)==null?void 0:B.querySelector(".mermaid-svg-container svg"))??null})&&((S=m.value)==null||S.showCopyTip("image"))}function M(E){var N,H;if(!f.value)return;o.value=E;const S=(N=e.getPos)==null?void 0:N.call(e);if(S===void 0||!((H=e.editor)!=null&&H.view))return;const{state:B,dispatch:z}=e.editor.view,F=B.doc.nodeAt(S);if(!F)return;const P=B.tr.replaceWith(S,S+F.nodeSize,F.type.create(F.attrs,E.length>0?B.schema.text(E):[]));P.setMeta("addToHistory",!0),z(P)}return(E,S)=>(a.openBlock(),a.createBlock(a.unref(Oe.NodeViewWrapper),a.mergeProps({"data-type":"mermaid-block",class:a.unref(n)},a.unref(r)),{default:a.withCtx(()=>[a.createVNode(W0,{ref_key:"shellRef",ref:m,class:"mermaid-block-wrap",label:"mermaid",fullscreen:l.value,"onUpdate:fullscreen":S[0]||(S[0]=B=>l.value=B),"can-copy-source":!0,"can-copy-image":!0,"can-fullscreen":!0,onCopySource:k,onCopyImage:T},{inline:a.withCtx(()=>[a.createElementVNode("div",{ref_key:"previewWrap",ref:c,class:"mermaid-preview"},[s.value?(a.openBlock(),a.createElementBlock("div",cm,a.toDisplayString(s.value),1)):(a.openBlock(),a.createElementBlock("div",{key:1,class:"mermaid-svg-container",innerHTML:i.value},null,8,dm))],512)]),fullscreen:a.withCtx(()=>[a.createElementVNode("div",mm,[s.value?(a.openBlock(),a.createElementBlock("div",fm,a.toDisplayString(s.value),1)):a.createCommentVNode("",!0),f.value?(a.openBlock(),a.createBlock(a.unref(ws.MermaidEditorPanel),{key:1,code:o.value,"onUpdate:code":M},null,8,["code"])):(a.openBlock(),a.createElementBlock("div",pm,[s.value?(a.openBlock(),a.createElementBlock("div",hm,a.toDisplayString(s.value),1)):(a.openBlock(),a.createElementBlock("div",{key:1,class:"mermaid-svg-container",innerHTML:i.value},null,8,vm))]))])]),_:1},8,["fullscreen"])]),_:1},16,["class"]))}}),fi=Te.Node.create({name:"mermaidBlock",content:"text*",marks:"",group:"block",code:!0,defining:!0,isolating:!0,parseHTML(){return[{tag:'pre[data-type="mermaid-block"]',preserveWhitespace:"full"}]},renderHTML({HTMLAttributes:t}){return["pre",Te.mergeAttributes(t,{"data-type":"mermaid-block"}),0]},addNodeView(){return Oe.VueNodeViewRenderer(bm)},addCommands(){return{insertMermaidBlock:(t=`graph TD
310
+ A --> B`)=>({commands:e})=>e.insertContent({type:this.name,content:[{type:"text",text:t}]})}}}),ym=a.defineComponent({__name:"MentionNode",props:Oe.nodeViewProps,setup(t){const e=t,r=a.computed(()=>String(e.node.attrs.userId??"")),n=a.computed(()=>String(e.node.attrs.displayName??""));return(o,l)=>(a.openBlock(),a.createBlock(a.unref(Oe.NodeViewWrapper),{as:"span",class:"pagely-mention-tag","data-mention-user-id":r.value,"data-mention-display-name":n.value},{default:a.withCtx(()=>[a.createTextVNode(" @"+a.toDisplayString(n.value),1)]),_:1},8,["data-mention-user-id","data-mention-display-name"]))}});function wm(t){return(t.getAttribute("data-mention-display-name")??t.textContent??"").replace(/^@/,"")}const pi=Te.Node.create({name:"mention",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{userId:{default:"",parseHTML:t=>t.getAttribute("data-mention-user-id")??"",renderHTML:t=>t.userId?{"data-mention-user-id":t.userId}:{}},displayName:{default:"",parseHTML:t=>wm(t),renderHTML:t=>t.displayName?{"data-mention-display-name":t.displayName}:{}}}},parseHTML(){return[{tag:"span[data-mention-user-id]"}]},renderHTML({HTMLAttributes:t}){const e=String(t["data-mention-display-name"]??"");return["span",Te.mergeAttributes({class:"pagely-mention-tag"},t),`@${e}`]},addNodeView(){return Oe.VueNodeViewRenderer(ym)},addCommands(){return{insertMention:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}}}),km=Te.Extension.create({name:"slashInsert",priority:1e3,addOptions(){return{onOpen:()=>{}}},addKeyboardShortcuts(){return{"/":({editor:t})=>{const{state:e,view:r}=t,{selection:n}=e;if(!n.empty)return!1;const{$from:o}=n,l=o.parent;if(!l.isTextblock||l.type.name==="codeBlock")return!1;for(let m=o.depth;m>0;m--){const p=o.node(m).type.name;if(p==="tableCell"||p==="tableHeader")return!1}const i=l.textBetween(0,o.parentOffset,void 0,"");if(i!==""&&!i.endsWith(" "))return!1;const s=r.coordsAtPos(o.pos),c=o.before(o.depth);return this.options.onOpen(c,new DOMRect(s.left,s.bottom,0,0)),!0}}}}),xm=/<(p|h[1-6]|ul|ol|li|table|tbody|thead|tr|td|th|blockquote)\b/i;function Cm(t){return t?xm.test(t):!1}const Tm=new Set(["tableCell","tableHeader"]);function Em(t,e){const r=t.clipboardData;if(!r)return null;const n=r.getData("text/plain")??"",o=r.getData("text/html")??"",l=o.length>0?o:null;return!n&&!l?null:{plainText:n,html:l,isRichHtml:Cm(l),inlineOnly:Mm(e)}}function Mm(t){const{$from:e}=t.state.selection;for(let r=e.depth;r>=0;r--)if(Tm.has(e.node(r).type.name))return!0;return!1}const Sm="*/*";async function G0(t){return URL.createObjectURL?{href:URL.createObjectURL(t),label:t.name}:null}const Am="image/*,.png,.jpg,.jpeg,.gif,.webp,.bmp,.svg,.avif",Bm=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i;function hi(t){return t.type.startsWith("image/")||Bm.test(t.name)}function vi(t){return new Promise(e=>{const r=new FileReader;r.onload=()=>e(typeof r.result=="string"?r.result:null),r.onerror=()=>e(null),r.readAsDataURL(t)})}function Lm(t){function e(n){var o;(o=t.onBeforeSelect)==null||o.call(t),n.currentTarget.value=""}async function r(n){var s;const o=n.target,l=((s=o.files)==null?void 0:s[0])??null;if(o.value="",!l||!hi(l))return;if(t.uploadHandler){const c=await t.uploadHandler(l);if(!(c!=null&&c.href))return;t.onInsert({src:c.href,attachmentId:c.attachmentId??null,fileName:c.label||l.name,mimeType:c.mimeType||l.type||null,alt:c.label||l.name});return}const i=await vi(l);i&&t.onInsert({src:i,alt:l.name})}return{imageAccept:Am,onImageFileClick:e,onImageFileChange:r}}function Nm(t){function e(n){var o;(o=t.onBeforeSelect)==null||o.call(t),n.currentTarget.value=""}async function r(n){var c;const o=n.target,l=((c=o.files)==null?void 0:c[0])??null;if(o.value="",!l)return;const s=await(t.uploadHandler??G0)(l);s!=null&&s.href&&t.onInsert({...s,href:s.href,label:s.label||l.name,mimeType:s.mimeType||l.type||void 0})}return{fileAccept:Sm,onDocFileClick:e,onDocFileChange:r}}function Im(t){var e,r;return t?(((e=t.getData("text/plain"))==null?void 0:e.length)??0)>0||(((r=t.getData("text/html"))==null?void 0:r.length)??0)>0:!1}function vo(t){var e;return(e=t==null?void 0:t.files)!=null&&e.length?Array.from(t.files):[]}function go(t){return t.length>0&&t.every(e=>hi(e))}function zm(t){if(!t)return!1;if(t.types&&Array.from(t.types).includes("Files"))return!0;if(t.items){for(const e of Array.from(t.items))if(e.kind==="file")return!0}return!1}const Dm=Te.Extension.create({name:"smartPaste",addOptions(){return{handlers:[],debug:!1}},addProseMirrorPlugins(){const t=this.editor,e=[...this.options.handlers].sort((i,s)=>i.priority-s.priority),r=this.options.fileUploadHandler,n=this.options.debug;async function o(i){const s=r??G0;for(const c of i){const m=await s(c);if(!(m!=null&&m.href))continue;const p=Vt({href:m.href,label:m.label||c.name});p&&t.commands.insertEmbedView(p)}}async function l(i){for(const s of i){if(r){const m=await r(s);if(!(m!=null&&m.href))continue;t.commands.insertImage({src:m.href,attachmentId:m.attachmentId??null,fileName:m.label||s.name,mimeType:m.mimeType||s.type||null,alt:m.label||s.name});continue}const c=await vi(s);c&&t.commands.insertImage({src:c,alt:s.name})}}return[new rt.Plugin({key:new rt.PluginKey("smartPaste"),props:{handleDOMEvents:{dragover(i,s){return zm(s.dataTransfer)&&(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="copy")),!1}},handleDrop(i,s){const c=vo(s.dataTransfer);if(c.length===0)return!1;s.preventDefault(),s.stopPropagation();const m=i.posAtCoords({left:s.clientX,top:s.clientY}),p=t.chain().focus();return m&&p.setTextSelection(m.pos),p.run(),go(c)?l(c):o(c),!0},handlePaste(i,s){var g;if(window.__pagelySkipNextPaste){window.__pagelySkipNextPaste=!1;const b=((g=s.clipboardData)==null?void 0:g.getData("text/plain"))??"";return b?(i.pasteText(b),!0):!1}if(i.state.selection.$from.parent.type.name==="codeBlock")return!1;const m=vo(s.clipboardData),p=Im(s.clipboardData);if(m.length>0&&!p)return s.preventDefault(),s.stopPropagation(),go(m)?l(m):o(m),!0;const f=Em(s,i);if(!f)return!1;for(const b of e){let v=!1;try{v=b.detect(f)}catch(w){console.error(`[smartPaste] detect ${b.name} threw`,w);continue}if(v){n&&console.debug("[smartPaste] hit:",b.name);try{const w=b.transform(f);return w&&t.commands.insertContent(w,{parseOptions:{preserveWhitespace:!1}}),!0}catch(w){return console.error(`[smartPaste] transform ${b.name} threw`,w),!1}}}return!1}}})]}}),Hm=new Set(["tableCell","tableHeader"]);function Rm(t){for(let e=t.depth;e>0;e-=1)if(Hm.has(t.node(e).type.name))return!0;return!1}const Pm=Te.Extension.create({name:"tableCellEnter",priority:1e3,addProseMirrorPlugins(){const t=this.editor;return[new rt.Plugin({props:{handleKeyDown(e,r){return r.key!=="Enter"||r.shiftKey||r.ctrlKey||r.metaKey||r.altKey||r.isComposing||e.composing||e.state.selection instanceof r0.CellSelection||!Rm(e.state.selection.$from)?!1:t.commands.setHardBreak()}}})]}}),gi={starterKit:["edit","view","comment"],table:["edit","view"],tableRow:["edit","view"],tableHeader:["edit","view"],tableCell:["edit","view"],taskList:["edit","view"],taskItem:["edit","view"],codeBlock:["edit","view"],mermaidBlock:["edit","view"],dotFlowPadBlock:["edit","view"],image:["edit","view"],mathematics:["edit","view"],textStyle:["edit","view"],color:["edit","view"],highlight:["edit","view"],autoLinkTitle:["edit","view"],embedView:["edit"],smartPaste:["edit"],slashInsert:["edit"],tableCellEnter:["edit"],commentMark:["edit","view"],commentBlock:["edit","view"],mention:["edit","view","comment"]};function bi(t,e){const r=gi[t];return r?r.includes(e):!0}function kn(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yi(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Om=[/^#{1,6}[ \t]/m,/^[ \t]*[-*+][ \t]+\S/m,/^[ \t]*\d+\.[ \t]+\S/m,/^[ \t]*>[ \t]/m,/^```/m],Vm=/[。!?一-龥]\s*$/,$m=[/^[ \t]{2,}\S/,/[;{}]\s*$/,/\b(function|const|let|var|class|def|import|from|return|if|else|for|while|switch|public|private|interface|enum)\b/,/=>|!==|===|<=|>=/,/^\s*(\/\/|\/\*|#\s|--\s)/,/\b\w+\s*\([^)]*\)\s*\{/],Fm=[[/^#!.*\b(bash|sh)\b/m,"bash"],[/^#!.*\bpython\b/m,"python"],[/\b(def\s+\w+|from\s+\w+\s+import)/m,"python"],[/\b(interface\s+\w+|:\s*(string|number|boolean)\b)/m,"typescript"],[/\b(function\s+\w+\s*\(|const\s+\w+\s*=\s*\(|=>)/m,"javascript"],[/\b(public\s+(static\s+)?class|System\.out\.println)/m,"java"],[/^\s*(SELECT|INSERT|UPDATE|DELETE)\s+/im,"sql"]];function qm(t){for(const[e,r]of Fm)if(e.test(t))return r;return"plaintext"}const Um={name:"codeBlock",priority:160,detect(t){if(t.inlineOnly||t.isRichHtml)return!1;const e=t.plainText;for(const o of Om)if(o.test(e))return!1;const r=e.split(`
311
+ `).filter(o=>o.trim().length>0);if(r.length<3||r.some(o=>Vm.test(o)))return!1;let n=0;for(const o of r)$m.some(l=>l.test(o))&&n++;return n/r.length>=.75},transform(t){const e=qm(t.plainText),r=kn(t.plainText.replace(/\n+$/,""));return`<pre data-type="code-block" data-language="${e}"><code>${r}</code></pre>`}};function Zr(t){const e=t.trim();if(!e||!(e.startsWith("{")||e.startsWith("[")))return null;try{return{value:JSON.parse(e)}}catch{return null}}function bo(t){return Array.isArray(t)}function wi(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function yo(t){return wi(t)?bo(t.nodes)&&bo(t.edges):!1}function wo(t,e){return!wi(t)||typeof t.type=="string"&&t.type.length>0?t:{...t,type:e}}function _m(t){return{...t,nodes:t.nodes.map(e=>wo(e,"rect")),edges:t.edges.map(e=>wo(e,"polyline"))}}const Wm={name:"dotFlowPad",priority:50,detect(t){if(t.inlineOnly||t.isRichHtml)return!1;const e=Zr(t.plainText);return e!==null&&yo(e.value)},transform(t){const e=Zr(t.plainText);if(!e||!yo(e.value))return"";const r=JSON.stringify(_m(e.value));return`<div data-type="dot-flow-pad" data-graph="${yi(r)}"></div>`}},Gm=50,Km={name:"jsonCode",priority:210,detect(t){return t.inlineOnly||t.isRichHtml||t.plainText.trim().length<Gm?!1:Zr(t.plainText)!==null},transform(t){const e=Zr(t.plainText);if(!e)return"";const r=JSON.stringify(e.value,null,2);return`<pre data-type="code-block" data-language="json"><code>${kn(r)}</code></pre>`}},ko=/^\s*\$\$([\s\S]+?)\$\$\s*$/,Ym=/^\s*\\begin\{([a-zA-Z*]+)\}([\s\S]+?)\\end\{\1\}\s*$/,jm={name:"latexBlock",priority:60,detect(t){if(t.inlineOnly||t.isRichHtml)return!1;const e=t.plainText;return ko.test(e)||Ym.test(e)},transform(t){const e=t.plainText,r=e.match(ko),n=r?r[1].trim():e.trim();return`<div data-type="block-math" data-latex="${yi(n)}"></div>`}},Xm=[/^#{1,6}[ \t]/m,/^[ \t]*[-*+][ \t]+\S/m,/^[ \t]*\d+\.[ \t]+\S/m,/^[ \t]*>[ \t]/m,/^[ \t]*-[ \t]\[[ xX]\][ \t]/m,/^```/m,/^[ \t]*[-*_]{3,}[ \t]*$/m],Jm=[/\*\*[^*\n]+\*\*/,/\[[^\]\n]+?\]\([^)\n]+?\)/,/(^|[^`])`[^`\n]+`(?!`)/],Qm={name:"markdown",priority:100,detect(t){if(t.isRichHtml)return!1;const e=t.plainText;if(!e||e.trim().length<2)return!1;for(const n of Xm)if(n.test(e))return!0;let r=0;for(const n of Jm)n.test(e)&&r++;return r>=2},transform(t){const e=ar(t.plainText);return t.inlineOnly?Zm(e):e}};function Zm(t){const e=document.createElement("template");return e.innerHTML=t,ki(e.content).join("<br>")}const ef=new Set(["P","H1","H2","H3","H4","H5","H6","UL","OL","LI","BLOCKQUOTE","PRE","HR","DIV","TABLE","THEAD","TBODY","TR","TD","TH"]);function ki(t){const e=[];for(const r of Array.from(t.childNodes)){if(r.nodeType===Node.TEXT_NODE){const o=r.textContent??"";o.trim().length>0&&e.push(o);continue}if(r.nodeType!==Node.ELEMENT_NODE)continue;const n=r;ef.has(n.tagName)?e.push(...ki(n)):e.push(n.outerHTML)}return e}const tf=["stateDiagram-v2","stateDiagram","sequenceDiagram","classDiagram","erDiagram","journey","gantt","pie","mindmap","timeline","gitGraph","quadrantChart","requirementDiagram","C4Context"],rf=["graph","flowchart"],nf=["TB","TD","BT","RL","LR"],af=new RegExp(`^\\s*(?:${tf.join("|")})(?:\\s+|\\s*$)`),of=new RegExp(`^\\s*(?:${rf.join("|")})\\s+(?:${nf.join("|")})\\b`),lf={name:"mermaid",priority:70,detect(t){if(t.inlineOnly||t.isRichHtml)return!1;const e=t.plainText;return af.test(e)||of.test(e)},transform(t){return`<pre data-type="mermaid-block">${kn(t.plainText.trim())}</pre>`}},sf={name:"richHtml",priority:200,detect:t=>t.isRichHtml&&t.html!==null,transform:t=>Kr(t.html??"")};function xo(t){const r=t.replace(/\r\n/g,`
317
312
  `).replace(/\n+$/,"").split(`
318
- `).filter(i=>i.length>0);if(t.length<2)return null;const n=t.map(i=>i.split(" ")),o=n[0].length;return o<2||n.some(i=>i.length!==o)||n.every(i=>i[0]==="")?null:{rows:n,cols:o}}const F4={name:"tsv",priority:150,detect(r){return r.inlineOnly||r.isRichHtml?!1:Ci(r.plainText)!==null},transform(r){const e=Ci(r.plainText);return e?`<table><tbody>${e.rows.map(n=>"<tr>"+n.map(o=>`<td>${Ao(o)}</td>`).join("")+"</tr>").join("")}</tbody></table>`:""}},$4=[C4,M4,H4,N4,F4,k4,V4,E4];function Ti(){return{align:{default:null,parseHTML:r=>Vr(r),renderHTML:r=>r.align?{align:r.align,style:`text-align:${r.align}`}:{}}}}function q4(r){return r==="comment"?{blockquote:!1,bold:!1,bulletList:!1,code:!1,codeBlock:!1,dropcursor:!1,gapcursor:!1,hardBreak:!1,heading:!1,horizontalRule:!1,italic:!1,link:!1,listItem:!1,listKeymap:!1,orderedList:!1,strike:!1,trailingNode:!1,underline:!1}:{codeBlock:!1,link:{autolink:!0,openOnClick:!1,isAllowedUri:(e,t)=>Hr(e)||t.defaultValidate(e),HTMLAttributes:{target:"_blank",rel:"noopener noreferrer",class:"pm-link"}}}}function Bo(r){const e=r.editable??r.profile!=="view",t=(l,i)=>nc(l,r.profile)?i():null,o=[t("starterKit",()=>_c.configure(q4(r.profile))),t("table",()=>Kr.Table.configure({resizable:e,View:Rh})),t("tableRow",()=>Kr.TableRow),t("tableHeader",()=>Kr.TableHeader.extend({content:"paragraph",addAttributes(){var l;return{...(l=this.parent)==null?void 0:l.call(this),...Ti()}}})),t("tableCell",()=>Kr.TableCell.extend({content:"paragraph",addAttributes(){var l;return{...(l=this.parent)==null?void 0:l.call(this),...Ti()}}})),r.profile==="comment"?null:r.headingCollapseExtension??null,t("taskList",()=>Gc.TaskList),t("taskItem",()=>Kc.TaskItem.configure({nested:!0})),t("codeBlock",()=>qf),t("mermaidBlock",()=>ec),t("dotFlowPadBlock",()=>Qu),t("embedView",()=>Zu),t("image",()=>qp),t("mathematics",()=>Ih.configure(e?{inlineOptions:{onClick:(l,i)=>{var s;return(s=r.onOpenMathPopover)==null?void 0:s.call(r,l,i,"inline")}},blockOptions:{onClick:(l,i)=>{var s;return(s=r.onOpenMathPopover)==null?void 0:s.call(r,l,i,"block")}}}:{inlineOptions:{},blockOptions:{}})),t("autoLinkTitle",()=>Sf),t("textStyle",()=>Xc.TextStyle),t("color",()=>Yc),t("highlight",()=>Jc.configure({multicolor:!0})),t("commentMark",()=>ju),t("commentBlock",()=>Ju),t("mention",()=>tc),t("smartPaste",()=>f4.configure({handlers:$4,fileUploadHandler:r.fileUploadHandler})),t("tableCellEnter",()=>p4),t("slashInsert",()=>e4.configure({onOpen:r.onOpenSlashInsert??(()=>{})}))].filter(l=>l!==null);return _e.useEditor({editable:e,extensions:o,content:r.initialContent,editorProps:{attributes:{spellcheck:"false"}},onUpdate({editor:l}){var i;e&&(r.isSettingContent.value||(i=r.onHtmlUpdate)==null||i.call(r,l.getHTML()))},onSelectionUpdate(){var l;e&&((l=r.onSelectionUpdate)==null||l.call(r))}})}function Ut(r){return Array.from(r.querySelectorAll(":scope > tr, :scope > thead > tr, :scope > tbody > tr, :scope > tfoot > tr"))}function Ir(r){return r?Array.from(r.children).filter(e=>e instanceof HTMLElement&&(e.tagName==="TD"||e.tagName==="TH")):[]}function Hn(r){return Ir(r)[0]??null}function U4(r){const e=a.reactive({top:0,left:0,width:0,height:0}),t=a.ref([]),n=a.ref([]),o=a.ref([]),l=a.ref(!1),i=a.ref(!1);function s(p){var w;const v=(w=r.value)==null?void 0:w.view;if(!v)return null;let b=null;return v.state.doc.descendants((k,T)=>{if(k.type.name!=="table")return!0;const E=v.nodeDOM(T);return E===p||E instanceof HTMLElement&&E.contains(p)?(b={node:k,pos:T},!1):!0}),b}function u(p){var k,T;const v=((k=s(p))==null?void 0:k.node)??null;if(!v){const E=Ut(p),M=Ir(E[0]);l.value=M.length>0&&M.every(B=>B.tagName==="TH"),i.value=E.length>0&&E.every(B=>{var D;return((D=Hn(B))==null?void 0:D.tagName)==="TH"});return}const b=[];v.forEach(E=>{E.type.name==="tableRow"&&b.push(E)});const w=[];(T=b[0])==null||T.forEach(E=>w.push(E)),l.value=w.length>0&&w.every(E=>E.type.name==="tableHeader"),i.value=b.length>0&&b.every(E=>{var M;return((M=E.firstChild)==null?void 0:M.type.name)==="tableHeader"})}function d(p){var T;const v=Ut(p),b=Ir(v[0]),w=s(p);if(!b.length){o.value=[];return}const k=[];if(w){const E=[];w.node.forEach(M=>{M.type.name==="tableRow"&&E.push(M)}),(T=E[0])==null||T.forEach(M=>k.push(M))}o.value=b.map((E,M)=>{var z;const B=E.getBoundingClientRect(),D=((z=k[M])==null?void 0:z.attrs.align)??null;return{pos:B.right-12,y:B.top+B.height/2,colIndex:M,align:D??Vr(E)}})}function m(p){const v=p.getBoundingClientRect();e.top=v.top,e.left=v.left,e.width=v.width,e.height=v.height,u(p),d(p);const b=Ut(p),w=b.map((E,M)=>({pos:E.getBoundingClientRect().top,index:M}));if(b.length&&w.push({pos:b[b.length-1].getBoundingClientRect().bottom,index:b.length}),t.value=w,!b[0]){n.value=[];return}const k=Ir(b[0]),T=k.map((E,M)=>({pos:E.getBoundingClientRect().left,index:M}));k.length&&T.push({pos:k[k.length-1].getBoundingClientRect().right,index:k.length}),n.value=T}function h(){t.value=[],n.value=[],o.value=[]}return{tableBounds:e,rowDots:t,colDots:n,colAlignDots:o,hasHeaderRow:l,hasHeaderCol:i,findPmTableState:s,refreshDots:m,refreshHeaderState:u,refreshColumnAlignDots:d,clearDots:h}}function W4(r,e,t,n,o,l){function i(H){if(!r.value||!H.isConnected)return;const A=r.value.view;try{const R=A.posAtDOM(H,0),K=A.state.doc.resolve(R+1);A.dispatch(A.state.tr.setSelection(ze.create(A.state.doc,K.pos)))}catch{}}function s(){if(!e.value)return;const H=Hn(Ut(e.value)[0]);H&&i(H)}function u(){if(!e.value)return;const H=Ut(e.value),A=H[H.length-1],R=Hn(A);R&&i(R)}function d(){if(!e.value)return;const H=Ir(Ut(e.value)[0]),A=H[H.length-1];A&&i(A)}function m(H){if(!e.value||!r.value)return;const A=Ut(e.value),R=H===0?A[0]:A[H-1]??A[A.length-1],K=Hn(R);K&&(i(K),H===0?r.value.commands.addRowBefore():r.value.commands.addRowAfter(),requestAnimationFrame(()=>{e.value=null}))}function h(H){if(!e.value||!r.value)return;const A=Ir(Ut(e.value)[0]),R=H===0?A[0]:A[H-1]??A[A.length-1];R&&(i(R),H===0?r.value.commands.addColumnBefore():r.value.commands.addColumnAfter(),requestAnimationFrame(()=>{e.value=null}))}function p(){if(!r.value)return;const{state:H,view:A}=r.value,R=H.selection.$anchor;let K=null,J=null;for(let le=R.depth;le>0;le--){const ee=R.node(le).type.name;K===null&&ee==="table"&&(K=R.before(le)),J===null&&(ee==="tableCell"||ee==="tableHeader")&&(J=R.before(le))}const te=K!==null?A.nodeDOM(K):null,Z=J!==null?A.nodeDOM(J):null;if(e.value=te instanceof HTMLElement?te:null,t.value=Z instanceof HTMLElement?Z:null,e.value&&o(e.value),t.value){const le=t.value.getBoundingClientRect();n.value={top:le.top,left:le.left,width:le.width,height:le.height}}}function v(H){!t.value||!r.value||(i(t.value),H(),requestAnimationFrame(p))}function b(H){!t.value||!r.value||(i(t.value),H(),requestAnimationFrame(l))}function w(){v(()=>r.value.commands.addRowBefore())}function k(){v(()=>r.value.commands.addRowAfter())}function T(){v(()=>r.value.commands.addColumnBefore())}function E(){v(()=>r.value.commands.addColumnAfter())}function M(){b(()=>r.value.chain().focus().deleteRow().run())}function B(){b(()=>r.value.chain().focus().deleteColumn().run())}const D={rowBefore:w,rowAfter:k,colBefore:T,colAfter:E,delRow:M,delCol:B};function z(){t.value&&i(t.value)}function W(){if(!r.value||!t.value)return null;try{const H=r.value.view.posAtDOM(t.value,0),A=r.value.state.doc.nodeAt(H);if(A&&!A.isText)return H;const R=H-1;return R>=0&&r.value.state.doc.nodeAt(R)?R:null}catch{return null}}return{cellOps:D,focusCell:i,focusFirstCell:s,focusLastRowCell:u,focusLastColCell:d,focusHoveredCell:z,insertRowAt:m,insertColAt:h,refreshCurrentCellFromSelection:p,getCurrentCellRootPMPos:W}}function ic(r,e){const t=a.ref(!1),n=a.ref(null),o=a.ref(null),l=a.ref(null);let i=null;const{tableBounds:s,rowDots:u,colDots:d,colAlignDots:m,hasHeaderRow:h,hasHeaderCol:p,findPmTableState:v,refreshDots:b,clearDots:w}=U4(e);function k(){i&&(clearTimeout(i),i=null)}function T(){k(),t.value=!1,n.value=null,w(),o.value=null,l.value=null}const{cellOps:E,focusCell:M,focusFirstCell:B,focusLastRowCell:D,focusLastColCell:z,focusHoveredCell:W,getCurrentCellRootPMPos:H,insertRowAt:A,insertColAt:R}=W4(e,o,l,n,b,T);function K(){i||(i=setTimeout(()=>{i=null,T()},200))}function J(){k()}function te(N){var oe;const O=N.target;if((oe=O.closest)!=null&&oe.call(O,".table-tools-overlay"))return;const $=O.closest("table");if(!$){n.value=null,l.value=null,K();return}k(),o.value!==$&&(o.value=$,b($),t.value=!0);const X=O.closest("td, th");if(X&&X!==l.value){l.value=X;const ve=X.getBoundingClientRect();n.value={top:ve.top,left:ve.left,width:ve.width,height:ve.height}}}function Z(N){A(N),t.value=!1}function le(N){R(N),t.value=!1}function ee(){!e.value||!o.value||(D(),e.value.commands.addRowAfter(),requestAnimationFrame(()=>{o.value&&b(o.value)}))}function we(){!e.value||!o.value||(z(),e.value.commands.addColumnAfter(),requestAnimationFrame(()=>{o.value&&b(o.value)}))}function pe(){!o.value||!e.value||(B(),e.value.chain().focus().toggleHeaderRow().run())}function se(){!o.value||!e.value||(B(),e.value.chain().focus().toggleHeaderColumn().run())}function I(N,O){if(!e.value||!o.value)return;const{view:$}=e.value;try{const X=v(o.value);if(!X)return;let oe=null,ve=X.node,Be=X.pos+1,$e=null,ot=e.value.state.tr;if(typeof O=="number")$e=O,oe=gl.TableMap.get(X.node);else{l.value&&M(l.value);const Xe=e.value.state;ot=Xe.tr;const ue=gl.selectedRect(Xe);oe=ue.map,ve=ue.table,Be=ue.tableStart,$e=ue.left}if($e===null||!oe||$e<0||$e>=oe.width)return;for(let Xe=0;Xe<oe.height;Xe++){const ue=oe.map[Xe*oe.width+$e],me=ve.nodeAt(ue);me&&(me.attrs.align??null)!==N&&ot.setNodeMarkup(Be+ue,null,{...me.attrs,align:N})}ot.steps.length&&$.dispatch(ot),requestAnimationFrame(()=>{o.value&&b(o.value)})}catch{}}function P(){B()}function V(){!e.value||!o.value||(B(),e.value.chain().focus().deleteTable().run(),T())}function q(){if(!e.value||!o.value)return;const N=v(o.value);N&&vl(e.value,N.pos,"copyTable")}function ae(){if(!e.value||!o.value)return;const N=v(o.value);N&&(vl(e.value,N.pos,"cutTable"),T())}function ge(){var N;return o.value?((N=v(o.value))==null?void 0:N.pos)??null:null}function ne(){if(!e.value)return;const{state:N,view:O}=e.value,{selection:$}=N,X=$.$anchor;for(let oe=X.depth;oe>0;oe--)if(X.node(oe).type.name==="table"){const ve=X.before(oe);try{const Be=O.nodeDOM(ve);Be instanceof HTMLElement&&(k(),o.value=Be,b(Be),t.value=!0)}catch{}return}T()}return{tableVisible:t,tableBounds:s,rowDots:u,colDots:d,colAlignDots:m,hoveredCellBounds:n,hasHeaderRow:h,hasHeaderCol:p,onTableMouseMove:te,onTableSelectionUpdate:ne,keepAlive:J,scheduleHide:K,insertRowAt:Z,insertColAt:le,cellOps:E,tableAddRowAfter:ee,tableAddColumnAfter:we,tableToggleHeaderRow:pe,tableToggleHeaderColumn:se,setColumnAlign:I,tableDeleteTable:V,tableCopyTable:q,tableCutTable:ae,getCurrentTableRootPMPos:ge,tableFocusFirstCell:P,focusHoveredCell:W,getCurrentCellRootPMPos:H}}function _4(r,e,t){let n=null;function o(i){const s=i.target.closest("a.pm-link[href]");s&&e(s.getAttribute("href")??"",s.textContent??"",s.getBoundingClientRect())}function l(i){var u,d;const s=i;(u=s.target)!=null&&u.closest("a.pm-link[href]")&&((d=s.relatedTarget)!=null&&d.closest("a.pm-link[href]")||t())}a.onMounted(()=>{requestAnimationFrame(()=>{var i;n=((i=r.value)==null?void 0:i.view.dom)??null,n&&(n.addEventListener("mouseover",o),n.addEventListener("mouseout",l))})}),a.onBeforeUnmount(()=>{n==null||n.removeEventListener("mouseover",o),n==null||n.removeEventListener("mouseout",l),n=null})}function G4(r,e,t){let n=null,o=!1,l=0;function i(){const v=document.activeElement;return v instanceof Element&&v.closest(".pagely-embed-block")!==null}function s(){if(i())return null;const v=window.getSelection();if(!v||v.isCollapsed||v.rangeCount===0||!(n!=null&&n.contains(v.anchorNode)))return null;const b=v.getRangeAt(0).getBoundingClientRect();return b.width===0&&b.height===0?null:b}function u(){o=!0,t()}function d(){l=Date.now()+600,t()}function m(){o=!1,requestAnimationFrame(()=>{if(Date.now()<l||i()){t();return}const v=s();v&&e(v)})}function h(){if(o)return;if(Date.now()<l||i()){t();return}const v=s();v?e(v):t()}function p(v){const b=v.detail;if(!(!b||b.editor!==r.value)){if(Date.now()<l||i()){t();return}b.rect?e(b.rect):t()}}a.onMounted(()=>{requestAnimationFrame(()=>{var v,b;n=((v=r.value)==null?void 0:v.view.dom)??null,n&&(n.addEventListener("mousedown",u),document.addEventListener("mouseup",m),window.addEventListener("pagely:hide-selection-toolbar",d),window.addEventListener("pagely:code-selection-toolbar",p),(b=r.value)==null||b.on("selectionUpdate",h))})}),a.onBeforeUnmount(()=>{var v;n==null||n.removeEventListener("mousedown",u),document.removeEventListener("mouseup",m),window.removeEventListener("pagely:hide-selection-toolbar",d),window.removeEventListener("pagely:code-selection-toolbar",p),(v=r.value)==null||v.off("selectionUpdate",h),n=null})}const K4=["onKeydown"],Y4=["onKeydown"],J4={key:0,class:"math-popover-error"},X4={class:"math-popover-footer"},j4={class:"math-popover-help",href:"https://katex.org/docs/supported.html",target:"_blank",rel:"noopener noreferrer"},Q4=a.defineComponent({__name:"MathPopover",props:{visible:{type:Boolean},anchorRect:{},initialLatex:{}},emits:["confirm","close"],setup(r,{emit:e}){const t=r,n=e,o=a.ref(null),l=a.ref(""),i=a.ref("");let s=0;function u(){s&&window.cancelAnimationFrame(s),a.nextTick(()=>{s=window.requestAnimationFrame(()=>{var p,v;s=0,(p=o.value)==null||p.focus({preventScroll:!0}),(v=o.value)==null||v.select()})})}a.watch(()=>t.visible,p=>{p&&(l.value=t.initialLatex,i.value="",u())},{flush:"post"}),a.onBeforeUnmount(()=>{s&&window.cancelAnimationFrame(s)});const d=a.computed(()=>{const p=t.anchorRect;if(!p)return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};const v=p.bottom+8,b=p.left;return{position:"fixed",top:`${v}px`,left:`${b}px`}});function m(){const p=l.value.trim();if(!p){h();return}try{Yu.renderToString(p,{throwOnError:!0})}catch{i.value="LaTeX 语法有误";return}n("confirm",l.value)}function h(){n("close")}return(p,v)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.visible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"math-popover-backdrop",onMousedown:a.withModifiers(h,["self"])},[a.createElementVNode("div",{class:"math-popover",style:a.normalizeStyle(d.value),onKeydown:a.withKeys(a.withModifiers(m,["prevent","stop"]),["esc"])},[v[3]||(v[3]=a.createElementVNode("div",{class:"math-popover-title"},"添加 LaTeX 公式",-1)),a.withDirectives(a.createElementVNode("input",{ref_key:"inputRef",ref:o,"onUpdate:modelValue":v[0]||(v[0]=b=>l.value=b),autofocus:"",class:"math-popover-input",placeholder:"请输入公式",onKeydown:[a.withKeys(a.withModifiers(m,["prevent","stop"]),["esc"]),a.withKeys(a.withModifiers(m,["prevent","stop"]),["enter"])]},null,40,Y4),[[a.vModelText,l.value]]),i.value?(a.openBlock(),a.createElementBlock("div",J4,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0),a.createElementVNode("div",X4,[v[2]||(v[2]=a.createElementVNode("span",{class:"math-popover-hint"},"Enter / ESC 保存",-1)),a.createElementVNode("a",j4,[a.createVNode(a.unref(L.HelpCircle),{size:13,"stroke-width":1.8}),v[1]||(v[1]=a.createElementVNode("span",null,"查看帮助文档",-1))])])],44,K4)],32)):a.createCommentVNode("",!0)]))}}),Z4=gt(Q4,[["__scopeId","data-v-8b9f6fbc"]]),Zr=new Ss("headingCollapse");function fl(r,e){if(e.size===0)return Le.empty;const t=[];let n=null;return r.forEach((o,l)=>{n!==null&&(o.type.name==="heading"&&o.attrs.level<=n?n=null:t.push(vt.node(l,l+o.nodeSize,{class:"heading-collapsed-content"}))),o.type.name==="heading"&&e.has(l)&&(n=o.attrs.level)}),Le.create(r,t)}function e2(){return new Ts({key:Zr,state:{init(r,e){const t=new Set;return{collapsed:t,decorations:fl(e.doc,t)}},apply(r,e,t,n){const o=r.getMeta(Zr);if(o){const l=new Set(e.collapsed);return l.has(o.toggle)?l.delete(o.toggle):l.add(o.toggle),{collapsed:l,decorations:fl(n.doc,l)}}if(r.docChanged){const l=new Set;return e.collapsed.forEach(i=>l.add(r.mapping.map(i))),{collapsed:l,decorations:fl(n.doc,l)}}return e}},props:{decorations(r){var e;return((e=Zr.getState(r))==null?void 0:e.decorations)??Le.empty}}})}const t2=new Set(["H1","H2","H3","H4","H5","H6"]);function No(){const r=e2(),e=Me.Extension.create({name:"headingCollapse",addProseMirrorPlugins(){return[r]}}),t=a.ref(0);function n(o,l,i){const s=()=>{t.value++};let u;const d=()=>{u&&(u.off("transaction",s),u=void 0)},m=()=>{o.value&&o.value!==u&&(d(),u=o.value,u.on("transaction",s))};m(),a.onBeforeUnmount(d);const h=a.computed(()=>(t.value,t2.has(l()))),p=a.computed(()=>{t.value,m();const b=i(),w=o.value&&Zr.getState(o.value.state);return b!==null&&!!(w!=null&&w.collapsed.has(b))});function v(){const b=i();if(b===null||!o.value)return;const w={toggle:b};o.value.view.dispatch(o.value.view.state.tr.setMeta(Zr,w))}return{isHeadingBlock:h,isCurrentCollapsed:p,onCollapseClick:v}}return{extension:e,bind:n}}const r2=[{color:"#1f2329",label:"默认黑"},{color:"#8f959e",label:"灰色"},{color:"#d83931",label:"红色"},{color:"#de7802",label:"橙色"},{color:"#dc9b04",label:"黄色"},{color:"#2ea121",label:"绿色"},{color:"#245bdb",label:"蓝色"},{color:"#6425d0",label:"紫色"}],n2=[{color:null,label:"无背景"},{color:"rgb(242,243,245)",label:"浅灰"},{color:"rgb(251,191,188)",label:"浅红"},{color:"rgba(254,212,164,0.8)",label:"浅橙"},{color:"rgba(255,246,122,0.8)",label:"浅黄"},{color:"rgba(183,237,177,0.8)",label:"浅绿"},{color:"rgba(186,206,253,0.7)",label:"浅蓝"},{color:"rgba(205,178,250,0.7)",label:"浅紫"},{color:"rgba(222,224,227,0.8)",label:"中灰"},{color:"rgb(187,191,196)",label:"深灰"},{color:"rgb(247,105,100)",label:"深红"},{color:"rgb(255,165,61)",label:"深橙"},{color:"rgb(255,233,40)",label:"深黄"},{color:"rgb(98,210,86)",label:"深绿"},{color:"rgba(78,131,253,0.55)",label:"深蓝"},{color:"rgba(150,88,243,0.6)",label:"深紫"}],ml=[{id:"paragraph",label:"正文",icon:L.Type,isActive:r=>!!(r!=null&&r.isActive("paragraph")),apply:r=>r.chain().focus().setParagraph().run()},{id:"h1",label:"标题 1",icon:L.Heading1,isActive:r=>!!(r!=null&&r.isActive("heading",{level:1})),apply:r=>r.chain().focus().setHeading({level:1}).run()},{id:"h2",label:"标题 2",icon:L.Heading2,isActive:r=>!!(r!=null&&r.isActive("heading",{level:2})),apply:r=>r.chain().focus().setHeading({level:2}).run()},{id:"h3",label:"标题 3",icon:L.Heading3,isActive:r=>!!(r!=null&&r.isActive("heading",{level:3})),apply:r=>r.chain().focus().setHeading({level:3}).run()}],o2={class:"pagely-color-panel"},l2={class:"pagely-color-group"},a2=["title","onClick"],i2={class:"pagely-color-group pagely-color-group--bg"},s2=["title","onClick"],u2=a.defineComponent({__name:"ColorPanel",props:{currentFontColor:{},currentBgColor:{}},emits:["applyFontColor","applyBgColor","reset"],setup(r){return(e,t)=>(a.openBlock(),a.createElementBlock("div",o2,[t[1]||(t[1]=a.createElementVNode("p",{class:"pagely-color-group-title"},"字体颜色",-1)),a.createElementVNode("div",l2,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(r2),n=>(a.openBlock(),a.createElementBlock("button",{key:n.label,class:a.normalizeClass(["pagely-color-btn pagely-color-btn--text",{selected:r.currentFontColor===n.color}]),title:n.label,type:"button",onClick:o=>e.$emit("applyFontColor",n.color)},[a.createVNode(a.unref(L.Baseline),{size:18,"stroke-width":1.5,style:a.normalizeStyle({color:n.color??"#1f2329"})},null,8,["style"])],10,a2))),128))]),t[2]||(t[2]=a.createElementVNode("p",{class:"pagely-color-group-title"},"背景颜色",-1)),a.createElementVNode("div",i2,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(n2),n=>(a.openBlock(),a.createElementBlock("button",{key:n.label,class:a.normalizeClass(["pagely-color-btn pagely-color-btn--bg",{selected:r.currentBgColor===n.color,"is-none":n.color===null}]),title:n.label,type:"button",style:a.normalizeStyle(n.color?{backgroundColor:n.color}:{}),onClick:o=>e.$emit("applyBgColor",n.color)},null,14,s2))),128))]),a.createElementVNode("button",{type:"button",class:"pagely-color-reset",onClick:t[0]||(t[0]=n=>e.$emit("reset"))},"恢复默认")]))}}),sc=gt(u2,[["__scopeId","data-v-bd597618"]]),c2=["data-placement"],d2={class:"pagely-menu-scroll"},f2=["disabled"],m2={class:"pagely-item-icon"},h2={key:1,class:"pagely-menu-divider"},p2={key:0,class:"pagely-menu-tiles"},g2=["title","onClick"],v2={key:0,class:"pagely-menu-section-label"},b2=["disabled","onClick","onMouseenter"],y2={class:"pagely-item-icon"},w2={class:"pagely-item-label"},k2={key:1,class:"pagely-submenu-arrow"},x2={key:2,class:"pagely-menu-divider"},C2=["disabled","onClick"],T2={class:"pagely-item-icon"},E2={class:"pagely-item-label"},S2={class:"pagely-preview-body"},M2={class:"pagely-preview-title"},A2={class:"pagely-preview-desc"},Ei="#1f2329",B2=4,N2=240,L2=a.defineComponent({__name:"BlockMenu",props:{visible:{type:Boolean},menuTop:{},menuLeft:{},placement:{},editor:{},blockInfo:{},blockTargetPos:{},enableComment:{type:Boolean}},emits:["close","menu-enter","menu-leave","convert","comment"],setup(r,{emit:e}){const t=r,n=e;function o(){const N=t.editor,O=t.blockTargetPos;if(!N||O===null)return null;try{const $=N.state.doc.resolve(O+1);return{from:$.start(),to:$.end()}}catch{return null}}function l(N){const O=t.editor,$=o();if(!O||!$)return null;let X=null;return O.state.doc.nodesBetween($.from,$.to,oe=>{if(X)return!1;const ve=oe.marks.find(Be=>Be.type.name===N);return ve&&(X=ve.attrs),!0}),X}const i=a.computed(()=>{const N=l("textStyle");return(N==null?void 0:N.color)??Ei}),s=a.computed(()=>{const N=l("highlight");return(N==null?void 0:N.color)??null});function u(N){const O=t.editor,$=o();if(!O||!$)return;const X=O.chain().focus().setTextSelection($);N===null||N===Ei?X.unsetColor().run():X.setColor(N).run()}function d(N){const O=t.editor,$=o();if(!O||!$)return;const X=O.chain().focus().setTextSelection($);N===null?X.unsetHighlight().run():X.setHighlight({color:N}).run()}function m(){const N=t.editor,O=o();!N||!O||N.chain().focus().setTextSelection(O).unsetColor().unsetHighlight().run()}const h=a.ref(null),p=a.ref(!1),v=a.ref(0);let b=null;a.onBeforeUnmount(()=>{b&&clearTimeout(b)}),a.watch(()=>t.visible,N=>{N&&(b&&(clearTimeout(b),b=null),h.value=null,p.value=!1)});const w=Jl({visible:()=>t.visible,rootSelector:".pagely-block-menu",estimatedHeight:()=>{var N;return((N=M.value)==null?void 0:N.panel)==="color"?N2:Math.max(44,v.value*pd+12)},fallbackTop:()=>t.menuTop,fallbackLeft:()=>t.menuLeft+Gt}),k=w.rootId,T=a.computed(()=>{var N;return((N=M.value)==null?void 0:N.panel)==="color"?"color":null}),E=a.computed(()=>{if(!h.value||B.value.length>0)return null;for(const N of le.value)for(const O of N.items)if(O.id===h.value&&O.description)return O;return null}),M=a.computed(()=>{if(!k.value)return null;for(const N of le.value){const O=N.items.find($=>$.id===k.value);if(O)return O}return null}),B=a.computed(()=>{var N,O;return((O=(N=M.value)==null?void 0:N.children)==null?void 0:O.map($=>Kl[$]).filter(Boolean))??[]});function D(N,O){var $;b&&(clearTimeout(b),b=null),w.clearCloseTimer(),h.value=N.id,we(N)?(v.value=(($=N.children)==null?void 0:$.length)??0,O&&w.open(N.id,O)):w.hovered.value||w.close()}function z(){b=setTimeout(()=>{p.value||(h.value=null)},un),w.scheduleClose()}function W(N){var O;return!!((O=N==null?void 0:N.closest)!=null&&O.call(N,".pagely-block-menu, .pagely-block-submenu, .pagely-block-color-side, .pagely-hover-preview"))}function H(){h.value=null,p.value=!1,w.close()}function A(N){const O=N.relatedTarget;W(O)||(H(),n("menu-leave"))}function R(N){w.onPanelMouseLeave();const O=N.relatedTarget;W(O)||(H(),n("menu-leave"))}function K(N){p.value=!1;const O=N.relatedTarget;W(O)||(H(),n("menu-leave"))}const J=a.computed(()=>({position:"fixed",top:`${t.menuTop}px`,left:`${t.menuLeft}px`,zIndex:"300","--pagely-menu-panel-width":`${Gt}px`,"--menu-enter-translate":Di(t.placement)})),te=a.computed(()=>({position:"fixed",top:`${t.menuTop}px`,left:`${t.menuLeft+Gt+oo+B2}px`,zIndex:"301"})),Z=w.style,le=a.computed(()=>(ur[t.blockInfo.tag]??ur.P).sections);function ee(){n("close")}function we(N){var O;return!!((O=N.children)!=null&&O.length)||!!N.panel}function pe(N){return we(N)?!1:N.action==="indent"?N.indentDir==="inc"?!Qi(t.editor):!Zi(t.editor):!1}function se(){const N=t.editor,O=t.blockTargetPos;if(!N||O===null)return null;const $=N.state.doc.nodeAt(O);if(($==null?void 0:$.type.name)==="table")return $;try{const X=N.state.doc.resolve(O+1);for(let oe=X.depth;oe>=0;oe--){const ve=X.node(oe);if(ve.type.name==="table")return ve}}catch{return null}return null}function I(N){const O=[];return N.forEach($=>{$.type.name==="tableRow"&&O.push($)}),O}function P(N){const O=I(N)[0];if(!O)return!1;const $=[];return O.forEach(X=>$.push(X)),$.length>0&&$.every(X=>X.type.name==="tableHeader")}function V(N){const O=I(N);return O.length>0&&O.every($=>{var X;return((X=$.firstChild)==null?void 0:X.type.name)==="tableHeader"})}function q(N){const O=se();return O?N.id==="TOGGLE_TABLE_HEADER_ROW"?P(O):N.id==="TOGGLE_TABLE_HEADER_COL"?V(O):!1:!1}function ae(N){we(N)||pe(N)||(n("convert",N.id),n("close"))}function ge(N){n("convert",N),ee()}function ne(){t.blockTargetPos!==null&&(n("comment"),n("close"))}return(N,O)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.visible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-block-menu-wrapper",onClick:O[8]||(O[8]=a.withModifiers(()=>{},["stop"])),onMousedown:O[9]||(O[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",{class:"pagely-block-menu",style:a.normalizeStyle(J.value),"data-placement":r.placement,onMouseenter:O[0]||(O[0]=$=>N.$emit("menu-enter")),onMouseleave:O[1]||(O[1]=$=>A($))},[a.createElementVNode("div",d2,[t.enableComment?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass(["pagely-menu-item",{"pagely-disabled":t.blockTargetPos===null}]),disabled:t.blockTargetPos===null,onClick:ne},[a.createElementVNode("span",m2,[a.createVNode(a.unref(L.MessageSquare),{size:16,"stroke-width":1.5})]),O[10]||(O[10]=a.createElementVNode("span",{class:"pagely-item-label"},"评论",-1))],10,f2)):a.createCommentVNode("",!0),t.enableComment&&le.value.length>0?(a.openBlock(),a.createElementBlock("div",h2)):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(le.value,($,X)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:X},[$.style==="tiles"?(a.openBlock(),a.createElementBlock("div",p2,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList($.items,oe=>(a.openBlock(),a.createElementBlock("button",{key:oe.id,class:a.normalizeClass(["pagely-menu-tile",{"pagely-current":r.blockInfo.currentTypeIds.includes(oe.id)}]),title:oe.label,onClick:ve=>ge(oe.id)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(oe.icon),{size:18,"stroke-width":1.5}))],10,g2))),128))])):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[$.label?(a.openBlock(),a.createElementBlock("div",v2,a.toDisplayString($.label),1)):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList($.items,oe=>(a.openBlock(),a.createElementBlock("button",{key:oe.id,class:a.normalizeClass(["pagely-menu-item",{"pagely-danger":oe.danger,"pagely-disabled":pe(oe),"pagely-active":q(oe),"pagely-has-submenu":we(oe),"pagely-submenu-open":a.unref(k)===oe.id,"pagely-item-hover-preview":h.value===oe.id}]),disabled:pe(oe),onClick:ve=>ae(oe),onMouseenter:ve=>D(oe,ve),onMouseleave:z},[a.createElementVNode("span",y2,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(oe.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",w2,a.toDisplayString(oe.label),1),oe.toggle?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["pagely-item-toggle",{"pagely-item-toggle-on":q(oe)}]),"aria-hidden":"true"},[...O[11]||(O[11]=[a.createElementVNode("span",{class:"pagely-item-toggle-thumb"},null,-1)])],2)):a.createCommentVNode("",!0),we(oe)?(a.openBlock(),a.createElementBlock("span",k2,"›")):a.createCommentVNode("",!0)],42,b2))),128))],64)),X<le.value.length-1?(a.openBlock(),a.createElementBlock("div",x2)):a.createCommentVNode("",!0)],64))),128))])],44,c2),B.value.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-block-submenu",style:a.normalizeStyle(a.unref(Z)),"data-placement":"right",onMouseenter:O[2]||(O[2]=(...$)=>a.unref(w).onPanelMouseEnter&&a.unref(w).onPanelMouseEnter(...$)),onMouseleave:O[3]||(O[3]=$=>R($))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(B.value,$=>(a.openBlock(),a.createElementBlock("button",{key:$.id,class:a.normalizeClass(["pagely-menu-item",{"pagely-danger":$.danger,"pagely-disabled":pe($),"pagely-active":q($)}]),disabled:pe($),onClick:X=>ae($)},[a.createElementVNode("span",T2,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent($.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",E2,a.toDisplayString($.label),1),$.toggle?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["pagely-item-toggle",{"pagely-item-toggle-on":q($)}]),"aria-hidden":"true"},[...O[12]||(O[12]=[a.createElementVNode("span",{class:"pagely-item-toggle-thumb"},null,-1)])],2)):a.createCommentVNode("",!0)],10,C2))),128))],36)):a.createCommentVNode("",!0),T.value==="color"?(a.openBlock(),a.createElementBlock("div",{key:1,class:"pagely-block-color-side",style:a.normalizeStyle(a.unref(Z)),"data-placement":"right",onMouseenter:O[4]||(O[4]=(...$)=>a.unref(w).onPanelMouseEnter&&a.unref(w).onPanelMouseEnter(...$)),onMouseleave:O[5]||(O[5]=$=>R($))},[a.createVNode(sc,{"current-font-color":i.value,"current-bg-color":s.value,onApplyFontColor:u,onApplyBgColor:d,onReset:m},null,8,["current-font-color","current-bg-color"])],36)):a.createCommentVNode("",!0),E.value?(a.openBlock(),a.createElementBlock("div",{key:2,class:"pagely-hover-preview",style:a.normalizeStyle(te.value),"data-placement":"right",onMouseenter:O[6]||(O[6]=$=>p.value=!0),onMouseleave:O[7]||(O[7]=$=>K($))},[O[13]||(O[13]=a.createElementVNode("span",{class:"pagely-preview-thumb"},[a.createElementVNode("svg",{viewBox:"0 0 212 100",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a.createElementVNode("line",{x1:"48",y1:"26",x2:"86",y2:"26",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"126",y1:"26",x2:"164",y2:"26",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"106",y1:"42",x2:"106",y2:"58",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"106",y1:"74",x2:"106",y2:"86",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"66",y1:"82",x2:"106",y2:"82",stroke:"#c4c7cc","stroke-width":"1.2","stroke-dasharray":"3 2"}),a.createElementVNode("rect",{x:"10",y:"14",width:"38",height:"24",rx:"4",fill:"#e8f5e9",stroke:"#66bb6a","stroke-width":"1.2"}),a.createElementVNode("text",{x:"29",y:"30","text-anchor":"middle",fill:"#2e7d32","font-size":"8","font-weight":"500"},"Data"),a.createElementVNode("circle",{cx:"106",cy:"26",r:"16",fill:"#ede7f6",stroke:"#9575cd","stroke-width":"1.2"}),a.createElementVNode("text",{x:"106",y:"29","text-anchor":"middle",fill:"#5e35b1","font-size":"7","font-weight":"500"},"Open"),a.createElementVNode("polygon",{points:"164,10 180,26 164,42 148,26",fill:"#fff8e1",stroke:"#ffb300","stroke-width":"1.2"}),a.createElementVNode("text",{x:"164",y:"29","text-anchor":"middle",fill:"#e65100","font-size":"7","font-weight":"500"},"?"),a.createElementVNode("rect",{x:"10",y:"58",width:"38",height:"24",rx:"4",fill:"#e3f2fd",stroke:"#42a5f5","stroke-width":"1.2"}),a.createElementVNode("text",{x:"29",y:"74","text-anchor":"middle",fill:"#1565c0","font-size":"8","font-weight":"500"},"Yes"),a.createElementVNode("circle",{cx:"106",cy:"70",r:"16",fill:"#fce4ec",stroke:"#ef5350","stroke-width":"1.2"}),a.createElementVNode("text",{x:"106",y:"73","text-anchor":"middle",fill:"#c62828","font-size":"7","font-weight":"500"},"No"),a.createElementVNode("rect",{x:"148",y:"58",width:"44",height:"24",rx:"4",fill:"#fff3e0",stroke:"#ff9800","stroke-width":"1.2"}),a.createElementVNode("text",{x:"170",y:"74","text-anchor":"middle",fill:"#e65100","font-size":"8","font-weight":"500"},"Action")])],-1)),a.createElementVNode("span",S2,[a.createElementVNode("span",M2,a.toDisplayString(E.value.label),1),a.createElementVNode("span",A2,a.toDisplayString(E.value.description),1)])],36)):a.createCommentVNode("",!0)],32)):a.createCommentVNode("",!0)]))}}),uc=gt(L2,[["__scopeId","data-v-057a6f90"]]),I2="image/*,.png,.jpg,.jpeg,.gif,.webp,.bmp,.svg,.avif",z2=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i;function D2(r){return r.type.startsWith("image/")||z2.test(r.name)}function O2(r){return new Promise(e=>{const t=new FileReader;t.onload=()=>e(typeof t.result=="string"?t.result:null),t.onerror=()=>e(null),t.readAsDataURL(r)})}function R2(r){function e(n){var o;(o=r.onBeforeSelect)==null||o.call(r),n.currentTarget.value=""}async function t(n){var s;const o=n.target,l=((s=o.files)==null?void 0:s[0])??null;if(o.value="",!l||!D2(l))return;const i=await O2(l);i&&r.onInsert({src:i,alt:l.name})}return{imageAccept:I2,onImageFileClick:e,onImageFileChange:t}}function P2(r){function e(n){var o;(o=r.onBeforeSelect)==null||o.call(r),n.currentTarget.value=""}async function t(n){var u;const o=n.target,l=((u=o.files)==null?void 0:u[0])??null;if(o.value="",!l)return;const s=await(r.uploadHandler??Sa)(l);s!=null&&s.href&&r.onInsert({href:s.href,label:s.label||l.name})}return{fileAccept:a4,onDocFileClick:e,onDocFileChange:t}}const H2={class:"pagely-link-dialog-head"},V2={class:"pagely-link-dialog-actions"},F2=["disabled"],$2=a.defineComponent({__name:"InsertLinkDialog",props:{open:{type:Boolean}},emits:["close","confirm"],setup(r,{emit:e}){const t=r,n=e,o=Math.random().toString(36).slice(2,9),l=`pagely-insert-${o}-link-text`,i=`pagely-insert-${o}-link-href`,s=a.ref(""),u=a.ref(""),d=a.ref(null),m=a.computed(()=>u.value.trim().length>0);a.watch(()=>t.open,v=>{v&&(s.value="",u.value="",a.nextTick(()=>{var b;return(b=d.value)==null?void 0:b.focus({preventScroll:!0})}))});function h(v){const b=v.trim();return b?/^(https?:|mailto:|tel:|#|\/)/i.test(b)?b:`https://${b}`:""}function p(){const v=h(u.value);v&&n("confirm",{text:s.value.trim()||v,href:v})}return(v,b)=>r.open?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-insert-link-dialog-backdrop",onMousedown:b[6]||(b[6]=a.withModifiers(w=>n("close"),["self"]))},[a.createElementVNode("form",{class:"pagely-insert-link-dialog",role:"dialog","aria-modal":"true","aria-label":"插入链接",onSubmit:a.withModifiers(p,["prevent"])},[a.createElementVNode("div",H2,[b[7]||(b[7]=a.createElementVNode("span",null,"插入链接",-1)),a.createElementVNode("button",{type:"button",class:"pagely-link-dialog-icon-btn","aria-label":"关闭",onClick:b[0]||(b[0]=w=>n("close"))},[a.createVNode(a.unref(L.X),{size:16,"stroke-width":1.8})])]),a.createElementVNode("label",{class:"pagely-link-field",for:l},[b[8]||(b[8]=a.createElementVNode("span",null,"文本",-1)),a.withDirectives(a.createElementVNode("input",{id:l,ref_key:"textInputEl",ref:d,"onUpdate:modelValue":b[1]||(b[1]=w=>s.value=w),name:l,type:"text",autocomplete:"off",onKeydown:b[2]||(b[2]=a.withKeys(a.withModifiers(w=>n("close"),["prevent"]),["esc"]))},null,544),[[a.vModelText,s.value]])]),a.createElementVNode("label",{class:"pagely-link-field",for:i},[b[9]||(b[9]=a.createElementVNode("span",null,"链接",-1)),a.withDirectives(a.createElementVNode("input",{id:i,"onUpdate:modelValue":b[3]||(b[3]=w=>u.value=w),name:i,type:"text",autocomplete:"off",onKeydown:b[4]||(b[4]=a.withKeys(a.withModifiers(w=>n("close"),["prevent"]),["esc"]))},null,544),[[a.vModelText,u.value]])]),a.createElementVNode("div",V2,[a.createElementVNode("button",{type:"button",class:"pagely-link-secondary",onClick:b[5]||(b[5]=w=>n("close"))},"取消"),a.createElementVNode("button",{type:"submit",class:"pagely-link-primary",disabled:!m.value},"插入",8,F2)])],32)],32)):a.createCommentVNode("",!0)}}),q2=gt($2,[["__scopeId","data-v-0af66664"]]),U2={class:"pagely-table-picker"},W2={class:"pagely-picker-head"},_2={key:0},G2=["aria-label","onMouseenter","onClick"],K2=a.defineComponent({inheritAttrs:!0,__name:"TableSizePicker",props:{maxRows:{default:8},maxCols:{default:10}},emits:["pick"],setup(r,{emit:e}){const t=r,n=e,o=a.ref(0),l=a.ref(0),i=a.computed(()=>{const m=[];for(let h=1;h<=t.maxRows;h+=1)for(let p=1;p<=t.maxCols;p+=1)m.push({key:`${h}-${p}`,row:h,col:p});return m});function s(m,h){o.value=m,l.value=h}function u(){o.value=0,l.value=0}function d(m,h){n("pick",{rows:m,cols:h})}return(m,h)=>(a.openBlock(),a.createElementBlock("div",U2,[a.createElementVNode("div",W2,[h[0]||(h[0]=a.createElementVNode("span",null,"插入支持富文本的表格",-1)),o.value>0?(a.openBlock(),a.createElementBlock("span",_2,a.toDisplayString(o.value)+" x "+a.toDisplayString(l.value),1)):a.createCommentVNode("",!0)]),a.createElementVNode("div",{class:"pagely-picker-grid",onMouseleave:u},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,p=>(a.openBlock(),a.createElementBlock("button",{key:p.key,class:a.normalizeClass(["pagely-picker-cell",{"pagely-active":p.row<=o.value&&p.col<=l.value}]),type:"button","aria-label":`插入 ${p.row} 行 ${p.col} 列表格`,onMouseenter:v=>s(p.row,p.col),onClick:v=>d(p.row,p.col)},null,42,G2))),128))],32)]))}}),cc=gt(K2,[["__scopeId","data-v-5f091973"]]),Y2=["data-placement"],J2={class:"pagely-menu-scroll"},X2={key:0,class:"pagely-menu-section-label"},j2={key:1,class:"pagely-menu-tiles"},Q2=["title","onClick"],Z2=["onMouseenter"],e5={class:"pagely-item-icon"},t5={class:"pagely-item-label"},r5=["accept"],n5=["onMouseenter"],o5={class:"pagely-item-icon"},l5={class:"pagely-item-label"},a5=["accept"],i5=["onClick","onMouseenter"],s5={class:"pagely-item-icon"},u5={class:"pagely-item-label"},c5={key:0,class:"pagely-submenu-arrow"},d5={key:3,class:"pagely-menu-divider"},f5=336,m5=a.defineComponent({__name:"InsertMenu",props:{visible:{type:Boolean},menuTop:{},menuLeft:{},placement:{},editor:{},sections:{},fileUploadHandler:{type:Function}},emits:["close","menu-enter","menu-leave","insert","cell-op"],setup(r,{emit:e}){const t=r,n=e,o=Math.random().toString(36).slice(2,9),l=`pagely-insert-${o}-image-file`,i=`pagely-insert-${o}-doc-file`,s=Jl({visible:()=>t.visible,rootSelector:".pagely-block-menu",estimatedHeight:()=>f5,fallbackTop:()=>t.menuTop,fallbackLeft:()=>t.menuLeft+Gt}),u=s.rootId;a.watch(()=>t.visible,I=>{I&&(u.value=null,s.close())});const d=a.computed(()=>({position:"fixed",top:`${t.menuTop}px`,left:`${t.menuLeft}px`,zIndex:"300","--pagely-menu-panel-width":`${Gt}px`,"--menu-enter-translate":Di(t.placement)})),m=a.computed(()=>{if(!u.value)return null;for(const I of t.sections){const P=I.items.find(V=>V.id===u.value);if(P&&!Vt(P))return P}return null}),h=a.computed(()=>{var I;return((I=m.value)==null?void 0:I.picker)??null}),p=s.style,v=a.ref(!1),{imageAccept:b,onImageFileClick:w,onImageFileChange:k}=R2({onBeforeSelect:ee,onInsert:I=>D("IMAGE",I)}),{fileAccept:T,onDocFileClick:E,onDocFileChange:M}=P2({onBeforeSelect:ee,uploadHandler:I=>{var P;return((P=t.fileUploadHandler)==null?void 0:P.call(t,I))??Sa(I)},onInsert:I=>D("FILE",I)});function B(I){n("insert",I),n("close")}function D(I,P){n("insert",I,P),n("close")}function z(I){Vt(I)||B(I.id)}function W(I){if(Vt(I)){n("cell-op",I.id),n("close");return}if(I.id==="LINK"){we();return}Z(I)||B(I.id)}function H(I,P){if(s.clearCloseTimer(),Vt(I)){ee();return}if(!Z(I)){ee();return}u.value=I.id,s.open(I.id,P)}function A(){s.scheduleClose()}function R(){s.onPanelMouseEnter()}function K(I){var V;s.onPanelMouseLeave();const P=I.relatedTarget;(V=P==null?void 0:P.closest)!=null&&V.call(P,".pagely-block-menu")||n("menu-leave")}function J(I){n("insert","TABLE",I),n("close")}function te(I){var V,q;const P=I.relatedTarget;(V=P==null?void 0:P.closest)!=null&&V.call(P,".pagely-insert-picker")||(q=P==null?void 0:P.closest)!=null&&q.call(P,".pagely-insert-link-dialog-backdrop")||(ee(),n("menu-leave"))}function Z(I){return!Vt(I)&&I.picker!==void 0}function le(I){return Vt(I)&&I.danger===!0}function ee(){u.value=null,s.close()}function we(){ee(),v.value=!0}function pe(){v.value=!1}function se(I){D("LINK",I),pe()}return(I,P)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.visible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-block-menu-wrapper pagely-insert-menu",onClick:P[7]||(P[7]=a.withModifiers(()=>{},["stop"])),onMousedown:P[8]||(P[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",{class:"pagely-block-menu",style:a.normalizeStyle(d.value),"data-placement":r.placement,onMouseenter:P[4]||(P[4]=V=>I.$emit("menu-enter")),onMouseleave:P[5]||(P[5]=V=>te(V))},[a.createElementVNode("div",J2,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.sections,(V,q)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:V.label},[V.label?(a.openBlock(),a.createElementBlock("div",X2,a.toDisplayString(V.label),1)):a.createCommentVNode("",!0),V.style==="tiles"?(a.openBlock(),a.createElementBlock("div",j2,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(V.items,ae=>(a.openBlock(),a.createElementBlock("button",{key:ae.id,class:"pagely-menu-tile",title:ae.label,onMouseenter:ee,onClick:ge=>z(ae)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(ae.icon),{size:18,"stroke-width":1.5}))],40,Q2))),128))])):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:2},a.renderList(V.items,ae=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:ae.id},[!a.unref(Vt)(ae)&&ae.id==="IMAGE"?(a.openBlock(),a.createElementBlock("label",{key:0,class:"pagely-menu-item pagely-insert-image-item",for:l,onClick:ee,onMouseenter:ge=>H(ae,ge),onMouseleave:A},[a.createElementVNode("span",e5,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(ae.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",t5,a.toDisplayString(ae.label),1),a.createElementVNode("input",{id:l,name:l,class:"pagely-insert-file-input",type:"file",accept:a.unref(b),"aria-label":"图片",onClick:P[0]||(P[0]=(...ge)=>a.unref(w)&&a.unref(w)(...ge)),onChange:P[1]||(P[1]=(...ge)=>a.unref(k)&&a.unref(k)(...ge))},null,40,r5)],40,Z2)):!a.unref(Vt)(ae)&&ae.id==="FILE"?(a.openBlock(),a.createElementBlock("label",{key:1,class:"pagely-menu-item pagely-insert-file-item",for:i,onClick:ee,onMouseenter:ge=>H(ae,ge),onMouseleave:A},[a.createElementVNode("span",o5,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(ae.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",l5,a.toDisplayString(ae.label),1),a.createElementVNode("input",{id:i,name:i,class:"pagely-insert-file-input",type:"file",accept:a.unref(T),"aria-label":"文件",onClick:P[2]||(P[2]=(...ge)=>a.unref(E)&&a.unref(E)(...ge)),onChange:P[3]||(P[3]=(...ge)=>a.unref(M)&&a.unref(M)(...ge))},null,40,a5)],40,n5)):(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass(["pagely-menu-item",{"pagely-danger":le(ae),"pagely-submenu-open":a.unref(u)===ae.id}]),onClick:ge=>W(ae),onMouseenter:ge=>H(ae,ge),onMouseleave:A},[a.createElementVNode("span",s5,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(ae.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",u5,a.toDisplayString(ae.label),1),Z(ae)?(a.openBlock(),a.createElementBlock("span",c5,"›")):a.createCommentVNode("",!0)],42,i5))],64))),128)),q<r.sections.length-1?(a.openBlock(),a.createElementBlock("div",d5)):a.createCommentVNode("",!0)],64))),128))])],44,Y2),h.value==="table"?(a.openBlock(),a.createBlock(cc,{key:0,class:"pagely-insert-picker",style:a.normalizeStyle(a.unref(p)),"data-placement":"right",onPick:J,onMouseenter:R,onMouseleave:P[6]||(P[6]=V=>K(V))},null,8,["style"])):a.createCommentVNode("",!0),a.createVNode(q2,{open:v.value,onConfirm:se,onClose:pe},null,8,["open"])],32)):a.createCommentVNode("",!0)]))}}),Ma=gt(m5,[["__scopeId","data-v-65ba9898"]]);function Aa(r=un){const e=a.ref(!1);let t=null;function n(){t&&(clearTimeout(t),t=null)}function o(){n(),e.value=!0}function l(){n(),e.value=!1}function i(){n(),t=setTimeout(()=>{e.value=!1,t=null},r)}return a.onBeforeUnmount(n),{isOpen:e,open:o,close:l,scheduleClose:i,clearCloseTimer:n}}const h5={class:"table-action-btn",type:"button","aria-label":"表格操作"},p5=a.defineComponent({__name:"TableActionMenu",props:{tableBounds:{},hasHeaderRow:{type:Boolean},hasHeaderCol:{type:Boolean},keepAlive:{type:Function},scheduleHide:{type:Function}},emits:["comment","cutTable","copyTable","toggleHeaderRow","toggleHeaderCol","deleteTable"],setup(r,{emit:e}){const t=r,n=e,o=Aa(),l=o.isOpen;function i(){t.keepAlive(),o.open()}function s(T){var M;const E=T.relatedTarget;(M=E==null?void 0:E.closest)!=null&&M.call(E,".tt-dropdown-right")||(o.scheduleClose(),t.scheduleHide())}function u(){t.keepAlive(),o.clearCloseTimer()}function d(T){var M;const E=T.relatedTarget;(M=E==null?void 0:E.closest)!=null&&M.call(E,".table-action-wrap")||(o.scheduleClose(),t.scheduleHide())}function m(){o.close()}function h(T){var E;m(),n("comment",((E=T.currentTarget)==null?void 0:E.getBoundingClientRect())??null)}function p(){m(),n("cutTable")}function v(){m(),n("copyTable")}function b(){m(),n("toggleHeaderRow")}function w(){m(),n("toggleHeaderCol")}function k(){m(),n("deleteTable")}return(T,E)=>(a.openBlock(),a.createElementBlock("div",{class:"table-tools-overlay table-action-wrap",style:a.normalizeStyle({position:"fixed",top:`${r.tableBounds.top-12}px`,left:`${r.tableBounds.left-12}px`,zIndex:"182"}),onMouseenter:i,onMouseleave:E[1]||(E[1]=M=>s(M))},[a.createElementVNode("button",h5,[a.createVNode(a.unref(L.LayoutGrid),{size:13,"stroke-width":1.8})]),a.unref(l)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"tt-dropdown tt-dropdown-right",onMouseenter:u,onMouseleave:E[0]||(E[0]=M=>d(M))},[a.createElementVNode("button",{class:"tt-item",type:"button",onClick:a.withModifiers(h,["stop"])},[a.createVNode(a.unref(L.MessageSquare),{size:15,"stroke-width":1.5}),E[2]||(E[2]=a.createElementVNode("span",null,"评论",-1))]),a.createElementVNode("button",{class:"tt-item",type:"button",onClick:a.withModifiers(p,["stop"])},[a.createVNode(a.unref(L.Scissors),{size:15,"stroke-width":1.5}),E[3]||(E[3]=a.createElementVNode("span",null,"剪切",-1))]),a.createElementVNode("button",{class:"tt-item",type:"button",onClick:a.withModifiers(v,["stop"])},[a.createVNode(a.unref(L.Copy),{size:15,"stroke-width":1.5}),E[4]||(E[4]=a.createElementVNode("span",null,"复制",-1))]),E[10]||(E[10]=a.createElementVNode("div",{class:"tt-divider"},null,-1)),a.createElementVNode("div",{class:"tt-toggle-row",onClick:a.withModifiers(b,["stop"])},[a.createVNode(a.unref(L.Rows3),{size:15,"stroke-width":1.5}),E[6]||(E[6]=a.createElementVNode("span",null,"标题行",-1)),a.createElementVNode("div",{class:a.normalizeClass(["tt-toggle",{"tt-toggle-on":r.hasHeaderRow}])},[...E[5]||(E[5]=[a.createElementVNode("div",{class:"tt-toggle-thumb"},null,-1)])],2)]),a.createElementVNode("div",{class:"tt-toggle-row",onClick:a.withModifiers(w,["stop"])},[a.createVNode(a.unref(L.Columns3),{size:15,"stroke-width":1.5}),E[8]||(E[8]=a.createElementVNode("span",null,"标题列",-1)),a.createElementVNode("div",{class:a.normalizeClass(["tt-toggle",{"tt-toggle-on":r.hasHeaderCol}])},[...E[7]||(E[7]=[a.createElementVNode("div",{class:"tt-toggle-thumb"},null,-1)])],2)]),E[11]||(E[11]=a.createElementVNode("div",{class:"tt-divider"},null,-1)),a.createElementVNode("button",{class:"tt-item tt-danger",type:"button",onClick:a.withModifiers(k,["stop"])},[a.createVNode(a.unref(L.Trash2),{size:15,"stroke-width":1.5}),E[9]||(E[9]=a.createElementVNode("span",null,"删除",-1))])],32)):a.createCommentVNode("",!0)],36))}}),g5=gt(p5,[["__scopeId","data-v-3191f26f"]]),v5=["title","aria-label"],b5=["onClick"],y5=a.defineComponent({__name:"ColAlignBadge",props:{align:{},colIndex:{},x:{},y:{},keepAlive:{type:Function},scheduleHide:{type:Function}},emits:["change"],setup(r,{emit:e}){const t=[{label:"左对齐",value:"left",icon:L.AlignLeft},{label:"居中",value:"center",icon:L.AlignCenter},{label:"右对齐",value:"right",icon:L.AlignRight}],n=r,o=e,l=Aa(),i=l.isOpen,s=a.computed(()=>n.align??"left"),u=a.computed(()=>s.value==="center"?L.AlignCenter:s.value==="right"?L.AlignRight:L.AlignLeft),d=a.computed(()=>{var w;return((w=t.find(k=>k.value===s.value))==null?void 0:w.label)??"左对齐"});function m(){n.keepAlive(),l.open()}function h(w){var T;const k=w.relatedTarget;(T=k==null?void 0:k.closest)!=null&&T.call(k,".col-align-popover")||(l.scheduleClose(),n.scheduleHide())}function p(){n.keepAlive(),l.clearCloseTimer()}function v(w){var T;const k=w.relatedTarget;(T=k==null?void 0:k.closest)!=null&&T.call(k,".col-align-badge-wrap")||(l.scheduleClose(),n.scheduleHide())}function b(w){n.keepAlive(),o("change",w,n.colIndex),l.close()}return(w,k)=>(a.openBlock(),a.createElementBlock("div",{class:"table-tools-overlay col-align-badge-wrap",style:a.normalizeStyle({position:"fixed",left:`${r.x-9}px`,top:`${r.y-9}px`,zIndex:"181"}),onMouseenter:m,onMouseleave:h},[a.createElementVNode("button",{class:a.normalizeClass(["col-align-badge",{"col-align-badge--active":a.unref(i)||r.align!==null}]),type:"button",title:`列对齐:${d.value}`,"aria-label":`列对齐:${d.value}`},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(u.value),{size:13,"stroke-width":1.8}))],10,v5),a.unref(i)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"col-align-popover",onMouseenter:p,onMouseleave:v},[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(t,T=>a.createElementVNode("button",{key:T.label,class:a.normalizeClass(["tt-item",{"tt-toggle-on":s.value===T.value}]),type:"button",onClick:a.withModifiers(E=>b(T.value),["stop"])},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(T.icon),{size:15,"stroke-width":1.5})),a.createElementVNode("span",null,a.toDisplayString(T.label),1)],10,b5)),64))],32)):a.createCommentVNode("",!0)],36))}}),w5=gt(y5,[["__scopeId","data-v-e7a7604f"]]),k5=["onClick"],x5=["onClick"],C5=24,T5=13,Si=20,Mi=20,E5=a.defineComponent({__name:"TableTools",props:{tableVisible:{type:Boolean},tableBounds:{},rowDots:{},colDots:{},colAlignDots:{},hoveredCellBounds:{},hasHeaderRow:{type:Boolean},hasHeaderCol:{type:Boolean},keepAlive:{type:Function},scheduleHide:{type:Function},insertRowAt:{type:Function},insertColAt:{type:Function},setColumnAlign:{type:Function}},emits:["comment","cutTable","copyTable","toggleHeaderRow","toggleHeaderCol","deleteTable","cellOp","cellInsert","cellComment"],setup(r,{emit:e}){const t=Mi/2,n=r,o=e,l=Aa(),i=l.isOpen;function s(b,w){n.setColumnAlign(b,w)}function u(){n.keepAlive(),l.open()}function d(b){var k;const w=b.relatedTarget;(k=w==null?void 0:w.closest)!=null&&k.call(w,".pagely-insert-menu")||(l.scheduleClose(),n.scheduleHide())}function m(){n.keepAlive(),l.clearCloseTimer()}function h(){l.scheduleClose(),n.scheduleHide()}function p(b){if(l.close(),b==="COMMENT"){const w=n.hoveredCellBounds;o("cellComment",w?new DOMRect(w.left,w.top,w.width,w.height):null);return}o("cellInsert",b)}function v(b){l.close(),o("cellOp",b)}return(b,w)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.tableVisible?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.rowDots,(k,T)=>(a.openBlock(),a.createElementBlock("div",{key:"r"+T,class:"table-tools-overlay ins-wrap ins-row",style:a.normalizeStyle({position:"fixed",top:k.pos-10+"px",left:r.tableBounds.left-20+"px",zIndex:"180"}),onMouseenter:w[0]||(w[0]=(...E)=>r.keepAlive&&r.keepAlive(...E)),onMouseleave:w[1]||(w[1]=(...E)=>r.scheduleHide&&r.scheduleHide(...E)),onClick:a.withModifiers(E=>r.insertRowAt(k.index),["stop"])},[...w[13]||(w[13]=[a.createElementVNode("div",{class:"ins-pill ins-pill-h"},[a.createElementVNode("div",{class:"ins-dot"}),a.createElementVNode("span",{class:"ins-label"},"插入行")],-1)])],44,k5))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.colDots,(k,T)=>(a.openBlock(),a.createElementBlock("div",{key:"c"+T,class:"table-tools-overlay ins-wrap ins-col",style:a.normalizeStyle({position:"fixed",left:k.pos-10+"px",top:r.tableBounds.top-20+"px",zIndex:"180"}),onMouseenter:w[2]||(w[2]=(...E)=>r.keepAlive&&r.keepAlive(...E)),onMouseleave:w[3]||(w[3]=(...E)=>r.scheduleHide&&r.scheduleHide(...E)),onClick:a.withModifiers(E=>r.insertColAt(k.index),["stop"])},[...w[14]||(w[14]=[a.createElementVNode("div",{class:"ins-pill ins-pill-v"},[a.createElementVNode("div",{class:"ins-dot"}),a.createElementVNode("span",{class:"ins-label"},"插入列")],-1)])],44,x5))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.colAlignDots,k=>(a.openBlock(),a.createBlock(w5,{key:"ca"+k.colIndex,align:k.align,"col-index":k.colIndex,x:k.pos,y:k.y,"keep-alive":r.keepAlive,"schedule-hide":r.scheduleHide,onChange:s},null,8,["align","col-index","x","y","keep-alive","schedule-hide"]))),128)),a.createVNode(g5,{"table-bounds":r.tableBounds,"has-header-row":r.hasHeaderRow,"has-header-col":r.hasHeaderCol,"keep-alive":r.keepAlive,"schedule-hide":r.scheduleHide,onComment:w[4]||(w[4]=k=>o("comment",k)),onCutTable:w[5]||(w[5]=k=>o("cutTable")),onCopyTable:w[6]||(w[6]=k=>o("copyTable")),onToggleHeaderRow:w[7]||(w[7]=k=>o("toggleHeaderRow")),onToggleHeaderCol:w[8]||(w[8]=k=>o("toggleHeaderCol")),onDeleteTable:w[9]||(w[9]=k=>o("deleteTable"))},null,8,["table-bounds","has-header-row","has-header-col","keep-alive","schedule-hide"]),r.hoveredCellBounds?(a.openBlock(),a.createElementBlock("div",{key:0,class:"table-tools-overlay table-cell-wrap",style:a.normalizeStyle({position:"fixed",top:r.hoveredCellBounds.top+r.hoveredCellBounds.height/2-t+"px",left:r.hoveredCellBounds.left-Si+"px",width:`${Si}px`,height:`${Mi}px`,zIndex:"182"}),onMouseenter:w[10]||(w[10]=(...k)=>r.keepAlive&&r.keepAlive(...k)),onMouseleave:w[11]||(w[11]=k=>d(k))},[a.createElementVNode("button",{class:"table-cell-btn",type:"button","aria-label":"单元格操作",onMouseenter:u},[a.createVNode(a.unref(L.Plus),{size:13,"stroke-width":2})],32)],36)):a.createCommentVNode("",!0),a.unref(i)&&r.hoveredCellBounds?(a.openBlock(),a.createBlock(Ma,{key:1,visible:a.unref(i),sections:a.unref(Xi),"menu-top":r.hoveredCellBounds.top+r.hoveredCellBounds.height/2-T5,"menu-left":r.hoveredCellBounds.left-C5-a.unref(oo)-a.unref(Gt),placement:"left",editor:void 0,onClose:w[12]||(w[12]=k=>a.unref(l).close()),onMenuEnter:m,onMenuLeave:h,onInsert:p,onCellOp:v},null,8,["visible","sections","menu-top","menu-left"])):a.createCommentVNode("",!0)],64)):a.createCommentVNode("",!0)]))}}),dc=gt(E5,[["__scopeId","data-v-a8378ff3"]]);function fc(r,e){const t=r.schema.marks.link;if(!t)return null;const n=[];if(r.doc.descendants((i,s)=>{if(!i.isText)return;i.marks.find(d=>d.type===t&&d.attrs.href===e)&&n.push({from:s,to:s+i.nodeSize})}),!n.length)return null;const o=n[0];let l=o.to;for(let i=1;i<n.length&&n[i].from===l;i++)l=n[i].to;return{from:o.from,to:l}}function Ai(r,e){const t=r.schema.marks.link;if(!t)return null;let n=null;return r.doc.descendants((o,l)=>{if(n)return!1;if(o.type.name!=="paragraph")return!0;let i="",s=!1,u=!0;return o.descendants(d=>{if(!u)return!1;if(!d.isText)return u=!1,!1;const m=d.text??"";return d.marks.find(p=>p.type===t&&p.attrs.href===e)?(s=!0,i+=m,!0):(m.trim().length>0&&(u=!1),i+=m,!0)}),!u||!s||i.trim().length===0||(n={from:l,to:l+o.nodeSize,text:i.trim()}),!1}),n}function hl(r,e,t){const n=r.state,o=n.schema.marks.link;if(!o)return!1;const l=[];if(n.doc.descendants((u,d)=>{if(!u.isText)return;const m=u.marks.find(h=>h.type===o&&h.attrs.href===e);m&&l.push({from:d,to:d+u.nodeSize,mark:m})}),!l.length)return!1;const i=l[0];let s=i.to;for(let u=1;u<l.length&&l[u].from===s;u++)s=l[u].to;return r.view.dispatch(n.tr.replaceWith(i.from,s,n.schema.text(t,[i.mark]))),!0}function S5(r,e,t){const n=fc(r.state,e);return n?(r.view.dispatch(r.state.tr.replaceWith(n.from,n.to,r.state.schema.text(t))),!0):!1}function M5(r,e,t){const n=r.state,o=n.schema.marks.link;if(!o)return!1;const l=fc(n,e);if(!l)return!1;const i=o.create({href:t,target:"_blank"}),s=n.tr.removeMark(l.from,l.to,o).addMark(l.from,l.to,i);return r.view.dispatch(s),!0}const A5=["title"],B5=["title"],N5={class:"wl-view-menu"},L5=["onKeydown"],I5=a.defineComponent({__name:"LinkToolbar",props:{editor:{}},setup(r,{expose:e}){const t=r,n=a.ref(!1),o=a.ref(""),l=a.ref(""),i=a.ref({}),s=a.ref(null),u=a.ref(!1),d=a.ref(""),m=a.ref(null),h=a.ref(!1),p=a.ref(null),v=a.ref(!1);let b=null;const w=a.computed(()=>o.value.length>38?o.value.slice(0,35)+"...":o.value),k=a.computed(()=>l.value===o.value?"link":"title"),T=a.computed(()=>t.editor?Ai(t.editor.state,o.value)!==null:!1),E=a.computed(()=>T.value&&en(o.value,l.value));function M(se,I,P){b&&(clearTimeout(b),b=null),o.value=se,l.value=I,u.value=!1,h.value=!1,D(P),n.value=!0}function B(se=!1){if(se){b&&(clearTimeout(b),b=null),n.value=!1,u.value=!1,h.value=!1;return}b&&clearTimeout(b),b=setTimeout(()=>{v.value||(n.value=!1,u.value=!1,h.value=!1),b=null},200)}function D(se){const V=se.top<56?se.bottom+4:se.top-44-4;i.value={top:`${V}px`,left:`${se.left}px`}}function z(){v.value=!0,b&&(clearTimeout(b),b=null)}function W(){v.value=!1,B()}function H(se){var I;h.value&&!((I=p.value)!=null&&I.contains(se.target))&&(h.value=!1)}a.onMounted(()=>document.addEventListener("click",H)),a.onBeforeUnmount(()=>{document.removeEventListener("click",H),b&&clearTimeout(b),K&&clearTimeout(K)});function A(){window.open(o.value,"_blank","noopener,noreferrer")}const R=a.ref(!1);let K=null;async function J(){try{await navigator.clipboard.writeText(o.value)}catch{const se=document.createElement("textarea");se.value=o.value,se.style.cssText="position:fixed;opacity:0",document.body.appendChild(se),se.select(),document.execCommand("copy"),document.body.removeChild(se)}R.value=!0,K&&clearTimeout(K),K=setTimeout(()=>{R.value=!1},1500)}function te(){t.editor&&(S5(t.editor,o.value,l.value),qe.unpin(o.value),B(!0))}function Z(){d.value=o.value,u.value=!0,a.nextTick(()=>{var se;return(se=m.value)==null?void 0:se.select()})}function le(){const se=d.value.trim();se&&t.editor&&(M5(t.editor,o.value,se),o.value=se),u.value=!1}function ee(){u.value=!1}function we(se){if(t.editor){if(se==="link")qe.pin(o.value),hl(t.editor,o.value,o.value),l.value=o.value;else{qe.unpin(o.value);const I=qe.getTitle(o.value);I?(hl(t.editor,o.value,I),l.value=I):qe.hasTitle(o.value)||(hl(t.editor,o.value,o.value),l.value=o.value)}h.value=!1}}function pe(se){const I=t.editor;if(!I||se==="preview"&&!en(o.value,l.value))return;const P=Ai(I.state,o.value);if(!P)return;const V=I.state.schema.nodes.embedView;if(!V)return;const q=P.text||l.value||o.value;I.view.dispatch(I.state.tr.replaceWith(P.from,P.to,V.create({href:o.value,label:q,view:se})).scrollIntoView()),I.view.focus(),B(!0)}return e({show:M,hide:B}),(se,I)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.withDirectives(a.createElementVNode("div",{ref_key:"toolbarEl",ref:s,class:"wl-toolbar",style:a.normalizeStyle(i.value),onMouseenter:z,onMouseleave:W,onMousedown:I[8]||(I[8]=a.withModifiers(()=>{},["prevent"]))},[u.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.withDirectives(a.createElementVNode("input",{ref_key:"editInputEl",ref:m,"onUpdate:modelValue":I[6]||(I[6]=P=>d.value=P),class:"wl-edit-input",placeholder:"输入链接地址...",onKeydown:[a.withKeys(a.withModifiers(le,["prevent"]),["enter"]),a.withKeys(a.withModifiers(ee,["prevent"]),["esc"])],onMousedown:I[7]||(I[7]=a.withModifiers(()=>{},["stop"]))},null,40,L5),[[a.vModelText,d.value]]),a.createElementVNode("button",{class:"wl-edit-ok",onClick:le},"确认"),a.createElementVNode("button",{class:"wl-edit-cancel",onClick:ee},"取消")],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("span",{class:"wl-tb-url",title:o.value},a.toDisplayString(w.value),9,A5),a.createElementVNode("button",{class:"wl-tb-btn",title:"在新标签打开",onClick:A},[a.createVNode(a.unref(L.ExternalLink),{size:16,"stroke-width":1.8})]),a.createElementVNode("button",{class:"wl-tb-btn",title:R.value?"已复制":"复制链接",onClick:J},[R.value?(a.openBlock(),a.createBlock(a.unref(L.Check),{key:0,size:16,"stroke-width":2,style:{color:"#34c759"}})):(a.openBlock(),a.createBlock(a.unref(L.Copy),{key:1,size:16,"stroke-width":1.8}))],8,B5),a.createElementVNode("button",{class:"wl-tb-btn",title:"编辑链接",onClick:Z},[a.createVNode(a.unref(L.Pencil),{size:16,"stroke-width":1.8})]),a.createElementVNode("button",{class:"wl-tb-btn",title:"取消链接",onClick:te},[a.createVNode(a.unref(L.Link2Off),{size:16,"stroke-width":1.8})]),I[15]||(I[15]=a.createElementVNode("div",{class:"wl-tb-sep"},null,-1)),a.createElementVNode("div",{class:"wl-view-wrap",ref_key:"viewWrapEl",ref:p},[a.createElementVNode("button",{class:"wl-tb-view-btn",onClick:I[0]||(I[0]=a.withModifiers(P=>h.value=!h.value,["stop"]))},[k.value==="link"?(a.openBlock(),a.createBlock(a.unref(L.Link2),{key:0,size:13,"stroke-width":1.6})):(a.openBlock(),a.createBlock(a.unref(L.AlignLeft),{key:1,size:13,"stroke-width":1.6})),a.createElementVNode("span",null,a.toDisplayString(k.value==="title"?"标题视图":"链接视图"),1),a.createVNode(a.unref(L.ChevronDown),{size:12,"stroke-width":1.8,class:a.normalizeClass(["wl-chev",{open:h.value}])},null,8,["class"])]),a.withDirectives(a.createElementVNode("div",N5,[a.createElementVNode("button",{class:a.normalizeClass(["wl-view-item",{active:k.value==="title"}]),onClick:I[1]||(I[1]=P=>we("title"))},[a.createVNode(a.unref(L.AlignLeft),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),I[9]||(I[9]=a.createElementVNode("span",null,"标题视图",-1)),k.value==="title"?(a.openBlock(),a.createBlock(a.unref(L.Check),{key:0,size:12,"stroke-width":2,class:"wl-vi-check",style:{color:"#3370ff"}})):a.createCommentVNode("",!0)],2),a.createElementVNode("button",{class:a.normalizeClass(["wl-view-item",{active:k.value==="link"}]),onClick:I[2]||(I[2]=P=>we("link"))},[a.createVNode(a.unref(L.Link2),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),I[10]||(I[10]=a.createElementVNode("span",null,"链接视图",-1)),k.value==="link"?(a.openBlock(),a.createBlock(a.unref(L.Check),{key:0,size:12,"stroke-width":2,class:"wl-vi-check",style:{color:"#3370ff"}})):a.createCommentVNode("",!0)],2),T.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[I[14]||(I[14]=a.createElementVNode("div",{class:"wl-view-sep"},null,-1)),a.createElementVNode("button",{class:"wl-view-item",onClick:I[3]||(I[3]=P=>pe("link"))},[a.createVNode(a.unref(L.Link2),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),I[11]||(I[11]=a.createElementVNode("span",null,"块级链接",-1))]),a.createElementVNode("button",{class:"wl-view-item",onClick:I[4]||(I[4]=P=>pe("card"))},[a.createVNode(a.unref(L.LayoutPanelTop),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),I[12]||(I[12]=a.createElementVNode("span",null,"卡片视图",-1))]),E.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"wl-view-item",onClick:I[5]||(I[5]=P=>pe("preview"))},[a.createVNode(a.unref(L.Eye),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),I[13]||(I[13]=a.createElementVNode("span",null,"预览视图",-1))])):a.createCommentVNode("",!0)],64)):a.createCommentVNode("",!0)],512),[[a.vShow,h.value]])],512)],64))],36),[[a.vShow,n.value]])]))}}),z5=["onKeydown"],D5={class:"sel-type-label"},O5={class:"sel-dropdown"},R5=["onClick"],P5=["disabled"],H5=["disabled"],Bi="#1f2329",V5=a.defineComponent({__name:"SelectionToolbar",props:{editor:{},enableComment:{type:Boolean,default:!1}},emits:["comment"],setup(r,{expose:e,emit:t}){const n=r,o=t,l=a.ref(!1),i=a.ref({}),s=a.ref(null),u=a.ref(!1),d=a.ref(null),m=a.ref(!1),h=a.ref(null),p=a.ref(!1),v=a.ref(""),b=a.ref(null),w=a.computed(()=>ml.find(V=>V.isActive(n.editor))??ml[0]),k=a.computed(()=>w.value.label),T=a.computed(()=>w.value.icon),E=a.computed(()=>{var q;return((q=n.editor)==null?void 0:q.getAttributes("textStyle").color)??Bi}),M=a.computed(()=>{var q;const V=(q=n.editor)==null?void 0:q.getAttributes("highlight");return V!=null&&V.color?V.color:null});function B(V){var q;(q=n.editor)==null||q.chain().focus()[V]().run()}function D(V){n.editor&&V.apply(n.editor),u.value=!1}function z(V){n.editor&&(V===null||V===Bi?n.editor.chain().focus().unsetColor().run():n.editor.chain().focus().setColor(V).run(),m.value=!1)}function W(V){n.editor&&(V===null?n.editor.chain().focus().unsetHighlight().run():n.editor.chain().focus().setHighlight({color:V}).run(),m.value=!1)}function H(){n.editor&&(n.editor.chain().focus().unsetColor().unsetHighlight().run(),m.value=!1)}const A=a.computed(()=>{if(!n.editor)return!1;const{$from:V}=n.editor.state.selection;for(let q=V.depth;q>0;q--){const ae=V.node(q).type.name;if(ae==="tableCell"||ae==="tableHeader")return!0}return!1}),R=a.computed(()=>Qi(n.editor)),K=a.computed(()=>Zi(n.editor));function J(){n.editor&&es(n.editor)}function te(){n.editor&&ts(n.editor)}function Z(){if(n.editor){if(n.editor.isActive("link")){n.editor.chain().focus().unsetLink().run();return}v.value="",p.value=!0,a.nextTick(()=>{var V;return(V=b.value)==null?void 0:V.focus()})}}function le(){const V=v.value.trim();V&&n.editor&&n.editor.chain().focus().setLink({href:V,target:"_blank"}).run(),p.value=!1}function ee(){var V;p.value=!1,(V=n.editor)==null||V.commands.focus()}function we(){o("comment")}function pe(V){p.value=!1,u.value=!1,l.value||(m.value=!1),l.value=!0,a.nextTick(()=>I(V))}function se(){l.value=!1,u.value=!1,m.value=!1,p.value=!1}function I(V){const q=s.value;if(!q)return;const ae=q.offsetWidth||340,ge=q.offsetHeight||40,ne=8,N=window.innerWidth;let O=V.left+V.width/2-ae/2;O=Math.max(8,Math.min(O,N-ae-8));const $=V.top>=ge+ne+8?V.top-ge-ne:V.bottom+ne;i.value={top:`${$}px`,left:`${O}px`}}function P(V){var q,ae;u.value&&!((q=d.value)!=null&&q.contains(V.target))&&(u.value=!1),m.value&&!((ae=h.value)!=null&&ae.contains(V.target))&&(m.value=!1)}return a.onMounted(()=>document.addEventListener("click",P)),a.onBeforeUnmount(()=>document.removeEventListener("click",P)),e({show:pe,hide:se}),(V,q)=>{var ae,ge,ne,N,O,$;return a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.withDirectives(a.createElementVNode("div",{ref_key:"toolbarEl",ref:s,class:"sel-toolbar",style:a.normalizeStyle(i.value),onMousedown:q[9]||(q[9]=a.withModifiers(()=>{},["prevent"]))},[p.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.withDirectives(a.createElementVNode("input",{ref_key:"linkInputEl",ref:b,"onUpdate:modelValue":q[0]||(q[0]=X=>v.value=X),class:"sel-link-input",placeholder:"输入链接地址…",onKeydown:[a.withKeys(a.withModifiers(le,["prevent"]),["enter"]),a.withKeys(a.withModifiers(ee,["prevent"]),["esc"])],onMousedown:q[1]||(q[1]=a.withModifiers(()=>{},["stop"]))},null,40,z5),[[a.vModelText,v.value]]),a.createElementVNode("button",{class:"sel-link-ok",onClick:le},"确认"),a.createElementVNode("button",{class:"sel-link-cancel",onClick:ee},"取消")],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createElementVNode("div",{class:"sel-type-wrap",ref_key:"typeWrapEl",ref:d},[a.createElementVNode("button",{class:"sel-btn sel-btn--type",onClick:q[2]||(q[2]=a.withModifiers(X=>u.value=!u.value,["stop"]))},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(T.value),{size:16,"stroke-width":1.5})),a.createElementVNode("span",D5,a.toDisplayString(k.value),1),a.createVNode(a.unref(L.ChevronDown),{size:10,"stroke-width":1.8,class:a.normalizeClass(["sel-chev",{open:u.value}])},null,8,["class"])]),a.withDirectives(a.createElementVNode("div",O5,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(ml),X=>(a.openBlock(),a.createElementBlock("button",{key:X.id,class:a.normalizeClass(["sel-dd-item",{active:X.isActive(r.editor)}]),onClick:oe=>D(X)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(X.icon),{size:15,"stroke-width":1.5,class:"sel-dd-icon"})),a.createElementVNode("span",null,a.toDisplayString(X.label),1),X.isActive(r.editor)?(a.openBlock(),a.createBlock(a.unref(L.Check),{key:0,size:12,"stroke-width":2.2,class:"sel-dd-check",style:{color:"#3370ff"}})):a.createCommentVNode("",!0)],10,R5))),128))],512),[[a.vShow,u.value]])],512),q[11]||(q[11]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(ae=r.editor)==null?void 0:ae.isActive("bold")}]),title:"粗体 Ctrl+B",onClick:q[3]||(q[3]=X=>B("toggleBold"))},[a.createVNode(a.unref(L.Bold),{size:16,"stroke-width":2.2})],2),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(ge=r.editor)==null?void 0:ge.isActive("italic")}]),title:"斜体 Ctrl+I",onClick:q[4]||(q[4]=X=>B("toggleItalic"))},[a.createVNode(a.unref(L.Italic),{size:16,"stroke-width":1.5})],2),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(ne=r.editor)==null?void 0:ne.isActive("strike")}]),title:"删除线",onClick:q[5]||(q[5]=X=>B("toggleStrike"))},[a.createVNode(a.unref(L.Strikethrough),{size:16,"stroke-width":1.5})],2),A.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass(["sel-btn",{active:(N=r.editor)==null?void 0:N.isActive("underline")}]),title:"下划线 Ctrl+U",onClick:q[6]||(q[6]=X=>B("toggleUnderline"))},[a.createVNode(a.unref(L.Underline),{size:16,"stroke-width":1.5})],2)),q[12]||(q[12]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("div",{class:"sel-color-wrap",ref_key:"colorWrapEl",ref:h},[a.createElementVNode("button",{class:"sel-btn sel-btn--color",title:"字体颜色 / 背景颜色",onClick:q[7]||(q[7]=a.withModifiers(X=>m.value=!m.value,["stop"]))},[a.createVNode(a.unref(L.Baseline),{size:16,"stroke-width":1.5,style:a.normalizeStyle({color:E.value})},null,8,["style"]),a.createVNode(a.unref(L.ChevronDown),{size:10,"stroke-width":1.8,class:a.normalizeClass(["sel-chev",{open:m.value}])},null,8,["class"])]),a.withDirectives(a.createVNode(sc,{class:"sel-color-panel","current-font-color":E.value,"current-bg-color":M.value,onApplyFontColor:z,onApplyBgColor:W,onReset:H},null,8,["current-font-color","current-bg-color"]),[[a.vShow,m.value]])],512),A.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[q[10]||(q[10]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{disabled:!R.value}]),disabled:!R.value,title:"增加缩进",onClick:J},[a.createVNode(a.unref(L.Indent),{size:16,"stroke-width":1.5})],10,P5),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{disabled:!K.value}]),disabled:!K.value,title:"减少缩进",onClick:te},[a.createVNode(a.unref(L.Outdent),{size:16,"stroke-width":1.5})],10,H5)],64)),q[13]||(q[13]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(O=r.editor)==null?void 0:O.isActive("code")}]),title:"行内代码",onClick:q[8]||(q[8]=X=>B("toggleCode"))},[a.createVNode(a.unref(L.Code),{size:16,"stroke-width":1.5})],2),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:($=r.editor)==null?void 0:$.isActive("link")}]),title:"链接",onClick:Z},[a.createVNode(a.unref(L.Link2),{size:16,"stroke-width":1.5})],2),n.enableComment?(a.openBlock(),a.createElementBlock("button",{key:2,class:"sel-btn",title:"评论",onClick:we},[a.createVNode(a.unref(L.MessageSquare),{size:16,"stroke-width":1.5})])):a.createCommentVNode("",!0)],64))],36),[[a.vShow,l.value]])])}}}),F5=["data-variant"],$5=["title"],q5={class:"drag-handle-btn",title:"拖拽移动"},U5=a.defineComponent({__name:"PagelyEditor",props:{initialContent:{default:""},fileUploadHandler:{},enableComment:{type:Boolean,default:!1}},emits:["update:html","update:markdown","comment:create","comment:click","comment:hover","comment:orphaned","comment:anchor-drift","anchors-changed","mention:trigger","mention:cancel"],setup(r,{expose:e,emit:t}){const n=r,o=t;let l=()=>{};const i=ds(()=>l(),o),s=No();let u=()=>{},d=()=>{};function m(re,ce){u(re,ce)}const h=Bo({profile:"edit",initialContent:n.initialContent,headingCollapseExtension:s.extension,isSettingContent:i.isSettingContent,onHtmlUpdate(re){o("update:html",re),i.scheduleMarkdownEmit(re)},onSelectionUpdate(){$()},onOpenMathPopover(re,ce,Te){d(re,ce,Te)},onOpenSlashInsert:m,fileUploadHandler:n.fileUploadHandler});l=()=>h.value;const p=a.ref(null),v=a.computed(()=>n.enableComment),b=$i(h,{enabled:v,onCreate:re=>o("comment:create",re),onClick:re=>o("comment:click",re),onHover:re=>o("comment:hover",re),onOrphaned:re=>o("comment:orphaned",re),onAnchorDrift:re=>o("comment:anchor-drift",re),onAnchorsChanged:re=>o("anchors-changed",re)}),w=is(h,{onTrigger:re=>o("mention:trigger",re),onCancel:()=>o("mention:cancel")}),{visible:k,anchorRect:T,initialLatex:E,openForEdit:M,openForInsert:B,confirm:D,close:z,rectAtPos:W}=Xd(h);d=M;const{overlayVisible:H,overlayStyle:A,blockInfo:R,onMouseMove:K,onMouseLeave:J,getCurrentBlockPMPos:te,getCurrentBlockRootPMPos:Z,getCurrentBlockEl:le}=zi(p,h),ee=a.ref(null),we=a.ref(null);function pe(){const re=ee.value??we.value;return(re==null?void 0:re.getBoundingClientRect())??null}const{isEmptyParagraph:se,updateFromCurrentBlock:I,clear:P}=ls(p,h,le),{tableVisible:V,tableBounds:q,rowDots:ae,colDots:ge,colAlignDots:ne,hoveredCellBounds:N,onTableMouseMove:O,onTableSelectionUpdate:$,keepAlive:X,scheduleHide:oe,insertRowAt:ve,insertColAt:Be,tableDeleteTable:$e,tableCutTable:ot,tableCopyTable:Xe,tableToggleHeaderRow:ue,tableToggleHeaderColumn:me,hasHeaderRow:Re,hasHeaderCol:Ke,cellOps:St,focusHoveredCell:Ht,getCurrentTableRootPMPos:Mt,getCurrentCellRootPMPos:br,setColumnAlign:vn}=ic(p,h),Lo=a.computed(()=>zr(R.tag).icon),Wr=a.computed(()=>{var re;return((re=ur[R.tag])==null?void 0:re.pillVariant)??"text"}),{isHeadingBlock:yr,isCurrentCollapsed:wr,onCollapseClick:Ba}=s.bind(h,()=>R.tag,te);let Na=()=>{};const kr=as(te,pe,()=>{Na()}),er=Oi(h,te,pe,()=>R.tag,()=>{kr.close(),kr.clearHideTimer()});Na=()=>{er.close(),er.clearHideTimer()};const{visible:La,top:hc,left:pc,placement:gc,targetPos:Io,sourceTag:vc,onPillEnter:Ia,onPillLeave:bc,onMenuEnter:yc,onMenuLeave:wc}=er,{visible:za,top:kc,left:xc,placement:Cc,targetPos:Tc,openFromButton:Da,openFromSlash:Ec,onButtonEnter:Oa,onButtonLeave:Sc,onMenuEnter:Mc,onMenuLeave:Ac}=kr;u=Ec;const zo=Md({onBlockMouseMove:K,onBlockMouseLeave:J,updateInsertButton:I,clearInsertButton:P,onTableMouseMove:O,scheduleTableHide:oe,closeBlockMenu:er.close,closeInsertMenu:kr.close,isBlockMenuVisible:()=>La.value,isInsertMenuVisible:()=>za.value}),{onMove:Ra,onLeave:Pa,onEditorMouseDown:Ha,onDocMouseUp:Va,onOverlayEnter:Fa,onOverlayLeave:$a,onKeyDown:qa}=zo,{onInsert:Bc,onCellInsert:Nc,onCellOp:Lc,onConvert:Ic}=os({editor:h,insertTargetPos:Tc,blockTargetPos:Io,blockSourceTag:vc,focusBlockTarget:er.focusTarget,focusHoveredCell:Ht,cellOps:St,closeInsertMenu:kr.close,closeBlockMenu:er.close,openMathPopoverForInsert:B,getMathRectAtPos:W}),Do=a.ref(null);_4(h,(re,ce,Te)=>{var Ua;return(Ua=Do.value)==null?void 0:Ua.show(re,ce,Te)},()=>{var re;return(re=Do.value)==null?void 0:re.hide()});const bn=a.ref(null);G4(h,re=>{var ce;zo.setHasSelection(!0),J(),P(),(ce=bn.value)==null||ce.show(re)},()=>{var re;zo.setHasSelection(!1),(re=bn.value)==null||re.hide()});function zc(){var re;b.requestInlineComment(),(re=bn.value)==null||re.hide()}function Dc(){const re=Z()??Io.value;re!==null&&b.requestBlockComment(re,pe()??void 0)}function Oc(re){const ce=Mt();ce!==null&&b.requestBlockComment(ce,re??void 0)}function Rc(re){const ce=br();ce!==null&&b.requestBlockComment(ce,re??void 0)}return a.onMounted(()=>{document.addEventListener("keydown",qa),document.addEventListener("mouseup",Va)}),a.onBeforeUnmount(()=>{var re;document.removeEventListener("keydown",qa),document.removeEventListener("mouseup",Va),(re=h.value)==null||re.destroy()}),e({getHtml:i.getHtml,getMarkdown:i.getMarkdown,setMarkdown:i.setMarkdown,setHtml:i.setHtml,getEditor:()=>h.value,getCommentAnchors:b.getCommentAnchors,applyCommentAnchors:b.applyCommentAnchors,addComment:(re,ce)=>b.addComment(re,ce),removeCommentAnchor:b.removeCommentAnchor,getMentions:w.getMentions,applyMentions:re=>w.applyMentions(re),insertMention:re=>w.insertMention(re)}),(re,ce)=>(a.openBlock(),a.createElementBlock("div",{class:"pagely-editor-wrap",ref_key:"wrapRef",ref:p,onMousemove:ce[11]||(ce[11]=(...Te)=>a.unref(Ra)&&a.unref(Ra)(...Te)),onMouseleave:ce[12]||(ce[12]=(...Te)=>a.unref(Pa)&&a.unref(Pa)(...Te)),onMousedown:ce[13]||(ce[13]=(...Te)=>a.unref(Ha)&&a.unref(Ha)(...Te))},[a.createVNode(a.unref(_e.EditorContent),{editor:a.unref(h)},null,8,["editor"]),ce[15]||(ce[15]=a.createElementVNode("div",{class:"pagely-document-end","aria-hidden":"true"},[a.createElementVNode("span",{class:"pagely-document-end-mark"})],-1)),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.createElementVNode("div",{class:a.normalizeClass(["block-btn-overlay",{visible:a.unref(H)}]),style:a.normalizeStyle(a.unref(A)),onMouseenter:ce[7]||(ce[7]=(...Te)=>a.unref(Fa)&&a.unref(Fa)(...Te)),onMouseleave:ce[8]||(ce[8]=(...Te)=>a.unref($a)&&a.unref($a)(...Te))},[a.unref(se)?(a.openBlock(),a.createElementBlock("button",{key:0,ref_key:"insertBtnRef",ref:ee,class:"insert-btn",title:"插入块",onMouseenter:ce[0]||(ce[0]=(...Te)=>a.unref(Oa)&&a.unref(Oa)(...Te)),onMouseleave:ce[1]||(ce[1]=Te=>a.unref(Sc)(Te)),onMousedown:ce[2]||(ce[2]=a.withModifiers(()=>{},["stop","prevent"])),onClick:ce[3]||(ce[3]=a.withModifiers((...Te)=>a.unref(Da)&&a.unref(Da)(...Te),["stop"]))},[a.createVNode(a.unref(L.Plus),{size:14,"stroke-width":1.8})],544)):a.createCommentVNode("",!0),a.unref(se)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:1,ref_key:"pillRef",ref:we,class:"block-btn-pill","data-variant":Wr.value,onMouseenter:ce[4]||(ce[4]=(...Te)=>a.unref(Ia)&&a.unref(Ia)(...Te)),onMouseleave:ce[5]||(ce[5]=Te=>a.unref(bc)(Te))},[Wr.value!=="minimal"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:"block-type-btn",title:a.unref(R).label},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(Lo.value),{class:"type-svg",size:16,"stroke-width":1.5})),Wr.value==="text"?(a.openBlock(),a.createBlock(a.unref(L.ChevronDown),{key:0,class:"chevron-svg",size:8,"stroke-width":1.8})):a.createCommentVNode("",!0)],8,$5),ce[14]||(ce[14]=a.createElementVNode("span",{class:"block-btn-divider"},null,-1))],64)):a.createCommentVNode("",!0),a.createElementVNode("button",q5,[a.createVNode(a.unref(L.GripVertical),{class:"drag-svg",size:14,"stroke-width":1.5})])],40,F5)),a.unref(yr)?(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass(["collapse-btn",{"is-collapsed":a.unref(wr)}]),title:"收起",onClick:ce[6]||(ce[6]=a.withModifiers((...Te)=>a.unref(Ba)&&a.unref(Ba)(...Te),["stop"]))},[a.createVNode(a.unref(L.ChevronDown),{size:10,"stroke-width":1.8})],2)):a.createCommentVNode("",!0)],38)])),a.createVNode(uc,{visible:a.unref(La),"menu-top":a.unref(hc),"menu-left":a.unref(pc),placement:a.unref(gc),editor:a.unref(h),"block-info":a.unref(R),"block-target-pos":a.unref(Io),"enable-comment":n.enableComment,onClose:ce[9]||(ce[9]=Te=>a.unref(er).close()),onMenuEnter:a.unref(yc),onMenuLeave:a.unref(wc),onConvert:a.unref(Ic),onComment:Dc},null,8,["visible","menu-top","menu-left","placement","editor","block-info","block-target-pos","enable-comment","onMenuEnter","onMenuLeave","onConvert"]),a.createVNode(Ma,{visible:a.unref(za),"menu-top":a.unref(kc),"menu-left":a.unref(xc),placement:a.unref(Cc),editor:a.unref(h),sections:a.unref(Gi),"file-upload-handler":n.fileUploadHandler,onClose:ce[10]||(ce[10]=Te=>a.unref(kr).close()),onMenuEnter:a.unref(Mc),onMenuLeave:a.unref(Ac),onInsert:a.unref(Bc)},null,8,["visible","menu-top","menu-left","placement","editor","sections","file-upload-handler","onMenuEnter","onMenuLeave","onInsert"]),a.createVNode(dc,{"table-visible":a.unref(V),"table-bounds":a.unref(q),"row-dots":a.unref(ae),"col-dots":a.unref(ge),"col-align-dots":a.unref(ne),"hovered-cell-bounds":a.unref(N),"has-header-row":a.unref(Re),"has-header-col":a.unref(Ke),"keep-alive":a.unref(X),"schedule-hide":a.unref(oe),"insert-row-at":a.unref(ve),"insert-col-at":a.unref(Be),"set-column-align":a.unref(vn),onComment:Oc,onCutTable:a.unref(ot),onCopyTable:a.unref(Xe),onToggleHeaderRow:a.unref(ue),onToggleHeaderCol:a.unref(me),onDeleteTable:a.unref($e),onCellOp:a.unref(Lc),onCellInsert:a.unref(Nc),onCellComment:Rc},null,8,["table-visible","table-bounds","row-dots","col-dots","col-align-dots","hovered-cell-bounds","has-header-row","has-header-col","keep-alive","schedule-hide","insert-row-at","insert-col-at","set-column-align","onCutTable","onCopyTable","onToggleHeaderRow","onToggleHeaderCol","onDeleteTable","onCellOp","onCellInsert"]),a.createVNode(I5,{ref_key:"linkToolbarRef",ref:Do,editor:a.unref(h)},null,8,["editor"]),a.createVNode(V5,{ref_key:"selToolbarRef",ref:bn,editor:a.unref(h),"enable-comment":n.enableComment,onComment:zc},null,8,["editor","enable-comment"]),a.createVNode(Z4,{visible:a.unref(k),"anchor-rect":a.unref(T),"initial-latex":a.unref(E),onConfirm:a.unref(D),onClose:a.unref(z)},null,8,["visible","anchor-rect","initial-latex","onConfirm","onClose"])],544))}});function W5(r,e){const t=r.createElement("p");return t.textContent=e,t}function _5(r,e,t){const n=r.createElement("p"),o=r.createElement("a");return o.setAttribute("href",e),o.setAttribute("target","_blank"),o.setAttribute("rel","noopener noreferrer"),o.className="pm-link",o.textContent=t||e,n.appendChild(o),n}function G5(r){var n,o;if(!r||!r.includes("embed-view"))return r;const e=new DOMParser().parseFromString(`<body>${r}</body>`,"text/html"),t=Array.from(e.body.querySelectorAll(':scope > div[data-type="embed-view"]'));for(const l of t){const i=((n=l.getAttribute("data-href"))==null?void 0:n.trim())??"",s=((o=l.textContent)==null?void 0:o.trim())||i,u=Hr(i)?_5(e,i,s):W5(e,s);l.replaceWith(u)}return e.body.innerHTML}const K5={class:"pagely-viewer-wrap"},Y5=a.defineComponent({__name:"PagelyViewer",props:{content:{},format:{default:"markdown"}},setup(r,{expose:e}){const t=r,n=a.ref(!1),o=No();function l(m,h){const p=h==="markdown"?dn(m):m;return G5(p)}const i=Bo({profile:"view",initialContent:l(t.content,t.format),headingCollapseExtension:o.extension,isSettingContent:n});a.watch(()=>t.content,m=>s(m,t.format)),a.watch(()=>t.format,m=>s(t.content,m));function s(m,h=t.format){const p=i.value;if(p){n.value=!0,p.setEditable(!0);try{p.commands.setContent(l(m,h),{emitUpdate:!1})}finally{p.setEditable(!1),n.value=!1}}}function u(){var m;return((m=i.value)==null?void 0:m.getHTML())??""}function d(){return Un(u())}return a.onBeforeUnmount(()=>{var m;(m=i.value)==null||m.destroy()}),e({getHtml:u,getMarkdown:d,setContent:s,getEditor:()=>i.value}),(m,h)=>(a.openBlock(),a.createElementBlock("div",K5,[a.createVNode(a.unref(_e.EditorContent),{editor:a.unref(i)},null,8,["editor"])]))}}),pl={type:"doc",content:[{type:"paragraph"}]};function mc(r={}){const e=a.ref(!1),t=a.ref(!0),n=No(),o=Bo({profile:"comment",initialContent:r.initialContent??pl,headingCollapseExtension:n.extension,isSettingContent:e,editable:r.editable??!0}),l=is(o,{onTrigger:b=>{var w;return(w=r.onMentionTrigger)==null?void 0:w.call(r,b)},onCancel:()=>{var b;return(b=r.onMentionCancel)==null?void 0:b.call(r)}});function i(){var b;t.value=((b=o.value)==null?void 0:b.isEmpty)??!0}function s(b,w){w==null||w.off("transaction",i),b==null||b.on("transaction",i),i()}a.watch(o,s,{immediate:!0}),a.onBeforeUnmount(()=>{var b,w;(b=o.value)==null||b.off("transaction",i),(w=o.value)==null||w.destroy()});function u(){var b;return((b=o.value)==null?void 0:b.getJSON())??pl}function d(b){const w=o.value;w&&(e.value=!0,w.commands.setContent(b,{emitUpdate:!1}),e.value=!1,i())}function m(){d(pl)}function h(b="end"){var w;(w=o.value)==null||w.commands.focus(b)}function p(){var b;(b=r.onSubmit)==null||b.call(r,u())}function v(b){var w;if(b.key==="Enter"){if(b.preventDefault(),b.shiftKey){(w=o.value)==null||w.chain().focus().splitBlock().run();return}p()}}return{editor:o,isEmpty:t,getContent:u,setContent:d,clear:m,focus:h,submit:p,onKeyDown:v,insertMention:b=>l.insertMention(b),getMentions:l.getMentions,applyMentions:l.applyMentions}}const J5={key:0,class:"pagely-comment-placeholder"},X5=a.defineComponent({__name:"CommentEditor",props:{initialContent:{},placeholder:{default:"输入评论"}},emits:["submit","mention:trigger","mention:cancel"],setup(r,{expose:e,emit:t}){const n=r,o=n.placeholder,l=t,i=mc({initialContent:n.initialContent,onSubmit:s=>l("submit",s),onMentionTrigger:s=>l("mention:trigger",s),onMentionCancel:()=>l("mention:cancel")});return e({getContent:i.getContent,setContent:i.setContent,clear:i.clear,focus:i.focus,submit:i.submit,insertMention:s=>i.insertMention(s)}),(s,u)=>(a.openBlock(),a.createElementBlock("div",{class:"pagely-comment-editor",onKeydownCapture:u[0]||(u[0]=(...d)=>a.unref(i).onKeyDown&&a.unref(i).onKeyDown(...d))},[a.createVNode(a.unref(_e.EditorContent),{editor:a.unref(i).editor.value},null,8,["editor"]),a.unref(i).isEmpty.value?(a.openBlock(),a.createElementBlock("span",J5,a.toDisplayString(a.unref(o)),1)):a.createCommentVNode("",!0)],32))}}),j5={class:"pagely-comment-content"},Q5=a.defineComponent({__name:"CommentContentViewer",props:{content:{}},setup(r,{expose:e}){const t=r,n=a.ref(!1),o=No(),l=Bo({profile:"comment",initialContent:t.content,headingCollapseExtension:o.extension,isSettingContent:n,editable:!1});function i(u){const d=l.value;if(d){n.value=!0,d.setEditable(!0);try{d.commands.setContent(u,{emitUpdate:!1})}finally{d.setEditable(!1),n.value=!1}}}function s(){var u;return((u=l.value)==null?void 0:u.getJSON())??null}return a.watch(()=>t.content,u=>i(u)),a.onBeforeUnmount(()=>{var u;(u=l.value)==null||u.destroy()}),e({getContent:s,setContent:i,getEditor:()=>l.value}),(u,d)=>(a.openBlock(),a.createElementBlock("div",j5,[a.createVNode(a.unref(_e.EditorContent),{editor:a.unref(l)},null,8,["editor"])]))}});exports.BLOCK_CONFIGS=ur;exports.BlockMenu=uc;exports.CommentBlock=Ju;exports.CommentContentViewer=Q5;exports.CommentEditor=X5;exports.CommentMark=ju;exports.DotFlowPadBlock=Qu;exports.EXTENSION_PROFILES=rc;exports.EmbedBlockShell=Ea;exports.EmbedFullscreenModal=ho;exports.EmbedView=Zu;exports.INSERT_BLOCK_CMDS=Ji;exports.INSERT_CMDS=or;exports.INSERT_ITEMS=qi;exports.INSERT_SECTIONS=Ui;exports.INSERT_SECTIONS_CELL=Wi;exports.InsertMenu=Ma;exports.Mention=tc;exports.MermaidBlock=ec;exports.PagelyEditor=U5;exports.PagelyViewer=Y5;exports.RESOLVED_INSERT_SECTIONS=Gi;exports.RESOLVED_INSERT_SECTIONS_CELL=Ki;exports.RESOLVED_INSERT_SECTIONS_CELL_WITH_OPS=Xi;exports.TableSizePicker=cc;exports.TableTools=dc;exports.calcMenuPosition=Yl;exports.htmlToMarkdown=Un;exports.markdownToHtml=dn;exports.normalizeLanguage=ss;exports.shouldLoad=nc;exports.useBlockButton=zi;exports.useBlockImageExport=lo;exports.useBlockMenu=Oi;exports.useCommentAnchors=$i;exports.useCommentEditor=mc;exports.useEditorCommands=os;exports.useInsertButton=ls;exports.useInsertMenu=as;exports.useMarkdownSync=ds;exports.useMenuSidePanel=Jl;exports.useTableTools=ic;
313
+ `).filter(i=>i.length>0);if(r.length<2)return null;const n=r.map(i=>i.split(" ")),o=n[0].length;return o<2||n.some(i=>i.length!==o)||n.every(i=>i[0]==="")?null:{rows:n,cols:o}}const uf={name:"tsv",priority:150,detect(t){return t.inlineOnly||t.isRichHtml?!1:xo(t.plainText)!==null},transform(t){const e=xo(t.plainText);return e?`<table><tbody>${e.rows.map(n=>"<tr>"+n.map(o=>`<td>${kn(o)}</td>`).join("")+"</tr>").join("")}</tbody></table>`:""}},cf=[Wm,jm,lf,Qm,uf,Um,sf,Km];function Co(){return{align:{default:null,parseHTML:t=>or(t),renderHTML:t=>t.align?{align:t.align,style:`text-align:${t.align}`}:{}}}}function df(t){return t==="comment"?{blockquote:!1,bold:!1,bulletList:!1,code:!1,codeBlock:!1,dropcursor:!1,gapcursor:!1,hardBreak:!1,heading:!1,horizontalRule:!1,italic:!1,link:!1,listItem:!1,listKeymap:!1,orderedList:!1,strike:!1,trailingNode:!1,underline:!1}:{codeBlock:!1,link:{autolink:!0,openOnClick:!1,isAllowedUri:(e,r)=>nr(e)||r.defaultValidate(e),HTMLAttributes:{target:"_blank",rel:"noopener noreferrer",class:"pm-link"}}}}function xn(t){const e=t.editable??t.profile!=="view",r=(l,i)=>bi(l,t.profile)?i():null,o=[r("starterKit",()=>ps.configure(df(t.profile))),r("table",()=>fr.Table.configure({resizable:e,View:nd})),r("tableRow",()=>fr.TableRow),r("tableHeader",()=>fr.TableHeader.extend({content:"paragraph",addAttributes(){var l;return{...(l=this.parent)==null?void 0:l.call(this),...Co()}}})),r("tableCell",()=>fr.TableCell.extend({content:"paragraph",addAttributes(){var l;return{...(l=this.parent)==null?void 0:l.call(this),...Co()}}})),t.profile==="comment"?null:t.headingCollapseExtension??null,r("taskList",()=>hs.TaskList),r("taskItem",()=>vs.TaskItem.configure({nested:!0})),r("codeBlock",()=>uc),r("mermaidBlock",()=>fi),r("dotFlowPadBlock",()=>di),r("embedView",()=>mi),r("image",()=>um.configure({imageUrlResolver:t.imageUrlResolver})),r("mathematics",()=>Z1.configure(e?{inlineOptions:{onClick:(l,i)=>{var s;return(s=t.onOpenMathPopover)==null?void 0:s.call(t,l,i,"inline")}},blockOptions:{onClick:(l,i)=>{var s;return(s=t.onOpenMathPopover)==null?void 0:s.call(t,l,i,"block")}}}:{inlineOptions:{},blockOptions:{}})),r("autoLinkTitle",()=>Ku),r("textStyle",()=>ys.TextStyle),r("color",()=>gs),r("highlight",()=>bs.configure({multicolor:!0})),r("commentMark",()=>ci),r("commentBlock",()=>si),r("mention",()=>pi),r("smartPaste",()=>Dm.configure({handlers:cf,fileUploadHandler:t.fileUploadHandler})),r("tableCellEnter",()=>Pm),r("slashInsert",()=>km.configure({onOpen:t.onOpenSlashInsert??(()=>{})}))].filter(l=>l!==null);return Oe.useEditor({editable:e,extensions:o,content:t.initialContent,editorProps:{attributes:{spellcheck:"false"}},onUpdate({editor:l}){var i;e&&(t.isSettingContent.value||(i=t.onHtmlUpdate)==null||i.call(t,l.getHTML()))},onSelectionUpdate(){var l;e&&((l=t.onSelectionUpdate)==null||l.call(t))}})}function Tt(t){return Array.from(t.querySelectorAll(":scope > tr, :scope > thead > tr, :scope > tbody > tr, :scope > tfoot > tr"))}function Jt(t){return t?Array.from(t.children).filter(e=>e instanceof HTMLElement&&(e.tagName==="TD"||e.tagName==="TH")):[]}function Fr(t){return Jt(t)[0]??null}function mf(t){const e=a.reactive({top:0,left:0,width:0,height:0}),r=a.ref([]),n=a.ref([]),o=a.ref([]),l=a.ref(!1),i=a.ref(!1);function s(g){var w;const b=(w=t.value)==null?void 0:w.view;if(!b)return null;let v=null;return b.state.doc.descendants((k,T)=>{if(k.type.name!=="table")return!0;const M=b.nodeDOM(T);return M===g||M instanceof HTMLElement&&M.contains(g)?(v={node:k,pos:T},!1):!0}),v}function c(g){var k,T;const b=((k=s(g))==null?void 0:k.node)??null;if(!b){const M=Tt(g),E=Jt(M[0]);l.value=E.length>0&&E.every(S=>S.tagName==="TH"),i.value=M.length>0&&M.every(S=>{var B;return((B=Fr(S))==null?void 0:B.tagName)==="TH"});return}const v=[];b.forEach(M=>{M.type.name==="tableRow"&&v.push(M)});const w=[];(T=v[0])==null||T.forEach(M=>w.push(M)),l.value=w.length>0&&w.every(M=>M.type.name==="tableHeader"),i.value=v.length>0&&v.every(M=>{var E;return((E=M.firstChild)==null?void 0:E.type.name)==="tableHeader"})}function m(g){var T;const b=Tt(g),v=Jt(b[0]),w=s(g);if(!v.length){o.value=[];return}const k=[];if(w){const M=[];w.node.forEach(E=>{E.type.name==="tableRow"&&M.push(E)}),(T=M[0])==null||T.forEach(E=>k.push(E))}o.value=v.map((M,E)=>{var z;const S=M.getBoundingClientRect(),B=((z=k[E])==null?void 0:z.attrs.align)??null;return{pos:S.right-12,y:S.top+S.height/2,colIndex:E,align:B??or(M)}})}function p(g){const b=g.getBoundingClientRect();e.top=b.top,e.left=b.left,e.width=b.width,e.height=b.height,c(g),m(g);const v=Tt(g),w=v.map((M,E)=>({pos:M.getBoundingClientRect().top,index:E}));if(v.length&&w.push({pos:v[v.length-1].getBoundingClientRect().bottom,index:v.length}),r.value=w,!v[0]){n.value=[];return}const k=Jt(v[0]),T=k.map((M,E)=>({pos:M.getBoundingClientRect().left,index:E}));k.length&&T.push({pos:k[k.length-1].getBoundingClientRect().right,index:k.length}),n.value=T}function f(){r.value=[],n.value=[],o.value=[]}return{tableBounds:e,rowDots:r,colDots:n,colAlignDots:o,hasHeaderRow:l,hasHeaderCol:i,findPmTableState:s,refreshDots:p,refreshHeaderState:c,refreshColumnAlignDots:m,clearDots:f}}function ff(t,e,r,n,o,l){function i(P){if(!t.value||!P.isConnected)return;const N=t.value.view;try{const H=N.posAtDOM(P,0),G=N.state.doc.resolve(H+1);N.dispatch(N.state.tr.setSelection(rt.TextSelection.create(N.state.doc,G.pos)))}catch{}}function s(){if(!e.value)return;const P=Fr(Tt(e.value)[0]);P&&i(P)}function c(){if(!e.value)return;const P=Tt(e.value),N=P[P.length-1],H=Fr(N);H&&i(H)}function m(){if(!e.value)return;const P=Jt(Tt(e.value)[0]),N=P[P.length-1];N&&i(N)}function p(P){if(!e.value||!t.value)return;const N=Tt(e.value),H=P===0?N[0]:N[P-1]??N[N.length-1],G=Fr(H);G&&(i(G),P===0?t.value.commands.addRowBefore():t.value.commands.addRowAfter(),requestAnimationFrame(()=>{e.value=null}))}function f(P){if(!e.value||!t.value)return;const N=Jt(Tt(e.value)[0]),H=P===0?N[0]:N[P-1]??N[N.length-1];H&&(i(H),P===0?t.value.commands.addColumnBefore():t.value.commands.addColumnAfter(),requestAnimationFrame(()=>{e.value=null}))}function g(){if(!t.value)return;const{state:P,view:N}=t.value,H=P.selection.$anchor;let G=null,X=null;for(let ce=H.depth;ce>0;ce--){const ne=H.node(ce).type.name;G===null&&ne==="table"&&(G=H.before(ce)),X===null&&(ne==="tableCell"||ne==="tableHeader")&&(X=H.before(ce))}const ae=G!==null?N.nodeDOM(G):null,re=X!==null?N.nodeDOM(X):null;if(e.value=ae instanceof HTMLElement?ae:null,r.value=re instanceof HTMLElement?re:null,e.value&&o(e.value),r.value){const ce=r.value.getBoundingClientRect();n.value={top:ce.top,left:ce.left,width:ce.width,height:ce.height}}}function b(P){!r.value||!t.value||(i(r.value),P(),requestAnimationFrame(g))}function v(P){!r.value||!t.value||(i(r.value),P(),requestAnimationFrame(l))}function w(){b(()=>t.value.commands.addRowBefore())}function k(){b(()=>t.value.commands.addRowAfter())}function T(){b(()=>t.value.commands.addColumnBefore())}function M(){b(()=>t.value.commands.addColumnAfter())}function E(){v(()=>t.value.chain().focus().deleteRow().run())}function S(){v(()=>t.value.chain().focus().deleteColumn().run())}const B={rowBefore:w,rowAfter:k,colBefore:T,colAfter:M,delRow:E,delCol:S};function z(){r.value&&i(r.value)}function F(){if(!t.value||!r.value)return null;try{const P=t.value.view.posAtDOM(r.value,0),N=t.value.state.doc.nodeAt(P);if(N&&!N.isText)return P;const H=P-1;return H>=0&&t.value.state.doc.nodeAt(H)?H:null}catch{return null}}return{cellOps:B,focusCell:i,focusFirstCell:s,focusLastRowCell:c,focusLastColCell:m,focusHoveredCell:z,insertRowAt:p,insertColAt:f,refreshCurrentCellFromSelection:g,getCurrentCellRootPMPos:F}}function xi(t,e){const r=a.ref(!1),n=a.ref(null),o=a.ref(null),l=a.ref(null);let i=null;const{tableBounds:s,rowDots:c,colDots:m,colAlignDots:p,hasHeaderRow:f,hasHeaderCol:g,findPmTableState:b,refreshDots:v,clearDots:w}=mf(e);function k(){i&&(clearTimeout(i),i=null)}function T(){k(),r.value=!1,n.value=null,w(),o.value=null,l.value=null}const{cellOps:M,focusCell:E,focusFirstCell:S,focusLastRowCell:B,focusLastColCell:z,focusHoveredCell:F,getCurrentCellRootPMPos:P,insertRowAt:N,insertColAt:H}=ff(e,o,l,n,v,T);function G(){i||(i=setTimeout(()=>{i=null,T()},200))}function X(){k()}function ae(L){var le;const D=L.target;if((le=D.closest)!=null&&le.call(D,".table-tools-overlay"))return;const V=D.closest("table");if(!V){n.value=null,l.value=null,G();return}k(),o.value!==V&&(o.value=V,v(V),r.value=!0);const Q=D.closest("td, th");if(Q&&Q!==l.value){l.value=Q;const be=Q.getBoundingClientRect();n.value={top:be.top,left:be.left,width:be.width,height:be.height}}}function re(L){N(L),r.value=!1}function ce(L){H(L),r.value=!1}function ne(){!e.value||!o.value||(B(),e.value.commands.addRowAfter(),requestAnimationFrame(()=>{o.value&&v(o.value)}))}function ge(){!e.value||!o.value||(z(),e.value.commands.addColumnAfter(),requestAnimationFrame(()=>{o.value&&v(o.value)}))}function ve(){!o.value||!e.value||(S(),e.value.chain().focus().toggleHeaderRow().run())}function se(){!o.value||!e.value||(S(),e.value.chain().focus().toggleHeaderColumn().run())}function R(L,D){if(!e.value||!o.value)return;const{view:V}=e.value;try{const Q=b(o.value);if(!Q)return;let le=null,be=Q.node,Me=Q.pos+1,De=null,je=e.value.state.tr;if(typeof D=="number")De=D,le=r0.TableMap.get(Q.node);else{l.value&&E(l.value);const qe=e.value.state;je=qe.tr;const ue=r0.selectedRect(qe);le=ue.map,be=ue.table,Me=ue.tableStart,De=ue.left}if(De===null||!le||De<0||De>=le.width)return;for(let qe=0;qe<le.height;qe++){const ue=le.map[qe*le.width+De],pe=be.nodeAt(ue);pe&&(pe.attrs.align??null)!==L&&je.setNodeMarkup(Me+ue,null,{...pe.attrs,align:L})}je.steps.length&&V.dispatch(je),requestAnimationFrame(()=>{o.value&&v(o.value)})}catch{}}function Y(){S()}function K(){!e.value||!o.value||(S(),e.value.chain().focus().deleteTable().run(),T())}function q(){if(!e.value||!o.value)return;const L=b(o.value);L&&n0(e.value,L.pos,"copyTable")}function U(){if(!e.value||!o.value)return;const L=b(o.value);L&&(n0(e.value,L.pos,"cutTable"),T())}function te(){var L;return o.value?((L=b(o.value))==null?void 0:L.pos)??null:null}function J(){if(!e.value)return;const{state:L,view:D}=e.value,{selection:V}=L,Q=V.$anchor;for(let le=Q.depth;le>0;le--)if(Q.node(le).type.name==="table"){const be=Q.before(le);try{const Me=D.nodeDOM(be);Me instanceof HTMLElement&&(k(),o.value=Me,v(Me),r.value=!0)}catch{}return}T()}return{tableVisible:r,tableBounds:s,rowDots:c,colDots:m,colAlignDots:p,hoveredCellBounds:n,hasHeaderRow:f,hasHeaderCol:g,onTableMouseMove:ae,onTableSelectionUpdate:J,keepAlive:X,scheduleHide:G,insertRowAt:re,insertColAt:ce,cellOps:M,tableAddRowAfter:ne,tableAddColumnAfter:ge,tableToggleHeaderRow:ve,tableToggleHeaderColumn:se,setColumnAlign:R,tableDeleteTable:K,tableCopyTable:q,tableCutTable:U,getCurrentTableRootPMPos:te,tableFocusFirstCell:Y,focusHoveredCell:F,getCurrentCellRootPMPos:P}}function pf(t,e,r){let n=null;function o(i){const s=i.target.closest("a.pm-link[href]");s&&e(s.getAttribute("href")??"",s.textContent??"",s.getBoundingClientRect())}function l(i){var c,m;const s=i;(c=s.target)!=null&&c.closest("a.pm-link[href]")&&((m=s.relatedTarget)!=null&&m.closest("a.pm-link[href]")||r())}a.onMounted(()=>{requestAnimationFrame(()=>{var i;n=((i=t.value)==null?void 0:i.view.dom)??null,n&&(n.addEventListener("mouseover",o),n.addEventListener("mouseout",l))})}),a.onBeforeUnmount(()=>{n==null||n.removeEventListener("mouseover",o),n==null||n.removeEventListener("mouseout",l),n=null})}function hf(t,e,r){let n=null,o=!1,l=0;function i(){const b=document.activeElement;return b instanceof Element&&b.closest(".pagely-embed-block")!==null}function s(){if(i())return null;const b=window.getSelection();if(!b||b.isCollapsed||b.rangeCount===0||!(n!=null&&n.contains(b.anchorNode)))return null;const v=b.getRangeAt(0).getBoundingClientRect();return v.width===0&&v.height===0?null:v}function c(){o=!0,r()}function m(){l=Date.now()+600,r()}function p(){o=!1,requestAnimationFrame(()=>{if(Date.now()<l||i()){r();return}const b=s();b&&e(b)})}function f(){if(o)return;if(Date.now()<l||i()){r();return}const b=s();b?e(b):r()}function g(b){const v=b.detail;if(!(!v||v.editor!==t.value)){if(Date.now()<l||i()){r();return}v.rect?e(v.rect):r()}}a.onMounted(()=>{requestAnimationFrame(()=>{var b,v;n=((b=t.value)==null?void 0:b.view.dom)??null,n&&(n.addEventListener("mousedown",c),document.addEventListener("mouseup",p),window.addEventListener("pagely:hide-selection-toolbar",m),window.addEventListener("pagely:code-selection-toolbar",g),(v=t.value)==null||v.on("selectionUpdate",f))})}),a.onBeforeUnmount(()=>{var b;n==null||n.removeEventListener("mousedown",c),document.removeEventListener("mouseup",p),window.removeEventListener("pagely:hide-selection-toolbar",m),window.removeEventListener("pagely:code-selection-toolbar",g),(b=t.value)==null||b.off("selectionUpdate",f),n=null})}const vf=["onKeydown"],gf=["onKeydown"],bf={key:0,class:"math-popover-error"},yf={class:"math-popover-footer"},wf={class:"math-popover-help",href:"https://katex.org/docs/supported.html",target:"_blank",rel:"noopener noreferrer"},kf=a.defineComponent({__name:"MathPopover",props:{visible:{type:Boolean},anchorRect:{},initialLatex:{}},emits:["confirm","close"],setup(t,{emit:e}){const r=t,n=e,o=a.ref(null),l=a.ref(""),i=a.ref("");let s=0;function c(){s&&window.cancelAnimationFrame(s),a.nextTick(()=>{s=window.requestAnimationFrame(()=>{var g,b;s=0,(g=o.value)==null||g.focus({preventScroll:!0}),(b=o.value)==null||b.select()})})}a.watch(()=>r.visible,g=>{g&&(l.value=r.initialLatex,i.value="",c())},{flush:"post"}),a.onBeforeUnmount(()=>{s&&window.cancelAnimationFrame(s)});const m=a.computed(()=>{const g=r.anchorRect;if(!g)return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};const b=g.bottom+8,v=g.left;return{position:"fixed",top:`${b}px`,left:`${v}px`}});function p(){const g=l.value.trim();if(!g){f();return}try{ii.renderToString(g,{throwOnError:!0})}catch{i.value="LaTeX 语法有误";return}n("confirm",l.value)}function f(){n("close")}return(g,b)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[t.visible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"math-popover-backdrop",onMousedown:a.withModifiers(f,["self"])},[a.createElementVNode("div",{class:"math-popover",style:a.normalizeStyle(m.value),onKeydown:a.withKeys(a.withModifiers(p,["prevent","stop"]),["esc"])},[b[3]||(b[3]=a.createElementVNode("div",{class:"math-popover-title"},"添加 LaTeX 公式",-1)),a.withDirectives(a.createElementVNode("input",{ref_key:"inputRef",ref:o,"onUpdate:modelValue":b[0]||(b[0]=v=>l.value=v),autofocus:"",class:"math-popover-input",placeholder:"请输入公式",onKeydown:[a.withKeys(a.withModifiers(p,["prevent","stop"]),["esc"]),a.withKeys(a.withModifiers(p,["prevent","stop"]),["enter"])]},null,40,gf),[[a.vModelText,l.value]]),i.value?(a.openBlock(),a.createElementBlock("div",bf,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0),a.createElementVNode("div",yf,[b[2]||(b[2]=a.createElementVNode("span",{class:"math-popover-hint"},"Enter / ESC 保存",-1)),a.createElementVNode("a",wf,[a.createVNode(a.unref(I.HelpCircle),{size:13,"stroke-width":1.8}),b[1]||(b[1]=a.createElementVNode("span",null,"查看帮助文档",-1))])])],44,vf)],32)):a.createCommentVNode("",!0)]))}}),xf=at(kf,[["__scopeId","data-v-8b9f6fbc"]]),vr=new rt.PluginKey("headingCollapse");function Qn(t,e){if(e.size===0)return Mt.DecorationSet.empty;const r=[];let n=null;return t.forEach((o,l)=>{n!==null&&(o.type.name==="heading"&&o.attrs.level<=n?n=null:r.push(Mt.Decoration.node(l,l+o.nodeSize,{class:"heading-collapsed-content"}))),o.type.name==="heading"&&e.has(l)&&(n=o.attrs.level)}),Mt.DecorationSet.create(t,r)}function Cf(){return new rt.Plugin({key:vr,state:{init(t,e){const r=new Set;return{collapsed:r,decorations:Qn(e.doc,r)}},apply(t,e,r,n){const o=t.getMeta(vr);if(o){const l=new Set(e.collapsed);return l.has(o.toggle)?l.delete(o.toggle):l.add(o.toggle),{collapsed:l,decorations:Qn(n.doc,l)}}if(t.docChanged){const l=new Set;return e.collapsed.forEach(i=>l.add(t.mapping.map(i))),{collapsed:l,decorations:Qn(n.doc,l)}}return e}},props:{decorations(t){var e;return((e=vr.getState(t))==null?void 0:e.decorations)??Mt.DecorationSet.empty}}})}const Tf=new Set(["H1","H2","H3","H4","H5","H6"]);function Cn(){const t=Cf(),e=Te.Extension.create({name:"headingCollapse",addProseMirrorPlugins(){return[t]}}),r=a.ref(0);function n(o,l,i){const s=()=>{r.value++};let c;const m=()=>{c&&(c.off("transaction",s),c=void 0)},p=()=>{o.value&&o.value!==c&&(m(),c=o.value,c.on("transaction",s))};p(),a.onBeforeUnmount(m);const f=a.computed(()=>(r.value,Tf.has(l()))),g=a.computed(()=>{r.value,p();const v=i(),w=o.value&&vr.getState(o.value.state);return v!==null&&!!(w!=null&&w.collapsed.has(v))});function b(){const v=i();if(v===null||!o.value)return;const w={toggle:v};o.value.view.dispatch(o.value.view.state.tr.setMeta(vr,w))}return{isHeadingBlock:f,isCurrentCollapsed:g,onCollapseClick:b}}return{extension:e,bind:n}}const Ef=[{color:"#1f2329",label:"默认黑"},{color:"#8f959e",label:"灰色"},{color:"#d83931",label:"红色"},{color:"#de7802",label:"橙色"},{color:"#dc9b04",label:"黄色"},{color:"#2ea121",label:"绿色"},{color:"#245bdb",label:"蓝色"},{color:"#6425d0",label:"紫色"}],Mf=[{color:null,label:"无背景"},{color:"rgb(242,243,245)",label:"浅灰"},{color:"rgb(251,191,188)",label:"浅红"},{color:"rgba(254,212,164,0.8)",label:"浅橙"},{color:"rgba(255,246,122,0.8)",label:"浅黄"},{color:"rgba(183,237,177,0.8)",label:"浅绿"},{color:"rgba(186,206,253,0.7)",label:"浅蓝"},{color:"rgba(205,178,250,0.7)",label:"浅紫"},{color:"rgba(222,224,227,0.8)",label:"中灰"},{color:"rgb(187,191,196)",label:"深灰"},{color:"rgb(247,105,100)",label:"深红"},{color:"rgb(255,165,61)",label:"深橙"},{color:"rgb(255,233,40)",label:"深黄"},{color:"rgb(98,210,86)",label:"深绿"},{color:"rgba(78,131,253,0.55)",label:"深蓝"},{color:"rgba(150,88,243,0.6)",label:"深紫"}],Zn=[{id:"paragraph",label:"正文",icon:I.Type,isActive:t=>!!(t!=null&&t.isActive("paragraph")),apply:t=>t.chain().focus().setParagraph().run()},{id:"h1",label:"标题 1",icon:I.Heading1,isActive:t=>!!(t!=null&&t.isActive("heading",{level:1})),apply:t=>t.chain().focus().setHeading({level:1}).run()},{id:"h2",label:"标题 2",icon:I.Heading2,isActive:t=>!!(t!=null&&t.isActive("heading",{level:2})),apply:t=>t.chain().focus().setHeading({level:2}).run()},{id:"h3",label:"标题 3",icon:I.Heading3,isActive:t=>!!(t!=null&&t.isActive("heading",{level:3})),apply:t=>t.chain().focus().setHeading({level:3}).run()}],Sf={class:"pagely-color-panel"},Af={class:"pagely-color-group"},Bf=["title","onClick"],Lf={class:"pagely-color-group pagely-color-group--bg"},Nf=["title","onClick"],If=a.defineComponent({__name:"ColorPanel",props:{currentFontColor:{},currentBgColor:{}},emits:["applyFontColor","applyBgColor","reset"],setup(t){return(e,r)=>(a.openBlock(),a.createElementBlock("div",Sf,[r[1]||(r[1]=a.createElementVNode("p",{class:"pagely-color-group-title"},"字体颜色",-1)),a.createElementVNode("div",Af,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Ef),n=>(a.openBlock(),a.createElementBlock("button",{key:n.label,class:a.normalizeClass(["pagely-color-btn pagely-color-btn--text",{selected:t.currentFontColor===n.color}]),title:n.label,type:"button",onClick:o=>e.$emit("applyFontColor",n.color)},[a.createVNode(a.unref(I.Baseline),{size:18,"stroke-width":1.5,style:a.normalizeStyle({color:n.color??"#1f2329"})},null,8,["style"])],10,Bf))),128))]),r[2]||(r[2]=a.createElementVNode("p",{class:"pagely-color-group-title"},"背景颜色",-1)),a.createElementVNode("div",Lf,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Mf),n=>(a.openBlock(),a.createElementBlock("button",{key:n.label,class:a.normalizeClass(["pagely-color-btn pagely-color-btn--bg",{selected:t.currentBgColor===n.color,"is-none":n.color===null}]),title:n.label,type:"button",style:a.normalizeStyle(n.color?{backgroundColor:n.color}:{}),onClick:o=>e.$emit("applyBgColor",n.color)},null,14,Nf))),128))]),a.createElementVNode("button",{type:"button",class:"pagely-color-reset",onClick:r[0]||(r[0]=n=>e.$emit("reset"))},"恢复默认")]))}}),Ci=at(If,[["__scopeId","data-v-bd597618"]]),zf=["data-placement"],Df={class:"pagely-menu-scroll"},Hf=["disabled"],Rf={class:"pagely-item-icon"},Pf={key:1,class:"pagely-menu-divider"},Of={key:0,class:"pagely-menu-tiles"},Vf=["title","onClick"],$f={key:0,class:"pagely-menu-section-label"},Ff=["disabled","onClick","onMouseenter"],qf={class:"pagely-item-icon"},Uf={class:"pagely-item-label"},_f={key:1,class:"pagely-submenu-arrow"},Wf={key:2,class:"pagely-menu-divider"},Gf=["disabled","onClick"],Kf={class:"pagely-item-icon"},Yf={class:"pagely-item-label"},jf={class:"pagely-preview-body"},Xf={class:"pagely-preview-title"},Jf={class:"pagely-preview-desc"},To="#1f2329",Qf=4,Zf=240,e4=a.defineComponent({__name:"BlockMenu",props:{visible:{type:Boolean},menuTop:{},menuLeft:{},placement:{},editor:{},blockInfo:{},blockTargetPos:{},enableComment:{type:Boolean}},emits:["close","menu-enter","menu-leave","convert","comment"],setup(t,{emit:e}){const r=t,n=e;function o(){const L=r.editor,D=r.blockTargetPos;if(!L||D===null)return null;try{const V=L.state.doc.resolve(D+1);return{from:V.start(),to:V.end()}}catch{return null}}function l(L){const D=r.editor,V=o();if(!D||!V)return null;let Q=null;return D.state.doc.nodesBetween(V.from,V.to,le=>{if(Q)return!1;const be=le.marks.find(Me=>Me.type.name===L);return be&&(Q=be.attrs),!0}),Q}const i=a.computed(()=>{const L=l("textStyle");return(L==null?void 0:L.color)??To}),s=a.computed(()=>{const L=l("highlight");return(L==null?void 0:L.color)??null});function c(L){const D=r.editor,V=o();if(!D||!V)return;const Q=D.chain().focus().setTextSelection(V);L===null||L===To?Q.unsetColor().run():Q.setColor(L).run()}function m(L){const D=r.editor,V=o();if(!D||!V)return;const Q=D.chain().focus().setTextSelection(V);L===null?Q.unsetHighlight().run():Q.setHighlight({color:L}).run()}function p(){const L=r.editor,D=o();!L||!D||L.chain().focus().setTextSelection(D).unsetColor().unsetHighlight().run()}const f=a.ref(null),g=a.ref(!1),b=a.ref(0);let v=null;a.onBeforeUnmount(()=>{v&&clearTimeout(v)}),a.watch(()=>r.visible,L=>{L&&(v&&(clearTimeout(v),v=null),f.value=null,g.value=!1)});const w=E0({visible:()=>r.visible,rootSelector:".pagely-block-menu",estimatedHeight:()=>{var L;return((L=E.value)==null?void 0:L.panel)==="color"?Zf:Math.max(44,b.value*Os+12)},fallbackTop:()=>r.menuTop,fallbackLeft:()=>r.menuLeft+St}),k=w.rootId,T=a.computed(()=>{var L;return((L=E.value)==null?void 0:L.panel)==="color"?"color":null}),M=a.computed(()=>{if(!f.value||S.value.length>0)return null;for(const L of ce.value)for(const D of L.items)if(D.id===f.value&&D.description)return D;return null}),E=a.computed(()=>{if(!k.value)return null;for(const L of ce.value){const D=L.items.find(V=>V.id===k.value);if(D)return D}return null}),S=a.computed(()=>{var L,D;return((D=(L=E.value)==null?void 0:L.children)==null?void 0:D.map(V=>C0[V]).filter(Boolean))??[]});function B(L,D){var V;v&&(clearTimeout(v),v=null),w.clearCloseTimer(),f.value=L.id,ge(L)?(b.value=((V=L.children)==null?void 0:V.length)??0,D&&w.open(L.id,D)):w.hovered.value||w.close()}function z(){v=setTimeout(()=>{g.value||(f.value=null)},wr),w.scheduleClose()}function F(L){var D;return!!((D=L==null?void 0:L.closest)!=null&&D.call(L,".pagely-block-menu, .pagely-block-submenu, .pagely-block-color-side, .pagely-hover-preview"))}function P(){f.value=null,g.value=!1,w.close()}function N(L){const D=L.relatedTarget;F(D)||(P(),n("menu-leave"))}function H(L){w.onPanelMouseLeave();const D=L.relatedTarget;F(D)||(P(),n("menu-leave"))}function G(L){g.value=!1;const D=L.relatedTarget;F(D)||(P(),n("menu-leave"))}const X=a.computed(()=>({position:"fixed",top:`${r.menuTop}px`,left:`${r.menuLeft}px`,zIndex:"300","--pagely-menu-panel-width":`${St}px`,"--menu-enter-translate":zo(r.placement)})),ae=a.computed(()=>({position:"fixed",top:`${r.menuTop}px`,left:`${r.menuLeft+St+tn+Qf}px`,zIndex:"301"})),re=w.style,ce=a.computed(()=>(Ot[r.blockInfo.tag]??Ot.P).sections);function ne(){n("close")}function ge(L){var D;return!!((D=L.children)!=null&&D.length)||!!L.panel}function ve(L){return ge(L)?!1:L.action==="indent"?L.indentDir==="inc"?!Jo(r.editor):!Qo(r.editor):!1}function se(){const L=r.editor,D=r.blockTargetPos;if(!L||D===null)return null;const V=L.state.doc.nodeAt(D);if((V==null?void 0:V.type.name)==="table")return V;try{const Q=L.state.doc.resolve(D+1);for(let le=Q.depth;le>=0;le--){const be=Q.node(le);if(be.type.name==="table")return be}}catch{return null}return null}function R(L){const D=[];return L.forEach(V=>{V.type.name==="tableRow"&&D.push(V)}),D}function Y(L){const D=R(L)[0];if(!D)return!1;const V=[];return D.forEach(Q=>V.push(Q)),V.length>0&&V.every(Q=>Q.type.name==="tableHeader")}function K(L){const D=R(L);return D.length>0&&D.every(V=>{var Q;return((Q=V.firstChild)==null?void 0:Q.type.name)==="tableHeader"})}function q(L){const D=se();return D?L.id==="TOGGLE_TABLE_HEADER_ROW"?Y(D):L.id==="TOGGLE_TABLE_HEADER_COL"?K(D):!1:!1}function U(L){ge(L)||ve(L)||(n("convert",L.id),n("close"))}function te(L){n("convert",L),ne()}function J(){r.blockTargetPos!==null&&(n("comment"),n("close"))}return(L,D)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[t.visible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-block-menu-wrapper",onClick:D[8]||(D[8]=a.withModifiers(()=>{},["stop"])),onMousedown:D[9]||(D[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",{class:"pagely-block-menu",style:a.normalizeStyle(X.value),"data-placement":t.placement,onMouseenter:D[0]||(D[0]=V=>L.$emit("menu-enter")),onMouseleave:D[1]||(D[1]=V=>N(V))},[a.createElementVNode("div",Df,[r.enableComment?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass(["pagely-menu-item",{"pagely-disabled":r.blockTargetPos===null}]),disabled:r.blockTargetPos===null,onClick:J},[a.createElementVNode("span",Rf,[a.createVNode(a.unref(I.MessageSquare),{size:16,"stroke-width":1.5})]),D[10]||(D[10]=a.createElementVNode("span",{class:"pagely-item-label"},"评论",-1))],10,Hf)):a.createCommentVNode("",!0),r.enableComment&&ce.value.length>0?(a.openBlock(),a.createElementBlock("div",Pf)):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ce.value,(V,Q)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:Q},[V.style==="tiles"?(a.openBlock(),a.createElementBlock("div",Of,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(V.items,le=>(a.openBlock(),a.createElementBlock("button",{key:le.id,class:a.normalizeClass(["pagely-menu-tile",{"pagely-current":t.blockInfo.currentTypeIds.includes(le.id)}]),title:le.label,onClick:be=>te(le.id)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(le.icon),{size:18,"stroke-width":1.5}))],10,Vf))),128))])):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[V.label?(a.openBlock(),a.createElementBlock("div",$f,a.toDisplayString(V.label),1)):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(V.items,le=>(a.openBlock(),a.createElementBlock("button",{key:le.id,class:a.normalizeClass(["pagely-menu-item",{"pagely-danger":le.danger,"pagely-disabled":ve(le),"pagely-active":q(le),"pagely-has-submenu":ge(le),"pagely-submenu-open":a.unref(k)===le.id,"pagely-item-hover-preview":f.value===le.id}]),disabled:ve(le),onClick:be=>U(le),onMouseenter:be=>B(le,be),onMouseleave:z},[a.createElementVNode("span",qf,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(le.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",Uf,a.toDisplayString(le.label),1),le.toggle?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["pagely-item-toggle",{"pagely-item-toggle-on":q(le)}]),"aria-hidden":"true"},[...D[11]||(D[11]=[a.createElementVNode("span",{class:"pagely-item-toggle-thumb"},null,-1)])],2)):a.createCommentVNode("",!0),ge(le)?(a.openBlock(),a.createElementBlock("span",_f,"›")):a.createCommentVNode("",!0)],42,Ff))),128))],64)),Q<ce.value.length-1?(a.openBlock(),a.createElementBlock("div",Wf)):a.createCommentVNode("",!0)],64))),128))])],44,zf),S.value.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-block-submenu",style:a.normalizeStyle(a.unref(re)),"data-placement":"right",onMouseenter:D[2]||(D[2]=(...V)=>a.unref(w).onPanelMouseEnter&&a.unref(w).onPanelMouseEnter(...V)),onMouseleave:D[3]||(D[3]=V=>H(V))},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.value,V=>(a.openBlock(),a.createElementBlock("button",{key:V.id,class:a.normalizeClass(["pagely-menu-item",{"pagely-danger":V.danger,"pagely-disabled":ve(V),"pagely-active":q(V)}]),disabled:ve(V),onClick:Q=>U(V)},[a.createElementVNode("span",Kf,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(V.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",Yf,a.toDisplayString(V.label),1),V.toggle?(a.openBlock(),a.createElementBlock("span",{key:0,class:a.normalizeClass(["pagely-item-toggle",{"pagely-item-toggle-on":q(V)}]),"aria-hidden":"true"},[...D[12]||(D[12]=[a.createElementVNode("span",{class:"pagely-item-toggle-thumb"},null,-1)])],2)):a.createCommentVNode("",!0)],10,Gf))),128))],36)):a.createCommentVNode("",!0),T.value==="color"?(a.openBlock(),a.createElementBlock("div",{key:1,class:"pagely-block-color-side",style:a.normalizeStyle(a.unref(re)),"data-placement":"right",onMouseenter:D[4]||(D[4]=(...V)=>a.unref(w).onPanelMouseEnter&&a.unref(w).onPanelMouseEnter(...V)),onMouseleave:D[5]||(D[5]=V=>H(V))},[a.createVNode(Ci,{"current-font-color":i.value,"current-bg-color":s.value,onApplyFontColor:c,onApplyBgColor:m,onReset:p},null,8,["current-font-color","current-bg-color"])],36)):a.createCommentVNode("",!0),M.value?(a.openBlock(),a.createElementBlock("div",{key:2,class:"pagely-hover-preview",style:a.normalizeStyle(ae.value),"data-placement":"right",onMouseenter:D[6]||(D[6]=V=>g.value=!0),onMouseleave:D[7]||(D[7]=V=>G(V))},[D[13]||(D[13]=a.createElementVNode("span",{class:"pagely-preview-thumb"},[a.createElementVNode("svg",{viewBox:"0 0 212 100",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a.createElementVNode("line",{x1:"48",y1:"26",x2:"86",y2:"26",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"126",y1:"26",x2:"164",y2:"26",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"106",y1:"42",x2:"106",y2:"58",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"106",y1:"74",x2:"106",y2:"86",stroke:"#c4c7cc","stroke-width":"1.2"}),a.createElementVNode("line",{x1:"66",y1:"82",x2:"106",y2:"82",stroke:"#c4c7cc","stroke-width":"1.2","stroke-dasharray":"3 2"}),a.createElementVNode("rect",{x:"10",y:"14",width:"38",height:"24",rx:"4",fill:"#e8f5e9",stroke:"#66bb6a","stroke-width":"1.2"}),a.createElementVNode("text",{x:"29",y:"30","text-anchor":"middle",fill:"#2e7d32","font-size":"8","font-weight":"500"},"Data"),a.createElementVNode("circle",{cx:"106",cy:"26",r:"16",fill:"#ede7f6",stroke:"#9575cd","stroke-width":"1.2"}),a.createElementVNode("text",{x:"106",y:"29","text-anchor":"middle",fill:"#5e35b1","font-size":"7","font-weight":"500"},"Open"),a.createElementVNode("polygon",{points:"164,10 180,26 164,42 148,26",fill:"#fff8e1",stroke:"#ffb300","stroke-width":"1.2"}),a.createElementVNode("text",{x:"164",y:"29","text-anchor":"middle",fill:"#e65100","font-size":"7","font-weight":"500"},"?"),a.createElementVNode("rect",{x:"10",y:"58",width:"38",height:"24",rx:"4",fill:"#e3f2fd",stroke:"#42a5f5","stroke-width":"1.2"}),a.createElementVNode("text",{x:"29",y:"74","text-anchor":"middle",fill:"#1565c0","font-size":"8","font-weight":"500"},"Yes"),a.createElementVNode("circle",{cx:"106",cy:"70",r:"16",fill:"#fce4ec",stroke:"#ef5350","stroke-width":"1.2"}),a.createElementVNode("text",{x:"106",y:"73","text-anchor":"middle",fill:"#c62828","font-size":"7","font-weight":"500"},"No"),a.createElementVNode("rect",{x:"148",y:"58",width:"44",height:"24",rx:"4",fill:"#fff3e0",stroke:"#ff9800","stroke-width":"1.2"}),a.createElementVNode("text",{x:"170",y:"74","text-anchor":"middle",fill:"#e65100","font-size":"8","font-weight":"500"},"Action")])],-1)),a.createElementVNode("span",jf,[a.createElementVNode("span",Xf,a.toDisplayString(M.value.label),1),a.createElementVNode("span",Jf,a.toDisplayString(M.value.description),1)])],36)):a.createCommentVNode("",!0)],32)):a.createCommentVNode("",!0)]))}}),Ti=at(e4,[["__scopeId","data-v-057a6f90"]]),t4={class:"pagely-link-dialog-head"},r4={class:"pagely-link-dialog-actions"},n4=["disabled"],a4=a.defineComponent({__name:"InsertLinkDialog",props:{open:{type:Boolean}},emits:["close","confirm"],setup(t,{emit:e}){const r=t,n=e,o=Math.random().toString(36).slice(2,9),l=`pagely-insert-${o}-link-text`,i=`pagely-insert-${o}-link-href`,s=a.ref(""),c=a.ref(""),m=a.ref(null),p=a.computed(()=>c.value.trim().length>0);a.watch(()=>r.open,b=>{b&&(s.value="",c.value="",a.nextTick(()=>{var v;return(v=m.value)==null?void 0:v.focus({preventScroll:!0})}))});function f(b){const v=b.trim();return v?/^(https?:|mailto:|tel:|#|\/)/i.test(v)?v:`https://${v}`:""}function g(){const b=f(c.value);b&&n("confirm",{text:s.value.trim()||b,href:b})}return(b,v)=>t.open?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-insert-link-dialog-backdrop",onMousedown:v[6]||(v[6]=a.withModifiers(w=>n("close"),["self"]))},[a.createElementVNode("form",{class:"pagely-insert-link-dialog",role:"dialog","aria-modal":"true","aria-label":"插入链接",onSubmit:a.withModifiers(g,["prevent"])},[a.createElementVNode("div",t4,[v[7]||(v[7]=a.createElementVNode("span",null,"插入链接",-1)),a.createElementVNode("button",{type:"button",class:"pagely-link-dialog-icon-btn","aria-label":"关闭",onClick:v[0]||(v[0]=w=>n("close"))},[a.createVNode(a.unref(I.X),{size:16,"stroke-width":1.8})])]),a.createElementVNode("label",{class:"pagely-link-field",for:l},[v[8]||(v[8]=a.createElementVNode("span",null,"文本",-1)),a.withDirectives(a.createElementVNode("input",{id:l,ref_key:"textInputEl",ref:m,"onUpdate:modelValue":v[1]||(v[1]=w=>s.value=w),name:l,type:"text",autocomplete:"off",onKeydown:v[2]||(v[2]=a.withKeys(a.withModifiers(w=>n("close"),["prevent"]),["esc"]))},null,544),[[a.vModelText,s.value]])]),a.createElementVNode("label",{class:"pagely-link-field",for:i},[v[9]||(v[9]=a.createElementVNode("span",null,"链接",-1)),a.withDirectives(a.createElementVNode("input",{id:i,"onUpdate:modelValue":v[3]||(v[3]=w=>c.value=w),name:i,type:"text",autocomplete:"off",onKeydown:v[4]||(v[4]=a.withKeys(a.withModifiers(w=>n("close"),["prevent"]),["esc"]))},null,544),[[a.vModelText,c.value]])]),a.createElementVNode("div",r4,[a.createElementVNode("button",{type:"button",class:"pagely-link-secondary",onClick:v[5]||(v[5]=w=>n("close"))},"取消"),a.createElementVNode("button",{type:"submit",class:"pagely-link-primary",disabled:!p.value},"插入",8,n4)])],32)],32)):a.createCommentVNode("",!0)}}),o4=at(a4,[["__scopeId","data-v-0af66664"]]),l4={class:"pagely-table-picker"},i4={class:"pagely-picker-head"},s4={key:0},u4=["aria-label","onMouseenter","onClick"],c4=a.defineComponent({inheritAttrs:!0,__name:"TableSizePicker",props:{maxRows:{default:8},maxCols:{default:10}},emits:["pick"],setup(t,{emit:e}){const r=t,n=e,o=a.ref(0),l=a.ref(0),i=a.computed(()=>{const p=[];for(let f=1;f<=r.maxRows;f+=1)for(let g=1;g<=r.maxCols;g+=1)p.push({key:`${f}-${g}`,row:f,col:g});return p});function s(p,f){o.value=p,l.value=f}function c(){o.value=0,l.value=0}function m(p,f){n("pick",{rows:p,cols:f})}return(p,f)=>(a.openBlock(),a.createElementBlock("div",l4,[a.createElementVNode("div",i4,[f[0]||(f[0]=a.createElementVNode("span",null,"插入支持富文本的表格",-1)),o.value>0?(a.openBlock(),a.createElementBlock("span",s4,a.toDisplayString(o.value)+" x "+a.toDisplayString(l.value),1)):a.createCommentVNode("",!0)]),a.createElementVNode("div",{class:"pagely-picker-grid",onMouseleave:c},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(i.value,g=>(a.openBlock(),a.createElementBlock("button",{key:g.key,class:a.normalizeClass(["pagely-picker-cell",{"pagely-active":g.row<=o.value&&g.col<=l.value}]),type:"button","aria-label":`插入 ${g.row} 行 ${g.col} 列表格`,onMouseenter:b=>s(g.row,g.col),onClick:b=>m(g.row,g.col)},null,42,u4))),128))],32)]))}}),Ei=at(c4,[["__scopeId","data-v-5f091973"]]),d4=["data-placement"],m4={class:"pagely-menu-scroll"},f4={key:0,class:"pagely-menu-section-label"},p4={key:1,class:"pagely-menu-tiles"},h4=["title","onClick"],v4=["onMouseenter"],g4={class:"pagely-item-icon"},b4={class:"pagely-item-label"},y4=["accept"],w4=["onMouseenter"],k4={class:"pagely-item-icon"},x4={class:"pagely-item-label"},C4=["accept"],T4=["onClick","onMouseenter"],E4={class:"pagely-item-icon"},M4={class:"pagely-item-label"},S4={key:0,class:"pagely-submenu-arrow"},A4={key:3,class:"pagely-menu-divider"},B4=336,L4=a.defineComponent({__name:"InsertMenu",props:{visible:{type:Boolean},menuTop:{},menuLeft:{},placement:{},editor:{},sections:{},fileUploadHandler:{type:Function}},emits:["close","menu-enter","menu-leave","insert","cell-op"],setup(t,{emit:e}){const r=t,n=e,o=Math.random().toString(36).slice(2,9),l=`pagely-insert-${o}-image-file`,i=`pagely-insert-${o}-doc-file`,s=E0({visible:()=>r.visible,rootSelector:".pagely-block-menu",estimatedHeight:()=>B4,fallbackTop:()=>r.menuTop,fallbackLeft:()=>r.menuLeft+St}),c=s.rootId;a.watch(()=>r.visible,R=>{R&&(c.value=null,s.close())});const m=a.computed(()=>({position:"fixed",top:`${r.menuTop}px`,left:`${r.menuLeft}px`,zIndex:"300","--pagely-menu-panel-width":`${St}px`,"--menu-enter-translate":zo(r.placement)})),p=a.computed(()=>{if(!c.value)return null;for(const R of r.sections){const Y=R.items.find(K=>K.id===c.value);if(Y&&!kt(Y))return Y}return null}),f=a.computed(()=>{var R;return((R=p.value)==null?void 0:R.picker)??null}),g=s.style,b=a.ref(!1),{imageAccept:v,onImageFileClick:w,onImageFileChange:k}=Lm({onBeforeSelect:ne,uploadHandler:r.fileUploadHandler,onInsert:R=>B("IMAGE",R)}),{fileAccept:T,onDocFileClick:M,onDocFileChange:E}=Nm({onBeforeSelect:ne,uploadHandler:R=>{var Y;return((Y=r.fileUploadHandler)==null?void 0:Y.call(r,R))??G0(R)},onInsert:R=>B("FILE",R)});function S(R){n("insert",R),n("close")}function B(R,Y){n("insert",R,Y),n("close")}function z(R){kt(R)||S(R.id)}function F(R){if(kt(R)){n("cell-op",R.id),n("close");return}if(R.id==="LINK"){ge();return}re(R)||S(R.id)}function P(R,Y){if(s.clearCloseTimer(),kt(R)){ne();return}if(!re(R)){ne();return}c.value=R.id,s.open(R.id,Y)}function N(){s.scheduleClose()}function H(){s.onPanelMouseEnter()}function G(R){var K;s.onPanelMouseLeave();const Y=R.relatedTarget;(K=Y==null?void 0:Y.closest)!=null&&K.call(Y,".pagely-block-menu")||n("menu-leave")}function X(R){n("insert","TABLE",R),n("close")}function ae(R){var K,q;const Y=R.relatedTarget;(K=Y==null?void 0:Y.closest)!=null&&K.call(Y,".pagely-insert-picker")||(q=Y==null?void 0:Y.closest)!=null&&q.call(Y,".pagely-insert-link-dialog-backdrop")||(ne(),n("menu-leave"))}function re(R){return!kt(R)&&R.picker!==void 0}function ce(R){return kt(R)&&R.danger===!0}function ne(){c.value=null,s.close()}function ge(){ne(),b.value=!0}function ve(){b.value=!1}function se(R){B("LINK",R),ve()}return(R,Y)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[t.visible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"pagely-block-menu-wrapper pagely-insert-menu",onClick:Y[7]||(Y[7]=a.withModifiers(()=>{},["stop"])),onMousedown:Y[8]||(Y[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",{class:"pagely-block-menu",style:a.normalizeStyle(m.value),"data-placement":t.placement,onMouseenter:Y[4]||(Y[4]=K=>R.$emit("menu-enter")),onMouseleave:Y[5]||(Y[5]=K=>ae(K))},[a.createElementVNode("div",m4,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.sections,(K,q)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:K.label},[K.label?(a.openBlock(),a.createElementBlock("div",f4,a.toDisplayString(K.label),1)):a.createCommentVNode("",!0),K.style==="tiles"?(a.openBlock(),a.createElementBlock("div",p4,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(K.items,U=>(a.openBlock(),a.createElementBlock("button",{key:U.id,class:"pagely-menu-tile",title:U.label,onMouseenter:ne,onClick:te=>z(U)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(U.icon),{size:18,"stroke-width":1.5}))],40,h4))),128))])):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:2},a.renderList(K.items,U=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:U.id},[!a.unref(kt)(U)&&U.id==="IMAGE"?(a.openBlock(),a.createElementBlock("label",{key:0,class:"pagely-menu-item pagely-insert-image-item",for:l,onClick:ne,onMouseenter:te=>P(U,te),onMouseleave:N},[a.createElementVNode("span",g4,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(U.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",b4,a.toDisplayString(U.label),1),a.createElementVNode("input",{id:l,name:l,class:"pagely-insert-file-input",type:"file",accept:a.unref(v),"aria-label":"图片",onClick:Y[0]||(Y[0]=(...te)=>a.unref(w)&&a.unref(w)(...te)),onChange:Y[1]||(Y[1]=(...te)=>a.unref(k)&&a.unref(k)(...te))},null,40,y4)],40,v4)):!a.unref(kt)(U)&&U.id==="FILE"?(a.openBlock(),a.createElementBlock("label",{key:1,class:"pagely-menu-item pagely-insert-file-item",for:i,onClick:ne,onMouseenter:te=>P(U,te),onMouseleave:N},[a.createElementVNode("span",k4,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(U.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",x4,a.toDisplayString(U.label),1),a.createElementVNode("input",{id:i,name:i,class:"pagely-insert-file-input",type:"file",accept:a.unref(T),"aria-label":"文件",onClick:Y[2]||(Y[2]=(...te)=>a.unref(M)&&a.unref(M)(...te)),onChange:Y[3]||(Y[3]=(...te)=>a.unref(E)&&a.unref(E)(...te))},null,40,C4)],40,w4)):(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass(["pagely-menu-item",{"pagely-danger":ce(U),"pagely-submenu-open":a.unref(c)===U.id}]),onClick:te=>F(U),onMouseenter:te=>P(U,te),onMouseleave:N},[a.createElementVNode("span",E4,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(U.icon),{size:16,"stroke-width":1.5}))]),a.createElementVNode("span",M4,a.toDisplayString(U.label),1),re(U)?(a.openBlock(),a.createElementBlock("span",S4,"›")):a.createCommentVNode("",!0)],42,T4))],64))),128)),q<t.sections.length-1?(a.openBlock(),a.createElementBlock("div",A4)):a.createCommentVNode("",!0)],64))),128))])],44,d4),f.value==="table"?(a.openBlock(),a.createBlock(Ei,{key:0,class:"pagely-insert-picker",style:a.normalizeStyle(a.unref(g)),"data-placement":"right",onPick:X,onMouseenter:H,onMouseleave:Y[6]||(Y[6]=K=>G(K))},null,8,["style"])):a.createCommentVNode("",!0),a.createVNode(o4,{open:b.value,onConfirm:se,onClose:ve},null,8,["open"])],32)):a.createCommentVNode("",!0)]))}}),K0=at(L4,[["__scopeId","data-v-aff29b49"]]);function Y0(t=wr){const e=a.ref(!1);let r=null;function n(){r&&(clearTimeout(r),r=null)}function o(){n(),e.value=!0}function l(){n(),e.value=!1}function i(){n(),r=setTimeout(()=>{e.value=!1,r=null},t)}return a.onBeforeUnmount(n),{isOpen:e,open:o,close:l,scheduleClose:i,clearCloseTimer:n}}const N4={class:"table-action-btn",type:"button","aria-label":"表格操作"},I4=a.defineComponent({__name:"TableActionMenu",props:{tableBounds:{},hasHeaderRow:{type:Boolean},hasHeaderCol:{type:Boolean},keepAlive:{type:Function},scheduleHide:{type:Function}},emits:["comment","cutTable","copyTable","toggleHeaderRow","toggleHeaderCol","deleteTable"],setup(t,{emit:e}){const r=t,n=e,o=Y0(),l=o.isOpen;function i(){r.keepAlive(),o.open()}function s(T){var E;const M=T.relatedTarget;(E=M==null?void 0:M.closest)!=null&&E.call(M,".tt-dropdown-right")||(o.scheduleClose(),r.scheduleHide())}function c(){r.keepAlive(),o.clearCloseTimer()}function m(T){var E;const M=T.relatedTarget;(E=M==null?void 0:M.closest)!=null&&E.call(M,".table-action-wrap")||(o.scheduleClose(),r.scheduleHide())}function p(){o.close()}function f(T){var M;p(),n("comment",((M=T.currentTarget)==null?void 0:M.getBoundingClientRect())??null)}function g(){p(),n("cutTable")}function b(){p(),n("copyTable")}function v(){p(),n("toggleHeaderRow")}function w(){p(),n("toggleHeaderCol")}function k(){p(),n("deleteTable")}return(T,M)=>(a.openBlock(),a.createElementBlock("div",{class:"table-tools-overlay table-action-wrap",style:a.normalizeStyle({position:"fixed",top:`${t.tableBounds.top-12}px`,left:`${t.tableBounds.left-12}px`,zIndex:"182"}),onMouseenter:i,onMouseleave:M[1]||(M[1]=E=>s(E))},[a.createElementVNode("button",N4,[a.createVNode(a.unref(I.LayoutGrid),{size:13,"stroke-width":1.8})]),a.unref(l)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"tt-dropdown tt-dropdown-right",onMouseenter:c,onMouseleave:M[0]||(M[0]=E=>m(E))},[a.createElementVNode("button",{class:"tt-item",type:"button",onClick:a.withModifiers(f,["stop"])},[a.createVNode(a.unref(I.MessageSquare),{size:15,"stroke-width":1.5}),M[2]||(M[2]=a.createElementVNode("span",null,"评论",-1))]),a.createElementVNode("button",{class:"tt-item",type:"button",onClick:a.withModifiers(g,["stop"])},[a.createVNode(a.unref(I.Scissors),{size:15,"stroke-width":1.5}),M[3]||(M[3]=a.createElementVNode("span",null,"剪切",-1))]),a.createElementVNode("button",{class:"tt-item",type:"button",onClick:a.withModifiers(b,["stop"])},[a.createVNode(a.unref(I.Copy),{size:15,"stroke-width":1.5}),M[4]||(M[4]=a.createElementVNode("span",null,"复制",-1))]),M[10]||(M[10]=a.createElementVNode("div",{class:"tt-divider"},null,-1)),a.createElementVNode("div",{class:"tt-toggle-row",onClick:a.withModifiers(v,["stop"])},[a.createVNode(a.unref(I.Rows3),{size:15,"stroke-width":1.5}),M[6]||(M[6]=a.createElementVNode("span",null,"标题行",-1)),a.createElementVNode("div",{class:a.normalizeClass(["tt-toggle",{"tt-toggle-on":t.hasHeaderRow}])},[...M[5]||(M[5]=[a.createElementVNode("div",{class:"tt-toggle-thumb"},null,-1)])],2)]),a.createElementVNode("div",{class:"tt-toggle-row",onClick:a.withModifiers(w,["stop"])},[a.createVNode(a.unref(I.Columns3),{size:15,"stroke-width":1.5}),M[8]||(M[8]=a.createElementVNode("span",null,"标题列",-1)),a.createElementVNode("div",{class:a.normalizeClass(["tt-toggle",{"tt-toggle-on":t.hasHeaderCol}])},[...M[7]||(M[7]=[a.createElementVNode("div",{class:"tt-toggle-thumb"},null,-1)])],2)]),M[11]||(M[11]=a.createElementVNode("div",{class:"tt-divider"},null,-1)),a.createElementVNode("button",{class:"tt-item tt-danger",type:"button",onClick:a.withModifiers(k,["stop"])},[a.createVNode(a.unref(I.Trash2),{size:15,"stroke-width":1.5}),M[9]||(M[9]=a.createElementVNode("span",null,"删除",-1))])],32)):a.createCommentVNode("",!0)],36))}}),z4=at(I4,[["__scopeId","data-v-3191f26f"]]),D4=["title","aria-label"],H4=["onClick"],R4=a.defineComponent({__name:"ColAlignBadge",props:{align:{},colIndex:{},x:{},y:{},keepAlive:{type:Function},scheduleHide:{type:Function}},emits:["change"],setup(t,{emit:e}){const r=[{label:"左对齐",value:"left",icon:I.AlignLeft},{label:"居中",value:"center",icon:I.AlignCenter},{label:"右对齐",value:"right",icon:I.AlignRight}],n=t,o=e,l=Y0(),i=l.isOpen,s=a.computed(()=>n.align??"left"),c=a.computed(()=>s.value==="center"?I.AlignCenter:s.value==="right"?I.AlignRight:I.AlignLeft),m=a.computed(()=>{var w;return((w=r.find(k=>k.value===s.value))==null?void 0:w.label)??"左对齐"});function p(){n.keepAlive(),l.open()}function f(w){var T;const k=w.relatedTarget;(T=k==null?void 0:k.closest)!=null&&T.call(k,".col-align-popover")||(l.scheduleClose(),n.scheduleHide())}function g(){n.keepAlive(),l.clearCloseTimer()}function b(w){var T;const k=w.relatedTarget;(T=k==null?void 0:k.closest)!=null&&T.call(k,".col-align-badge-wrap")||(l.scheduleClose(),n.scheduleHide())}function v(w){n.keepAlive(),o("change",w,n.colIndex),l.close()}return(w,k)=>(a.openBlock(),a.createElementBlock("div",{class:"table-tools-overlay col-align-badge-wrap",style:a.normalizeStyle({position:"fixed",left:`${t.x-9}px`,top:`${t.y-9}px`,zIndex:"181"}),onMouseenter:p,onMouseleave:f},[a.createElementVNode("button",{class:a.normalizeClass(["col-align-badge",{"col-align-badge--active":a.unref(i)||t.align!==null}]),type:"button",title:`列对齐:${m.value}`,"aria-label":`列对齐:${m.value}`},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(c.value),{size:13,"stroke-width":1.8}))],10,D4),a.unref(i)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"col-align-popover",onMouseenter:g,onMouseleave:b},[(a.openBlock(),a.createElementBlock(a.Fragment,null,a.renderList(r,T=>a.createElementVNode("button",{key:T.label,class:a.normalizeClass(["tt-item",{"tt-toggle-on":s.value===T.value}]),type:"button",onClick:a.withModifiers(M=>v(T.value),["stop"])},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(T.icon),{size:15,"stroke-width":1.5})),a.createElementVNode("span",null,a.toDisplayString(T.label),1)],10,H4)),64))],32)):a.createCommentVNode("",!0)],36))}}),P4=at(R4,[["__scopeId","data-v-e7a7604f"]]),O4=["onClick"],V4=["onClick"],$4=24,F4=13,Eo=20,Mo=20,q4=a.defineComponent({__name:"TableTools",props:{tableVisible:{type:Boolean},tableBounds:{},rowDots:{},colDots:{},colAlignDots:{},hoveredCellBounds:{},hasHeaderRow:{type:Boolean},hasHeaderCol:{type:Boolean},keepAlive:{type:Function},scheduleHide:{type:Function},insertRowAt:{type:Function},insertColAt:{type:Function},setColumnAlign:{type:Function}},emits:["comment","cutTable","copyTable","toggleHeaderRow","toggleHeaderCol","deleteTable","cellOp","cellInsert","cellComment"],setup(t,{emit:e}){const r=Mo/2,n=t,o=e,l=Y0(),i=l.isOpen;function s(v,w){n.setColumnAlign(v,w)}function c(){n.keepAlive(),l.open()}function m(v){var k;const w=v.relatedTarget;(k=w==null?void 0:w.closest)!=null&&k.call(w,".pagely-insert-menu")||(l.scheduleClose(),n.scheduleHide())}function p(){n.keepAlive(),l.clearCloseTimer()}function f(){l.scheduleClose(),n.scheduleHide()}function g(v){if(l.close(),v==="COMMENT"){const w=n.hoveredCellBounds;o("cellComment",w?new DOMRect(w.left,w.top,w.width,w.height):null);return}o("cellInsert",v)}function b(v){l.close(),o("cellOp",v)}return(v,w)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[t.tableVisible?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.rowDots,(k,T)=>(a.openBlock(),a.createElementBlock("div",{key:"r"+T,class:"table-tools-overlay ins-wrap ins-row",style:a.normalizeStyle({position:"fixed",top:k.pos-10+"px",left:t.tableBounds.left-20+"px",zIndex:"180"}),onMouseenter:w[0]||(w[0]=(...M)=>t.keepAlive&&t.keepAlive(...M)),onMouseleave:w[1]||(w[1]=(...M)=>t.scheduleHide&&t.scheduleHide(...M)),onClick:a.withModifiers(M=>t.insertRowAt(k.index),["stop"])},[...w[13]||(w[13]=[a.createElementVNode("div",{class:"ins-pill ins-pill-h"},[a.createElementVNode("div",{class:"ins-dot"}),a.createElementVNode("span",{class:"ins-label"},"插入行")],-1)])],44,O4))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.colDots,(k,T)=>(a.openBlock(),a.createElementBlock("div",{key:"c"+T,class:"table-tools-overlay ins-wrap ins-col",style:a.normalizeStyle({position:"fixed",left:k.pos-10+"px",top:t.tableBounds.top-20+"px",zIndex:"180"}),onMouseenter:w[2]||(w[2]=(...M)=>t.keepAlive&&t.keepAlive(...M)),onMouseleave:w[3]||(w[3]=(...M)=>t.scheduleHide&&t.scheduleHide(...M)),onClick:a.withModifiers(M=>t.insertColAt(k.index),["stop"])},[...w[14]||(w[14]=[a.createElementVNode("div",{class:"ins-pill ins-pill-v"},[a.createElementVNode("div",{class:"ins-dot"}),a.createElementVNode("span",{class:"ins-label"},"插入列")],-1)])],44,V4))),128)),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.colAlignDots,k=>(a.openBlock(),a.createBlock(P4,{key:"ca"+k.colIndex,align:k.align,"col-index":k.colIndex,x:k.pos,y:k.y,"keep-alive":t.keepAlive,"schedule-hide":t.scheduleHide,onChange:s},null,8,["align","col-index","x","y","keep-alive","schedule-hide"]))),128)),a.createVNode(z4,{"table-bounds":t.tableBounds,"has-header-row":t.hasHeaderRow,"has-header-col":t.hasHeaderCol,"keep-alive":t.keepAlive,"schedule-hide":t.scheduleHide,onComment:w[4]||(w[4]=k=>o("comment",k)),onCutTable:w[5]||(w[5]=k=>o("cutTable")),onCopyTable:w[6]||(w[6]=k=>o("copyTable")),onToggleHeaderRow:w[7]||(w[7]=k=>o("toggleHeaderRow")),onToggleHeaderCol:w[8]||(w[8]=k=>o("toggleHeaderCol")),onDeleteTable:w[9]||(w[9]=k=>o("deleteTable"))},null,8,["table-bounds","has-header-row","has-header-col","keep-alive","schedule-hide"]),t.hoveredCellBounds?(a.openBlock(),a.createElementBlock("div",{key:0,class:"table-tools-overlay table-cell-wrap",style:a.normalizeStyle({position:"fixed",top:t.hoveredCellBounds.top+t.hoveredCellBounds.height/2-r+"px",left:t.hoveredCellBounds.left-Eo+"px",width:`${Eo}px`,height:`${Mo}px`,zIndex:"182"}),onMouseenter:w[10]||(w[10]=(...k)=>t.keepAlive&&t.keepAlive(...k)),onMouseleave:w[11]||(w[11]=k=>m(k))},[a.createElementVNode("button",{class:"table-cell-btn",type:"button","aria-label":"单元格操作",onMouseenter:c},[a.createVNode(a.unref(I.Plus),{size:13,"stroke-width":2})],32)],36)):a.createCommentVNode("",!0),a.unref(i)&&t.hoveredCellBounds?(a.openBlock(),a.createBlock(K0,{key:1,visible:a.unref(i),sections:a.unref(jo),"menu-top":t.hoveredCellBounds.top+t.hoveredCellBounds.height/2-F4,"menu-left":t.hoveredCellBounds.left-$4-a.unref(tn)-a.unref(St),placement:"left",editor:void 0,onClose:w[12]||(w[12]=k=>a.unref(l).close()),onMenuEnter:p,onMenuLeave:f,onInsert:g,onCellOp:b},null,8,["visible","sections","menu-top","menu-left"])):a.createCommentVNode("",!0)],64)):a.createCommentVNode("",!0)]))}}),Mi=at(q4,[["__scopeId","data-v-a8378ff3"]]);function Si(t,e){const r=t.schema.marks.link;if(!r)return null;const n=[];if(t.doc.descendants((i,s)=>{if(!i.isText)return;i.marks.find(m=>m.type===r&&m.attrs.href===e)&&n.push({from:s,to:s+i.nodeSize})}),!n.length)return null;const o=n[0];let l=o.to;for(let i=1;i<n.length&&n[i].from===l;i++)l=n[i].to;return{from:o.from,to:l}}function So(t,e){const r=t.schema.marks.link;if(!r)return null;let n=null;return t.doc.descendants((o,l)=>{if(n)return!1;if(o.type.name!=="paragraph")return!0;let i="",s=!1,c=!0;return o.descendants(m=>{if(!c)return!1;if(!m.isText)return c=!1,!1;const p=m.text??"";return m.marks.find(g=>g.type===r&&g.attrs.href===e)?(s=!0,i+=p,!0):(p.trim().length>0&&(c=!1),i+=p,!0)}),!c||!s||i.trim().length===0||(n={from:l,to:l+o.nodeSize,text:i.trim()}),!1}),n}function e0(t,e,r){const n=t.state,o=n.schema.marks.link;if(!o)return!1;const l=[];if(n.doc.descendants((c,m)=>{if(!c.isText)return;const p=c.marks.find(f=>f.type===o&&f.attrs.href===e);p&&l.push({from:m,to:m+c.nodeSize,mark:p})}),!l.length)return!1;const i=l[0];let s=i.to;for(let c=1;c<l.length&&l[c].from===s;c++)s=l[c].to;return t.view.dispatch(n.tr.replaceWith(i.from,s,n.schema.text(r,[i.mark]))),!0}function U4(t,e,r){const n=Si(t.state,e);return n?(t.view.dispatch(t.state.tr.replaceWith(n.from,n.to,t.state.schema.text(r))),!0):!1}function _4(t,e,r){const n=t.state,o=n.schema.marks.link;if(!o)return!1;const l=Si(n,e);if(!l)return!1;const i=o.create({href:r,target:"_blank"}),s=n.tr.removeMark(l.from,l.to,o).addMark(l.from,l.to,i);return t.view.dispatch(s),!0}const W4=["title"],G4=["title"],K4={class:"wl-view-menu"},Y4=["onKeydown"],j4=a.defineComponent({__name:"LinkToolbar",props:{editor:{}},setup(t,{expose:e}){const r=t,n=a.ref(!1),o=a.ref(""),l=a.ref(""),i=a.ref({}),s=a.ref(null),c=a.ref(!1),m=a.ref(""),p=a.ref(null),f=a.ref(!1),g=a.ref(null),b=a.ref(!1);let v=null;const w=a.computed(()=>o.value.length>38?o.value.slice(0,35)+"...":o.value),k=a.computed(()=>l.value===o.value?"link":"title"),T=a.computed(()=>r.editor?So(r.editor.state,o.value)!==null:!1),M=a.computed(()=>T.value&&gr(o.value,l.value));function E(se,R,Y){v&&(clearTimeout(v),v=null),o.value=se,l.value=R,c.value=!1,f.value=!1,B(Y),n.value=!0}function S(se=!1){if(se){v&&(clearTimeout(v),v=null),n.value=!1,c.value=!1,f.value=!1;return}v&&clearTimeout(v),v=setTimeout(()=>{b.value||(n.value=!1,c.value=!1,f.value=!1),v=null},200)}function B(se){const K=se.top<56?se.bottom+4:se.top-44-4;i.value={top:`${K}px`,left:`${se.left}px`}}function z(){b.value=!0,v&&(clearTimeout(v),v=null)}function F(){b.value=!1,S()}function P(se){var R;f.value&&!((R=g.value)!=null&&R.contains(se.target))&&(f.value=!1)}a.onMounted(()=>document.addEventListener("click",P)),a.onBeforeUnmount(()=>{document.removeEventListener("click",P),v&&clearTimeout(v),G&&clearTimeout(G)});function N(){window.open(o.value,"_blank","noopener,noreferrer")}const H=a.ref(!1);let G=null;async function X(){try{await navigator.clipboard.writeText(o.value)}catch{const se=document.createElement("textarea");se.value=o.value,se.style.cssText="position:fixed;opacity:0",document.body.appendChild(se),se.select(),document.execCommand("copy"),document.body.removeChild(se)}H.value=!0,G&&clearTimeout(G),G=setTimeout(()=>{H.value=!1},1500)}function ae(){r.editor&&(U4(r.editor,o.value,l.value),He.unpin(o.value),S(!0))}function re(){m.value=o.value,c.value=!0,a.nextTick(()=>{var se;return(se=p.value)==null?void 0:se.select()})}function ce(){const se=m.value.trim();se&&r.editor&&(_4(r.editor,o.value,se),o.value=se),c.value=!1}function ne(){c.value=!1}function ge(se){if(r.editor){if(se==="link")He.pin(o.value),e0(r.editor,o.value,o.value),l.value=o.value;else{He.unpin(o.value);const R=He.getTitle(o.value);R?(e0(r.editor,o.value,R),l.value=R):He.hasTitle(o.value)||(e0(r.editor,o.value,o.value),l.value=o.value)}f.value=!1}}function ve(se){const R=r.editor;if(!R||se==="preview"&&!gr(o.value,l.value))return;const Y=So(R.state,o.value);if(!Y)return;const K=R.state.schema.nodes.embedView;if(!K)return;const q=Y.text||l.value||o.value;R.view.dispatch(R.state.tr.replaceWith(Y.from,Y.to,K.create({href:o.value,label:q,view:se})).scrollIntoView()),R.view.focus(),S(!0)}return e({show:E,hide:S}),(se,R)=>(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.withDirectives(a.createElementVNode("div",{ref_key:"toolbarEl",ref:s,class:"wl-toolbar",style:a.normalizeStyle(i.value),onMouseenter:z,onMouseleave:F,onMousedown:R[8]||(R[8]=a.withModifiers(()=>{},["prevent"]))},[c.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.withDirectives(a.createElementVNode("input",{ref_key:"editInputEl",ref:p,"onUpdate:modelValue":R[6]||(R[6]=Y=>m.value=Y),class:"wl-edit-input",placeholder:"输入链接地址...",onKeydown:[a.withKeys(a.withModifiers(ce,["prevent"]),["enter"]),a.withKeys(a.withModifiers(ne,["prevent"]),["esc"])],onMousedown:R[7]||(R[7]=a.withModifiers(()=>{},["stop"]))},null,40,Y4),[[a.vModelText,m.value]]),a.createElementVNode("button",{class:"wl-edit-ok",onClick:ce},"确认"),a.createElementVNode("button",{class:"wl-edit-cancel",onClick:ne},"取消")],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("span",{class:"wl-tb-url",title:o.value},a.toDisplayString(w.value),9,W4),a.createElementVNode("button",{class:"wl-tb-btn",title:"在新标签打开",onClick:N},[a.createVNode(a.unref(I.ExternalLink),{size:16,"stroke-width":1.8})]),a.createElementVNode("button",{class:"wl-tb-btn",title:H.value?"已复制":"复制链接",onClick:X},[H.value?(a.openBlock(),a.createBlock(a.unref(I.Check),{key:0,size:16,"stroke-width":2,style:{color:"#34c759"}})):(a.openBlock(),a.createBlock(a.unref(I.Copy),{key:1,size:16,"stroke-width":1.8}))],8,G4),a.createElementVNode("button",{class:"wl-tb-btn",title:"编辑链接",onClick:re},[a.createVNode(a.unref(I.Pencil),{size:16,"stroke-width":1.8})]),a.createElementVNode("button",{class:"wl-tb-btn",title:"取消链接",onClick:ae},[a.createVNode(a.unref(I.Link2Off),{size:16,"stroke-width":1.8})]),R[15]||(R[15]=a.createElementVNode("div",{class:"wl-tb-sep"},null,-1)),a.createElementVNode("div",{class:"wl-view-wrap",ref_key:"viewWrapEl",ref:g},[a.createElementVNode("button",{class:"wl-tb-view-btn",onClick:R[0]||(R[0]=a.withModifiers(Y=>f.value=!f.value,["stop"]))},[k.value==="link"?(a.openBlock(),a.createBlock(a.unref(I.Link2),{key:0,size:13,"stroke-width":1.6})):(a.openBlock(),a.createBlock(a.unref(I.AlignLeft),{key:1,size:13,"stroke-width":1.6})),a.createElementVNode("span",null,a.toDisplayString(k.value==="title"?"标题视图":"链接视图"),1),a.createVNode(a.unref(I.ChevronDown),{size:12,"stroke-width":1.8,class:a.normalizeClass(["wl-chev",{open:f.value}])},null,8,["class"])]),a.withDirectives(a.createElementVNode("div",K4,[a.createElementVNode("button",{class:a.normalizeClass(["wl-view-item",{active:k.value==="title"}]),onClick:R[1]||(R[1]=Y=>ge("title"))},[a.createVNode(a.unref(I.AlignLeft),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),R[9]||(R[9]=a.createElementVNode("span",null,"标题视图",-1)),k.value==="title"?(a.openBlock(),a.createBlock(a.unref(I.Check),{key:0,size:12,"stroke-width":2,class:"wl-vi-check",style:{color:"#3370ff"}})):a.createCommentVNode("",!0)],2),a.createElementVNode("button",{class:a.normalizeClass(["wl-view-item",{active:k.value==="link"}]),onClick:R[2]||(R[2]=Y=>ge("link"))},[a.createVNode(a.unref(I.Link2),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),R[10]||(R[10]=a.createElementVNode("span",null,"链接视图",-1)),k.value==="link"?(a.openBlock(),a.createBlock(a.unref(I.Check),{key:0,size:12,"stroke-width":2,class:"wl-vi-check",style:{color:"#3370ff"}})):a.createCommentVNode("",!0)],2),T.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[R[14]||(R[14]=a.createElementVNode("div",{class:"wl-view-sep"},null,-1)),a.createElementVNode("button",{class:"wl-view-item",onClick:R[3]||(R[3]=Y=>ve("link"))},[a.createVNode(a.unref(I.Link2),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),R[11]||(R[11]=a.createElementVNode("span",null,"块级链接",-1))]),a.createElementVNode("button",{class:"wl-view-item",onClick:R[4]||(R[4]=Y=>ve("card"))},[a.createVNode(a.unref(I.LayoutPanelTop),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),R[12]||(R[12]=a.createElementVNode("span",null,"卡片视图",-1))]),M.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"wl-view-item",onClick:R[5]||(R[5]=Y=>ve("preview"))},[a.createVNode(a.unref(I.Eye),{size:14,"stroke-width":1.6,class:"wl-vi-icon"}),R[13]||(R[13]=a.createElementVNode("span",null,"预览视图",-1))])):a.createCommentVNode("",!0)],64)):a.createCommentVNode("",!0)],512),[[a.vShow,f.value]])],512)],64))],36),[[a.vShow,n.value]])]))}}),X4=["onKeydown"],J4={class:"sel-type-label"},Q4={class:"sel-dropdown"},Z4=["onClick"],ep=["disabled"],tp=["disabled"],Ao="#1f2329",rp=a.defineComponent({__name:"SelectionToolbar",props:{editor:{},enableComment:{type:Boolean,default:!1}},emits:["comment"],setup(t,{expose:e,emit:r}){const n=t,o=r,l=a.ref(!1),i=a.ref({}),s=a.ref(null),c=a.ref(!1),m=a.ref(null),p=a.ref(!1),f=a.ref(null),g=a.ref(!1),b=a.ref(""),v=a.ref(null),w=a.computed(()=>Zn.find(K=>K.isActive(n.editor))??Zn[0]),k=a.computed(()=>w.value.label),T=a.computed(()=>w.value.icon),M=a.computed(()=>{var q;return((q=n.editor)==null?void 0:q.getAttributes("textStyle").color)??Ao}),E=a.computed(()=>{var q;const K=(q=n.editor)==null?void 0:q.getAttributes("highlight");return K!=null&&K.color?K.color:null});function S(K){var q;(q=n.editor)==null||q.chain().focus()[K]().run()}function B(K){n.editor&&K.apply(n.editor),c.value=!1}function z(K){n.editor&&(K===null||K===Ao?n.editor.chain().focus().unsetColor().run():n.editor.chain().focus().setColor(K).run(),p.value=!1)}function F(K){n.editor&&(K===null?n.editor.chain().focus().unsetHighlight().run():n.editor.chain().focus().setHighlight({color:K}).run(),p.value=!1)}function P(){n.editor&&(n.editor.chain().focus().unsetColor().unsetHighlight().run(),p.value=!1)}const N=a.computed(()=>{if(!n.editor)return!1;const{$from:K}=n.editor.state.selection;for(let q=K.depth;q>0;q--){const U=K.node(q).type.name;if(U==="tableCell"||U==="tableHeader")return!0}return!1}),H=a.computed(()=>Jo(n.editor)),G=a.computed(()=>Qo(n.editor));function X(){n.editor&&Zo(n.editor)}function ae(){n.editor&&el(n.editor)}function re(){if(n.editor){if(n.editor.isActive("link")){n.editor.chain().focus().unsetLink().run();return}b.value="",g.value=!0,a.nextTick(()=>{var K;return(K=v.value)==null?void 0:K.focus()})}}function ce(){const K=b.value.trim();K&&n.editor&&n.editor.chain().focus().setLink({href:K,target:"_blank"}).run(),g.value=!1}function ne(){var K;g.value=!1,(K=n.editor)==null||K.commands.focus()}function ge(){o("comment")}function ve(K){g.value=!1,c.value=!1,l.value||(p.value=!1),l.value=!0,a.nextTick(()=>R(K))}function se(){l.value=!1,c.value=!1,p.value=!1,g.value=!1}function R(K){const q=s.value;if(!q)return;const U=q.offsetWidth||340,te=q.offsetHeight||40,J=8,L=window.innerWidth;let D=K.left+K.width/2-U/2;D=Math.max(8,Math.min(D,L-U-8));const V=K.top>=te+J+8?K.top-te-J:K.bottom+J;i.value={top:`${V}px`,left:`${D}px`}}function Y(K){var q,U;c.value&&!((q=m.value)!=null&&q.contains(K.target))&&(c.value=!1),p.value&&!((U=f.value)!=null&&U.contains(K.target))&&(p.value=!1)}return a.onMounted(()=>document.addEventListener("click",Y)),a.onBeforeUnmount(()=>document.removeEventListener("click",Y)),e({show:ve,hide:se}),(K,q)=>{var U,te,J,L,D,V;return a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.withDirectives(a.createElementVNode("div",{ref_key:"toolbarEl",ref:s,class:"sel-toolbar",style:a.normalizeStyle(i.value),onMousedown:q[9]||(q[9]=a.withModifiers(()=>{},["prevent"]))},[g.value?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.withDirectives(a.createElementVNode("input",{ref_key:"linkInputEl",ref:v,"onUpdate:modelValue":q[0]||(q[0]=Q=>b.value=Q),class:"sel-link-input",placeholder:"输入链接地址…",onKeydown:[a.withKeys(a.withModifiers(ce,["prevent"]),["enter"]),a.withKeys(a.withModifiers(ne,["prevent"]),["esc"])],onMousedown:q[1]||(q[1]=a.withModifiers(()=>{},["stop"]))},null,40,X4),[[a.vModelText,b.value]]),a.createElementVNode("button",{class:"sel-link-ok",onClick:ce},"确认"),a.createElementVNode("button",{class:"sel-link-cancel",onClick:ne},"取消")],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createElementVNode("div",{class:"sel-type-wrap",ref_key:"typeWrapEl",ref:m},[a.createElementVNode("button",{class:"sel-btn sel-btn--type",onClick:q[2]||(q[2]=a.withModifiers(Q=>c.value=!c.value,["stop"]))},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(T.value),{size:16,"stroke-width":1.5})),a.createElementVNode("span",J4,a.toDisplayString(k.value),1),a.createVNode(a.unref(I.ChevronDown),{size:10,"stroke-width":1.8,class:a.normalizeClass(["sel-chev",{open:c.value}])},null,8,["class"])]),a.withDirectives(a.createElementVNode("div",Q4,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(Zn),Q=>(a.openBlock(),a.createElementBlock("button",{key:Q.id,class:a.normalizeClass(["sel-dd-item",{active:Q.isActive(t.editor)}]),onClick:le=>B(Q)},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(Q.icon),{size:15,"stroke-width":1.5,class:"sel-dd-icon"})),a.createElementVNode("span",null,a.toDisplayString(Q.label),1),Q.isActive(t.editor)?(a.openBlock(),a.createBlock(a.unref(I.Check),{key:0,size:12,"stroke-width":2.2,class:"sel-dd-check",style:{color:"#3370ff"}})):a.createCommentVNode("",!0)],10,Z4))),128))],512),[[a.vShow,c.value]])],512),q[11]||(q[11]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(U=t.editor)==null?void 0:U.isActive("bold")}]),title:"粗体 Ctrl+B",onClick:q[3]||(q[3]=Q=>S("toggleBold"))},[a.createVNode(a.unref(I.Bold),{size:16,"stroke-width":2.2})],2),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(te=t.editor)==null?void 0:te.isActive("italic")}]),title:"斜体 Ctrl+I",onClick:q[4]||(q[4]=Q=>S("toggleItalic"))},[a.createVNode(a.unref(I.Italic),{size:16,"stroke-width":1.5})],2),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(J=t.editor)==null?void 0:J.isActive("strike")}]),title:"删除线",onClick:q[5]||(q[5]=Q=>S("toggleStrike"))},[a.createVNode(a.unref(I.Strikethrough),{size:16,"stroke-width":1.5})],2),N.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass(["sel-btn",{active:(L=t.editor)==null?void 0:L.isActive("underline")}]),title:"下划线 Ctrl+U",onClick:q[6]||(q[6]=Q=>S("toggleUnderline"))},[a.createVNode(a.unref(I.Underline),{size:16,"stroke-width":1.5})],2)),q[12]||(q[12]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("div",{class:"sel-color-wrap",ref_key:"colorWrapEl",ref:f},[a.createElementVNode("button",{class:"sel-btn sel-btn--color",title:"字体颜色 / 背景颜色",onClick:q[7]||(q[7]=a.withModifiers(Q=>p.value=!p.value,["stop"]))},[a.createVNode(a.unref(I.Baseline),{size:16,"stroke-width":1.5,style:a.normalizeStyle({color:M.value})},null,8,["style"]),a.createVNode(a.unref(I.ChevronDown),{size:10,"stroke-width":1.8,class:a.normalizeClass(["sel-chev",{open:p.value}])},null,8,["class"])]),a.withDirectives(a.createVNode(Ci,{class:"sel-color-panel","current-font-color":M.value,"current-bg-color":E.value,onApplyFontColor:z,onApplyBgColor:F,onReset:P},null,8,["current-font-color","current-bg-color"]),[[a.vShow,p.value]])],512),N.value?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[q[10]||(q[10]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{disabled:!H.value}]),disabled:!H.value,title:"增加缩进",onClick:X},[a.createVNode(a.unref(I.Indent),{size:16,"stroke-width":1.5})],10,ep),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{disabled:!G.value}]),disabled:!G.value,title:"减少缩进",onClick:ae},[a.createVNode(a.unref(I.Outdent),{size:16,"stroke-width":1.5})],10,tp)],64)),q[13]||(q[13]=a.createElementVNode("div",{class:"sel-sep"},null,-1)),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(D=t.editor)==null?void 0:D.isActive("code")}]),title:"行内代码",onClick:q[8]||(q[8]=Q=>S("toggleCode"))},[a.createVNode(a.unref(I.Code),{size:16,"stroke-width":1.5})],2),a.createElementVNode("button",{class:a.normalizeClass(["sel-btn",{active:(V=t.editor)==null?void 0:V.isActive("link")}]),title:"链接",onClick:re},[a.createVNode(a.unref(I.Link2),{size:16,"stroke-width":1.5})],2),n.enableComment?(a.openBlock(),a.createElementBlock("button",{key:2,class:"sel-btn",title:"评论",onClick:ge},[a.createVNode(a.unref(I.MessageSquare),{size:16,"stroke-width":1.5})])):a.createCommentVNode("",!0)],64))],36),[[a.vShow,l.value]])])}}}),np=["data-variant"],ap=["title"],op={class:"drag-handle-btn",title:"拖拽移动"},Ai=a.defineComponent({__name:"PagelyEditor",props:{initialContent:{default:""},fileUploadHandler:{},imageUrlResolver:{},enableComment:{type:Boolean,default:!1}},emits:["update:html","update:markdown","comment:create","comment:click","comment:hover","comment:orphaned","comment:anchor-drift","anchors-changed","mention:trigger","mention:cancel"],setup(t,{expose:e,emit:r}){const n=t,o=r;let l=()=>{};const i=cl(()=>l(),o),s=Cn();let c=()=>{},m=()=>{};function p(oe,de){c(oe,de)}const f=xn({profile:"edit",initialContent:n.initialContent,headingCollapseExtension:s.extension,isSettingContent:i.isSettingContent,onHtmlUpdate(oe){o("update:html",oe),i.scheduleMarkdownEmit(oe)},onSelectionUpdate(){V()},onOpenMathPopover(oe,de,ke){m(oe,de,ke)},onOpenSlashInsert:p,fileUploadHandler:n.fileUploadHandler,imageUrlResolver:n.imageUrlResolver});l=()=>f.value;const g=a.ref(null),b=a.computed(()=>n.enableComment),v=$o(f,{enabled:b,onCreate:oe=>o("comment:create",oe),onClick:oe=>o("comment:click",oe),onHover:oe=>o("comment:hover",oe),onOrphaned:oe=>o("comment:orphaned",oe),onAnchorDrift:oe=>o("comment:anchor-drift",oe),onAnchorsChanged:oe=>o("anchors-changed",oe)}),w=ll(f,{onTrigger:oe=>o("mention:trigger",oe),onCancel:()=>o("mention:cancel")}),{visible:k,anchorRect:T,initialLatex:M,openForEdit:E,openForInsert:S,confirm:B,close:z,rectAtPos:F}=yu(f);m=E;const{overlayVisible:P,overlayStyle:N,blockInfo:H,onMouseMove:G,onMouseLeave:X,getCurrentBlockPMPos:ae,getCurrentBlockRootPMPos:re,getCurrentBlockEl:ce}=Io(g,f),ne=a.ref(null),ge=a.ref(null);function ve(){const oe=ne.value??ge.value;return(oe==null?void 0:oe.getBoundingClientRect())??null}const{isEmptyParagraph:se,updateFromCurrentBlock:R,clear:Y}=al(g,f,ce),{tableVisible:K,tableBounds:q,rowDots:U,colDots:te,colAlignDots:J,hoveredCellBounds:L,onTableMouseMove:D,onTableSelectionUpdate:V,keepAlive:Q,scheduleHide:le,insertRowAt:be,insertColAt:Me,tableDeleteTable:De,tableCutTable:je,tableCopyTable:qe,tableToggleHeaderRow:ue,tableToggleHeaderColumn:pe,hasHeaderRow:Le,hasHeaderCol:$e,cellOps:ct,focusHoveredCell:wt,getCurrentTableRootPMPos:dt,getCurrentCellRootPMPos:qt,setColumnAlign:Er}=xi(g,f),Tn=a.computed(()=>Qt(H.tag).icon),cr=a.computed(()=>{var oe;return((oe=Ot[H.tag])==null?void 0:oe.pillVariant)??"text"}),{isHeadingBlock:Ut,isCurrentCollapsed:_t,onCollapseClick:X0}=s.bind(f,()=>H.tag,ae);let J0=()=>{};const Wt=ol(ae,ve,()=>{J0()}),zt=Do(f,ae,ve,()=>H.tag,()=>{Wt.close(),Wt.clearHideTimer()});J0=()=>{zt.close(),zt.clearHideTimer()};const{visible:Q0,top:Pi,left:Oi,placement:Vi,targetPos:En,sourceTag:$i,onPillEnter:Z0,onPillLeave:Fi,onMenuEnter:qi,onMenuLeave:Ui}=zt,{visible:ea,top:_i,left:Wi,placement:Gi,targetPos:Ki,openFromButton:ta,openFromSlash:Yi,onButtonEnter:ra,onButtonLeave:ji,onMenuEnter:Xi,onMenuLeave:Ji}=Wt;c=Yi;const Mn=Xs({onBlockMouseMove:G,onBlockMouseLeave:X,updateInsertButton:R,clearInsertButton:Y,onTableMouseMove:D,scheduleTableHide:le,closeBlockMenu:zt.close,closeInsertMenu:Wt.close,isBlockMenuVisible:()=>Q0.value,isInsertMenuVisible:()=>ea.value}),{onMove:na,onLeave:aa,onEditorMouseDown:oa,onDocMouseUp:la,onOverlayEnter:ia,onOverlayLeave:sa,onKeyDown:ua}=Mn,{onInsert:Qi,onCellInsert:Zi,onCellOp:es,onConvert:ts}=nl({editor:f,insertTargetPos:Ki,blockTargetPos:En,blockSourceTag:$i,focusBlockTarget:zt.focusTarget,focusHoveredCell:wt,cellOps:ct,closeInsertMenu:Wt.close,closeBlockMenu:zt.close,openMathPopoverForInsert:S,getMathRectAtPos:F}),Sn=a.ref(null);pf(f,(oe,de,ke)=>{var ca;return(ca=Sn.value)==null?void 0:ca.show(oe,de,ke)},()=>{var oe;return(oe=Sn.value)==null?void 0:oe.hide()});const Mr=a.ref(null);hf(f,oe=>{var de;Mn.setHasSelection(!0),X(),Y(),(de=Mr.value)==null||de.show(oe)},()=>{var oe;Mn.setHasSelection(!1),(oe=Mr.value)==null||oe.hide()});function rs(){var oe;v.requestInlineComment(),(oe=Mr.value)==null||oe.hide()}function ns(){const oe=re()??En.value;oe!==null&&v.requestBlockComment(oe,ve()??void 0)}function as(oe){const de=dt();de!==null&&v.requestBlockComment(de,oe??void 0)}function os(oe){const de=qt();de!==null&&v.requestBlockComment(de,oe??void 0)}return a.onMounted(()=>{document.addEventListener("keydown",ua),document.addEventListener("mouseup",la)}),a.onBeforeUnmount(()=>{var oe;document.removeEventListener("keydown",ua),document.removeEventListener("mouseup",la),(oe=f.value)==null||oe.destroy()}),e({getHtml:i.getHtml,getMarkdown:i.getMarkdown,setMarkdown:i.setMarkdown,setHtml:i.setHtml,getEditor:()=>f.value,getCommentAnchors:v.getCommentAnchors,applyCommentAnchors:v.applyCommentAnchors,addComment:(oe,de)=>v.addComment(oe,de),removeCommentAnchor:v.removeCommentAnchor,getMentions:w.getMentions,applyMentions:oe=>w.applyMentions(oe),insertMention:oe=>w.insertMention(oe)}),(oe,de)=>(a.openBlock(),a.createElementBlock("div",{class:"pagely-editor-wrap",ref_key:"wrapRef",ref:g,onMousemove:de[11]||(de[11]=(...ke)=>a.unref(na)&&a.unref(na)(...ke)),onMouseleave:de[12]||(de[12]=(...ke)=>a.unref(aa)&&a.unref(aa)(...ke)),onMousedown:de[13]||(de[13]=(...ke)=>a.unref(oa)&&a.unref(oa)(...ke))},[a.createVNode(a.unref(Oe.EditorContent),{editor:a.unref(f)},null,8,["editor"]),de[15]||(de[15]=a.createElementVNode("div",{class:"pagely-document-end","aria-hidden":"true"},[a.createElementVNode("span",{class:"pagely-document-end-mark"})],-1)),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.createElementVNode("div",{class:a.normalizeClass(["block-btn-overlay",{visible:a.unref(P)}]),style:a.normalizeStyle(a.unref(N)),onMouseenter:de[7]||(de[7]=(...ke)=>a.unref(ia)&&a.unref(ia)(...ke)),onMouseleave:de[8]||(de[8]=(...ke)=>a.unref(sa)&&a.unref(sa)(...ke))},[a.unref(se)?(a.openBlock(),a.createElementBlock("button",{key:0,ref_key:"insertBtnRef",ref:ne,class:"insert-btn",title:"插入块",onMouseenter:de[0]||(de[0]=(...ke)=>a.unref(ra)&&a.unref(ra)(...ke)),onMouseleave:de[1]||(de[1]=ke=>a.unref(ji)(ke)),onMousedown:de[2]||(de[2]=a.withModifiers(()=>{},["stop","prevent"])),onClick:de[3]||(de[3]=a.withModifiers((...ke)=>a.unref(ta)&&a.unref(ta)(...ke),["stop"]))},[a.createVNode(a.unref(I.Plus),{size:14,"stroke-width":1.8})],544)):a.createCommentVNode("",!0),a.unref(se)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:1,ref_key:"pillRef",ref:ge,class:"block-btn-pill","data-variant":cr.value,onMouseenter:de[4]||(de[4]=(...ke)=>a.unref(Z0)&&a.unref(Z0)(...ke)),onMouseleave:de[5]||(de[5]=ke=>a.unref(Fi)(ke))},[cr.value!=="minimal"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:"block-type-btn",title:a.unref(H).label},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(Tn.value),{class:"type-svg",size:16,"stroke-width":1.5})),cr.value==="text"?(a.openBlock(),a.createBlock(a.unref(I.ChevronDown),{key:0,class:"chevron-svg",size:8,"stroke-width":1.8})):a.createCommentVNode("",!0)],8,ap),de[14]||(de[14]=a.createElementVNode("span",{class:"block-btn-divider"},null,-1))],64)):a.createCommentVNode("",!0),a.createElementVNode("button",op,[a.createVNode(a.unref(I.GripVertical),{class:"drag-svg",size:14,"stroke-width":1.5})])],40,np)),a.unref(Ut)?(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass(["collapse-btn",{"is-collapsed":a.unref(_t)}]),title:"收起",onClick:de[6]||(de[6]=a.withModifiers((...ke)=>a.unref(X0)&&a.unref(X0)(...ke),["stop"]))},[a.createVNode(a.unref(I.ChevronDown),{size:10,"stroke-width":1.8})],2)):a.createCommentVNode("",!0)],38)])),a.createVNode(Ti,{visible:a.unref(Q0),"menu-top":a.unref(Pi),"menu-left":a.unref(Oi),placement:a.unref(Vi),editor:a.unref(f),"block-info":a.unref(H),"block-target-pos":a.unref(En),"enable-comment":n.enableComment,onClose:de[9]||(de[9]=ke=>a.unref(zt).close()),onMenuEnter:a.unref(qi),onMenuLeave:a.unref(Ui),onConvert:a.unref(ts),onComment:ns},null,8,["visible","menu-top","menu-left","placement","editor","block-info","block-target-pos","enable-comment","onMenuEnter","onMenuLeave","onConvert"]),a.createVNode(K0,{visible:a.unref(ea),"menu-top":a.unref(_i),"menu-left":a.unref(Wi),placement:a.unref(Gi),editor:a.unref(f),sections:a.unref(Wo),"file-upload-handler":n.fileUploadHandler,onClose:de[10]||(de[10]=ke=>a.unref(Wt).close()),onMenuEnter:a.unref(Xi),onMenuLeave:a.unref(Ji),onInsert:a.unref(Qi)},null,8,["visible","menu-top","menu-left","placement","editor","sections","file-upload-handler","onMenuEnter","onMenuLeave","onInsert"]),a.createVNode(Mi,{"table-visible":a.unref(K),"table-bounds":a.unref(q),"row-dots":a.unref(U),"col-dots":a.unref(te),"col-align-dots":a.unref(J),"hovered-cell-bounds":a.unref(L),"has-header-row":a.unref(Le),"has-header-col":a.unref($e),"keep-alive":a.unref(Q),"schedule-hide":a.unref(le),"insert-row-at":a.unref(be),"insert-col-at":a.unref(Me),"set-column-align":a.unref(Er),onComment:as,onCutTable:a.unref(je),onCopyTable:a.unref(qe),onToggleHeaderRow:a.unref(ue),onToggleHeaderCol:a.unref(pe),onDeleteTable:a.unref(De),onCellOp:a.unref(es),onCellInsert:a.unref(Zi),onCellComment:os},null,8,["table-visible","table-bounds","row-dots","col-dots","col-align-dots","hovered-cell-bounds","has-header-row","has-header-col","keep-alive","schedule-hide","insert-row-at","insert-col-at","set-column-align","onCutTable","onCopyTable","onToggleHeaderRow","onToggleHeaderCol","onDeleteTable","onCellOp","onCellInsert"]),a.createVNode(j4,{ref_key:"linkToolbarRef",ref:Sn,editor:a.unref(f)},null,8,["editor"]),a.createVNode(rp,{ref_key:"selToolbarRef",ref:Mr,editor:a.unref(f),"enable-comment":n.enableComment,onComment:rs},null,8,["editor","enable-comment"]),a.createVNode(xf,{visible:a.unref(k),"anchor-rect":a.unref(T),"initial-latex":a.unref(M),onConfirm:a.unref(B),onClose:a.unref(z)},null,8,["visible","anchor-rect","initial-latex","onConfirm","onClose"])],544))}}),lp=1,ip=3,sp=24,up=96;function Bi(t,e="section"){return t.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fff]+/g,"-").replace(/^-+|-+$/g,"")||e}function cp(t,e){const r=e.get(t)??0;return e.set(t,r+1),r===0?t:`${t}-${r+1}`}function dp(t){var r;const e=(r=t.attrs)==null?void 0:r.level;return typeof e=="number"&&Number.isInteger(e)?e:null}function Li(t,e={}){const r=e.minLevel??lp,n=e.maxLevel??ip,o=new Map,l=[];return t.descendants((i,s)=>{var g;if(i.type.name!=="heading")return;const c=dp(i);if(c===null||c<r||c>n)return;const m=(i.textContent??"").trim().replace(/\s+/g," ");if(!m)return;const p=typeof((g=i.attrs)==null?void 0:g.id)=="string"?i.attrs.id:"",f=Bi(p||m);l.push({id:cp(f,o),text:m,level:c,pos:s})}),l}function Ni(t,e={}){return t?Li(t.state.doc,e):[]}function x0(t,e){const r=t.view.nodeDOM(e.pos);return r instanceof HTMLElement&&/^H[1-6]$/.test(r.tagName)?r:r instanceof HTMLElement?r.querySelector("h1,h2,h3,h4,h5,h6"):null}function mp(t,e){for(const r of e){const n=x0(t,r);n&&(n.id=r.id,n.dataset.pagelyTocId=r.id)}}function Ii(){return typeof window>"u"?null:window}function fp(t){return t??Ii()}function j0(t){return t===Ii()}function pp(t){return j0(t)?t.scrollY:t.scrollTop}function hp(t){return j0(t)?0:t.getBoundingClientRect().top}function zi(t,e={}){const r=a.ref([]),n=a.ref("");let o=null,l=null,i=0;function s(){return a.unref(t)??null}function c(){return fp(a.unref(e.scrollContainer))}function m(){const v=++i;a.nextTick(()=>{if(v!==i)return;const w=s();if(!w){r.value=[],n.value="";return}r.value=Ni(w,{minLevel:e.minLevel,maxLevel:e.maxLevel}),mp(w,r.value),p()})}function p(){const v=s(),w=c();if(!v||!w||r.value.length===0){n.value="";return}const k=hp(w)+(a.unref(e.activeOffset)??up);let T=r.value[0];for(const M of r.value){const E=x0(v,M);E&&E.getBoundingClientRect().top<=k&&(T=M)}n.value=(T==null?void 0:T.id)??""}function f(v){const w=s(),k=c();if(!w||!k)return;const T=x0(w,v);if(!T)return;const M=a.unref(e.scrollOffset)??sp,E=a.unref(e.behavior)??"smooth";j0(k)?k.scrollTo({top:k.scrollY+T.getBoundingClientRect().top-M,behavior:E}):k.scrollTo({top:pp(k)+T.getBoundingClientRect().top-k.getBoundingClientRect().top-M,behavior:E}),n.value=v.id}function g(v){if(o==null||o(),o=null,!v){r.value=[],n.value="";return}const w=()=>m();v.on("transaction",w),o=()=>{v.off("transaction",w)},m()}function b(v){l==null||l(),l=null,v&&(v.addEventListener("scroll",p,{passive:!0}),l=()=>{v.removeEventListener("scroll",p)})}return a.watch(()=>s(),g,{immediate:!0}),a.watch(()=>[e.minLevel,e.maxLevel],()=>m()),a.watch(()=>a.unref(e.scrollContainer)??null,()=>b(c()),{immediate:!0}),a.onBeforeUnmount(()=>{o==null||o(),l==null||l()}),{items:r,activeId:n,refresh:m,scrollToItem:f,updateActiveFromScroll:p}}const vp={class:"pagely-toc__header"},gp={key:0,class:"pagely-toc__list","aria-label":"当前页面目录"},bp=["title","onClick"],yp={class:"pagely-toc__title"},wp={key:1,class:"pagely-toc__empty"},Di=a.defineComponent({__name:"PagelyToc",props:{items:{},activeId:{default:""},collapsed:{type:Boolean,default:!1}},emits:["update:collapsed","item-click"],setup(t,{emit:e}){const r=e;function n(o){r("update:collapsed",o)}return(o,l)=>(a.openBlock(),a.createElementBlock("aside",{class:a.normalizeClass(["pagely-toc",{"pagely-toc--collapsed":t.collapsed}]),"aria-label":"页面目录","data-pagely-toc":""},[t.collapsed?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"pagely-toc__restore",title:"展开目录","aria-label":"展开目录","data-pagely-toc-restore":"",onClick:l[0]||(l[0]=i=>n(!1))},[a.createVNode(a.unref(I.TableOfContents),{size:18,"stroke-width":1.7})])):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createElementVNode("div",vp,[a.createElementVNode("button",{type:"button",class:"pagely-toc__collapse",title:"收起目录","aria-label":"收起目录","data-pagely-toc-collapse":"",onClick:l[1]||(l[1]=i=>n(!0))},[a.createVNode(a.unref(I.ChevronsLeft),{size:17,"stroke-width":1.7})])]),t.items.length>0?(a.openBlock(),a.createElementBlock("nav",gp,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.items,i=>(a.openBlock(),a.createElementBlock("button",{key:`${i.id}:${i.pos}`,type:"button",class:a.normalizeClass(["pagely-toc__item",{"pagely-toc__item--active":i.id===t.activeId,[`pagely-toc__item--level-${i.level}`]:!0}]),title:i.text,style:a.normalizeStyle({"--pagely-toc-depth":`${Math.max(0,i.level-1)}`}),"data-pagely-toc-item":"",onClick:s=>o.$emit("item-click",i)},[a.createElementVNode("span",yp,a.toDisplayString(i.text),1)],14,bp))),128))])):(a.openBlock(),a.createElementBlock("div",wp,"暂无目录"))],64))],2))}});function kp(t,e){const r=t.createElement("p");return r.textContent=e,r}function xp(t,e,r){const n=t.createElement("p"),o=t.createElement("a");return o.setAttribute("href",e),o.setAttribute("target","_blank"),o.setAttribute("rel","noopener noreferrer"),o.className="pm-link",o.textContent=r||e,n.appendChild(o),n}function Cp(t){var n,o;if(!t||!t.includes("embed-view"))return t;const e=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html"),r=Array.from(e.body.querySelectorAll(':scope > div[data-type="embed-view"]'));for(const l of r){const i=((n=l.getAttribute("data-href"))==null?void 0:n.trim())??"",s=((o=l.textContent)==null?void 0:o.trim())||i,c=nr(i)?xp(e,i,s):kp(e,s);l.replaceWith(c)}return e.body.innerHTML}const Tp={class:"pagely-viewer-wrap"},Hi=a.defineComponent({__name:"PagelyViewer",props:{content:{},format:{default:"markdown"},imageUrlResolver:{}},setup(t,{expose:e}){const r=t,n=a.ref(!1),o=Cn();function l(p,f){const g=f==="markdown"?ar(p):p;return Cp(g)}const i=xn({profile:"view",initialContent:l(r.content,r.format),headingCollapseExtension:o.extension,isSettingContent:n,imageUrlResolver:r.imageUrlResolver});a.watch(()=>r.content,p=>s(p,r.format)),a.watch(()=>r.format,p=>s(r.content,p));function s(p,f=r.format){const g=i.value;if(g){n.value=!0,g.setEditable(!0);try{g.commands.setContent(l(p,f),{emitUpdate:!1})}finally{g.setEditable(!1),n.value=!1}}}function c(){var p;return((p=i.value)==null?void 0:p.getHTML())??""}function m(){return Gr(c())}return a.onBeforeUnmount(()=>{var p;(p=i.value)==null||p.destroy()}),e({getHtml:c,getMarkdown:m,setContent:s,getEditor:()=>i.value}),(p,f)=>(a.openBlock(),a.createElementBlock("div",Tp,[a.createVNode(a.unref(Oe.EditorContent),{editor:a.unref(i)},null,8,["editor"])]))}}),Ep={class:"pagely-page__content"},Mp=a.defineComponent({__name:"PagelyPage",props:{mode:{default:"edit"},content:{default:""},format:{default:"markdown"},initialContent:{default:""},fileUploadHandler:{},imageUrlResolver:{},enableComment:{type:Boolean,default:!1},tocMaxLevel:{default:3}},emits:["update:html","update:markdown","comment:create","comment:click","comment:hover","comment:orphaned","comment:anchor-drift","anchors-changed","mention:trigger","mention:cancel"],setup(t,{expose:e,emit:r}){const n=t,o=r,l=a.ref(null),i=a.ref(null),s=a.ref(null),c=a.ref(!1),m=a.computed(()=>n.initialContent?n.initialContent:n.format==="markdown"?ar(n.content):n.content),p=a.computed(()=>{var E,S;return n.mode==="view"?((E=i.value)==null?void 0:E.getEditor())??null:((S=l.value)==null?void 0:S.getEditor())??null}),f=zi(p,{maxLevel:n.tocMaxLevel,scrollContainer:s,scrollOffset:28,activeOffset:112});function g(){f.refresh()}function b(){var E,S;return n.mode==="view"?((E=i.value)==null?void 0:E.getHtml())??"":((S=l.value)==null?void 0:S.getHtml())??""}function v(){var E,S;return n.mode==="view"?((E=i.value)==null?void 0:E.getMarkdown())??"":((S=l.value)==null?void 0:S.getMarkdown())??""}function w(E){var S,B;n.mode==="view"?(S=i.value)==null||S.setContent(E,"markdown"):(B=l.value)==null||B.setMarkdown(E),a.nextTick(g)}function k(E){var S,B;n.mode==="view"?(S=i.value)==null||S.setContent(E,"html"):(B=l.value)==null||B.setHtml(E),a.nextTick(g)}function T(E,S=n.format){S==="html"?k(E):w(E)}function M(){return p.value??void 0}return a.watch(()=>[n.content,n.format,n.mode],()=>{n.mode==="view"&&a.nextTick(g)}),a.onMounted(()=>{a.nextTick(g)}),e({getHtml:b,getMarkdown:v,setMarkdown:w,setHtml:k,setContent:T,getEditor:M,refreshToc:g,getTocItems:()=>f.items.value,getCommentAnchors:()=>{var E;return((E=l.value)==null?void 0:E.getCommentAnchors())??[]},applyCommentAnchors:E=>{var S;return(S=l.value)==null?void 0:S.applyCommentAnchors(E)},addComment:(E,S)=>{var B;return(B=l.value)==null?void 0:B.addComment(E,S)},removeCommentAnchor:E=>{var S;return(S=l.value)==null?void 0:S.removeCommentAnchor(E)},getMentions:()=>{var E;return((E=l.value)==null?void 0:E.getMentions())??[]},applyMentions:E=>{var S;return(S=l.value)==null?void 0:S.applyMentions(E)},insertMention:E=>{var S;return(S=l.value)==null?void 0:S.insertMention(E)}}),(E,S)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["pagely-page",{"pagely-page--view":t.mode==="view","pagely-page--edit":t.mode==="edit","pagely-page--toc-collapsed":c.value}]),"data-pagely-page":""},[a.createVNode(Di,{collapsed:c.value,"onUpdate:collapsed":S[0]||(S[0]=B=>c.value=B),items:a.unref(f).items.value,"active-id":a.unref(f).activeId.value,onItemClick:a.unref(f).scrollToItem},null,8,["collapsed","items","active-id","onItemClick"]),a.createElementVNode("main",{ref_key:"scrollRef",ref:s,class:"pagely-page__main","data-pagely-page-main":""},[a.createElementVNode("div",Ep,[t.mode==="edit"?(a.openBlock(),a.createBlock(Ai,{key:0,ref_key:"editorRef",ref:l,"initial-content":m.value,"file-upload-handler":t.fileUploadHandler,"image-url-resolver":t.imageUrlResolver,"enable-comment":t.enableComment,"onUpdate:html":S[1]||(S[1]=B=>o("update:html",B)),"onUpdate:markdown":S[2]||(S[2]=B=>o("update:markdown",B)),"onComment:create":S[3]||(S[3]=B=>o("comment:create",B)),"onComment:click":S[4]||(S[4]=B=>o("comment:click",B)),"onComment:hover":S[5]||(S[5]=B=>o("comment:hover",B)),"onComment:orphaned":S[6]||(S[6]=B=>o("comment:orphaned",B)),"onComment:anchorDrift":S[7]||(S[7]=B=>o("comment:anchor-drift",B)),onAnchorsChanged:S[8]||(S[8]=B=>o("anchors-changed",B)),"onMention:trigger":S[9]||(S[9]=B=>o("mention:trigger",B)),"onMention:cancel":S[10]||(S[10]=B=>o("mention:cancel"))},null,8,["initial-content","file-upload-handler","image-url-resolver","enable-comment"])):(a.openBlock(),a.createBlock(Hi,{key:1,ref_key:"viewerRef",ref:i,content:t.content,format:t.format,"image-url-resolver":t.imageUrlResolver},null,8,["content","format","image-url-resolver"])),a.renderSlot(E.$slots,"after")])],512)],2))}}),t0={type:"doc",content:[{type:"paragraph"}]};function Ri(t={}){const e=a.ref(!1),r=a.ref(!0),n=Cn(),o=xn({profile:"comment",initialContent:t.initialContent??t0,headingCollapseExtension:n.extension,isSettingContent:e,editable:t.editable??!0}),l=ll(o,{onTrigger:v=>{var w;return(w=t.onMentionTrigger)==null?void 0:w.call(t,v)},onCancel:()=>{var v;return(v=t.onMentionCancel)==null?void 0:v.call(t)}});function i(){var v;r.value=((v=o.value)==null?void 0:v.isEmpty)??!0}function s(v,w){w==null||w.off("transaction",i),v==null||v.on("transaction",i),i()}a.watch(o,s,{immediate:!0}),a.onBeforeUnmount(()=>{var v,w;(v=o.value)==null||v.off("transaction",i),(w=o.value)==null||w.destroy()});function c(){var v;return((v=o.value)==null?void 0:v.getJSON())??t0}function m(v){const w=o.value;w&&(e.value=!0,w.commands.setContent(v,{emitUpdate:!1}),e.value=!1,i())}function p(){m(t0)}function f(v="end"){var w;(w=o.value)==null||w.commands.focus(v)}function g(){var v;(v=t.onSubmit)==null||v.call(t,c())}function b(v){var w;if(v.key==="Enter"){if(v.preventDefault(),v.shiftKey){(w=o.value)==null||w.chain().focus().splitBlock().run();return}g()}}return{editor:o,isEmpty:r,getContent:c,setContent:m,clear:p,focus:f,submit:g,onKeyDown:b,insertMention:v=>l.insertMention(v),getMentions:l.getMentions,applyMentions:l.applyMentions}}const Sp={key:0,class:"pagely-comment-placeholder"},Ap=a.defineComponent({__name:"CommentEditor",props:{initialContent:{},placeholder:{default:"输入评论"}},emits:["submit","mention:trigger","mention:cancel"],setup(t,{expose:e,emit:r}){const n=t,o=n.placeholder,l=r,i=Ri({initialContent:n.initialContent,onSubmit:s=>l("submit",s),onMentionTrigger:s=>l("mention:trigger",s),onMentionCancel:()=>l("mention:cancel")});return e({getContent:i.getContent,setContent:i.setContent,clear:i.clear,focus:i.focus,submit:i.submit,insertMention:s=>i.insertMention(s)}),(s,c)=>(a.openBlock(),a.createElementBlock("div",{class:"pagely-comment-editor",onKeydownCapture:c[0]||(c[0]=(...m)=>a.unref(i).onKeyDown&&a.unref(i).onKeyDown(...m))},[a.createVNode(a.unref(Oe.EditorContent),{editor:a.unref(i).editor.value},null,8,["editor"]),a.unref(i).isEmpty.value?(a.openBlock(),a.createElementBlock("span",Sp,a.toDisplayString(a.unref(o)),1)):a.createCommentVNode("",!0)],32))}}),Bp={class:"pagely-comment-content"},Lp=a.defineComponent({__name:"CommentContentViewer",props:{content:{}},setup(t,{expose:e}){const r=t,n=a.ref(!1),o=Cn(),l=xn({profile:"comment",initialContent:r.content,headingCollapseExtension:o.extension,isSettingContent:n,editable:!1});function i(c){const m=l.value;if(m){n.value=!0,m.setEditable(!0);try{m.commands.setContent(c,{emitUpdate:!1})}finally{m.setEditable(!1),n.value=!1}}}function s(){var c;return((c=l.value)==null?void 0:c.getJSON())??null}return a.watch(()=>r.content,c=>i(c)),a.onBeforeUnmount(()=>{var c;(c=l.value)==null||c.destroy()}),e({getContent:s,setContent:i,getEditor:()=>l.value}),(c,m)=>(a.openBlock(),a.createElementBlock("div",Bp,[a.createVNode(a.unref(Oe.EditorContent),{editor:a.unref(l)},null,8,["editor"])]))}});exports.BLOCK_CONFIGS=Ot;exports.BlockMenu=Ti;exports.CommentBlock=si;exports.CommentContentViewer=Lp;exports.CommentEditor=Ap;exports.CommentMark=ci;exports.DotFlowPadBlock=di;exports.EXTENSION_PROFILES=gi;exports.EmbedBlockShell=W0;exports.EmbedFullscreenModal=ln;exports.EmbedView=mi;exports.INSERT_BLOCK_CMDS=Yo;exports.INSERT_CMDS=Pt;exports.INSERT_ITEMS=Fo;exports.INSERT_SECTIONS=qo;exports.INSERT_SECTIONS_CELL=Uo;exports.InsertMenu=K0;exports.Mention=pi;exports.MermaidBlock=fi;exports.PagelyEditor=Ai;exports.PagelyPage=Mp;exports.PagelyToc=Di;exports.PagelyViewer=Hi;exports.RESOLVED_INSERT_SECTIONS=Wo;exports.RESOLVED_INSERT_SECTIONS_CELL=Go;exports.RESOLVED_INSERT_SECTIONS_CELL_WITH_OPS=jo;exports.TableSizePicker=Ei;exports.TableTools=Mi;exports.calcMenuPosition=T0;exports.extractPagelyTocItems=Ni;exports.extractPagelyTocItemsFromDoc=Li;exports.htmlToMarkdown=Gr;exports.markdownToHtml=ar;exports.normalizeLanguage=il;exports.shouldLoad=bi;exports.slugifyTocId=Bi;exports.useBlockButton=Io;exports.useBlockImageExport=rn;exports.useBlockMenu=Do;exports.useCommentAnchors=$o;exports.useCommentEditor=Ri;exports.useEditorCommands=nl;exports.useInsertButton=al;exports.useInsertMenu=ol;exports.useMarkdownSync=cl;exports.useMenuSidePanel=E0;exports.usePagelyToc=zi;exports.useTableTools=xi;