@white-give/editor-vue 2.0.2 → 2.0.3
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/es/index.js +1 -3
- package/dist/lib/index.js +1 -1
- package/package.json +2 -2
package/dist/es/index.js
CHANGED
|
@@ -110923,9 +110923,7 @@ const OBe = /* @__PURE__ */ vt({
|
|
|
110923
110923
|
bottom: 2.54
|
|
110924
110924
|
}
|
|
110925
110925
|
})
|
|
110926
|
-
);
|
|
110927
|
-
console.log("page", c.value);
|
|
110928
|
-
const f = pt(!1), d = pt(/* @__PURE__ */ new Map());
|
|
110926
|
+
), f = pt(!1), d = pt(/* @__PURE__ */ new Map());
|
|
110929
110927
|
Kl("container", a), Kl("options", u), Kl("editor", l), Kl("page", c), Kl("assistant", f), Kl("uploadFileMap", d), Kl("dicts", s), Cr(
|
|
110930
110928
|
() => l.value,
|
|
110931
110929
|
() => {
|
package/dist/lib/index.js
CHANGED
|
@@ -422,4 +422,4 @@ echarts.use([`+$+"]);":"Unknown series "+z))}return}if(f==="tooltip"){if(w){proc
|
|
|
422
422
|
});
|
|
423
423
|
<\/script>
|
|
424
424
|
</body>
|
|
425
|
-
</html>`},c=async()=>{yBe(u(),()=>{console.log("打印完成")})};return(f,d)=>(m.openBlock(),m.createElementBlock("div",{class:"px-[12px] py-[5px] flex items-center gap-[0.4rem] cursor-pointer hover:bg-[rgb(242,243,245)]",onClick:d[0]||(d[0]=h=>c())},[...d[1]||(d[1]=[m.createElementVNode("i",{class:"w-iconfont icon-export-pdf"},null,-1),m.createTextVNode(" 导出为PDF ",-1)])]))}}),xBe={class:"flex items-center gap-[20px] text-[#333] foot-action"},wBe={key:0,class:"cursor-pointer flex items-center gap-[0.4rem] text-[14px] hover:text-[#007aff]"},_Be=m.defineComponent({__name:"FootRight",setup(n){const e=m.inject("editor"),t=m.inject("options"),r=async()=>{if(!e.value)return;const a=e.value.getHTML(),{toClipboard:o}=CD();await o(a)},i=()=>{if(!e.value)return;const a=new Blob([e.value.getText()],{type:"text/plain;charset=utf-8"}),{title:o}=t.value.document??{},s=o!==""?t.value?.document?.title:"无标题文档";gBe.saveAs(a,`${s}.txt`)};return(a,o)=>(m.openBlock(),m.createElementBlock("div",xBe,[m.unref(t).layout.foot.copy?(m.openBlock(),m.createElementBlock("span",{key:0,class:"cursor-pointer flex items-center gap-[0.4rem] text-[14px] hover:text-[#007aff]",onClick:o[0]||(o[0]=s=>r())},[...o[2]||(o[2]=[m.createElementVNode("i",{class:"w-iconfont icon-copy-content"},null,-1),m.createTextVNode(" 复制全文 ",-1)])])):m.createCommentVNode("",!0),m.createVNode(qs,{trigger:"click",placement:"top",contentStyle:{padding:"6px 0",boxShadow:"0 6px 16px 0 rgba(0, 0, 0, 0.08)"}},{content:m.withCtx(()=>[m.createElementVNode("div",{class:"px-[12px] py-[5px] flex items-center gap-[0.4rem] cursor-pointer hover:bg-[rgb(242,243,245)]",onClick:o[1]||(o[1]=s=>i())},[...o[4]||(o[4]=[m.createElementVNode("i",{class:"w-iconfont icon-text"},null,-1),m.createTextVNode(" 导出为文本 ",-1)])]),m.createVNode(bBe)]),default:m.withCtx(()=>[m.unref(t).layout.foot.download?(m.openBlock(),m.createElementBlock("span",wBe,[...o[3]||(o[3]=[m.createElementVNode("i",{class:"w-iconfont icon-down"},null,-1),m.createTextVNode(" 下载 ",-1)])])):m.createCommentVNode("",!0)]),_:1})]))}}),SBe={class:"w-full h-full flex items-center justify-between"},TBe=m.defineComponent({__name:"index",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",SBe,[m.createVNode(hBe),m.createVNode(_Be)]))}}),CBe=["width","height"],kBe={class:"text-[#666]"},EBe=m.defineComponent({__name:"Nodata",props:{size:{default:"1em"},top:{default:"30%"},title:{default:"暂无数据"}},setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",{class:"flex items-center justify-center flex-col gap-2",style:m.normalizeStyle({paddingTop:n.top})},[(m.openBlock(),m.createElementBlock("svg",{t:"1766712532477",class:"icon",viewBox:"0 0 1030 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:n.size,height:n.size},[...t[0]||(t[0]=[m.createStaticVNode('<path d="M927.053254 896q0 1.254249-0.496852 2.508497t-1.484497 2.508497q-0.993704 1.248189-2.48426 2.49032-1.478438 1.248189-3.453728 2.48426-1.969231 1.230012-4.429254 2.447905-2.453964 1.217893-5.392663 2.423669-2.938698 1.199716-6.343953 2.381254-3.405254 1.187598-7.277065 2.3449-3.87787 1.163361-8.198059 2.302485-4.320189 1.133065-9.088757 2.241893t-9.967338 2.181302q-5.210888 1.084592-10.82168 2.126769-5.616852 1.048237-11.645728 2.060119-6.022817 1.005822-12.439479 1.97529-6.422722 0.969467-13.208994 1.90258-6.792331 0.933112-13.948213 1.817751-7.149822 0.890698-14.645018 1.738982-7.495195 0.842225-15.311527 1.635977-7.822391 0.799811-15.94168 1.551148-8.125349 0.745278-16.541539 1.442082-8.404071 0.702864-17.086863 1.345137-8.670675 0.648331-17.589776 1.24213-8.919101 0.593799-18.068449 1.127006-9.14329 0.539266-18.480474 1.01794-9.349302 0.484734-18.874319 0.908876-9.518959 0.424142-19.201515 0.787693-9.676497 0.36355-19.492355 0.666508-9.809799 0.302959-19.728663 0.551385-9.918864 0.242367-19.928615 0.430201-9.997633 0.181775-20.067977 0.302959-10.064284 0.127243-20.170982 0.187834-10.100639 0.060592-20.213396 0.060592-10.118817 0-20.219456-0.060592-10.100639-0.060592-20.164923-0.181775-10.070343-0.121183-20.074035-0.302959-10.003692-0.187834-19.922557-0.43626-9.924923-0.242367-19.734722-0.545325-9.815858-0.309018-19.492355-0.672568-9.676497-0.36355-19.201514-0.787693-9.518959-0.424142-18.868261-0.908876-9.343243-0.478675-18.486532-1.01794-9.14329-0.533207-18.062391-1.127006t-17.595834-1.24213q-8.676734-0.642272-17.086864-1.345137-8.41013-0.696805-16.535479-1.442082-8.11929-0.751337-15.935622-1.551148-7.822391-0.793751-15.317585-1.635977-7.495195-0.848284-14.651077-1.732923-7.149822-0.890698-13.936095-1.817751-6.798391-0.933112-13.208994-1.908639-6.422722-0.969467-12.445539-1.981349-6.028876-1.005822-11.645727-2.05406-5.622911-1.042178-10.821681-2.12071t-9.967337-2.187361q-4.768568-1.108828-9.088757-2.241893-4.326249-1.139124-8.19806-2.302485-3.871811-1.157302-7.277065-2.3449-3.411314-1.181538-6.343952-2.387313-2.938698-1.199716-5.392663-2.423669-2.460024-1.211834-4.435314-2.447905-1.969231-1.230012-3.453728-2.478201-1.484497-1.24213-2.478201-2.49032-0.987645-1.254249-1.484497-2.508497-0.496852-1.254249-0.496852-2.508497 0-1.260308 0.496852-2.514556t1.484497-2.508497q0.993704-1.248189 2.478201-2.49032 1.484497-1.24213 3.453728-2.478201 1.97529-1.230012 4.435314-2.453964 2.453964-1.211834 5.392663-2.423669 2.932639-1.199716 6.343952-2.381255 3.405254-1.181538 7.271006-2.344899 3.87787-1.163361 8.198059-2.302485 4.326249-1.133065 9.094817-2.241894 4.768568-1.108828 9.967337-2.181301 5.198769-1.084592 10.821681-2.12677 5.616852-1.042178 11.645727-2.060118 6.022817-1.005822 12.43948-1.97529 6.422722-0.969467 13.208994-1.90258 6.792331-0.933112 13.942154-1.817751 7.149822-0.890698 14.651077-1.732923 7.495195-0.848284 15.311526-1.642036 7.816331-0.799811 15.941681-1.551148 8.125349-0.745278 16.535479-1.442083 8.41013-0.702864 17.086864-1.345136 8.676734-0.648331 17.595834-1.24213 8.919101-0.58774 18.062391-1.127006 9.149349-0.539266 18.486532-1.017941 9.349302-0.484734 18.868261-0.908875 9.525018-0.424142 19.207574-0.787693 9.676497-0.36355 19.486295-0.666509 9.815858-0.302959 19.734722-0.551384 9.918864-0.242367 19.922557-0.430201 10.003692-0.181775 20.074035-0.302959 10.058225-0.127243 20.164923-0.187834 10.100639-0.060592 20.219456-0.060592 10.118817 0 20.213396 0.060592 10.106698 0.060592 20.170982 0.181775 10.064284 0.121183 20.067977 0.309018 10.009751 0.181775 19.928615 0.424142 9.918864 0.248426 19.728663 0.557443 9.815858 0.302959 19.492355 0.666509 9.682556 0.36355 19.207574 0.787693 9.518959 0.424142 18.862201 0.908875 9.343243 0.484734 18.486533 1.017941 9.149349 0.539266 18.068449 1.127006 8.919101 0.593799 17.595835 1.24213 8.676734 0.642272 17.086864 1.345136 8.41013 0.696805 16.535479 1.442083 8.11929 0.751337 15.935621 1.551148 7.816331 0.793751 15.317586 1.635976 7.495195 0.848284 14.645018 1.738983 7.149822 0.884639 13.948213 1.817751 6.786272 0.933112 13.208994 1.90258 6.416663 0.969467 12.439479 1.981349 6.028876 1.011882 11.645728 2.054059 5.616852 1.042178 10.82168 2.12071 5.198769 1.078533 9.967338 2.187361t9.088757 2.241894q4.326249 1.139124 8.198059 2.302485t7.271006 2.344899q3.411314 1.181538 6.350012 2.387314 2.938698 1.199716 5.392663 2.423669 2.460024 1.211834 4.423195 2.447905 1.981349 1.236071 3.465846 2.478201 1.484497 1.24213 2.478201 2.49032 0.987645 1.254249 1.484497 2.508497 0.496852 1.254249 0.496852 2.514556z" fill="#007bff" opacity=".1"></path><path d="M117.426746 376.832c0 8.70703 6.695385 15.36 15.450887 15.36 8.755503 0 15.450888-6.65297 15.450888-15.36 0-8.70097-6.695385-15.36-15.450888-15.36-8.240473 0-15.450888 7.168-15.450887 15.36z m814.776804 455.16497c-19.571124 5.12-23.691361 9.222059-28.326627 28.16303-5.150296-19.449941-9.270533-23.552-28.326627-28.16303 19.056095-5.12 23.691361-9.209941 28.326627-28.15697 4.635266 18.94703 8.755503 23.552 28.326627 28.15697zM203.436686 323.07503c-25.23645 6.65297-30.386746 11.77297-37.08213 36.864-6.695385-25.08497-11.84568-30.21103-37.08213-36.864 25.23645-6.65903 30.386746-12.288 37.08213-36.864 6.180355 25.08497 11.84568 30.20497 37.08213 36.864z m618.035503-88.064c-15.450888 4.096-18.541065 7.168-22.661301 22.528-4.120237-15.36-7.210414-18.432-22.661302-22.528 15.450888-4.096 18.541065-7.168 22.661302-22.528 3.605207 15.36 7.210414 18.432 22.661301 22.528z m66.438817-78.848c-40.172308 10.24-48.412781 18.94097-59.228402 58.87697-10.300592-39.929941-19.056095-48.128-59.228403-58.87697 40.172308-10.24 48.412781-18.94703 59.228403-58.88303 10.300592 39.42703 19.056095 48.128 59.228402 58.88303z" fill="#007bff" opacity=".5"></path><path d="M422.32426 713.21297v4.096l33.991953 31.23503 130.302485-62.97903-117.941775 75.26703v36.864l19.056095-18.432v-0.51503 0.51503l19.056094 18.432 100.945799-122.88v-4.096l-185.410651 42.49297z" fill="#007bff" opacity=".2"></path><path d="M865.249704 551.936v-1.024c0-1.024-0.51503-1.53297-0.515029-2.55697v-0.51503L754.003314 260.61103c-15.965917-48.64303-61.288521-81.41103-112.79148-81.41103H389.362367c-51.502959 0-96.825562 32.768-112.791479 81.41103L165.839527 547.84v0.51503c-0.51503 1.024-0.51503 1.53297-0.51503 2.55697v206.848c0 65.02097 53.048047 117.76 118.456805 117.76h463.526627c65.408757 0 118.456805-52.73903 118.456805-117.76v-204.8c-0.51503-0.50897-0.51503-0.50897-0.51503-1.024zM305.412544 271.36q0-0.50897 0.51503-0.50897c11.330651-36.864 45.322604-60.93103 83.434793-60.93103h251.334438c38.112189 0 72.104142 24.06703 83.949822 60.416q0 0.51503 0.51503 0.51503l102.490887 266.24H592.284024c-8.755503 0-15.450888 6.65297-15.450888 15.36 0 33.792-27.811598 61.44-61.80355 61.44-33.991953 0-61.80355-27.648-61.80355-61.44 0-8.70703-6.695385-15.36-15.450888-15.36H202.921657l102.490887-265.73103zM834.347929 757.76c0 48.128-39.142249 87.04-87.55503 87.04h-463.526627c-48.412781 0-87.55503-38.912-87.555029-87.04V568.32h228.158106c7.210414 43.52303 45.322604 76.8 91.160237 76.8 45.837633 0 83.949822-33.27697 91.160236-76.8H834.347929v189.44z" fill="#007bff" opacity=".5"></path><path d="M515.029586 578.566059c-14.420828 0-25.751479-11.264-25.751479-25.6v-51.2H254.939645l84.464852-219.136 0.51503-1.024c7.210414-21.504 26.781538-35.84 49.44284-35.84h251.334438c22.661302 0 42.232426 14.336 49.44284 35.84l0.51503 1.024 84.464852 219.136H540.781065v51.2c0 14.336-11.330651 25.6-25.751479 25.6z" fill="#007bff" opacity=".2"></path>',5)])],8,CBe)),m.createElementVNode("p",kBe,m.toDisplayString(n.title),1)],4))}}),MBe={class:"w-[260px] h-full flex flex-col overflow-hidden"},ABe={key:0,class:"h-[50px] flex-none flex items-center px-4 text-[15px] text-[#666] hover:text-[#333]"},NBe={class:"overflow-y-auto min-h-0"},DBe={key:0,class:"flex-1 px-4 py-2 space-y-[0.3rem]"},OBe=["onClick"],IBe=m.defineComponent({__name:"EditorToc",setup(n){const e=m.inject("editor"),t=m.inject("page"),r=m.inject("options"),i=m.ref([]),a=m.ref(""),o=jue(()=>{i.value=e.value.storage.tableOfContents.content},200);m.watch(()=>e.value?.storage.tableOfContents.content,()=>{o()},{immediate:!0});const s=l=>{if(!e.value)return;a.value=l.id;const u=e.value.view.dom.querySelector(`[data-toc-id="${l.id}"]`);if(!u)return;u.scrollIntoView({behavior:"smooth"});const c=e.value.view.posAtDOM(u,0),{tr:f}=e.value.view.state,d=f.doc.nodeAt(c);if(d){const h=c+d.nodeSize;f.setSelection(en.create(f.doc,h))}else f.setSelection(new en(f.doc.resolve(c)));e.value.view.dispatch(f),e.value.view.focus()};return(l,u)=>(m.openBlock(),m.createElementBlock("div",MBe,[m.unref(r).layout.foot.show?(m.openBlock(),m.createElementBlock("div",ABe,[m.createElementVNode("span",{class:"flex items-center gap-2 cursor-pointer",onClick:u[0]||(u[0]=c=>m.unref(t).showToc=!1)},[...u[1]||(u[1]=[m.createElementVNode("i",{class:"w-iconfont icon-left !text-[12px]"},null,-1),m.createTextVNode(" 收起大纲 ",-1)])])])):m.createCommentVNode("",!0),m.createElementVNode("div",NBe,[i.value?.length?(m.openBlock(),m.createElementBlock("ul",DBe,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(i.value,c=>(m.openBlock(),m.createElementBlock("li",{key:c.id,class:m.normalizeClass(["cursor-pointer text-[#333] text-[14px] h-[34px] block leading-[34px] pr-2 hover:text-[#101219] rounded text-ellipsis overflow-hidden whitespace-nowrap",a.value===c.id?"font-bold bg-[#f5f5f5]":""]),style:m.normalizeStyle({textIndent:`${c.level}rem`}),onClick:f=>s(c)},m.toDisplayString(c.textContent),15,OBe))),128))])):(m.openBlock(),m.createBlock(EBe,{key:1,size:"120px"}))])]))}}),fZ=["top","right","bottom","left"],D9=["start","end"],O9=fZ.reduce((n,e)=>n.concat(e,e+"-"+D9[0],e+"-"+D9[1]),[]),nl=Math.min,oa=Math.max,Kw=Math.round,Hs=n=>({x:n,y:n}),RBe={left:"right",right:"left",bottom:"top",top:"bottom"},LBe={start:"end",end:"start"};function hN(n,e,t){return oa(n,nl(e,t))}function uu(n,e){return typeof n=="function"?n(e):n}function Eo(n){return n.split("-")[0]}function Ko(n){return n.split("-")[1]}function dZ(n){return n==="x"?"y":"x"}function KI(n){return n==="y"?"height":"width"}const PBe=new Set(["top","bottom"]);function Ls(n){return PBe.has(Eo(n))?"y":"x"}function YI(n){return dZ(Ls(n))}function hZ(n,e,t){t===void 0&&(t=!1);const r=Ko(n),i=YI(n),a=KI(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Xw(o)),[o,Xw(o)]}function BBe(n){const e=Xw(n);return[Yw(n),e,Yw(e)]}function Yw(n){return n.replace(/start|end/g,e=>LBe[e])}const I9=["left","right"],R9=["right","left"],VBe=["top","bottom"],zBe=["bottom","top"];function FBe(n,e,t){switch(n){case"top":case"bottom":return t?e?R9:I9:e?I9:R9;case"left":case"right":return e?VBe:zBe;default:return[]}}function $Be(n,e,t,r){const i=Ko(n);let a=FBe(Eo(n),t==="start",r);return i&&(a=a.map(o=>o+"-"+i),e&&(a=a.concat(a.map(Yw)))),a}function Xw(n){return n.replace(/left|right|bottom|top/g,e=>RBe[e])}function HBe(n){return{top:0,right:0,bottom:0,left:0,...n}}function XI(n){return typeof n!="number"?HBe(n):{top:n,right:n,bottom:n,left:n}}function Lp(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function L9(n,e,t){let{reference:r,floating:i}=n;const a=Ls(e),o=YI(e),s=KI(o),l=Eo(e),u=a==="y",c=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,d=r[s]/2-i[s]/2;let h;switch(l){case"top":h={x:c,y:r.y-i.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Ko(e)){case"start":h[o]-=d*(t&&u?-1:1);break;case"end":h[o]+=d*(t&&u?-1:1);break}return h}const UBe=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=t,s=a.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:c,y:f}=L9(u,r,l),d=r,h={},p=0;for(let v=0;v<s.length;v++){const{name:g,fn:y}=s[v],{x:b,y:w,data:x,reset:S}=await y({x:c,y:f,initialPlacement:r,placement:d,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:n,floating:e}});c=b??c,f=w??f,h={...h,[g]:{...h[g],...x}},S&&p<=50&&(p++,typeof S=="object"&&(S.placement&&(d=S.placement),S.rects&&(u=S.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):S.rects),{x:c,y:f}=L9(u,d,l)),v=-1)}return{x:c,y:f,placement:d,strategy:i,middlewareData:h}};async function Pp(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:o,elements:s,strategy:l}=n,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=uu(e,n),p=XI(h),g=s[d?f==="floating"?"reference":"floating":f],y=Lp(await a.getClippingRect({element:(t=await(a.isElement==null?void 0:a.isElement(g)))==null||t?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),b=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),x=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},S=Lp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:w,strategy:l}):b);return{top:(y.top-S.top+p.top)/x.y,bottom:(S.bottom-y.bottom+p.bottom)/x.y,left:(y.left-S.left+p.left)/x.x,right:(S.right-y.right+p.right)/x.x}}const GBe=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:l}=e,{element:u,padding:c=0}=uu(n,e)||{};if(u==null)return{};const f=XI(c),d={x:t,y:r},h=YI(i),p=KI(h),v=await o.getDimensions(u),g=h==="y",y=g?"top":"left",b=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=a.reference[p]+a.reference[h]-d[h]-a.floating[p],S=d[h]-a.reference[h],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let k=C?C[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(C)))&&(k=s.floating[w]||a.floating[p]);const O=x/2-S/2,R=k/2-v[p]/2-1,P=nl(f[y],R),z=nl(f[b],R),$=P,H=k-v[p]-z,J=k/2-v[p]/2+O,te=hN($,J,H),Q=!l.arrow&&Ko(i)!=null&&J!==te&&a.reference[p]/2-(J<$?P:z)-v[p]/2<0,fe=Q?J<$?J-$:J-H:0;return{[h]:d[h]+fe,data:{[h]:te,centerOffset:J-te-fe,...Q&&{alignmentOffset:fe}},reset:Q}}});function WBe(n,e,t){return(n?[...t.filter(i=>Ko(i)===n),...t.filter(i=>Ko(i)!==n)]:t.filter(i=>Eo(i)===i)).filter(i=>n?Ko(i)===n||(e?Yw(i)!==i:!1):!0)}const jBe=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,r,i;const{rects:a,middlewareData:o,placement:s,platform:l,elements:u}=e,{crossAxis:c=!1,alignment:f,allowedPlacements:d=O9,autoAlignment:h=!0,...p}=uu(n,e),v=f!==void 0||d===O9?WBe(f||null,h,d):d,g=await Pp(e,p),y=((t=o.autoPlacement)==null?void 0:t.index)||0,b=v[y];if(b==null)return{};const w=hZ(b,a,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(s!==b)return{reset:{placement:v[0]}};const x=[g[Eo(b)],g[w[0]],g[w[1]]],S=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:b,overflows:x}],C=v[y+1];if(C)return{data:{index:y+1,overflows:S},reset:{placement:C}};const k=S.map(P=>{const z=Ko(P.placement);return[P.placement,z&&c?P.overflows.slice(0,2).reduce(($,H)=>$+H,0):P.overflows[0],P.overflows]}).sort((P,z)=>P[1]-z[1]),R=((i=k.filter(P=>P[2].slice(0,Ko(P[0])?2:3).every(z=>z<=0))[0])==null?void 0:i[0])||k[0][0];return R!==s?{data:{index:y+1,overflows:S},reset:{placement:R}}:{}}}},qBe=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:v=!0,...g}=uu(n,e);if((t=a.arrow)!=null&&t.alignmentOffset)return{};const y=Eo(i),b=Ls(s),w=Eo(s)===s,x=await(l.isRTL==null?void 0:l.isRTL(u.floating)),S=d||(w||!v?[Xw(s)]:BBe(s)),C=p!=="none";!d&&C&&S.push(...$Be(s,v,p,x));const k=[s,...S],O=await Pp(e,g),R=[];let P=((r=a.flip)==null?void 0:r.overflows)||[];if(c&&R.push(O[y]),f){const J=hZ(i,o,x);R.push(O[J[0]],O[J[1]])}if(P=[...P,{placement:i,overflows:R}],!R.every(J=>J<=0)){var z,$;const J=(((z=a.flip)==null?void 0:z.index)||0)+1,te=k[J];if(te&&(!(f==="alignment"?b!==Ls(te):!1)||P.every(oe=>Ls(oe.placement)===b?oe.overflows[0]>0:!0)))return{data:{index:J,overflows:P},reset:{placement:te}};let Q=($=P.filter(fe=>fe.overflows[0]<=0).sort((fe,oe)=>fe.overflows[1]-oe.overflows[1])[0])==null?void 0:$.placement;if(!Q)switch(h){case"bestFit":{var H;const fe=(H=P.filter(oe=>{if(C){const me=Ls(oe.placement);return me===b||me==="y"}return!0}).map(oe=>[oe.placement,oe.overflows.filter(me=>me>0).reduce((me,Ie)=>me+Ie,0)]).sort((oe,me)=>oe[1]-me[1])[0])==null?void 0:H[0];fe&&(Q=fe);break}case"initialPlacement":Q=s;break}if(i!==Q)return{reset:{placement:Q}}}return{}}}};function P9(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function B9(n){return fZ.some(e=>n[e]>=0)}const KBe=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=uu(n,e);switch(r){case"referenceHidden":{const a=await Pp(e,{...i,elementContext:"reference"}),o=P9(a,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:B9(o)}}}case"escaped":{const a=await Pp(e,{...i,altBoundary:!0}),o=P9(a,t.floating);return{data:{escapedOffsets:o,escaped:B9(o)}}}default:return{}}}}};function pZ(n){const e=nl(...n.map(a=>a.left)),t=nl(...n.map(a=>a.top)),r=oa(...n.map(a=>a.right)),i=oa(...n.map(a=>a.bottom));return{x:e,y:t,width:r-e,height:i-t}}function YBe(n){const e=n.slice().sort((i,a)=>i.y-a.y),t=[];let r=null;for(let i=0;i<e.length;i++){const a=e[i];!r||a.y-r.y>r.height/2?t.push([a]):t[t.length-1].push(a),r=a}return t.map(i=>Lp(pZ(i)))}const XBe=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:r,rects:i,platform:a,strategy:o}=e,{padding:s=2,x:l,y:u}=uu(n,e),c=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]),f=YBe(c),d=Lp(pZ(c)),h=XI(s);function p(){if(f.length===2&&f[0].left>f[1].right&&l!=null&&u!=null)return f.find(g=>l>g.left-h.left&&l<g.right+h.right&&u>g.top-h.top&&u<g.bottom+h.bottom)||d;if(f.length>=2){if(Ls(t)==="y"){const P=f[0],z=f[f.length-1],$=Eo(t)==="top",H=P.top,J=z.bottom,te=$?P.left:z.left,Q=$?P.right:z.right,fe=Q-te,oe=J-H;return{top:H,bottom:J,left:te,right:Q,width:fe,height:oe,x:te,y:H}}const g=Eo(t)==="left",y=oa(...f.map(P=>P.right)),b=nl(...f.map(P=>P.left)),w=f.filter(P=>g?P.left===b:P.right===y),x=w[0].top,S=w[w.length-1].bottom,C=b,k=y,O=k-C,R=S-x;return{top:x,bottom:S,left:C,right:k,width:O,height:R,x:C,y:x}}return d}const v=await a.getElementRects({reference:{getBoundingClientRect:p},floating:r.floating,strategy:o});return i.reference.x!==v.reference.x||i.reference.y!==v.reference.y||i.reference.width!==v.reference.width||i.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}},ZBe=new Set(["left","top"]);async function JBe(n,e){const{placement:t,platform:r,elements:i}=n,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Eo(t),s=Ko(t),l=Ls(t)==="y",u=ZBe.has(o)?-1:1,c=a&&l?-1:1,f=uu(e,n);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof p=="number"&&(h=s==="end"?p*-1:p),l?{x:h*c,y:d*u}:{x:d*u,y:h*c}}const QBe=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:a,placement:o,middlewareData:s}=e,l=await JBe(e,n);return o===((t=s.offset)==null?void 0:t.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:o}}}}},e8e=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:g=>{let{x:y,y:b}=g;return{x:y,y:b}}},...l}=uu(n,e),u={x:t,y:r},c=await Pp(e,l),f=Ls(Eo(i)),d=dZ(f);let h=u[d],p=u[f];if(a){const g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",b=h+c[g],w=h-c[y];h=hN(b,h,w)}if(o){const g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",b=p+c[g],w=p-c[y];p=hN(b,p,w)}const v=s.fn({...e,[d]:h,[f]:p});return{...v,data:{x:v.x-t,y:v.y-r,enabled:{[d]:a,[f]:o}}}}}},t8e=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:a,platform:o,elements:s}=e,{apply:l=()=>{},...u}=uu(n,e),c=await Pp(e,u),f=Eo(i),d=Ko(i),h=Ls(i)==="y",{width:p,height:v}=a.floating;let g,y;f==="top"||f==="bottom"?(g=f,y=d===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(y=f,g=d==="end"?"top":"bottom");const b=v-c.top-c.bottom,w=p-c.left-c.right,x=nl(v-c[g],b),S=nl(p-c[y],w),C=!e.middlewareData.shift;let k=x,O=S;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(O=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(k=b),C&&!d){const P=oa(c.left,0),z=oa(c.right,0),$=oa(c.top,0),H=oa(c.bottom,0);h?O=p-2*(P!==0||z!==0?P+z:oa(c.left,c.right)):k=v-2*($!==0||H!==0?$+H:oa(c.top,c.bottom))}await l({...e,availableWidth:O,availableHeight:k});const R=await o.getDimensions(s.floating);return p!==R.width||v!==R.height?{reset:{rects:!0}}:{}}}};function pS(){return typeof window<"u"}function cv(n){return vZ(n)?(n.nodeName||"").toLowerCase():"#document"}function Ua(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function cu(n){var e;return(e=(vZ(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function vZ(n){return pS()?n instanceof Node||n instanceof Ua(n).Node:!1}function Qo(n){return pS()?n instanceof Element||n instanceof Ua(n).Element:!1}function rl(n){return pS()?n instanceof HTMLElement||n instanceof Ua(n).HTMLElement:!1}function V9(n){return!pS()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ua(n).ShadowRoot}const n8e=new Set(["inline","contents"]);function $y(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=es(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!n8e.has(i)}const r8e=new Set(["table","td","th"]);function i8e(n){return r8e.has(cv(n))}const a8e=[":popover-open",":modal"];function vS(n){return a8e.some(e=>{try{return n.matches(e)}catch{return!1}})}const o8e=["transform","translate","scale","rotate","perspective"],s8e=["transform","translate","scale","rotate","perspective","filter"],l8e=["paint","layout","strict","content"];function ZI(n){const e=JI(),t=Qo(n)?es(n):n;return o8e.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||s8e.some(r=>(t.willChange||"").includes(r))||l8e.some(r=>(t.contain||"").includes(r))}function u8e(n){let e=Tc(n);for(;rl(e)&&!Bp(e);){if(ZI(e))return e;if(vS(e))return null;e=Tc(e)}return null}function JI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const c8e=new Set(["html","body","#document"]);function Bp(n){return c8e.has(cv(n))}function es(n){return Ua(n).getComputedStyle(n)}function gS(n){return Qo(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Tc(n){if(cv(n)==="html")return n;const e=n.assignedSlot||n.parentNode||V9(n)&&n.host||cu(n);return V9(e)?e.host:e}function gZ(n){const e=Tc(n);return Bp(e)?n.ownerDocument?n.ownerDocument.body:n.body:rl(e)&&$y(e)?e:gZ(e)}function mZ(n,e,t){var r;e===void 0&&(e=[]);const i=gZ(n),a=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ua(i);return a?(pN(o),e.concat(o,o.visualViewport||[],$y(i)?i:[],[])):e.concat(i,mZ(i,[]))}function pN(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function yZ(n){const e=es(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=rl(n),a=i?n.offsetWidth:t,o=i?n.offsetHeight:r,s=Kw(t)!==a||Kw(r)!==o;return s&&(t=a,r=o),{width:t,height:r,$:s}}function bZ(n){return Qo(n)?n:n.contextElement}function op(n){const e=bZ(n);if(!rl(e))return Hs(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:a}=yZ(e);let o=(a?Kw(t.width):t.width)/r,s=(a?Kw(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const f8e=Hs(0);function xZ(n){const e=Ua(n);return!JI()||!e.visualViewport?f8e:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function d8e(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ua(n)?!1:e}function py(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),a=bZ(n);let o=Hs(1);e&&(r?Qo(r)&&(o=op(r)):o=op(n));const s=d8e(a,t,r)?xZ(a):Hs(0);let l=(i.left+s.x)/o.x,u=(i.top+s.y)/o.y,c=i.width/o.x,f=i.height/o.y;if(a){const d=Ua(a),h=r&&Qo(r)?Ua(r):r;let p=d,v=pN(p);for(;v&&r&&h!==p;){const g=op(v),y=v.getBoundingClientRect(),b=es(v),w=y.left+(v.clientLeft+parseFloat(b.paddingLeft))*g.x,x=y.top+(v.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,f*=g.y,l+=w,u+=x,p=Ua(v),v=pN(p)}}return Lp({width:c,height:f,x:l,y:u})}function mS(n,e){const t=gS(n).scrollLeft;return e?e.left+t:py(cu(n)).left+t}function wZ(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-mS(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function h8e(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const a=i==="fixed",o=cu(r),s=e?vS(e.floating):!1;if(r===o||s&&a)return t;let l={scrollLeft:0,scrollTop:0},u=Hs(1);const c=Hs(0),f=rl(r);if((f||!f&&!a)&&((cv(r)!=="body"||$y(o))&&(l=gS(r)),rl(r))){const h=py(r);u=op(r),c.x=h.x+r.clientLeft,c.y=h.y+r.clientTop}const d=o&&!f&&!a?wZ(o,l):Hs(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-l.scrollLeft*u.x+c.x+d.x,y:t.y*u.y-l.scrollTop*u.y+c.y+d.y}}function p8e(n){return Array.from(n.getClientRects())}function v8e(n){const e=cu(n),t=gS(n),r=n.ownerDocument.body,i=oa(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=oa(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+mS(n);const s=-t.scrollTop;return es(r).direction==="rtl"&&(o+=oa(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}const z9=25;function g8e(n,e){const t=Ua(n),r=cu(n),i=t.visualViewport;let a=r.clientWidth,o=r.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;const c=JI();(!c||c&&e==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}const u=mS(r);if(u<=0){const c=r.ownerDocument,f=c.body,d=getComputedStyle(f),h=c.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,p=Math.abs(r.clientWidth-f.clientWidth-h);p<=z9&&(a-=p)}else u<=z9&&(a+=u);return{width:a,height:o,x:s,y:l}}const m8e=new Set(["absolute","fixed"]);function y8e(n,e){const t=py(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,a=rl(n)?op(n):Hs(1),o=n.clientWidth*a.x,s=n.clientHeight*a.y,l=i*a.x,u=r*a.y;return{width:o,height:s,x:l,y:u}}function F9(n,e,t){let r;if(e==="viewport")r=g8e(n,t);else if(e==="document")r=v8e(cu(n));else if(Qo(e))r=y8e(e,t);else{const i=xZ(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Lp(r)}function _Z(n,e){const t=Tc(n);return t===e||!Qo(t)||Bp(t)?!1:es(t).position==="fixed"||_Z(t,e)}function b8e(n,e){const t=e.get(n);if(t)return t;let r=mZ(n,[]).filter(s=>Qo(s)&&cv(s)!=="body"),i=null;const a=es(n).position==="fixed";let o=a?Tc(n):n;for(;Qo(o)&&!Bp(o);){const s=es(o),l=ZI(o);!l&&s.position==="fixed"&&(i=null),(a?!l&&!i:!l&&s.position==="static"&&!!i&&m8e.has(i.position)||$y(o)&&!l&&_Z(n,o))?r=r.filter(c=>c!==o):i=s,o=Tc(o)}return e.set(n,r),r}function x8e(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?vS(e)?[]:b8e(e,this._c):[].concat(t),r],s=o[0],l=o.reduce((u,c)=>{const f=F9(e,c,i);return u.top=oa(f.top,u.top),u.right=nl(f.right,u.right),u.bottom=nl(f.bottom,u.bottom),u.left=oa(f.left,u.left),u},F9(e,s,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function w8e(n){const{width:e,height:t}=yZ(n);return{width:e,height:t}}function _8e(n,e,t){const r=rl(e),i=cu(e),a=t==="fixed",o=py(n,!0,a,e);let s={scrollLeft:0,scrollTop:0};const l=Hs(0);function u(){l.x=mS(i)}if(r||!r&&!a)if((cv(e)!=="body"||$y(i))&&(s=gS(e)),r){const h=py(e,!0,a,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&u();a&&!r&&i&&u();const c=i&&!r&&!a?wZ(i,s):Hs(0),f=o.left+s.scrollLeft-l.x-c.x,d=o.top+s.scrollTop-l.y-c.y;return{x:f,y:d,width:o.width,height:o.height}}function $k(n){return es(n).position==="static"}function $9(n,e){if(!rl(n)||es(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return cu(n)===t&&(t=t.ownerDocument.body),t}function SZ(n,e){const t=Ua(n);if(vS(n))return t;if(!rl(n)){let i=Tc(n);for(;i&&!Bp(i);){if(Qo(i)&&!$k(i))return i;i=Tc(i)}return t}let r=$9(n,e);for(;r&&i8e(r)&&$k(r);)r=$9(r,e);return r&&Bp(r)&&$k(r)&&!ZI(r)?t:r||u8e(n)||t}const S8e=async function(n){const e=this.getOffsetParent||SZ,t=this.getDimensions,r=await t(n.floating);return{reference:_8e(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function T8e(n){return es(n).direction==="rtl"}const C8e={convertOffsetParentRelativeRectToViewportRelativeRect:h8e,getDocumentElement:cu,getClippingRect:x8e,getOffsetParent:SZ,getElementRects:S8e,getClientRects:p8e,getDimensions:w8e,getScale:op,isElement:Qo,isRTL:T8e},TZ=QBe,CZ=jBe,kZ=e8e,EZ=qBe,MZ=t8e,AZ=KBe,NZ=GBe,DZ=XBe,OZ=(n,e,t)=>{const r=new Map,i={platform:C8e,...t},a={...i.platform,_c:r};return UBe(n,e,{...i,platform:a})};function k8e(n,e){const t=Math.min(n.top,e.top),r=Math.max(n.bottom,e.bottom),i=Math.min(n.left,e.left),o=Math.max(n.right,e.right)-i,s=r-t,l=i,u=t;return new DOMRect(l,u,o,s)}var E8e=class{constructor({editor:n,element:e,view:t,updateDelay:r=250,resizeDelay:i=60,shouldShow:a,appendTo:o,getReferencedVirtualElement:s,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:c,state:f,from:d,to:h})=>{const{doc:p,selection:v}=f,{empty:g}=v,y=!p.textBetween(d,h).length&&GN(f.selection),b=this.element.contains(document.activeElement);return!(!(c.hasFocus()||b)||g||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:c})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}c?.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(c.relatedTarget))||c?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(c,f)=>{const d=!f?.selection.eq(c.state.selection),h=!f?.doc.eq(c.state.doc);!d&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,d,h,f)},this.updateDelay))},this.updateHandler=(c,f,d,h)=>{const{composing:p}=c;if(p||!f&&!d)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:c})=>{c.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var u;this.editor=n,this.element=e,this.view=t,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(u=l?.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=s,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(EZ(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(kZ(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(TZ(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(NZ(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(MZ(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(CZ(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(AZ(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(DZ(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n;const{selection:e}=this.editor.state,t=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(t)return t;const r=XF(this.view,e.from,e.to);let i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(e instanceof nn){let a=this.view.nodeDOM(e.from);const o=a.dataset.nodeViewWrapper?a:a.querySelector("[data-node-view-wrapper]");o&&(a=o),a&&(i={getBoundingClientRect:()=>a.getBoundingClientRect(),getClientRects:()=>[a.getBoundingClientRect()]})}if(e instanceof gr){const{$anchorCell:a,$headCell:o}=e,s=a?a.pos:o.pos,l=o?o.pos:a.pos,u=this.view.nodeDOM(s),c=this.view.nodeDOM(l);if(!u||!c)return;const f=u===c?u.getBoundingClientRect():k8e(u.getBoundingClientRect(),c.getBoundingClientRect());i={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return i}updatePosition(){const n=this.virtualElement;n&&OZ(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,r=t.selection.from!==t.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(n,e);return}const i=!e?.selection.eq(n.state.selection),a=!e?.doc.eq(n.state.doc);this.updateHandler(n,i,a,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,a=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:a,to:o}))||!1}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},M8e=n=>new jn({key:typeof n.pluginKey=="string"?new Zn(n.pluginKey):n.pluginKey,view:e=>new E8e({view:e,...n})}),A8e=m.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{editor:i,options:a,pluginKey:o,resizeDelay:s,appendTo:l,shouldShow:u,getReferencedVirtualElement:c,updateDelay:f}=n,d=r.value;d&&(d.style.visibility="hidden",d.style.position="absolute",d.remove(),m.nextTick(()=>{i.registerPlugin(M8e({editor:i,element:d,options:a,pluginKey:o,resizeDelay:s,appendTo:l,shouldShow:u,getReferencedVirtualElement:c,updateDelay:f}))}))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:a}=n;a.unregisterPlugin(i)}),()=>{var i;return m.h("div",{ref:r,...t},(i=e.default)==null?void 0:i.call(e))}}}),N8e=class{constructor({editor:n,element:e,view:t,options:r,appendTo:i,shouldShow:a}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:s})=>{const{selection:l}=s,{$anchor:u,empty:c}=l,f=u.depth===1,d=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!o.hasFocus()||!c||!f||!d||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,s,l,u)=>{const{composing:c}=o;if(c||!s&&!l)return;if(!this.getShouldShow(u)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var s;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((s=this.element.parentNode)!=null&&s.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=n,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(n){return GF(n,{textSerializers:qN(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(EZ(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(kZ(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(TZ(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(NZ(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(MZ(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(CZ(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(AZ(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(DZ(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,a=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:a,to:o})}updatePosition(){const{selection:n}=this.editor.state,e=XF(this.view,n.from,n.to);OZ({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:a})=>{this.element.style.width="max-content",this.element.style.position=a,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!e?.selection.eq(n.state.selection),r=!e?.doc.eq(n.state.doc);this.updateHandler(n,t,r,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},D8e=n=>new jn({key:typeof n.pluginKey=="string"?new Zn(n.pluginKey):n.pluginKey,view:e=>new N8e({view:e,...n})});m.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{pluginKey:i,editor:a,options:o,appendTo:s,shouldShow:l}=n,u=r.value;u&&(u.style.visibility="hidden",u.style.position="absolute",u.remove(),a.registerPlugin(D8e({pluginKey:i,editor:a,element:u,options:o,appendTo:s,shouldShow:l})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:a}=n;a.unregisterPlugin(i)}),()=>{var i;return m.h("div",{ref:r,...t},(i=e.default)==null?void 0:i.call(e))}}});const O8e=m.defineComponent({__name:"flip",setup(n){const e=m.inject("editor"),t=m.computed(()=>{const a=e.value?Ps(e.value):null;return a?.type?.name?e.value?.getAttributes(a?.type?.name)?.flipY:!1}),r=m.computed(()=>{const a=e.value?Ps(e.value):null;return a?.type?.name?e.value?.getAttributes(a?.type?.name)?.flipX:!1}),i=a=>{const o=e.value?Ps(e.value):null,{flipX:s,flipY:l}=o?.attrs??{};o&&a==="flipX"&&e.value?.commands.updateAttributes(o.type,{flipX:!s}),o&&a==="flipY"&&e.value?.commands.updateAttributes(o.type,{flipY:!l})};return(a,o)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"flip-x",text:"水平翻转","hide-text":"","menu-active":t.value,onMenuClick:o[0]||(o[0]=s=>i("flipY"))},null,8,["menu-active"]),m.createVNode(Tn,{ico:"flip-y",text:"垂直翻转","hide-text":"","menu-active":r.value,onMenuClick:o[1]||(o[1]=s=>i("flipX"))},null,8,["menu-active"])],64))}}),IZ=m.defineComponent({__name:"open",setup(n){const e=m.inject("editor"),t=()=>{const r=e.value?Ps(e?.value):null;window.open(r?.attrs.src)};return(r,i)=>(m.openBlock(),m.createBlock(Tn,{ico:"open",text:"新窗口打开",shortcut:"Backspace","hide-text":"",onMenuClick:t}))}}),I8e=m.defineComponent({__name:"covert",setup(n){const e=m.inject("editor"),t=m.computed(()=>(e.value?Ps(e.value):null)?.type?.name==="inlineImage"?"转为节点图片":"转为行内图片"),r=()=>{const i=e.value?Ps(e.value):null;if(i){const a=i?.type?.name==="inlineImage"?"inlineImage":"image",o=i.attrs??{};!o.error&&o.src&&(e.value?.chain().focus().deleteSelectionNode().run(),a==="inlineImage"?e.value?.chain().focus().setImage({...o,equalProportion:!1,inline:!1}).run():e.value?.chain().focus().setInlineImage({...o,inline:!0,equalProportion:!1}).run())}};return(i,a)=>(m.openBlock(),m.createBlock(Tn,{ico:"huantu",text:t.value,"hide-text":"",onMenuClick:r},null,8,["text"]))}}),Gd=m.defineComponent({__name:"delete",setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createBlock(Tn,{ico:"remove",text:"删除",shortcut:"Backspace","hide-text":"",onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().deleteSelectionNode().run())}))}}),R8e={class:"flex items-center gap-2"},L8e=m.defineComponent({__name:"image-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",R8e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(O8e),m.createVNode(I8e),m.createVNode(IZ),m.createVNode(Gd)]))}}),P8e=m.defineComponent({__name:"down",setup(n){const e=m.inject("editor"),t=()=>{const r=e.value?Ps(e.value):null,i=document.createElement("a");i.href=r?.attrs.url,i.download=r?.attrs.name,i&&(document.body.appendChild(i),i.click(),document.body.removeChild(i))};return(r,i)=>m.unref(e)?.getAttributes("file")?.uploaded?(m.openBlock(),m.createBlock(Tn,{key:0,ico:"down",text:"下载","hide-text":"",onMenuClick:i[0]||(i[0]=a=>t())})):m.createCommentVNode("",!0)}}),B8e={class:"flex items-center gap-2"},V8e=m.defineComponent({__name:"file-menu",setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock("div",B8e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.unref(e)?.isActive("file")||m.unref(e)?.isActive("video")||m.unref(e)?.isActive("audio")?(m.openBlock(),m.createBlock(P8e,{key:0})):m.createCommentVNode("",!0),m.createVNode(Gd)]))}}),z8e=m.defineComponent({__name:"cell-background",props:{text:{type:String,default:""},defaultColor:{type:String,default:"#007bff"}},setup(n){const e=n,t=m.inject("editor"),r=m.ref(!1),i=m.ref(e.defaultColor),a=s=>{i.value=s,r.value=!1;const l=s===""?null:s;t.value?.chain().focus().setCellAttribute("background",l).run()},o=xN(s=>{i.value=s,r.value=!1;const l=s===""?null:s;t.value?.chain().focus().setCellAttribute("background",l).run()},200);return m.watch(()=>i.value,s=>{o(s)}),(s,l)=>(m.openBlock(),m.createBlock(sl,{ico:"fill",text:"填充背景","hide-text":"","popup-visible":r.value,"onUpdate:popupVisible":l[1]||(l[1]=u=>r.value=u),disabled:!m.unref(t)?.can().setCellAttribute("background",""),"popup-type":"arrow",onMenuClick:l[2]||(l[2]=u=>a(i.value))},{content:m.withCtx(()=>[m.createVNode(m.unref(jI),{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=u=>i.value=u)},null,8,["modelValue"])]),default:m.withCtx(()=>[m.createElementVNode("div",{class:"w-[14px] h-[2px] mx-auto",style:m.normalizeStyle({backgroundColor:i.value})},null,4)]),_:1},8,["popup-visible","disabled"]))}}),F8e=m.defineComponent({__name:"cell-insert",props:{hideText:{type:Boolean,default:!0}},setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"charutop",text:"上方插入一行","hide-text":n.hideText,disabled:!m.unref(e)?.can().addRowBefore(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().addRowBefore().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"charubottom",text:"下方插入一行","hide-text":n.hideText,disabled:!m.unref(e)?.can().addRowAfter(),onMenuClick:r[1]||(r[1]=i=>m.unref(e)?.chain().focus().addRowAfter().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"charuleft",text:"左方插入一列","hide-text":n.hideText,disabled:!m.unref(e)?.can().addColumnBefore(),onMenuClick:r[2]||(r[2]=i=>m.unref(e)?.chain().focus().addColumnBefore().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"charuright",text:"右方插入一列","hide-text":n.hideText,disabled:!m.unref(e)?.can().addColumnAfter(),onMenuClick:r[3]||(r[3]=i=>m.unref(e)?.chain().focus().addColumnAfter().run())},null,8,["hide-text","disabled"])],64))}}),$8e=m.defineComponent({__name:"cell-delete",props:{hideText:{type:Boolean,default:!0}},setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"removehang",text:"删除行","hide-text":n.hideText,disabled:!m.unref(e)?.can().deleteColumn(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().deleteRow().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"removelie",text:"删除列","hide-text":n.hideText,disabled:!m.unref(e)?.can().deleteColumn(),onMenuClick:r[1]||(r[1]=i=>m.unref(e)?.chain().focus().deleteColumn().run())},null,8,["hide-text","disabled"])],64))}}),H8e=m.defineComponent({__name:"cell-merge",props:{hideText:{type:Boolean,default:!0}},setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"merge-cell",text:"合并单元格","hide-text":n.hideText,disabled:!m.unref(e)?.can().mergeCells(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().mergeCells().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"split-cell",text:"拆分单元格","hide-text":n.hideText,disabled:!m.unref(e)?.can().splitCell(),onMenuClick:r[1]||(r[1]=i=>m.unref(e)?.chain().focus().splitCell().run())},null,8,["hide-text","disabled"])],64))}}),U8e=m.defineComponent({__name:"table-delete",setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createBlock(Tn,{ico:"remove",text:"删除表格",shortcut:"Backspace","hide-text":"",disabled:!m.unref(e)?.can().deleteTable(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().deleteTable().run())},null,8,["disabled"]))}}),G8e={class:"flex items-center gap-2"},W8e=m.defineComponent({__name:"table-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",G8e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(z8e),m.createVNode(F8e),m.createVNode($8e),m.createVNode(H8e),m.createVNode(U8e)]))}}),j8e=m.defineComponent({__name:"tag-input",setup(n){const e=m.ref(""),t=m.inject("editor"),r=()=>{if(e.value==="")return;t.value?.state?.selection?.$from?.node()&&t.value?.commands.updateAttributes("tag",{text:e.value})},i=()=>{const a=t.value?.getAttributes("tag");a?.text&&(e.value=a.text)};return m.onMounted(()=>{i(),t.value?.on("selectionUpdate",i)}),m.onBeforeUnmount(()=>{t.value?.off("selectionUpdate")}),(a,o)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Vm,{placeholder:"请输入标签",value:e.value,"onUpdate:value":o[0]||(o[0]=s=>e.value=s),size:"small"},null,8,["value"]),m.createVNode(Uo,{type:"primary",size:"small",onClick:o[1]||(o[1]=s=>r())},{default:m.withCtx(()=>[...o[2]||(o[2]=[m.createTextVNode("确认",-1)])]),_:1})],64))}}),q8e={class:"px-2"},K8e=["onClick"],Y8e=m.defineComponent({__name:"tag-color",setup(n){const e=m.inject("editor"),t=m.ref("#007bff"),r=m.ref(!1),i=[{label:"蓝色",color:"#007bff",bgcolor:"rgb(217, 231, 255)"},{label:"红色",color:"rgba(200, 78, 67, 1)",bgcolor:"rgb(252, 223, 220)"},{label:"黄色",color:"rgba(240, 196, 23, 1)",bgcolor:"rgb(255, 245, 210)"},{label:"绿色",color:"rgba(5, 205, 153, 1)",bgcolor:"rgb(205, 245, 235)"},{label:"紫色",color:"#e6afff",bgcolor:"rgb(220, 223, 252)"}],a=s=>{e.value?.state?.selection?.$from?.node()&&e.value?.commands.updateAttributes("tag",{type:s.type,color:s.color,backgroundColor:s.bgcolor}),t.value=s?.bgcolor,r.value=!1},o=()=>{e.value?.state?.selection?.$from?.node()&&e.value?.commands.updateAttributes("tag",{type:"default",color:"#999",backgroundColor:"rgba(0, 0, 0, 0.05)"}),t.value="rgba(0, 0, 0, 0.05)",r.value=!1};return(s,l)=>(m.openBlock(),m.createBlock(hS,{ico:"fill",text:"高亮填充","hide-text":"",onMenuClick:l[1]||(l[1]=u=>a()),maxHeight:!1,"popup-visible":r.value,"onUpdate:popupVisible":l[2]||(l[2]=u=>r.value=u)},{content:m.withCtx(()=>[m.createElementVNode("div",q8e,[(m.openBlock(),m.createElementBlock(m.Fragment,null,m.renderList(i,(u,c)=>m.createElementVNode("div",{key:c,onClick:f=>a(u),style:m.normalizeStyle({backgroundColor:u.bgcolor}),class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer"},[l[3]||(l[3]=m.createElementVNode("i",{class:"w-iconfont icon-tumo !text-[14px]"},null,-1)),m.createTextVNode(" "+m.toDisplayString(u.label),1)],12,K8e)),64)),m.createElementVNode("div",{class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer border",onClick:l[0]||(l[0]=u=>o())},[...l[4]||(l[4]=[m.createElementVNode("i",{class:"w-iconfont icon-clear-format !text-[14px]"},null,-1),m.createTextVNode(" 清除 ",-1)])])])]),_:1},8,["popup-visible"]))}}),X8e={class:"flex items-center gap-2"},Z8e=m.defineComponent({__name:"tag-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",X8e,[m.createVNode(j8e),m.createVNode(Y8e),m.createVNode(Gd)]))}}),J8e=m.defineComponent({__name:"ai-operation",setup(n){const e=m.inject("editor"),t=m.inject("assistant"),r=()=>{t.value=!0,e.value?.commands.focus()};return(i,a)=>(m.openBlock(),m.createBlock(Tn,{ico:"ai-assistant",text:"AI智能助手","hide-text":"",onMenuClick:r}))}}),Q8e={class:"px-2"},e6e=["onClick"],t6e=m.defineComponent({__name:"high-background",setup(n){const e=m.inject("editor"),t=m.ref("#007bff"),r=m.ref(!1),i=[{label:"默认",bgcolor:"#007bff"},{label:"红色",bgcolor:"#ff8a8a"},{label:"黄色",bgcolor:"#ffff8a"},{label:"绿色",bgcolor:"#a7ffa7"},{label:"紫色",bgcolor:"#e6afff"},{label:"蓝色",bgcolor:"#83d3ff"}],a=s=>{if(!s){e.value?.chain().focus().setHighlight({color:i[0].bgcolor}).run();return}t.value=s?.bgcolor,e.value?.chain().focus().setHighlight({color:s.bgcolor}).run(),r.value=!1},o=()=>{e.value?.chain().focus().unsetHighlight().run(),t.value="#007bff",r.value=!1};return(s,l)=>(m.openBlock(),m.createBlock(hS,{ico:"fill",text:"高亮填充","hide-text":"",onMenuClick:l[1]||(l[1]=u=>a()),maxHeight:!1,"popup-visible":r.value,"onUpdate:popupVisible":l[2]||(l[2]=u=>r.value=u)},{content:m.withCtx(()=>[m.createElementVNode("div",Q8e,[(m.openBlock(),m.createElementBlock(m.Fragment,null,m.renderList(i,(u,c)=>m.createElementVNode("div",{key:c,onClick:f=>a(u),style:m.normalizeStyle({backgroundColor:u.bgcolor}),class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer"},[l[3]||(l[3]=m.createElementVNode("i",{class:"w-iconfont icon-tumo !text-[14px]"},null,-1)),m.createTextVNode(" "+m.toDisplayString(u.label),1)],12,e6e)),64)),m.createElementVNode("div",{class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer border",onClick:l[0]||(l[0]=u=>o())},[...l[4]||(l[4]=[m.createElementVNode("i",{class:"w-iconfont icon-clear-format !text-[14px]"},null,-1),m.createTextVNode(" 清除 ",-1)])])])]),_:1},8,["popup-visible"]))}}),n6e={class:"flex items-center gap-2"},r6e=m.defineComponent({__name:"text-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",n6e,[m.createVNode(J8e),m.createVNode(iN),m.createVNode(aN),m.createVNode(oN),m.createVNode(sN),m.createVNode(uZ),m.createVNode(t6e),m.createVNode(Gd)]))}}),i6e={class:"flex items-center gap-2"},a6e={key:0,class:"flex items-center gap-2 py-2 px-1"},o6e={class:"flex-1 h-[90px] flex flex-col justify-between gap-1"},s6e={class:"mb-2"},l6e={class:"flex items-center gap-2"},u6e=["innerHTML"],c6e={key:1,class:"text-[12px] text-[#999]"},f6e=["onClick"],d6e=["innerHTML"],h6e={class:"flex items-center gap-2"},p6e=m.defineComponent({__name:"iframe-menu",setup(n){const e=m.inject("editor"),t=m.ref(),r=m.ref(""),i=m.ref(""),a=m.computed(()=>_g.find(l=>l.value===i.value)),o=l=>{i.value=l.value,t.value?.changePopoverVisible(!1)},s=()=>{const{validate:l,transformURL:u}=_g.find(c=>c.value===i.value);l&&!l(r.value)||e.value.chain().focus().setParagraph().setIframe({type:i.value,src:u?u(r.value):r.value}).run()};return(l,u)=>(m.openBlock(),m.createElementBlock("div",i6e,[m.unref(e)?.getAttributes("iframe").src==""?(m.openBlock(),m.createElementBlock("div",a6e,[u[3]||(u[3]=m.createElementVNode("div",{class:"flex flex-col items-center gap-1 h-[80px]"},[m.createElementVNode("span",{class:"w-[24px] h-[24px] text-center rounded-full bg-[#007bff] text-[12px] text-[#fff] font-500",style:{"line-height":"24px"}}," 1 "),m.createElementVNode("div",{class:"w-[1px] flex-1 bg-[#e5e5e5]"}),m.createElementVNode("span",{class:"w-[24px] h-[24px] text-center rounded-full bg-[#007bff] text-[12px] text-[#fff] font-500",style:{"line-height":"24px"}}," 2 ")],-1)),m.createElementVNode("div",o6e,[m.createElementVNode("div",s6e,[m.createVNode(im,{value:i.value,"onUpdate:value":u[0]||(u[0]=c=>i.value=c),options:m.unref(_g),placeholder:"选择网页类型",class:"w-full",ref_key:"selectRef",ref:t},{main:m.withCtx(()=>[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(m.unref(_g),(c,f)=>(m.openBlock(),m.createElementBlock("div",{key:c.value,class:m.normalizeClass(["flex items-center gap-2 h-[32px] px-2 cursor-pointer rounded-[4px] hover:bg-[rgb(242,243,245)]",{"bg-[rgb(242,243,245)]":i.value===c.value,"mb-1":f!==m.unref(_g).length-1}]),onClick:d=>o(c)},[m.createElementVNode("span",{innerHTML:c.icon},null,8,d6e),m.createTextVNode(" "+m.toDisplayString(c.label),1)],10,f6e))),128))]),default:m.withCtx(()=>[m.createElementVNode("div",l6e,[a.value&&Object.keys(a.value).length?(m.openBlock(),m.createElementBlock(m.Fragment,{key:0},[m.createElementVNode("span",{innerHTML:a.value.icon},null,8,u6e),m.createTextVNode(" "+m.toDisplayString(a.value.label),1)],64)):(m.openBlock(),m.createElementBlock("span",c6e,"选择网页类型"))])]),_:1},8,["value","options"])]),m.createElementVNode("div",h6e,[m.createVNode(Vm,{value:r.value,"onUpdate:value":u[1]||(u[1]=c=>r.value=c),placeholder:"打开网址复制链接,以http:// 或 https:// 开头",class:"w-[300px]"},null,8,["value"]),m.createVNode(Uo,{type:"primary",size:"small",disabled:!r.value,onClick:s},{default:m.withCtx(()=>[...u[2]||(u[2]=[m.createTextVNode("添加",-1)])]),_:1},8,["disabled"])])])])):(m.openBlock(),m.createElementBlock(m.Fragment,{key:1},[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(IZ),m.createVNode(Gd)],64))]))}}),v6e={class:"flex items-center gap-2"},g6e=m.defineComponent({__name:"echarts-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",v6e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(dN,{icon:"setting",text:"图表配置",isEdit:!0}),m.createVNode(Gd)]))}}),m6e="data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='14'%20cy='14'%20r='11.0833'%20fill='%23258AFF'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.8581%2011.2155C11.9065%2011.1088%2012.058%2011.1088%2012.1064%2011.2155L14.6199%2016.7534C14.6609%2016.8437%2014.5948%2016.9461%2014.4957%2016.9461H11.6756C11.461%2016.9461%2011.2663%2017.072%2011.1782%2017.2677L10.7355%2018.2514C10.6273%2018.492%2010.8033%2018.7642%2011.0671%2018.7642H16.0477C16.7417%2018.7642%2017.2037%2018.0471%2016.9169%2017.4152L12.8512%208.45725C12.5122%207.71045%2011.4515%207.71057%2011.1127%208.45743L6.67056%2018.2504C6.56136%2018.4911%206.73737%2018.7642%207.00171%2018.7642H8.08241C8.29645%2018.7642%208.49072%2018.639%208.57914%2018.4441L11.8581%2011.2155ZM19.373%2018.4441C19.4614%2018.639%2019.6557%2018.7642%2019.8698%2018.7642H20.9504C21.2147%2018.7642%2021.3907%2018.4911%2021.2816%2018.2504L16.7334%208.22172C16.645%208.02677%2016.4508%207.90156%2016.2367%207.90156L15.156%207.90156C14.8917%207.90156%2014.7157%208.17464%2014.8249%208.41537L19.373%2018.4441Z'%20fill='white'/%3e%3c/svg%3e",y6e=["maxlength","disabled"],b6e=["disabled","loading"],x6e={key:0,class:"w-iconfont icon-send"},w6e={key:1,class:"w-iconfont icon-loading animate-spin"},_6e=["innerHTML"],S6e={class:"flex items-center gap-2 text-handle"},T6e=m.defineComponent({__name:"assistant",setup(n){const e=m.inject("editor"),t=m.inject("assistant"),r=m.inject("options"),i=m.ref(null),a=m.ref(""),o=m.ref({prompt:"",content:"",error:!1}),s=m.ref(!1),l=m.ref(600),u=async()=>{s.value=!0,o.value.error=!1,o.value.prompt="",o.value.content="";const y={lang:"",input:e.value?p$(e.value):"",command:a},b={html:e.value?.getHTML()??"",text:e.value?.getText()??"",json:e.value?.getJSON()??{}};try{const w=await r.value.ai?.sendMessage?.(y,b),x=()=>{o.value.content.startsWith("[ERROR]: ")&&(o.value.error=!0,o.value.content=o.value.content.replace("[ERROR]: ",""))};if(w instanceof ReadableStream){const S=new WritableStream({write(C){x(),o.value.content+=C},close(){s.value=!1,o.value.command=a}});w.pipeTo(S);return}if(LZ(w)){s.value=!1,o.value.command=a,x(),o.value.content=w;return}console.error('"ai.assistant.onMessage" method returns data in an incorrect format, it can be a ReadableStream or plain text.')}catch(w){console.error(w),t.value=!1}},c=()=>{t.value=!1,e.value?.commands.focus()},f=()=>{e.value?.chain().insertContent(o.value.content).run(),c()},d=()=>{const{to:y}=e.value?.state.selection??{};y&&e.value?.chain().insertContentAt(y,o.value.content).focus().run(),c()},h=()=>{e.value?.commands.selectParentNode();const{to:y}=e.value?.state.selection??{};y&&e.value?.chain().insertContentAt(y,o.value.content).focus().run(),c()},p=async()=>{const{toClipboard:y}=CD();await y(o.value.content)},v=()=>{const{command:y}=o.value;y&&(a.value=y),u()},g=()=>{a.value="",o.value.prompt="",o.value.content=""};return(y,b)=>{const w=m.resolveDirective("tooltip");return m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createElementVNode("div",{class:"relative flex items-center gap-4 h-[50px] border-b px-3 white-ai-wrapper",style:m.normalizeStyle({width:`${l.value}px`})},[b[7]||(b[7]=m.createElementVNode("div",{class:"flex-shrink-0"},[m.createElementVNode("img",{src:m6e,alt:"ai",class:"w-8 h-8"})],-1)),m.withDirectives(m.createElementVNode("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":b[0]||(b[0]=x=>a.value=x),class:m.normalizeClass(["flex-1 outline-none h-full",{"input-disabled":s.value}]),maxlength:m.unref(r).ai?.maxlength,disabled:s.value,autocomplete:"false",placeholder:"告诉AI下一步怎么做"},null,10,y6e),[[m.vModelText,a.value]]),m.createElementVNode("button",{class:"ai-button",disabled:s.value,loading:s.value,onClick:u},[s.value?(m.openBlock(),m.createElementBlock("i",w6e)):(m.openBlock(),m.createElementBlock("i",x6e))],8,b6e)],4),o.value.content?(m.openBlock(),m.createElementBlock("div",{key:0,class:"w-full px-3 py-2",style:m.normalizeStyle({width:`${l.value}px`})},[m.createElementVNode("div",{class:m.normalizeClass(["w-full min-h-[50px] overflow-y-auto line-clamp-6 result-content",{error:o.value.error}]),innerHTML:o.value.content},null,10,_6e),m.createElementVNode("div",S6e,[m.createVNode(Uo,{type:"primary",size:"small",onClick:b[1]||(b[1]=x=>f())},{default:m.withCtx(()=>[...b[8]||(b[8]=[m.createTextVNode("替换所选",-1)])]),_:1}),m.createVNode(Uo,{size:"small",onClick:b[2]||(b[2]=x=>h())},{default:m.withCtx(()=>[...b[9]||(b[9]=[m.createTextVNode("插入下方",-1)])]),_:1}),m.createVNode(Uo,{size:"small",onClick:b[3]||(b[3]=x=>d())},{default:m.withCtx(()=>[...b[10]||(b[10]=[m.createTextVNode("插入后方",-1)])]),_:1}),m.createVNode(Uo,{size:"small",onClick:b[4]||(b[4]=x=>g())},{default:m.withCtx(()=>[...b[11]||(b[11]=[m.createTextVNode("放弃",-1)])]),_:1}),m.withDirectives(m.createElementVNode("i",{class:"w-iconfont icon-copy-text",onClick:b[5]||(b[5]=x=>p())},null,512),[[w,"复制"]]),m.withDirectives(m.createElementVNode("i",{class:"w-iconfont icon-refresh",onClick:b[6]||(b[6]=x=>v())},null,512),[[w,"重新生成"]])])],4)):m.createCommentVNode("",!0)],64)}}}),C6e=m.defineComponent({__name:"index",setup(n){const e=m.inject("editor"),t=m.inject("assistant"),r=m.computed(()=>({placement:t.value?"bottom":"top",onHide(){t.value=!1}}));return m.onUnmounted(()=>{}),(i,a)=>(m.openBlock(),m.createBlock(m.unref(A8e),{class:m.normalizeClass(["white-editor-bubble-menu rounded-md",{"px-3 py-2":!m.unref(t)}]),style:{zIndex:200},editor:m.unref(e),options:r.value},{default:m.withCtx(()=>[m.unref(t)?m.createCommentVNode("",!0):(m.openBlock(),m.createElementBlock(m.Fragment,{key:0},[m.unref(e)?.isActive("toc")||m.unref(e)?.isActive("pageBreak")||m.unref(e)?.isActive("horizontalRule")||m.unref(e)?.isActive("codeBlock")||m.unref(e)?.getAttributes("image").error?(m.openBlock(),m.createBlock(Gd,{key:0})):m.unref(e)?.isActive("image")&&!m.unref(e)?.getAttributes("image").error||m.unref(e)?.isActive("inlineImage")&&!m.unref(e)?.getAttributes("inlineImage").error?(m.openBlock(),m.createBlock(L8e,{key:1})):m.unref(e)?.isActive("video")||m.unref(e)?.isActive("audio")||m.unref(e)?.isActive("file")?(m.openBlock(),m.createBlock(V8e,{key:2})):m.unref(e)?.isActive("iframe")?(m.openBlock(),m.createBlock(p6e,{key:3})):m.unref(e)?.isActive("table")?(m.openBlock(),m.createBlock(W8e,{key:4})):m.unref(e)?.isActive("tag")?(m.openBlock(),m.createBlock(Z8e,{key:5})):m.unref(e)?.isActive("echarts")?(m.openBlock(),m.createBlock(g6e,{key:6})):(m.openBlock(),m.createBlock(r6e,{key:7}))],64)),m.unref(t)?(m.openBlock(),m.createBlock(T6e,{key:1})):m.createCommentVNode("",!0)]),_:1},8,["class","editor","options"]))}}),k6e={key:0,class:"w-full h-[4rem]"},E6e={key:1,class:"w-full h-[4rem]"},M6e=m.defineComponent({__name:"index",setup(n){const e=m.inject("editor"),t=m.inject("page"),r=m.computed(()=>{const{width:a,height:o}=t.value.size??{width:0,height:0};return{width:a,height:o}}),i=m.computed(()=>t.value.layout==="web"?"100%":`calc(${r.value.width}cm * 1)`);return(a,o)=>(m.openBlock(),m.createElementBlock("div",{class:m.normalizeClass(["white-editor-container min-h-full mx-auto overflow-hidden relative flex flex-col",m.unref(t).layout==="page"?"shadow-[0_0_10px_rgba(0,0,0,0.1)] bg-white":""]),style:m.normalizeStyle({width:i.value})},[m.unref(t).layout==="page"?(m.openBlock(),m.createElementBlock("div",k6e)):m.createCommentVNode("",!0),m.createVNode(m.unref(Aae),{editor:m.unref(e),class:m.normalizeClass(["white-editor-content flex-1 flex flex-col",{"is-empty":m.unref(e)?.isEmpty&&m.unref(e)?.state.doc.childCount<=1,"is-readonly":m.unref(e)?.editable,"format-painter":m.unref(e)?.view?.painter?.enabled}])},null,8,["editor","class"]),m.unref(t).layout==="page"?(m.openBlock(),m.createElementBlock("div",E6e)):m.createCommentVNode("",!0),m.unref(e)?(m.openBlock(),m.createBlock(C6e,{key:2})):m.createCommentVNode("",!0)],6))}}),A6e={class:"white-editor-namespace white-give-editor-wrapper"},N6e={class:"flex flex-col h-full w-full"},D6e={key:0,class:"w-full flex-none border-b border-[#d9d9d9]"},O6e=["id"],I6e={key:1,class:"w-full h-[40px] flex-none border-t border-[#d9d9d9] px-[2rem]"},R6e=m.defineComponent({__name:"HomeView",setup(n){const e=m.inject("editor"),t=m.inject("container"),r=m.inject("options"),i=m.inject("uploadFileMap"),a=m.inject("page"),o=B3e({container:t,options:r,uploadFileMap:i}),s=new Mae({editable:!r.value?.editor?.readOnly,autofocus:r.value?.editor?.autofocus,content:Zk(r.value.document?.content),enableInputRules:Kz(r),enablePasteRules:Kz(r),editorProps:{attributes:{class:"white-editor"},...r.value?.editor?.editorProps},parseOptions:r.value?.editor?.parseOptions,extensions:o});return e.value=s,e.value.storage.container=t,e.value.storage.options=r.value,(l,u)=>(m.openBlock(),m.createElementBlock("div",A6e,[m.createElementVNode("div",N6e,[m.unref(r).layout.toolbar.show?(m.openBlock(),m.createElementBlock("div",D6e,[m.createVNode(eBe)])):m.createCommentVNode("",!0),m.createElementVNode("div",{class:"w-full flex-1 min-h-0 flex overflow-hidden",id:m.unref(t)},[m.unref(a).showToc&&m.unref(r).layout.toc.show?(m.openBlock(),m.createBlock(IBe,{key:0})):m.createCommentVNode("",!0),m.createElementVNode("div",{class:m.normalizeClass(["flex-1 h-full overflow-y-auto py-[20px]",m.unref(a).layout==="page"?"bg-[#f4f6fa]":""])},[m.createVNode(M6e)],2)],8,O6e),m.unref(r).layout.foot.show?(m.openBlock(),m.createElementBlock("div",I6e,[m.createVNode(TBe)])):m.createCommentVNode("",!0)])]))}}),vN=m.defineComponent({__name:"index",emits:["beforeCreate","created","change","change:selection","change:transaction","change:menu","change:toolbar","change:pageLayout","change:pageSize","change:pageOrientation","change:pageMargin","change:pageBackground","change:pageShowToc","change:pagePreview","change:pageZoom","change:pageWatermark","change:locale","change:theme","contentError","print","focus","blur","saved","destroy","menuChange"],setup(n,{expose:e,emit:t}){const r=t,i=m.inject("providedOptions",{}),a=m.ref(`white-editor-${hp()}`),o={document:{title:"无标题文档",content:""},editor:{readOnly:!1,autofocus:!1,parseOptions:{preserveWhitespace:"full"},editorProps:{},enableMarkdown:!0},layout:{toc:{show:!0},toolbar:{show:!0},foot:{show:!0,pageSize:!0,character:!0,copy:!0,download:!0}},file:{allowedMimeTypes:[],maxSize:1024*1024*100},ai:{enabled:!0,maxlength:100,async sendMessage(k){return new Promise(O=>{setTimeout(()=>{O(`这里是 AI 的回复。你发送了:${k.input}`)},1e3)})}},users:[{id:"Cassielxd",label:"Cassielxd"},{id:"Goldziher",label:"Na'aman Hirschfeld"},{id:"SerRashin",label:"SerRashin"},{id:"ChenErik",label:"ChenErik"},{id:"china-wangxu",label:"china-wangxu"},{id:"Sherman Xu",label:"xuzhenjun130"},{id:"testuser",label:"测试用户"}],echarts:{onSetOptions(k,O){return console.log("onSetOptions",k,O),null}},page:{layout:"page",showToc:!1,toolbar:"double",size:{key:"A4",width:21,height:29.7}},async onFileUpload(k){if(!k)throw new Error("没有找到要上传的文件");return console.log("onUpload",k),await new Promise(O=>setTimeout(O,3e3)),{id:hp(),url:k.url??URL.createObjectURL(k),name:k.name,type:k.type,size:k.size}},onFileDelete(k,O){console.log(k,O)}},s={lineHeights:[{label:"单倍行距",value:1},{label:"1.5 倍行距",value:1.5},{label:"1.7 倍行距",value:1.7,default:!0},{label:"2 倍行距",value:2},{label:"2.5 倍行距",value:2.5},{label:"3 倍行距",value:3}],pageSizeOption:[{label:"网页",layout:"web"},{label:"A4",width:21,height:29.7,default:!0,layout:"page"},{label:"A3",width:29.7,height:42,layout:"page"},{label:"A5",width:14.8,height:21,layout:"page"},{label:"B5",width:17.6,height:25,layout:"page"},{label:"5号信纸",width:10.9,height:12.9,layout:"page"},{label:"6号信纸",width:11.9,height:22.9,layout:"page"},{label:"7号信纸",width:16.1,height:22.8,layout:"page"},{label:"9号信纸",width:22.8,height:32.3,layout:"page"},{label:"法律用纸",width:21.5,height:33.5,layout:"page"}]},l=m.ref(null),u=m.ref(n2(i,o)),c=m.ref(n2(u.value?.page,{layouts:["page","web"],watermark:{type:"测试",alpha:.2,fontColor:"#000",fontSize:16,fontFamily:"SimSun",fontWeight:"normal",text:""},margin:{left:3.18,right:3.18,top:2.54,bottom:2.54}}));console.log("page",c.value);const f=m.ref(!1),d=m.ref(new Map);m.provide("container",a),m.provide("options",u),m.provide("editor",l),m.provide("page",c),m.provide("assistant",f),m.provide("uploadFileMap",d),m.provide("dicts",s),m.watch(()=>l.value,()=>{l.value&&(l.value.on("create",({editor:k})=>{r("created",{editor:k})}),l.value.on("update",({editor:k})=>{r("change",{editor:k})}),l.value.on("selectionUpdate",({editor:k})=>{r("change:selection",{editor:k})}),l.value.on("transaction",({editor:k,transaction:O})=>{r("change:transaction",{editor:k,transaction:O})}),l.value.on("focus",({editor:k,event:O})=>{r("focus",{editor:k,event:O})}),l.value.on("contentError",({editor:k,error:O,disableCollaboration:R})=>{r("contentError",{editor:k,error:O,disableCollaboration:R})}),l.value.on("blur",({editor:k,event:O})=>{r("blur",{editor:k,event:O})}),l.value.on("destroy",()=>{r("destroy")}))});const h=(k,O="merge")=>{O==="merge"?u.value=n2(u.value,k):u.value=k},p=(k,O={updateSelection:!0,position:"start"})=>{if(!l.value)throw new Error("editor is not ready!");const R=Zk(k);l.value.chain().setContent(R,{emitUpdate:O.updateSelection}).focus(O.position,{scrollIntoView:!0}).run()},v=(k,O={updateSelection:!0,position:"start"})=>{if(!l.value)throw new Error("editor is not ready!");const R=Zk(k);l.value.chain().insertContent(R,{updateSelection:O.updateSelection}).focus(O.position,{scrollIntoView:!0}).run()},g=(k="html")=>{if(!l.value)throw new Error("editor is not ready!");if(k==="html")return l.value.getHTML();if(k==="text")return l.value.getText();if(k==="json")return l.value.getJSON();throw new Error("format must be html, text or json")};return e({getOptions(){return u.value},setOptions:h,setContent:p,insertContent:v,getText:()=>g("text"),getHTML:()=>g("html"),getJSON:()=>g("json"),focus:(k="start",O={scrollIntoView:!0})=>l.value?.commands.focus(k,O),blur:()=>l.value?.chain().blur().run(),getEditor:()=>l.value,getSelectionText:()=>l.value?p$(l.value):"",getSelectionNode:()=>l.value?Ps(l.value):null,deleteSelectionNode:()=>l.value?.commands.deleteSelectionNode(),setCurrentNodeSelection:()=>l.value?.commands.setCurrentNodeSelection(),changeDisabled(k=!0){u.value.editor&&(u.value.editor.readOnly=k)},setLayout:k=>{if(!c.value.layouts.includes(k.layout))throw new Error(`"params.layout" must be one of ${JSON.stringify(c.value.layouts)}.`);if(c.value.layout=k.layout,k.layout!=="web"){if(!k.width||!k.height)throw new Error('"params.width" and "params.height" must be provided.');c.value.size={key:k.layout,width:k.width,height:k.height}}}}),(k,O)=>(m.openBlock(),m.createBlock(R6e))}}),Sg="TOOLTIP_INSTANCE",L6e={mounted(n,e){let t="",r="top",i=[300,0];typeof e.value=="string"?t=e.value:(t=e.value.content,e.value.placement!==void 0&&(r=e.value.placement),e.value.delay!==void 0&&(i=e.value.delay)),n[Sg]=Dd(n,{content:t,theme:"tooltip",duration:100,animation:"scale",allowHTML:!0,placement:r,delay:i})},updated(n,e){let t="";typeof e.value=="string"?t=e.value:t=e.value.content,n[Sg]&&n[Sg].setContent(t)},unmounted(n){n[Sg]&&n[Sg].destroy()}},P6e={install(n){n.directive("tooltip",L6e)}},B6e={install:(n,e)=>{n.provide("providedOptions",e??{}),n.component(vN.name??"WhiteEditor",vN),n.use(P6e)}};exports.default=vN;exports.useWhiteEditor=B6e;
|
|
425
|
+
</html>`},c=async()=>{yBe(u(),()=>{console.log("打印完成")})};return(f,d)=>(m.openBlock(),m.createElementBlock("div",{class:"px-[12px] py-[5px] flex items-center gap-[0.4rem] cursor-pointer hover:bg-[rgb(242,243,245)]",onClick:d[0]||(d[0]=h=>c())},[...d[1]||(d[1]=[m.createElementVNode("i",{class:"w-iconfont icon-export-pdf"},null,-1),m.createTextVNode(" 导出为PDF ",-1)])]))}}),xBe={class:"flex items-center gap-[20px] text-[#333] foot-action"},wBe={key:0,class:"cursor-pointer flex items-center gap-[0.4rem] text-[14px] hover:text-[#007aff]"},_Be=m.defineComponent({__name:"FootRight",setup(n){const e=m.inject("editor"),t=m.inject("options"),r=async()=>{if(!e.value)return;const a=e.value.getHTML(),{toClipboard:o}=CD();await o(a)},i=()=>{if(!e.value)return;const a=new Blob([e.value.getText()],{type:"text/plain;charset=utf-8"}),{title:o}=t.value.document??{},s=o!==""?t.value?.document?.title:"无标题文档";gBe.saveAs(a,`${s}.txt`)};return(a,o)=>(m.openBlock(),m.createElementBlock("div",xBe,[m.unref(t).layout.foot.copy?(m.openBlock(),m.createElementBlock("span",{key:0,class:"cursor-pointer flex items-center gap-[0.4rem] text-[14px] hover:text-[#007aff]",onClick:o[0]||(o[0]=s=>r())},[...o[2]||(o[2]=[m.createElementVNode("i",{class:"w-iconfont icon-copy-content"},null,-1),m.createTextVNode(" 复制全文 ",-1)])])):m.createCommentVNode("",!0),m.createVNode(qs,{trigger:"click",placement:"top",contentStyle:{padding:"6px 0",boxShadow:"0 6px 16px 0 rgba(0, 0, 0, 0.08)"}},{content:m.withCtx(()=>[m.createElementVNode("div",{class:"px-[12px] py-[5px] flex items-center gap-[0.4rem] cursor-pointer hover:bg-[rgb(242,243,245)]",onClick:o[1]||(o[1]=s=>i())},[...o[4]||(o[4]=[m.createElementVNode("i",{class:"w-iconfont icon-text"},null,-1),m.createTextVNode(" 导出为文本 ",-1)])]),m.createVNode(bBe)]),default:m.withCtx(()=>[m.unref(t).layout.foot.download?(m.openBlock(),m.createElementBlock("span",wBe,[...o[3]||(o[3]=[m.createElementVNode("i",{class:"w-iconfont icon-down"},null,-1),m.createTextVNode(" 下载 ",-1)])])):m.createCommentVNode("",!0)]),_:1})]))}}),SBe={class:"w-full h-full flex items-center justify-between"},TBe=m.defineComponent({__name:"index",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",SBe,[m.createVNode(hBe),m.createVNode(_Be)]))}}),CBe=["width","height"],kBe={class:"text-[#666]"},EBe=m.defineComponent({__name:"Nodata",props:{size:{default:"1em"},top:{default:"30%"},title:{default:"暂无数据"}},setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",{class:"flex items-center justify-center flex-col gap-2",style:m.normalizeStyle({paddingTop:n.top})},[(m.openBlock(),m.createElementBlock("svg",{t:"1766712532477",class:"icon",viewBox:"0 0 1030 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:n.size,height:n.size},[...t[0]||(t[0]=[m.createStaticVNode('<path d="M927.053254 896q0 1.254249-0.496852 2.508497t-1.484497 2.508497q-0.993704 1.248189-2.48426 2.49032-1.478438 1.248189-3.453728 2.48426-1.969231 1.230012-4.429254 2.447905-2.453964 1.217893-5.392663 2.423669-2.938698 1.199716-6.343953 2.381254-3.405254 1.187598-7.277065 2.3449-3.87787 1.163361-8.198059 2.302485-4.320189 1.133065-9.088757 2.241893t-9.967338 2.181302q-5.210888 1.084592-10.82168 2.126769-5.616852 1.048237-11.645728 2.060119-6.022817 1.005822-12.439479 1.97529-6.422722 0.969467-13.208994 1.90258-6.792331 0.933112-13.948213 1.817751-7.149822 0.890698-14.645018 1.738982-7.495195 0.842225-15.311527 1.635977-7.822391 0.799811-15.94168 1.551148-8.125349 0.745278-16.541539 1.442082-8.404071 0.702864-17.086863 1.345137-8.670675 0.648331-17.589776 1.24213-8.919101 0.593799-18.068449 1.127006-9.14329 0.539266-18.480474 1.01794-9.349302 0.484734-18.874319 0.908876-9.518959 0.424142-19.201515 0.787693-9.676497 0.36355-19.492355 0.666508-9.809799 0.302959-19.728663 0.551385-9.918864 0.242367-19.928615 0.430201-9.997633 0.181775-20.067977 0.302959-10.064284 0.127243-20.170982 0.187834-10.100639 0.060592-20.213396 0.060592-10.118817 0-20.219456-0.060592-10.100639-0.060592-20.164923-0.181775-10.070343-0.121183-20.074035-0.302959-10.003692-0.187834-19.922557-0.43626-9.924923-0.242367-19.734722-0.545325-9.815858-0.309018-19.492355-0.672568-9.676497-0.36355-19.201514-0.787693-9.518959-0.424142-18.868261-0.908876-9.343243-0.478675-18.486532-1.01794-9.14329-0.533207-18.062391-1.127006t-17.595834-1.24213q-8.676734-0.642272-17.086864-1.345137-8.41013-0.696805-16.535479-1.442082-8.11929-0.751337-15.935622-1.551148-7.822391-0.793751-15.317585-1.635977-7.495195-0.848284-14.651077-1.732923-7.149822-0.890698-13.936095-1.817751-6.798391-0.933112-13.208994-1.908639-6.422722-0.969467-12.445539-1.981349-6.028876-1.005822-11.645727-2.05406-5.622911-1.042178-10.821681-2.12071t-9.967337-2.187361q-4.768568-1.108828-9.088757-2.241893-4.326249-1.139124-8.19806-2.302485-3.871811-1.157302-7.277065-2.3449-3.411314-1.181538-6.343952-2.387313-2.938698-1.199716-5.392663-2.423669-2.460024-1.211834-4.435314-2.447905-1.969231-1.230012-3.453728-2.478201-1.484497-1.24213-2.478201-2.49032-0.987645-1.254249-1.484497-2.508497-0.496852-1.254249-0.496852-2.508497 0-1.260308 0.496852-2.514556t1.484497-2.508497q0.993704-1.248189 2.478201-2.49032 1.484497-1.24213 3.453728-2.478201 1.97529-1.230012 4.435314-2.453964 2.453964-1.211834 5.392663-2.423669 2.932639-1.199716 6.343952-2.381255 3.405254-1.181538 7.271006-2.344899 3.87787-1.163361 8.198059-2.302485 4.326249-1.133065 9.094817-2.241894 4.768568-1.108828 9.967337-2.181301 5.198769-1.084592 10.821681-2.12677 5.616852-1.042178 11.645727-2.060118 6.022817-1.005822 12.43948-1.97529 6.422722-0.969467 13.208994-1.90258 6.792331-0.933112 13.942154-1.817751 7.149822-0.890698 14.651077-1.732923 7.495195-0.848284 15.311526-1.642036 7.816331-0.799811 15.941681-1.551148 8.125349-0.745278 16.535479-1.442083 8.41013-0.702864 17.086864-1.345136 8.676734-0.648331 17.595834-1.24213 8.919101-0.58774 18.062391-1.127006 9.149349-0.539266 18.486532-1.017941 9.349302-0.484734 18.868261-0.908875 9.525018-0.424142 19.207574-0.787693 9.676497-0.36355 19.486295-0.666509 9.815858-0.302959 19.734722-0.551384 9.918864-0.242367 19.922557-0.430201 10.003692-0.181775 20.074035-0.302959 10.058225-0.127243 20.164923-0.187834 10.100639-0.060592 20.219456-0.060592 10.118817 0 20.213396 0.060592 10.106698 0.060592 20.170982 0.181775 10.064284 0.121183 20.067977 0.309018 10.009751 0.181775 19.928615 0.424142 9.918864 0.248426 19.728663 0.557443 9.815858 0.302959 19.492355 0.666509 9.682556 0.36355 19.207574 0.787693 9.518959 0.424142 18.862201 0.908875 9.343243 0.484734 18.486533 1.017941 9.149349 0.539266 18.068449 1.127006 8.919101 0.593799 17.595835 1.24213 8.676734 0.642272 17.086864 1.345136 8.41013 0.696805 16.535479 1.442083 8.11929 0.751337 15.935621 1.551148 7.816331 0.793751 15.317586 1.635976 7.495195 0.848284 14.645018 1.738983 7.149822 0.884639 13.948213 1.817751 6.786272 0.933112 13.208994 1.90258 6.416663 0.969467 12.439479 1.981349 6.028876 1.011882 11.645728 2.054059 5.616852 1.042178 10.82168 2.12071 5.198769 1.078533 9.967338 2.187361t9.088757 2.241894q4.326249 1.139124 8.198059 2.302485t7.271006 2.344899q3.411314 1.181538 6.350012 2.387314 2.938698 1.199716 5.392663 2.423669 2.460024 1.211834 4.423195 2.447905 1.981349 1.236071 3.465846 2.478201 1.484497 1.24213 2.478201 2.49032 0.987645 1.254249 1.484497 2.508497 0.496852 1.254249 0.496852 2.514556z" fill="#007bff" opacity=".1"></path><path d="M117.426746 376.832c0 8.70703 6.695385 15.36 15.450887 15.36 8.755503 0 15.450888-6.65297 15.450888-15.36 0-8.70097-6.695385-15.36-15.450888-15.36-8.240473 0-15.450888 7.168-15.450887 15.36z m814.776804 455.16497c-19.571124 5.12-23.691361 9.222059-28.326627 28.16303-5.150296-19.449941-9.270533-23.552-28.326627-28.16303 19.056095-5.12 23.691361-9.209941 28.326627-28.15697 4.635266 18.94703 8.755503 23.552 28.326627 28.15697zM203.436686 323.07503c-25.23645 6.65297-30.386746 11.77297-37.08213 36.864-6.695385-25.08497-11.84568-30.21103-37.08213-36.864 25.23645-6.65903 30.386746-12.288 37.08213-36.864 6.180355 25.08497 11.84568 30.20497 37.08213 36.864z m618.035503-88.064c-15.450888 4.096-18.541065 7.168-22.661301 22.528-4.120237-15.36-7.210414-18.432-22.661302-22.528 15.450888-4.096 18.541065-7.168 22.661302-22.528 3.605207 15.36 7.210414 18.432 22.661301 22.528z m66.438817-78.848c-40.172308 10.24-48.412781 18.94097-59.228402 58.87697-10.300592-39.929941-19.056095-48.128-59.228403-58.87697 40.172308-10.24 48.412781-18.94703 59.228403-58.88303 10.300592 39.42703 19.056095 48.128 59.228402 58.88303z" fill="#007bff" opacity=".5"></path><path d="M422.32426 713.21297v4.096l33.991953 31.23503 130.302485-62.97903-117.941775 75.26703v36.864l19.056095-18.432v-0.51503 0.51503l19.056094 18.432 100.945799-122.88v-4.096l-185.410651 42.49297z" fill="#007bff" opacity=".2"></path><path d="M865.249704 551.936v-1.024c0-1.024-0.51503-1.53297-0.515029-2.55697v-0.51503L754.003314 260.61103c-15.965917-48.64303-61.288521-81.41103-112.79148-81.41103H389.362367c-51.502959 0-96.825562 32.768-112.791479 81.41103L165.839527 547.84v0.51503c-0.51503 1.024-0.51503 1.53297-0.51503 2.55697v206.848c0 65.02097 53.048047 117.76 118.456805 117.76h463.526627c65.408757 0 118.456805-52.73903 118.456805-117.76v-204.8c-0.51503-0.50897-0.51503-0.50897-0.51503-1.024zM305.412544 271.36q0-0.50897 0.51503-0.50897c11.330651-36.864 45.322604-60.93103 83.434793-60.93103h251.334438c38.112189 0 72.104142 24.06703 83.949822 60.416q0 0.51503 0.51503 0.51503l102.490887 266.24H592.284024c-8.755503 0-15.450888 6.65297-15.450888 15.36 0 33.792-27.811598 61.44-61.80355 61.44-33.991953 0-61.80355-27.648-61.80355-61.44 0-8.70703-6.695385-15.36-15.450888-15.36H202.921657l102.490887-265.73103zM834.347929 757.76c0 48.128-39.142249 87.04-87.55503 87.04h-463.526627c-48.412781 0-87.55503-38.912-87.555029-87.04V568.32h228.158106c7.210414 43.52303 45.322604 76.8 91.160237 76.8 45.837633 0 83.949822-33.27697 91.160236-76.8H834.347929v189.44z" fill="#007bff" opacity=".5"></path><path d="M515.029586 578.566059c-14.420828 0-25.751479-11.264-25.751479-25.6v-51.2H254.939645l84.464852-219.136 0.51503-1.024c7.210414-21.504 26.781538-35.84 49.44284-35.84h251.334438c22.661302 0 42.232426 14.336 49.44284 35.84l0.51503 1.024 84.464852 219.136H540.781065v51.2c0 14.336-11.330651 25.6-25.751479 25.6z" fill="#007bff" opacity=".2"></path>',5)])],8,CBe)),m.createElementVNode("p",kBe,m.toDisplayString(n.title),1)],4))}}),MBe={class:"w-[260px] h-full flex flex-col overflow-hidden"},ABe={key:0,class:"h-[50px] flex-none flex items-center px-4 text-[15px] text-[#666] hover:text-[#333]"},NBe={class:"overflow-y-auto min-h-0"},DBe={key:0,class:"flex-1 px-4 py-2 space-y-[0.3rem]"},OBe=["onClick"],IBe=m.defineComponent({__name:"EditorToc",setup(n){const e=m.inject("editor"),t=m.inject("page"),r=m.inject("options"),i=m.ref([]),a=m.ref(""),o=jue(()=>{i.value=e.value.storage.tableOfContents.content},200);m.watch(()=>e.value?.storage.tableOfContents.content,()=>{o()},{immediate:!0});const s=l=>{if(!e.value)return;a.value=l.id;const u=e.value.view.dom.querySelector(`[data-toc-id="${l.id}"]`);if(!u)return;u.scrollIntoView({behavior:"smooth"});const c=e.value.view.posAtDOM(u,0),{tr:f}=e.value.view.state,d=f.doc.nodeAt(c);if(d){const h=c+d.nodeSize;f.setSelection(en.create(f.doc,h))}else f.setSelection(new en(f.doc.resolve(c)));e.value.view.dispatch(f),e.value.view.focus()};return(l,u)=>(m.openBlock(),m.createElementBlock("div",MBe,[m.unref(r).layout.foot.show?(m.openBlock(),m.createElementBlock("div",ABe,[m.createElementVNode("span",{class:"flex items-center gap-2 cursor-pointer",onClick:u[0]||(u[0]=c=>m.unref(t).showToc=!1)},[...u[1]||(u[1]=[m.createElementVNode("i",{class:"w-iconfont icon-left !text-[12px]"},null,-1),m.createTextVNode(" 收起大纲 ",-1)])])])):m.createCommentVNode("",!0),m.createElementVNode("div",NBe,[i.value?.length?(m.openBlock(),m.createElementBlock("ul",DBe,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(i.value,c=>(m.openBlock(),m.createElementBlock("li",{key:c.id,class:m.normalizeClass(["cursor-pointer text-[#333] text-[14px] h-[34px] block leading-[34px] pr-2 hover:text-[#101219] rounded text-ellipsis overflow-hidden whitespace-nowrap",a.value===c.id?"font-bold bg-[#f5f5f5]":""]),style:m.normalizeStyle({textIndent:`${c.level}rem`}),onClick:f=>s(c)},m.toDisplayString(c.textContent),15,OBe))),128))])):(m.openBlock(),m.createBlock(EBe,{key:1,size:"120px"}))])]))}}),fZ=["top","right","bottom","left"],D9=["start","end"],O9=fZ.reduce((n,e)=>n.concat(e,e+"-"+D9[0],e+"-"+D9[1]),[]),nl=Math.min,oa=Math.max,Kw=Math.round,Hs=n=>({x:n,y:n}),RBe={left:"right",right:"left",bottom:"top",top:"bottom"},LBe={start:"end",end:"start"};function hN(n,e,t){return oa(n,nl(e,t))}function uu(n,e){return typeof n=="function"?n(e):n}function Eo(n){return n.split("-")[0]}function Ko(n){return n.split("-")[1]}function dZ(n){return n==="x"?"y":"x"}function KI(n){return n==="y"?"height":"width"}const PBe=new Set(["top","bottom"]);function Ls(n){return PBe.has(Eo(n))?"y":"x"}function YI(n){return dZ(Ls(n))}function hZ(n,e,t){t===void 0&&(t=!1);const r=Ko(n),i=YI(n),a=KI(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Xw(o)),[o,Xw(o)]}function BBe(n){const e=Xw(n);return[Yw(n),e,Yw(e)]}function Yw(n){return n.replace(/start|end/g,e=>LBe[e])}const I9=["left","right"],R9=["right","left"],VBe=["top","bottom"],zBe=["bottom","top"];function FBe(n,e,t){switch(n){case"top":case"bottom":return t?e?R9:I9:e?I9:R9;case"left":case"right":return e?VBe:zBe;default:return[]}}function $Be(n,e,t,r){const i=Ko(n);let a=FBe(Eo(n),t==="start",r);return i&&(a=a.map(o=>o+"-"+i),e&&(a=a.concat(a.map(Yw)))),a}function Xw(n){return n.replace(/left|right|bottom|top/g,e=>RBe[e])}function HBe(n){return{top:0,right:0,bottom:0,left:0,...n}}function XI(n){return typeof n!="number"?HBe(n):{top:n,right:n,bottom:n,left:n}}function Lp(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function L9(n,e,t){let{reference:r,floating:i}=n;const a=Ls(e),o=YI(e),s=KI(o),l=Eo(e),u=a==="y",c=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,d=r[s]/2-i[s]/2;let h;switch(l){case"top":h={x:c,y:r.y-i.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Ko(e)){case"start":h[o]-=d*(t&&u?-1:1);break;case"end":h[o]+=d*(t&&u?-1:1);break}return h}const UBe=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=t,s=a.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:c,y:f}=L9(u,r,l),d=r,h={},p=0;for(let v=0;v<s.length;v++){const{name:g,fn:y}=s[v],{x:b,y:w,data:x,reset:S}=await y({x:c,y:f,initialPlacement:r,placement:d,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:n,floating:e}});c=b??c,f=w??f,h={...h,[g]:{...h[g],...x}},S&&p<=50&&(p++,typeof S=="object"&&(S.placement&&(d=S.placement),S.rects&&(u=S.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):S.rects),{x:c,y:f}=L9(u,d,l)),v=-1)}return{x:c,y:f,placement:d,strategy:i,middlewareData:h}};async function Pp(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:o,elements:s,strategy:l}=n,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=uu(e,n),p=XI(h),g=s[d?f==="floating"?"reference":"floating":f],y=Lp(await a.getClippingRect({element:(t=await(a.isElement==null?void 0:a.isElement(g)))==null||t?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),b=f==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),x=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},S=Lp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:w,strategy:l}):b);return{top:(y.top-S.top+p.top)/x.y,bottom:(S.bottom-y.bottom+p.bottom)/x.y,left:(y.left-S.left+p.left)/x.x,right:(S.right-y.right+p.right)/x.x}}const GBe=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:l}=e,{element:u,padding:c=0}=uu(n,e)||{};if(u==null)return{};const f=XI(c),d={x:t,y:r},h=YI(i),p=KI(h),v=await o.getDimensions(u),g=h==="y",y=g?"top":"left",b=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=a.reference[p]+a.reference[h]-d[h]-a.floating[p],S=d[h]-a.reference[h],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let k=C?C[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(C)))&&(k=s.floating[w]||a.floating[p]);const O=x/2-S/2,R=k/2-v[p]/2-1,P=nl(f[y],R),z=nl(f[b],R),$=P,H=k-v[p]-z,J=k/2-v[p]/2+O,te=hN($,J,H),Q=!l.arrow&&Ko(i)!=null&&J!==te&&a.reference[p]/2-(J<$?P:z)-v[p]/2<0,fe=Q?J<$?J-$:J-H:0;return{[h]:d[h]+fe,data:{[h]:te,centerOffset:J-te-fe,...Q&&{alignmentOffset:fe}},reset:Q}}});function WBe(n,e,t){return(n?[...t.filter(i=>Ko(i)===n),...t.filter(i=>Ko(i)!==n)]:t.filter(i=>Eo(i)===i)).filter(i=>n?Ko(i)===n||(e?Yw(i)!==i:!1):!0)}const jBe=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,r,i;const{rects:a,middlewareData:o,placement:s,platform:l,elements:u}=e,{crossAxis:c=!1,alignment:f,allowedPlacements:d=O9,autoAlignment:h=!0,...p}=uu(n,e),v=f!==void 0||d===O9?WBe(f||null,h,d):d,g=await Pp(e,p),y=((t=o.autoPlacement)==null?void 0:t.index)||0,b=v[y];if(b==null)return{};const w=hZ(b,a,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(s!==b)return{reset:{placement:v[0]}};const x=[g[Eo(b)],g[w[0]],g[w[1]]],S=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:b,overflows:x}],C=v[y+1];if(C)return{data:{index:y+1,overflows:S},reset:{placement:C}};const k=S.map(P=>{const z=Ko(P.placement);return[P.placement,z&&c?P.overflows.slice(0,2).reduce(($,H)=>$+H,0):P.overflows[0],P.overflows]}).sort((P,z)=>P[1]-z[1]),R=((i=k.filter(P=>P[2].slice(0,Ko(P[0])?2:3).every(z=>z<=0))[0])==null?void 0:i[0])||k[0][0];return R!==s?{data:{index:y+1,overflows:S},reset:{placement:R}}:{}}}},qBe=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:v=!0,...g}=uu(n,e);if((t=a.arrow)!=null&&t.alignmentOffset)return{};const y=Eo(i),b=Ls(s),w=Eo(s)===s,x=await(l.isRTL==null?void 0:l.isRTL(u.floating)),S=d||(w||!v?[Xw(s)]:BBe(s)),C=p!=="none";!d&&C&&S.push(...$Be(s,v,p,x));const k=[s,...S],O=await Pp(e,g),R=[];let P=((r=a.flip)==null?void 0:r.overflows)||[];if(c&&R.push(O[y]),f){const J=hZ(i,o,x);R.push(O[J[0]],O[J[1]])}if(P=[...P,{placement:i,overflows:R}],!R.every(J=>J<=0)){var z,$;const J=(((z=a.flip)==null?void 0:z.index)||0)+1,te=k[J];if(te&&(!(f==="alignment"?b!==Ls(te):!1)||P.every(oe=>Ls(oe.placement)===b?oe.overflows[0]>0:!0)))return{data:{index:J,overflows:P},reset:{placement:te}};let Q=($=P.filter(fe=>fe.overflows[0]<=0).sort((fe,oe)=>fe.overflows[1]-oe.overflows[1])[0])==null?void 0:$.placement;if(!Q)switch(h){case"bestFit":{var H;const fe=(H=P.filter(oe=>{if(C){const me=Ls(oe.placement);return me===b||me==="y"}return!0}).map(oe=>[oe.placement,oe.overflows.filter(me=>me>0).reduce((me,Ie)=>me+Ie,0)]).sort((oe,me)=>oe[1]-me[1])[0])==null?void 0:H[0];fe&&(Q=fe);break}case"initialPlacement":Q=s;break}if(i!==Q)return{reset:{placement:Q}}}return{}}}};function P9(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function B9(n){return fZ.some(e=>n[e]>=0)}const KBe=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=uu(n,e);switch(r){case"referenceHidden":{const a=await Pp(e,{...i,elementContext:"reference"}),o=P9(a,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:B9(o)}}}case"escaped":{const a=await Pp(e,{...i,altBoundary:!0}),o=P9(a,t.floating);return{data:{escapedOffsets:o,escaped:B9(o)}}}default:return{}}}}};function pZ(n){const e=nl(...n.map(a=>a.left)),t=nl(...n.map(a=>a.top)),r=oa(...n.map(a=>a.right)),i=oa(...n.map(a=>a.bottom));return{x:e,y:t,width:r-e,height:i-t}}function YBe(n){const e=n.slice().sort((i,a)=>i.y-a.y),t=[];let r=null;for(let i=0;i<e.length;i++){const a=e[i];!r||a.y-r.y>r.height/2?t.push([a]):t[t.length-1].push(a),r=a}return t.map(i=>Lp(pZ(i)))}const XBe=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:r,rects:i,platform:a,strategy:o}=e,{padding:s=2,x:l,y:u}=uu(n,e),c=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]),f=YBe(c),d=Lp(pZ(c)),h=XI(s);function p(){if(f.length===2&&f[0].left>f[1].right&&l!=null&&u!=null)return f.find(g=>l>g.left-h.left&&l<g.right+h.right&&u>g.top-h.top&&u<g.bottom+h.bottom)||d;if(f.length>=2){if(Ls(t)==="y"){const P=f[0],z=f[f.length-1],$=Eo(t)==="top",H=P.top,J=z.bottom,te=$?P.left:z.left,Q=$?P.right:z.right,fe=Q-te,oe=J-H;return{top:H,bottom:J,left:te,right:Q,width:fe,height:oe,x:te,y:H}}const g=Eo(t)==="left",y=oa(...f.map(P=>P.right)),b=nl(...f.map(P=>P.left)),w=f.filter(P=>g?P.left===b:P.right===y),x=w[0].top,S=w[w.length-1].bottom,C=b,k=y,O=k-C,R=S-x;return{top:x,bottom:S,left:C,right:k,width:O,height:R,x:C,y:x}}return d}const v=await a.getElementRects({reference:{getBoundingClientRect:p},floating:r.floating,strategy:o});return i.reference.x!==v.reference.x||i.reference.y!==v.reference.y||i.reference.width!==v.reference.width||i.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}},ZBe=new Set(["left","top"]);async function JBe(n,e){const{placement:t,platform:r,elements:i}=n,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Eo(t),s=Ko(t),l=Ls(t)==="y",u=ZBe.has(o)?-1:1,c=a&&l?-1:1,f=uu(e,n);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof p=="number"&&(h=s==="end"?p*-1:p),l?{x:h*c,y:d*u}:{x:d*u,y:h*c}}const QBe=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:a,placement:o,middlewareData:s}=e,l=await JBe(e,n);return o===((t=s.offset)==null?void 0:t.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:o}}}}},e8e=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:g=>{let{x:y,y:b}=g;return{x:y,y:b}}},...l}=uu(n,e),u={x:t,y:r},c=await Pp(e,l),f=Ls(Eo(i)),d=dZ(f);let h=u[d],p=u[f];if(a){const g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",b=h+c[g],w=h-c[y];h=hN(b,h,w)}if(o){const g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",b=p+c[g],w=p-c[y];p=hN(b,p,w)}const v=s.fn({...e,[d]:h,[f]:p});return{...v,data:{x:v.x-t,y:v.y-r,enabled:{[d]:a,[f]:o}}}}}},t8e=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:a,platform:o,elements:s}=e,{apply:l=()=>{},...u}=uu(n,e),c=await Pp(e,u),f=Eo(i),d=Ko(i),h=Ls(i)==="y",{width:p,height:v}=a.floating;let g,y;f==="top"||f==="bottom"?(g=f,y=d===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(y=f,g=d==="end"?"top":"bottom");const b=v-c.top-c.bottom,w=p-c.left-c.right,x=nl(v-c[g],b),S=nl(p-c[y],w),C=!e.middlewareData.shift;let k=x,O=S;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(O=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(k=b),C&&!d){const P=oa(c.left,0),z=oa(c.right,0),$=oa(c.top,0),H=oa(c.bottom,0);h?O=p-2*(P!==0||z!==0?P+z:oa(c.left,c.right)):k=v-2*($!==0||H!==0?$+H:oa(c.top,c.bottom))}await l({...e,availableWidth:O,availableHeight:k});const R=await o.getDimensions(s.floating);return p!==R.width||v!==R.height?{reset:{rects:!0}}:{}}}};function pS(){return typeof window<"u"}function cv(n){return vZ(n)?(n.nodeName||"").toLowerCase():"#document"}function Ua(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function cu(n){var e;return(e=(vZ(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function vZ(n){return pS()?n instanceof Node||n instanceof Ua(n).Node:!1}function Qo(n){return pS()?n instanceof Element||n instanceof Ua(n).Element:!1}function rl(n){return pS()?n instanceof HTMLElement||n instanceof Ua(n).HTMLElement:!1}function V9(n){return!pS()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ua(n).ShadowRoot}const n8e=new Set(["inline","contents"]);function $y(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=es(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!n8e.has(i)}const r8e=new Set(["table","td","th"]);function i8e(n){return r8e.has(cv(n))}const a8e=[":popover-open",":modal"];function vS(n){return a8e.some(e=>{try{return n.matches(e)}catch{return!1}})}const o8e=["transform","translate","scale","rotate","perspective"],s8e=["transform","translate","scale","rotate","perspective","filter"],l8e=["paint","layout","strict","content"];function ZI(n){const e=JI(),t=Qo(n)?es(n):n;return o8e.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||s8e.some(r=>(t.willChange||"").includes(r))||l8e.some(r=>(t.contain||"").includes(r))}function u8e(n){let e=Tc(n);for(;rl(e)&&!Bp(e);){if(ZI(e))return e;if(vS(e))return null;e=Tc(e)}return null}function JI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const c8e=new Set(["html","body","#document"]);function Bp(n){return c8e.has(cv(n))}function es(n){return Ua(n).getComputedStyle(n)}function gS(n){return Qo(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Tc(n){if(cv(n)==="html")return n;const e=n.assignedSlot||n.parentNode||V9(n)&&n.host||cu(n);return V9(e)?e.host:e}function gZ(n){const e=Tc(n);return Bp(e)?n.ownerDocument?n.ownerDocument.body:n.body:rl(e)&&$y(e)?e:gZ(e)}function mZ(n,e,t){var r;e===void 0&&(e=[]);const i=gZ(n),a=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ua(i);return a?(pN(o),e.concat(o,o.visualViewport||[],$y(i)?i:[],[])):e.concat(i,mZ(i,[]))}function pN(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function yZ(n){const e=es(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=rl(n),a=i?n.offsetWidth:t,o=i?n.offsetHeight:r,s=Kw(t)!==a||Kw(r)!==o;return s&&(t=a,r=o),{width:t,height:r,$:s}}function bZ(n){return Qo(n)?n:n.contextElement}function op(n){const e=bZ(n);if(!rl(e))return Hs(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:a}=yZ(e);let o=(a?Kw(t.width):t.width)/r,s=(a?Kw(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const f8e=Hs(0);function xZ(n){const e=Ua(n);return!JI()||!e.visualViewport?f8e:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function d8e(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ua(n)?!1:e}function py(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),a=bZ(n);let o=Hs(1);e&&(r?Qo(r)&&(o=op(r)):o=op(n));const s=d8e(a,t,r)?xZ(a):Hs(0);let l=(i.left+s.x)/o.x,u=(i.top+s.y)/o.y,c=i.width/o.x,f=i.height/o.y;if(a){const d=Ua(a),h=r&&Qo(r)?Ua(r):r;let p=d,v=pN(p);for(;v&&r&&h!==p;){const g=op(v),y=v.getBoundingClientRect(),b=es(v),w=y.left+(v.clientLeft+parseFloat(b.paddingLeft))*g.x,x=y.top+(v.clientTop+parseFloat(b.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,f*=g.y,l+=w,u+=x,p=Ua(v),v=pN(p)}}return Lp({width:c,height:f,x:l,y:u})}function mS(n,e){const t=gS(n).scrollLeft;return e?e.left+t:py(cu(n)).left+t}function wZ(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-mS(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function h8e(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const a=i==="fixed",o=cu(r),s=e?vS(e.floating):!1;if(r===o||s&&a)return t;let l={scrollLeft:0,scrollTop:0},u=Hs(1);const c=Hs(0),f=rl(r);if((f||!f&&!a)&&((cv(r)!=="body"||$y(o))&&(l=gS(r)),rl(r))){const h=py(r);u=op(r),c.x=h.x+r.clientLeft,c.y=h.y+r.clientTop}const d=o&&!f&&!a?wZ(o,l):Hs(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-l.scrollLeft*u.x+c.x+d.x,y:t.y*u.y-l.scrollTop*u.y+c.y+d.y}}function p8e(n){return Array.from(n.getClientRects())}function v8e(n){const e=cu(n),t=gS(n),r=n.ownerDocument.body,i=oa(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=oa(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+mS(n);const s=-t.scrollTop;return es(r).direction==="rtl"&&(o+=oa(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}const z9=25;function g8e(n,e){const t=Ua(n),r=cu(n),i=t.visualViewport;let a=r.clientWidth,o=r.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;const c=JI();(!c||c&&e==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}const u=mS(r);if(u<=0){const c=r.ownerDocument,f=c.body,d=getComputedStyle(f),h=c.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,p=Math.abs(r.clientWidth-f.clientWidth-h);p<=z9&&(a-=p)}else u<=z9&&(a+=u);return{width:a,height:o,x:s,y:l}}const m8e=new Set(["absolute","fixed"]);function y8e(n,e){const t=py(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,a=rl(n)?op(n):Hs(1),o=n.clientWidth*a.x,s=n.clientHeight*a.y,l=i*a.x,u=r*a.y;return{width:o,height:s,x:l,y:u}}function F9(n,e,t){let r;if(e==="viewport")r=g8e(n,t);else if(e==="document")r=v8e(cu(n));else if(Qo(e))r=y8e(e,t);else{const i=xZ(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Lp(r)}function _Z(n,e){const t=Tc(n);return t===e||!Qo(t)||Bp(t)?!1:es(t).position==="fixed"||_Z(t,e)}function b8e(n,e){const t=e.get(n);if(t)return t;let r=mZ(n,[]).filter(s=>Qo(s)&&cv(s)!=="body"),i=null;const a=es(n).position==="fixed";let o=a?Tc(n):n;for(;Qo(o)&&!Bp(o);){const s=es(o),l=ZI(o);!l&&s.position==="fixed"&&(i=null),(a?!l&&!i:!l&&s.position==="static"&&!!i&&m8e.has(i.position)||$y(o)&&!l&&_Z(n,o))?r=r.filter(c=>c!==o):i=s,o=Tc(o)}return e.set(n,r),r}function x8e(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?vS(e)?[]:b8e(e,this._c):[].concat(t),r],s=o[0],l=o.reduce((u,c)=>{const f=F9(e,c,i);return u.top=oa(f.top,u.top),u.right=nl(f.right,u.right),u.bottom=nl(f.bottom,u.bottom),u.left=oa(f.left,u.left),u},F9(e,s,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function w8e(n){const{width:e,height:t}=yZ(n);return{width:e,height:t}}function _8e(n,e,t){const r=rl(e),i=cu(e),a=t==="fixed",o=py(n,!0,a,e);let s={scrollLeft:0,scrollTop:0};const l=Hs(0);function u(){l.x=mS(i)}if(r||!r&&!a)if((cv(e)!=="body"||$y(i))&&(s=gS(e)),r){const h=py(e,!0,a,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&u();a&&!r&&i&&u();const c=i&&!r&&!a?wZ(i,s):Hs(0),f=o.left+s.scrollLeft-l.x-c.x,d=o.top+s.scrollTop-l.y-c.y;return{x:f,y:d,width:o.width,height:o.height}}function $k(n){return es(n).position==="static"}function $9(n,e){if(!rl(n)||es(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return cu(n)===t&&(t=t.ownerDocument.body),t}function SZ(n,e){const t=Ua(n);if(vS(n))return t;if(!rl(n)){let i=Tc(n);for(;i&&!Bp(i);){if(Qo(i)&&!$k(i))return i;i=Tc(i)}return t}let r=$9(n,e);for(;r&&i8e(r)&&$k(r);)r=$9(r,e);return r&&Bp(r)&&$k(r)&&!ZI(r)?t:r||u8e(n)||t}const S8e=async function(n){const e=this.getOffsetParent||SZ,t=this.getDimensions,r=await t(n.floating);return{reference:_8e(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function T8e(n){return es(n).direction==="rtl"}const C8e={convertOffsetParentRelativeRectToViewportRelativeRect:h8e,getDocumentElement:cu,getClippingRect:x8e,getOffsetParent:SZ,getElementRects:S8e,getClientRects:p8e,getDimensions:w8e,getScale:op,isElement:Qo,isRTL:T8e},TZ=QBe,CZ=jBe,kZ=e8e,EZ=qBe,MZ=t8e,AZ=KBe,NZ=GBe,DZ=XBe,OZ=(n,e,t)=>{const r=new Map,i={platform:C8e,...t},a={...i.platform,_c:r};return UBe(n,e,{...i,platform:a})};function k8e(n,e){const t=Math.min(n.top,e.top),r=Math.max(n.bottom,e.bottom),i=Math.min(n.left,e.left),o=Math.max(n.right,e.right)-i,s=r-t,l=i,u=t;return new DOMRect(l,u,o,s)}var E8e=class{constructor({editor:n,element:e,view:t,updateDelay:r=250,resizeDelay:i=60,shouldShow:a,appendTo:o,getReferencedVirtualElement:s,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:c,state:f,from:d,to:h})=>{const{doc:p,selection:v}=f,{empty:g}=v,y=!p.textBetween(d,h).length&&GN(f.selection),b=this.element.contains(document.activeElement);return!(!(c.hasFocus()||b)||g||y||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:c})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}c?.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(c.relatedTarget))||c?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(c,f)=>{const d=!f?.selection.eq(c.state.selection),h=!f?.doc.eq(c.state.doc);!d&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,d,h,f)},this.updateDelay))},this.updateHandler=(c,f,d,h)=>{const{composing:p}=c;if(p||!f&&!d)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:c})=>{c.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var u;this.editor=n,this.element=e,this.view=t,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(u=l?.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=s,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(EZ(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(kZ(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(TZ(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(NZ(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(MZ(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(CZ(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(AZ(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(DZ(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n;const{selection:e}=this.editor.state,t=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(t)return t;const r=XF(this.view,e.from,e.to);let i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(e instanceof nn){let a=this.view.nodeDOM(e.from);const o=a.dataset.nodeViewWrapper?a:a.querySelector("[data-node-view-wrapper]");o&&(a=o),a&&(i={getBoundingClientRect:()=>a.getBoundingClientRect(),getClientRects:()=>[a.getBoundingClientRect()]})}if(e instanceof gr){const{$anchorCell:a,$headCell:o}=e,s=a?a.pos:o.pos,l=o?o.pos:a.pos,u=this.view.nodeDOM(s),c=this.view.nodeDOM(l);if(!u||!c)return;const f=u===c?u.getBoundingClientRect():k8e(u.getBoundingClientRect(),c.getBoundingClientRect());i={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return i}updatePosition(){const n=this.virtualElement;n&&OZ(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,r=t.selection.from!==t.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(n,e);return}const i=!e?.selection.eq(n.state.selection),a=!e?.doc.eq(n.state.doc);this.updateHandler(n,i,a,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,a=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:a,to:o}))||!1}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},M8e=n=>new jn({key:typeof n.pluginKey=="string"?new Zn(n.pluginKey):n.pluginKey,view:e=>new E8e({view:e,...n})}),A8e=m.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{editor:i,options:a,pluginKey:o,resizeDelay:s,appendTo:l,shouldShow:u,getReferencedVirtualElement:c,updateDelay:f}=n,d=r.value;d&&(d.style.visibility="hidden",d.style.position="absolute",d.remove(),m.nextTick(()=>{i.registerPlugin(M8e({editor:i,element:d,options:a,pluginKey:o,resizeDelay:s,appendTo:l,shouldShow:u,getReferencedVirtualElement:c,updateDelay:f}))}))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:a}=n;a.unregisterPlugin(i)}),()=>{var i;return m.h("div",{ref:r,...t},(i=e.default)==null?void 0:i.call(e))}}}),N8e=class{constructor({editor:n,element:e,view:t,options:r,appendTo:i,shouldShow:a}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:s})=>{const{selection:l}=s,{$anchor:u,empty:c}=l,f=u.depth===1,d=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!o.hasFocus()||!c||!f||!d||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,s,l,u)=>{const{composing:c}=o;if(c||!s&&!l)return;if(!this.getShouldShow(u)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var s;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((s=this.element.parentNode)!=null&&s.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=n,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(n){return GF(n,{textSerializers:qN(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(EZ(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(kZ(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(TZ(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(NZ(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(MZ(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(CZ(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(AZ(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(DZ(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,a=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:a,to:o})}updatePosition(){const{selection:n}=this.editor.state,e=XF(this.view,n.from,n.to);OZ({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:a})=>{this.element.style.width="max-content",this.element.style.position=a,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!e?.selection.eq(n.state.selection),r=!e?.doc.eq(n.state.doc);this.updateHandler(n,t,r,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},D8e=n=>new jn({key:typeof n.pluginKey=="string"?new Zn(n.pluginKey):n.pluginKey,view:e=>new N8e({view:e,...n})});m.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{pluginKey:i,editor:a,options:o,appendTo:s,shouldShow:l}=n,u=r.value;u&&(u.style.visibility="hidden",u.style.position="absolute",u.remove(),a.registerPlugin(D8e({pluginKey:i,editor:a,element:u,options:o,appendTo:s,shouldShow:l})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:a}=n;a.unregisterPlugin(i)}),()=>{var i;return m.h("div",{ref:r,...t},(i=e.default)==null?void 0:i.call(e))}}});const O8e=m.defineComponent({__name:"flip",setup(n){const e=m.inject("editor"),t=m.computed(()=>{const a=e.value?Ps(e.value):null;return a?.type?.name?e.value?.getAttributes(a?.type?.name)?.flipY:!1}),r=m.computed(()=>{const a=e.value?Ps(e.value):null;return a?.type?.name?e.value?.getAttributes(a?.type?.name)?.flipX:!1}),i=a=>{const o=e.value?Ps(e.value):null,{flipX:s,flipY:l}=o?.attrs??{};o&&a==="flipX"&&e.value?.commands.updateAttributes(o.type,{flipX:!s}),o&&a==="flipY"&&e.value?.commands.updateAttributes(o.type,{flipY:!l})};return(a,o)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"flip-x",text:"水平翻转","hide-text":"","menu-active":t.value,onMenuClick:o[0]||(o[0]=s=>i("flipY"))},null,8,["menu-active"]),m.createVNode(Tn,{ico:"flip-y",text:"垂直翻转","hide-text":"","menu-active":r.value,onMenuClick:o[1]||(o[1]=s=>i("flipX"))},null,8,["menu-active"])],64))}}),IZ=m.defineComponent({__name:"open",setup(n){const e=m.inject("editor"),t=()=>{const r=e.value?Ps(e?.value):null;window.open(r?.attrs.src)};return(r,i)=>(m.openBlock(),m.createBlock(Tn,{ico:"open",text:"新窗口打开",shortcut:"Backspace","hide-text":"",onMenuClick:t}))}}),I8e=m.defineComponent({__name:"covert",setup(n){const e=m.inject("editor"),t=m.computed(()=>(e.value?Ps(e.value):null)?.type?.name==="inlineImage"?"转为节点图片":"转为行内图片"),r=()=>{const i=e.value?Ps(e.value):null;if(i){const a=i?.type?.name==="inlineImage"?"inlineImage":"image",o=i.attrs??{};!o.error&&o.src&&(e.value?.chain().focus().deleteSelectionNode().run(),a==="inlineImage"?e.value?.chain().focus().setImage({...o,equalProportion:!1,inline:!1}).run():e.value?.chain().focus().setInlineImage({...o,inline:!0,equalProportion:!1}).run())}};return(i,a)=>(m.openBlock(),m.createBlock(Tn,{ico:"huantu",text:t.value,"hide-text":"",onMenuClick:r},null,8,["text"]))}}),Gd=m.defineComponent({__name:"delete",setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createBlock(Tn,{ico:"remove",text:"删除",shortcut:"Backspace","hide-text":"",onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().deleteSelectionNode().run())}))}}),R8e={class:"flex items-center gap-2"},L8e=m.defineComponent({__name:"image-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",R8e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(O8e),m.createVNode(I8e),m.createVNode(IZ),m.createVNode(Gd)]))}}),P8e=m.defineComponent({__name:"down",setup(n){const e=m.inject("editor"),t=()=>{const r=e.value?Ps(e.value):null,i=document.createElement("a");i.href=r?.attrs.url,i.download=r?.attrs.name,i&&(document.body.appendChild(i),i.click(),document.body.removeChild(i))};return(r,i)=>m.unref(e)?.getAttributes("file")?.uploaded?(m.openBlock(),m.createBlock(Tn,{key:0,ico:"down",text:"下载","hide-text":"",onMenuClick:i[0]||(i[0]=a=>t())})):m.createCommentVNode("",!0)}}),B8e={class:"flex items-center gap-2"},V8e=m.defineComponent({__name:"file-menu",setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock("div",B8e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.unref(e)?.isActive("file")||m.unref(e)?.isActive("video")||m.unref(e)?.isActive("audio")?(m.openBlock(),m.createBlock(P8e,{key:0})):m.createCommentVNode("",!0),m.createVNode(Gd)]))}}),z8e=m.defineComponent({__name:"cell-background",props:{text:{type:String,default:""},defaultColor:{type:String,default:"#007bff"}},setup(n){const e=n,t=m.inject("editor"),r=m.ref(!1),i=m.ref(e.defaultColor),a=s=>{i.value=s,r.value=!1;const l=s===""?null:s;t.value?.chain().focus().setCellAttribute("background",l).run()},o=xN(s=>{i.value=s,r.value=!1;const l=s===""?null:s;t.value?.chain().focus().setCellAttribute("background",l).run()},200);return m.watch(()=>i.value,s=>{o(s)}),(s,l)=>(m.openBlock(),m.createBlock(sl,{ico:"fill",text:"填充背景","hide-text":"","popup-visible":r.value,"onUpdate:popupVisible":l[1]||(l[1]=u=>r.value=u),disabled:!m.unref(t)?.can().setCellAttribute("background",""),"popup-type":"arrow",onMenuClick:l[2]||(l[2]=u=>a(i.value))},{content:m.withCtx(()=>[m.createVNode(m.unref(jI),{modelValue:i.value,"onUpdate:modelValue":l[0]||(l[0]=u=>i.value=u)},null,8,["modelValue"])]),default:m.withCtx(()=>[m.createElementVNode("div",{class:"w-[14px] h-[2px] mx-auto",style:m.normalizeStyle({backgroundColor:i.value})},null,4)]),_:1},8,["popup-visible","disabled"]))}}),F8e=m.defineComponent({__name:"cell-insert",props:{hideText:{type:Boolean,default:!0}},setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"charutop",text:"上方插入一行","hide-text":n.hideText,disabled:!m.unref(e)?.can().addRowBefore(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().addRowBefore().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"charubottom",text:"下方插入一行","hide-text":n.hideText,disabled:!m.unref(e)?.can().addRowAfter(),onMenuClick:r[1]||(r[1]=i=>m.unref(e)?.chain().focus().addRowAfter().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"charuleft",text:"左方插入一列","hide-text":n.hideText,disabled:!m.unref(e)?.can().addColumnBefore(),onMenuClick:r[2]||(r[2]=i=>m.unref(e)?.chain().focus().addColumnBefore().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"charuright",text:"右方插入一列","hide-text":n.hideText,disabled:!m.unref(e)?.can().addColumnAfter(),onMenuClick:r[3]||(r[3]=i=>m.unref(e)?.chain().focus().addColumnAfter().run())},null,8,["hide-text","disabled"])],64))}}),$8e=m.defineComponent({__name:"cell-delete",props:{hideText:{type:Boolean,default:!0}},setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"removehang",text:"删除行","hide-text":n.hideText,disabled:!m.unref(e)?.can().deleteColumn(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().deleteRow().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"removelie",text:"删除列","hide-text":n.hideText,disabled:!m.unref(e)?.can().deleteColumn(),onMenuClick:r[1]||(r[1]=i=>m.unref(e)?.chain().focus().deleteColumn().run())},null,8,["hide-text","disabled"])],64))}}),H8e=m.defineComponent({__name:"cell-merge",props:{hideText:{type:Boolean,default:!0}},setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Tn,{ico:"merge-cell",text:"合并单元格","hide-text":n.hideText,disabled:!m.unref(e)?.can().mergeCells(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().mergeCells().run())},null,8,["hide-text","disabled"]),m.createVNode(Tn,{ico:"split-cell",text:"拆分单元格","hide-text":n.hideText,disabled:!m.unref(e)?.can().splitCell(),onMenuClick:r[1]||(r[1]=i=>m.unref(e)?.chain().focus().splitCell().run())},null,8,["hide-text","disabled"])],64))}}),U8e=m.defineComponent({__name:"table-delete",setup(n){const e=m.inject("editor");return(t,r)=>(m.openBlock(),m.createBlock(Tn,{ico:"remove",text:"删除表格",shortcut:"Backspace","hide-text":"",disabled:!m.unref(e)?.can().deleteTable(),onMenuClick:r[0]||(r[0]=i=>m.unref(e)?.chain().focus().deleteTable().run())},null,8,["disabled"]))}}),G8e={class:"flex items-center gap-2"},W8e=m.defineComponent({__name:"table-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",G8e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(z8e),m.createVNode(F8e),m.createVNode($8e),m.createVNode(H8e),m.createVNode(U8e)]))}}),j8e=m.defineComponent({__name:"tag-input",setup(n){const e=m.ref(""),t=m.inject("editor"),r=()=>{if(e.value==="")return;t.value?.state?.selection?.$from?.node()&&t.value?.commands.updateAttributes("tag",{text:e.value})},i=()=>{const a=t.value?.getAttributes("tag");a?.text&&(e.value=a.text)};return m.onMounted(()=>{i(),t.value?.on("selectionUpdate",i)}),m.onBeforeUnmount(()=>{t.value?.off("selectionUpdate")}),(a,o)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createVNode(Vm,{placeholder:"请输入标签",value:e.value,"onUpdate:value":o[0]||(o[0]=s=>e.value=s),size:"small"},null,8,["value"]),m.createVNode(Uo,{type:"primary",size:"small",onClick:o[1]||(o[1]=s=>r())},{default:m.withCtx(()=>[...o[2]||(o[2]=[m.createTextVNode("确认",-1)])]),_:1})],64))}}),q8e={class:"px-2"},K8e=["onClick"],Y8e=m.defineComponent({__name:"tag-color",setup(n){const e=m.inject("editor"),t=m.ref("#007bff"),r=m.ref(!1),i=[{label:"蓝色",color:"#007bff",bgcolor:"rgb(217, 231, 255)"},{label:"红色",color:"rgba(200, 78, 67, 1)",bgcolor:"rgb(252, 223, 220)"},{label:"黄色",color:"rgba(240, 196, 23, 1)",bgcolor:"rgb(255, 245, 210)"},{label:"绿色",color:"rgba(5, 205, 153, 1)",bgcolor:"rgb(205, 245, 235)"},{label:"紫色",color:"#e6afff",bgcolor:"rgb(220, 223, 252)"}],a=s=>{e.value?.state?.selection?.$from?.node()&&e.value?.commands.updateAttributes("tag",{type:s.type,color:s.color,backgroundColor:s.bgcolor}),t.value=s?.bgcolor,r.value=!1},o=()=>{e.value?.state?.selection?.$from?.node()&&e.value?.commands.updateAttributes("tag",{type:"default",color:"#999",backgroundColor:"rgba(0, 0, 0, 0.05)"}),t.value="rgba(0, 0, 0, 0.05)",r.value=!1};return(s,l)=>(m.openBlock(),m.createBlock(hS,{ico:"fill",text:"高亮填充","hide-text":"",onMenuClick:l[1]||(l[1]=u=>a()),maxHeight:!1,"popup-visible":r.value,"onUpdate:popupVisible":l[2]||(l[2]=u=>r.value=u)},{content:m.withCtx(()=>[m.createElementVNode("div",q8e,[(m.openBlock(),m.createElementBlock(m.Fragment,null,m.renderList(i,(u,c)=>m.createElementVNode("div",{key:c,onClick:f=>a(u),style:m.normalizeStyle({backgroundColor:u.bgcolor}),class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer"},[l[3]||(l[3]=m.createElementVNode("i",{class:"w-iconfont icon-tumo !text-[14px]"},null,-1)),m.createTextVNode(" "+m.toDisplayString(u.label),1)],12,K8e)),64)),m.createElementVNode("div",{class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer border",onClick:l[0]||(l[0]=u=>o())},[...l[4]||(l[4]=[m.createElementVNode("i",{class:"w-iconfont icon-clear-format !text-[14px]"},null,-1),m.createTextVNode(" 清除 ",-1)])])])]),_:1},8,["popup-visible"]))}}),X8e={class:"flex items-center gap-2"},Z8e=m.defineComponent({__name:"tag-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",X8e,[m.createVNode(j8e),m.createVNode(Y8e),m.createVNode(Gd)]))}}),J8e=m.defineComponent({__name:"ai-operation",setup(n){const e=m.inject("editor"),t=m.inject("assistant"),r=()=>{t.value=!0,e.value?.commands.focus()};return(i,a)=>(m.openBlock(),m.createBlock(Tn,{ico:"ai-assistant",text:"AI智能助手","hide-text":"",onMenuClick:r}))}}),Q8e={class:"px-2"},e6e=["onClick"],t6e=m.defineComponent({__name:"high-background",setup(n){const e=m.inject("editor"),t=m.ref("#007bff"),r=m.ref(!1),i=[{label:"默认",bgcolor:"#007bff"},{label:"红色",bgcolor:"#ff8a8a"},{label:"黄色",bgcolor:"#ffff8a"},{label:"绿色",bgcolor:"#a7ffa7"},{label:"紫色",bgcolor:"#e6afff"},{label:"蓝色",bgcolor:"#83d3ff"}],a=s=>{if(!s){e.value?.chain().focus().setHighlight({color:i[0].bgcolor}).run();return}t.value=s?.bgcolor,e.value?.chain().focus().setHighlight({color:s.bgcolor}).run(),r.value=!1},o=()=>{e.value?.chain().focus().unsetHighlight().run(),t.value="#007bff",r.value=!1};return(s,l)=>(m.openBlock(),m.createBlock(hS,{ico:"fill",text:"高亮填充","hide-text":"",onMenuClick:l[1]||(l[1]=u=>a()),maxHeight:!1,"popup-visible":r.value,"onUpdate:popupVisible":l[2]||(l[2]=u=>r.value=u)},{content:m.withCtx(()=>[m.createElementVNode("div",Q8e,[(m.openBlock(),m.createElementBlock(m.Fragment,null,m.renderList(i,(u,c)=>m.createElementVNode("div",{key:c,onClick:f=>a(u),style:m.normalizeStyle({backgroundColor:u.bgcolor}),class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer"},[l[3]||(l[3]=m.createElementVNode("i",{class:"w-iconfont icon-tumo !text-[14px]"},null,-1)),m.createTextVNode(" "+m.toDisplayString(u.label),1)],12,e6e)),64)),m.createElementVNode("div",{class:"h-[30px] w-[90px] flex items-center justify-center gap-2 mb-2 rounded-[3px] cursor-pointer border",onClick:l[0]||(l[0]=u=>o())},[...l[4]||(l[4]=[m.createElementVNode("i",{class:"w-iconfont icon-clear-format !text-[14px]"},null,-1),m.createTextVNode(" 清除 ",-1)])])])]),_:1},8,["popup-visible"]))}}),n6e={class:"flex items-center gap-2"},r6e=m.defineComponent({__name:"text-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",n6e,[m.createVNode(J8e),m.createVNode(iN),m.createVNode(aN),m.createVNode(oN),m.createVNode(sN),m.createVNode(uZ),m.createVNode(t6e),m.createVNode(Gd)]))}}),i6e={class:"flex items-center gap-2"},a6e={key:0,class:"flex items-center gap-2 py-2 px-1"},o6e={class:"flex-1 h-[90px] flex flex-col justify-between gap-1"},s6e={class:"mb-2"},l6e={class:"flex items-center gap-2"},u6e=["innerHTML"],c6e={key:1,class:"text-[12px] text-[#999]"},f6e=["onClick"],d6e=["innerHTML"],h6e={class:"flex items-center gap-2"},p6e=m.defineComponent({__name:"iframe-menu",setup(n){const e=m.inject("editor"),t=m.ref(),r=m.ref(""),i=m.ref(""),a=m.computed(()=>_g.find(l=>l.value===i.value)),o=l=>{i.value=l.value,t.value?.changePopoverVisible(!1)},s=()=>{const{validate:l,transformURL:u}=_g.find(c=>c.value===i.value);l&&!l(r.value)||e.value.chain().focus().setParagraph().setIframe({type:i.value,src:u?u(r.value):r.value}).run()};return(l,u)=>(m.openBlock(),m.createElementBlock("div",i6e,[m.unref(e)?.getAttributes("iframe").src==""?(m.openBlock(),m.createElementBlock("div",a6e,[u[3]||(u[3]=m.createElementVNode("div",{class:"flex flex-col items-center gap-1 h-[80px]"},[m.createElementVNode("span",{class:"w-[24px] h-[24px] text-center rounded-full bg-[#007bff] text-[12px] text-[#fff] font-500",style:{"line-height":"24px"}}," 1 "),m.createElementVNode("div",{class:"w-[1px] flex-1 bg-[#e5e5e5]"}),m.createElementVNode("span",{class:"w-[24px] h-[24px] text-center rounded-full bg-[#007bff] text-[12px] text-[#fff] font-500",style:{"line-height":"24px"}}," 2 ")],-1)),m.createElementVNode("div",o6e,[m.createElementVNode("div",s6e,[m.createVNode(im,{value:i.value,"onUpdate:value":u[0]||(u[0]=c=>i.value=c),options:m.unref(_g),placeholder:"选择网页类型",class:"w-full",ref_key:"selectRef",ref:t},{main:m.withCtx(()=>[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(m.unref(_g),(c,f)=>(m.openBlock(),m.createElementBlock("div",{key:c.value,class:m.normalizeClass(["flex items-center gap-2 h-[32px] px-2 cursor-pointer rounded-[4px] hover:bg-[rgb(242,243,245)]",{"bg-[rgb(242,243,245)]":i.value===c.value,"mb-1":f!==m.unref(_g).length-1}]),onClick:d=>o(c)},[m.createElementVNode("span",{innerHTML:c.icon},null,8,d6e),m.createTextVNode(" "+m.toDisplayString(c.label),1)],10,f6e))),128))]),default:m.withCtx(()=>[m.createElementVNode("div",l6e,[a.value&&Object.keys(a.value).length?(m.openBlock(),m.createElementBlock(m.Fragment,{key:0},[m.createElementVNode("span",{innerHTML:a.value.icon},null,8,u6e),m.createTextVNode(" "+m.toDisplayString(a.value.label),1)],64)):(m.openBlock(),m.createElementBlock("span",c6e,"选择网页类型"))])]),_:1},8,["value","options"])]),m.createElementVNode("div",h6e,[m.createVNode(Vm,{value:r.value,"onUpdate:value":u[1]||(u[1]=c=>r.value=c),placeholder:"打开网址复制链接,以http:// 或 https:// 开头",class:"w-[300px]"},null,8,["value"]),m.createVNode(Uo,{type:"primary",size:"small",disabled:!r.value,onClick:s},{default:m.withCtx(()=>[...u[2]||(u[2]=[m.createTextVNode("添加",-1)])]),_:1},8,["disabled"])])])])):(m.openBlock(),m.createElementBlock(m.Fragment,{key:1},[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(IZ),m.createVNode(Gd)],64))]))}}),v6e={class:"flex items-center gap-2"},g6e=m.defineComponent({__name:"echarts-menu",setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",v6e,[m.createVNode(uv),m.createVNode(sv),m.createVNode(lv),m.createVNode(dN,{icon:"setting",text:"图表配置",isEdit:!0}),m.createVNode(Gd)]))}}),m6e="data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='14'%20cy='14'%20r='11.0833'%20fill='%23258AFF'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M11.8581%2011.2155C11.9065%2011.1088%2012.058%2011.1088%2012.1064%2011.2155L14.6199%2016.7534C14.6609%2016.8437%2014.5948%2016.9461%2014.4957%2016.9461H11.6756C11.461%2016.9461%2011.2663%2017.072%2011.1782%2017.2677L10.7355%2018.2514C10.6273%2018.492%2010.8033%2018.7642%2011.0671%2018.7642H16.0477C16.7417%2018.7642%2017.2037%2018.0471%2016.9169%2017.4152L12.8512%208.45725C12.5122%207.71045%2011.4515%207.71057%2011.1127%208.45743L6.67056%2018.2504C6.56136%2018.4911%206.73737%2018.7642%207.00171%2018.7642H8.08241C8.29645%2018.7642%208.49072%2018.639%208.57914%2018.4441L11.8581%2011.2155ZM19.373%2018.4441C19.4614%2018.639%2019.6557%2018.7642%2019.8698%2018.7642H20.9504C21.2147%2018.7642%2021.3907%2018.4911%2021.2816%2018.2504L16.7334%208.22172C16.645%208.02677%2016.4508%207.90156%2016.2367%207.90156L15.156%207.90156C14.8917%207.90156%2014.7157%208.17464%2014.8249%208.41537L19.373%2018.4441Z'%20fill='white'/%3e%3c/svg%3e",y6e=["maxlength","disabled"],b6e=["disabled","loading"],x6e={key:0,class:"w-iconfont icon-send"},w6e={key:1,class:"w-iconfont icon-loading animate-spin"},_6e=["innerHTML"],S6e={class:"flex items-center gap-2 text-handle"},T6e=m.defineComponent({__name:"assistant",setup(n){const e=m.inject("editor"),t=m.inject("assistant"),r=m.inject("options"),i=m.ref(null),a=m.ref(""),o=m.ref({prompt:"",content:"",error:!1}),s=m.ref(!1),l=m.ref(600),u=async()=>{s.value=!0,o.value.error=!1,o.value.prompt="",o.value.content="";const y={lang:"",input:e.value?p$(e.value):"",command:a},b={html:e.value?.getHTML()??"",text:e.value?.getText()??"",json:e.value?.getJSON()??{}};try{const w=await r.value.ai?.sendMessage?.(y,b),x=()=>{o.value.content.startsWith("[ERROR]: ")&&(o.value.error=!0,o.value.content=o.value.content.replace("[ERROR]: ",""))};if(w instanceof ReadableStream){const S=new WritableStream({write(C){x(),o.value.content+=C},close(){s.value=!1,o.value.command=a}});w.pipeTo(S);return}if(LZ(w)){s.value=!1,o.value.command=a,x(),o.value.content=w;return}console.error('"ai.assistant.onMessage" method returns data in an incorrect format, it can be a ReadableStream or plain text.')}catch(w){console.error(w),t.value=!1}},c=()=>{t.value=!1,e.value?.commands.focus()},f=()=>{e.value?.chain().insertContent(o.value.content).run(),c()},d=()=>{const{to:y}=e.value?.state.selection??{};y&&e.value?.chain().insertContentAt(y,o.value.content).focus().run(),c()},h=()=>{e.value?.commands.selectParentNode();const{to:y}=e.value?.state.selection??{};y&&e.value?.chain().insertContentAt(y,o.value.content).focus().run(),c()},p=async()=>{const{toClipboard:y}=CD();await y(o.value.content)},v=()=>{const{command:y}=o.value;y&&(a.value=y),u()},g=()=>{a.value="",o.value.prompt="",o.value.content=""};return(y,b)=>{const w=m.resolveDirective("tooltip");return m.openBlock(),m.createElementBlock(m.Fragment,null,[m.createElementVNode("div",{class:"relative flex items-center gap-4 h-[50px] border-b px-3 white-ai-wrapper",style:m.normalizeStyle({width:`${l.value}px`})},[b[7]||(b[7]=m.createElementVNode("div",{class:"flex-shrink-0"},[m.createElementVNode("img",{src:m6e,alt:"ai",class:"w-8 h-8"})],-1)),m.withDirectives(m.createElementVNode("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":b[0]||(b[0]=x=>a.value=x),class:m.normalizeClass(["flex-1 outline-none h-full",{"input-disabled":s.value}]),maxlength:m.unref(r).ai?.maxlength,disabled:s.value,autocomplete:"false",placeholder:"告诉AI下一步怎么做"},null,10,y6e),[[m.vModelText,a.value]]),m.createElementVNode("button",{class:"ai-button",disabled:s.value,loading:s.value,onClick:u},[s.value?(m.openBlock(),m.createElementBlock("i",w6e)):(m.openBlock(),m.createElementBlock("i",x6e))],8,b6e)],4),o.value.content?(m.openBlock(),m.createElementBlock("div",{key:0,class:"w-full px-3 py-2",style:m.normalizeStyle({width:`${l.value}px`})},[m.createElementVNode("div",{class:m.normalizeClass(["w-full min-h-[50px] overflow-y-auto line-clamp-6 result-content",{error:o.value.error}]),innerHTML:o.value.content},null,10,_6e),m.createElementVNode("div",S6e,[m.createVNode(Uo,{type:"primary",size:"small",onClick:b[1]||(b[1]=x=>f())},{default:m.withCtx(()=>[...b[8]||(b[8]=[m.createTextVNode("替换所选",-1)])]),_:1}),m.createVNode(Uo,{size:"small",onClick:b[2]||(b[2]=x=>h())},{default:m.withCtx(()=>[...b[9]||(b[9]=[m.createTextVNode("插入下方",-1)])]),_:1}),m.createVNode(Uo,{size:"small",onClick:b[3]||(b[3]=x=>d())},{default:m.withCtx(()=>[...b[10]||(b[10]=[m.createTextVNode("插入后方",-1)])]),_:1}),m.createVNode(Uo,{size:"small",onClick:b[4]||(b[4]=x=>g())},{default:m.withCtx(()=>[...b[11]||(b[11]=[m.createTextVNode("放弃",-1)])]),_:1}),m.withDirectives(m.createElementVNode("i",{class:"w-iconfont icon-copy-text",onClick:b[5]||(b[5]=x=>p())},null,512),[[w,"复制"]]),m.withDirectives(m.createElementVNode("i",{class:"w-iconfont icon-refresh",onClick:b[6]||(b[6]=x=>v())},null,512),[[w,"重新生成"]])])],4)):m.createCommentVNode("",!0)],64)}}}),C6e=m.defineComponent({__name:"index",setup(n){const e=m.inject("editor"),t=m.inject("assistant"),r=m.computed(()=>({placement:t.value?"bottom":"top",onHide(){t.value=!1}}));return m.onUnmounted(()=>{}),(i,a)=>(m.openBlock(),m.createBlock(m.unref(A8e),{class:m.normalizeClass(["white-editor-bubble-menu rounded-md",{"px-3 py-2":!m.unref(t)}]),style:{zIndex:200},editor:m.unref(e),options:r.value},{default:m.withCtx(()=>[m.unref(t)?m.createCommentVNode("",!0):(m.openBlock(),m.createElementBlock(m.Fragment,{key:0},[m.unref(e)?.isActive("toc")||m.unref(e)?.isActive("pageBreak")||m.unref(e)?.isActive("horizontalRule")||m.unref(e)?.isActive("codeBlock")||m.unref(e)?.getAttributes("image").error?(m.openBlock(),m.createBlock(Gd,{key:0})):m.unref(e)?.isActive("image")&&!m.unref(e)?.getAttributes("image").error||m.unref(e)?.isActive("inlineImage")&&!m.unref(e)?.getAttributes("inlineImage").error?(m.openBlock(),m.createBlock(L8e,{key:1})):m.unref(e)?.isActive("video")||m.unref(e)?.isActive("audio")||m.unref(e)?.isActive("file")?(m.openBlock(),m.createBlock(V8e,{key:2})):m.unref(e)?.isActive("iframe")?(m.openBlock(),m.createBlock(p6e,{key:3})):m.unref(e)?.isActive("table")?(m.openBlock(),m.createBlock(W8e,{key:4})):m.unref(e)?.isActive("tag")?(m.openBlock(),m.createBlock(Z8e,{key:5})):m.unref(e)?.isActive("echarts")?(m.openBlock(),m.createBlock(g6e,{key:6})):(m.openBlock(),m.createBlock(r6e,{key:7}))],64)),m.unref(t)?(m.openBlock(),m.createBlock(T6e,{key:1})):m.createCommentVNode("",!0)]),_:1},8,["class","editor","options"]))}}),k6e={key:0,class:"w-full h-[4rem]"},E6e={key:1,class:"w-full h-[4rem]"},M6e=m.defineComponent({__name:"index",setup(n){const e=m.inject("editor"),t=m.inject("page"),r=m.computed(()=>{const{width:a,height:o}=t.value.size??{width:0,height:0};return{width:a,height:o}}),i=m.computed(()=>t.value.layout==="web"?"100%":`calc(${r.value.width}cm * 1)`);return(a,o)=>(m.openBlock(),m.createElementBlock("div",{class:m.normalizeClass(["white-editor-container min-h-full mx-auto overflow-hidden relative flex flex-col",m.unref(t).layout==="page"?"shadow-[0_0_10px_rgba(0,0,0,0.1)] bg-white":""]),style:m.normalizeStyle({width:i.value})},[m.unref(t).layout==="page"?(m.openBlock(),m.createElementBlock("div",k6e)):m.createCommentVNode("",!0),m.createVNode(m.unref(Aae),{editor:m.unref(e),class:m.normalizeClass(["white-editor-content flex-1 flex flex-col",{"is-empty":m.unref(e)?.isEmpty&&m.unref(e)?.state.doc.childCount<=1,"is-readonly":m.unref(e)?.editable,"format-painter":m.unref(e)?.view?.painter?.enabled}])},null,8,["editor","class"]),m.unref(t).layout==="page"?(m.openBlock(),m.createElementBlock("div",E6e)):m.createCommentVNode("",!0),m.unref(e)?(m.openBlock(),m.createBlock(C6e,{key:2})):m.createCommentVNode("",!0)],6))}}),A6e={class:"white-editor-namespace white-give-editor-wrapper"},N6e={class:"flex flex-col h-full w-full"},D6e={key:0,class:"w-full flex-none border-b border-[#d9d9d9]"},O6e=["id"],I6e={key:1,class:"w-full h-[40px] flex-none border-t border-[#d9d9d9] px-[2rem]"},R6e=m.defineComponent({__name:"HomeView",setup(n){const e=m.inject("editor"),t=m.inject("container"),r=m.inject("options"),i=m.inject("uploadFileMap"),a=m.inject("page"),o=B3e({container:t,options:r,uploadFileMap:i}),s=new Mae({editable:!r.value?.editor?.readOnly,autofocus:r.value?.editor?.autofocus,content:Zk(r.value.document?.content),enableInputRules:Kz(r),enablePasteRules:Kz(r),editorProps:{attributes:{class:"white-editor"},...r.value?.editor?.editorProps},parseOptions:r.value?.editor?.parseOptions,extensions:o});return e.value=s,e.value.storage.container=t,e.value.storage.options=r.value,(l,u)=>(m.openBlock(),m.createElementBlock("div",A6e,[m.createElementVNode("div",N6e,[m.unref(r).layout.toolbar.show?(m.openBlock(),m.createElementBlock("div",D6e,[m.createVNode(eBe)])):m.createCommentVNode("",!0),m.createElementVNode("div",{class:"w-full flex-1 min-h-0 flex overflow-hidden",id:m.unref(t)},[m.unref(a).showToc&&m.unref(r).layout.toc.show?(m.openBlock(),m.createBlock(IBe,{key:0})):m.createCommentVNode("",!0),m.createElementVNode("div",{class:m.normalizeClass(["flex-1 h-full overflow-y-auto py-[20px]",m.unref(a).layout==="page"?"bg-[#f4f6fa]":""])},[m.createVNode(M6e)],2)],8,O6e),m.unref(r).layout.foot.show?(m.openBlock(),m.createElementBlock("div",I6e,[m.createVNode(TBe)])):m.createCommentVNode("",!0)])]))}}),vN=m.defineComponent({__name:"index",emits:["beforeCreate","created","change","change:selection","change:transaction","change:menu","change:toolbar","change:pageLayout","change:pageSize","change:pageOrientation","change:pageMargin","change:pageBackground","change:pageShowToc","change:pagePreview","change:pageZoom","change:pageWatermark","change:locale","change:theme","contentError","print","focus","blur","saved","destroy","menuChange"],setup(n,{expose:e,emit:t}){const r=t,i=m.inject("providedOptions",{}),a=m.ref(`white-editor-${hp()}`),o={document:{title:"无标题文档",content:""},editor:{readOnly:!1,autofocus:!1,parseOptions:{preserveWhitespace:"full"},editorProps:{},enableMarkdown:!0},layout:{toc:{show:!0},toolbar:{show:!0},foot:{show:!0,pageSize:!0,character:!0,copy:!0,download:!0}},file:{allowedMimeTypes:[],maxSize:1024*1024*100},ai:{enabled:!0,maxlength:100,async sendMessage(k){return new Promise(O=>{setTimeout(()=>{O(`这里是 AI 的回复。你发送了:${k.input}`)},1e3)})}},users:[{id:"Cassielxd",label:"Cassielxd"},{id:"Goldziher",label:"Na'aman Hirschfeld"},{id:"SerRashin",label:"SerRashin"},{id:"ChenErik",label:"ChenErik"},{id:"china-wangxu",label:"china-wangxu"},{id:"Sherman Xu",label:"xuzhenjun130"},{id:"testuser",label:"测试用户"}],echarts:{onSetOptions(k,O){return console.log("onSetOptions",k,O),null}},page:{layout:"page",showToc:!1,toolbar:"double",size:{key:"A4",width:21,height:29.7}},async onFileUpload(k){if(!k)throw new Error("没有找到要上传的文件");return console.log("onUpload",k),await new Promise(O=>setTimeout(O,3e3)),{id:hp(),url:k.url??URL.createObjectURL(k),name:k.name,type:k.type,size:k.size}},onFileDelete(k,O){console.log(k,O)}},s={lineHeights:[{label:"单倍行距",value:1},{label:"1.5 倍行距",value:1.5},{label:"1.7 倍行距",value:1.7,default:!0},{label:"2 倍行距",value:2},{label:"2.5 倍行距",value:2.5},{label:"3 倍行距",value:3}],pageSizeOption:[{label:"网页",layout:"web"},{label:"A4",width:21,height:29.7,default:!0,layout:"page"},{label:"A3",width:29.7,height:42,layout:"page"},{label:"A5",width:14.8,height:21,layout:"page"},{label:"B5",width:17.6,height:25,layout:"page"},{label:"5号信纸",width:10.9,height:12.9,layout:"page"},{label:"6号信纸",width:11.9,height:22.9,layout:"page"},{label:"7号信纸",width:16.1,height:22.8,layout:"page"},{label:"9号信纸",width:22.8,height:32.3,layout:"page"},{label:"法律用纸",width:21.5,height:33.5,layout:"page"}]},l=m.ref(null),u=m.ref(n2(i,o)),c=m.ref(n2(u.value?.page,{layouts:["page","web"],watermark:{type:"测试",alpha:.2,fontColor:"#000",fontSize:16,fontFamily:"SimSun",fontWeight:"normal",text:""},margin:{left:3.18,right:3.18,top:2.54,bottom:2.54}})),f=m.ref(!1),d=m.ref(new Map);m.provide("container",a),m.provide("options",u),m.provide("editor",l),m.provide("page",c),m.provide("assistant",f),m.provide("uploadFileMap",d),m.provide("dicts",s),m.watch(()=>l.value,()=>{l.value&&(l.value.on("create",({editor:k})=>{r("created",{editor:k})}),l.value.on("update",({editor:k})=>{r("change",{editor:k})}),l.value.on("selectionUpdate",({editor:k})=>{r("change:selection",{editor:k})}),l.value.on("transaction",({editor:k,transaction:O})=>{r("change:transaction",{editor:k,transaction:O})}),l.value.on("focus",({editor:k,event:O})=>{r("focus",{editor:k,event:O})}),l.value.on("contentError",({editor:k,error:O,disableCollaboration:R})=>{r("contentError",{editor:k,error:O,disableCollaboration:R})}),l.value.on("blur",({editor:k,event:O})=>{r("blur",{editor:k,event:O})}),l.value.on("destroy",()=>{r("destroy")}))});const h=(k,O="merge")=>{O==="merge"?u.value=n2(u.value,k):u.value=k},p=(k,O={updateSelection:!0,position:"start"})=>{if(!l.value)throw new Error("editor is not ready!");const R=Zk(k);l.value.chain().setContent(R,{emitUpdate:O.updateSelection}).focus(O.position,{scrollIntoView:!0}).run()},v=(k,O={updateSelection:!0,position:"start"})=>{if(!l.value)throw new Error("editor is not ready!");const R=Zk(k);l.value.chain().insertContent(R,{updateSelection:O.updateSelection}).focus(O.position,{scrollIntoView:!0}).run()},g=(k="html")=>{if(!l.value)throw new Error("editor is not ready!");if(k==="html")return l.value.getHTML();if(k==="text")return l.value.getText();if(k==="json")return l.value.getJSON();throw new Error("format must be html, text or json")};return e({getOptions(){return u.value},setOptions:h,setContent:p,insertContent:v,getText:()=>g("text"),getHTML:()=>g("html"),getJSON:()=>g("json"),focus:(k="start",O={scrollIntoView:!0})=>l.value?.commands.focus(k,O),blur:()=>l.value?.chain().blur().run(),getEditor:()=>l.value,getSelectionText:()=>l.value?p$(l.value):"",getSelectionNode:()=>l.value?Ps(l.value):null,deleteSelectionNode:()=>l.value?.commands.deleteSelectionNode(),setCurrentNodeSelection:()=>l.value?.commands.setCurrentNodeSelection(),changeDisabled(k=!0){u.value.editor&&(u.value.editor.readOnly=k)},setLayout:k=>{if(!c.value.layouts.includes(k.layout))throw new Error(`"params.layout" must be one of ${JSON.stringify(c.value.layouts)}.`);if(c.value.layout=k.layout,k.layout!=="web"){if(!k.width||!k.height)throw new Error('"params.width" and "params.height" must be provided.');c.value.size={key:k.layout,width:k.width,height:k.height}}}}),(k,O)=>(m.openBlock(),m.createBlock(R6e))}}),Sg="TOOLTIP_INSTANCE",L6e={mounted(n,e){let t="",r="top",i=[300,0];typeof e.value=="string"?t=e.value:(t=e.value.content,e.value.placement!==void 0&&(r=e.value.placement),e.value.delay!==void 0&&(i=e.value.delay)),n[Sg]=Dd(n,{content:t,theme:"tooltip",duration:100,animation:"scale",allowHTML:!0,placement:r,delay:i})},updated(n,e){let t="";typeof e.value=="string"?t=e.value:t=e.value.content,n[Sg]&&n[Sg].setContent(t)},unmounted(n){n[Sg]&&n[Sg].destroy()}},P6e={install(n){n.directive("tooltip",L6e)}},B6e={install:(n,e)=>{n.provide("providedOptions",e??{}),n.component(vN.name??"WhiteEditor",vN),n.use(P6e)}};exports.default=vN;exports.useWhiteEditor=B6e;
|
package/package.json
CHANGED