vdc-editor 0.1.294 → 0.1.295

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.
@@ -342,7 +342,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),q=L,z=U),V===void 0&&(
342
342
  `}),J=getComputedStyle(b.value);P.font=J.font;const $=20,R=()=>Math.max(0,(v.value||0)-$);function L(q,ne){let de=1,Ee=q.length,oe=0;for(;de<=Ee;){const me=Math.floor((de+Ee)/2);P.measureText(q.slice(0,me)).width<=ne?(oe=me,de=me+1):Ee=me-1}return oe}let U="";const V=[];for(const q of G){if(q===`
343
343
  `){V.push(U),U="";continue}if(U+=q,P.measureText(U).width>R())for(;P.measureText(U).width>R();){const ne=L(U,R());ne<=0?(V.push(U.charAt(0)),U=U.slice(1)):(V.push(U.slice(0,ne)),U=U.slice(ne))}}return V.push(U),V.map(q=>`<p>${q}</p>`).join("")}const B=o.computed(()=>{var J,$,R;const G=(R=($=(J=r.parentEditor)==null?void 0:J.storage.superText.superInputModal)==null?void 0:$.props)==null?void 0:R.guidelineLeftOffset;return s.value||!G?{}:{backgroundImage:"linear-gradient(to right, #d1d5db 1px, transparent 1px)",backgroundSize:"1px 100%",backgroundRepeat:"no-repeat",backgroundPosition:sn(G)}}),{isScrolling:F,handleScroll:H}=Xl();return e({insertSpecialCharater:m,isChecked:u,toggleSpellCheck:g,wrapText:O,editor:p}),(G,J)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:b,class:o.normalizeClass(o.unref(ke)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5 relative",G.isReadOnly&&"border-none",o.unref(s)&&"h-auto min-h-20 max-h-44 border-ed-gray rounded-md px-4 py-2.5",o.unref(s)&&!o.unref(F)&&"scrollbar-thumb-transparent")),style:o.normalizeStyle([o.unref(_),o.unref(B),o.unref(T)]),onScroll:J[0]||(J[0]=(...$)=>o.unref(H)&&o.unref(H)(...$))},[o.createVNode(o.unref(er),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(ke)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),QJ={class:"sr-only"},NJ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},eZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},tZ={class:"flex items-center space-x-2 text-xs font-normal [&>input[type='checkbox']]:h-[20px] [&>input[type='checkbox']]:w-[20px] [&>input[type='checkbox']]:!border-ed-border [&>input[type='checkbox']]:shadow"},nZ=["checked"],rZ={for:"spellcheck",class:"select-none whitespace-nowrap"},oZ={class:"flex gap-x-1"},iZ={class:"ml-auto"},sZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},aZ={class:"text-right text-sm p-2"},lZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},mk=5,qc=o.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){var U,V;const n=e,r=t,{t:i}=At(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=nt.useLocalStorage("superInputModalPosition",null),f=o.reactive({x:0,y:0}),p=o.ref(!1),m={x:0,y:0},g=o.ref(!1),b=o.ref(!1),v=o.ref(!1),y=z=>{p.value=!0;const q=z.currentTarget.closest(".draggable-dialog").getBoundingClientRect();m.x=z.clientX-q.left,m.y=z.clientY-q.top,document.addEventListener("mousemove",x),document.addEventListener("mouseup",C)},x=z=>{p.value&&(f.x=z.clientX-m.x,f.y=z.clientY-m.y)},C=()=>{p.value=!1,c.value={x:f.x,y:f.y},document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",C)};o.watch(()=>r.open,async z=>{if(!z)return;b.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await o.nextTick();const q=document.querySelector(".draggable-dialog");if(!q)return;q.getBoundingClientRect();const ne=window.innerWidth,de=window.innerHeight;c.value&&c.value.x!==void 0&&c.value.y!==void 0?(f.x=c.value.x,f.y=c.value.y):(f.x=Math.max((ne-q.offsetWidth)/2,0),f.y=Math.max((de-q.offsetHeight)/2,0))},{immediate:!0});const k=()=>{n("close"),s.value="",a.value="",u.value=!1},E=()=>{var q;if((q=l.value)==null?void 0:q.editor.commands.hasInvalidChar()){v.value=!0;return}s.value=l.value.wrapText(),a.value="",b.value?g.value=!0:n("close"),n("save",s.value),s.value=""},T=()=>{g.value=!1,n("close")},_=(V=(U=r.editor)==null?void 0:U.extensionManager.extensions.find(z=>z.name==="superText"))==null?void 0:V.options.specialCharModal,A=o.inject("fontFamily",""),P=o.computed(()=>{var z,q,ne;return op(r.editor,cc)&&o.unref(A)?o.unref(A):(ne=(q=(z=r.editor)==null?void 0:z.storage.superText.superInputModal)==null?void 0:q.props)==null?void 0:ne.fontFamily}),O=o.inject("fontWeight",o.ref("")),B=o.computed(()=>o.unref(O)||void 0),F=nt.useLocalStorage("recentSpecialChars",[]),H=z=>{if(!z)return;const q=(F.value??[]).filter(ne=>ne!==z);q.unshift(z),F.value=q.slice(0,mk)},G=z=>{var q;(q=l.value)==null||q.insertSpecialCharater(z)},J=(z,q)=>{var ne;q&&((ne=l.value)==null||ne.insertSpecialCharater(z),H(z))},$=o.computed(()=>{var z;return(z=l.value)==null?void 0:z.isChecked}),R=()=>{var z;(z=l.value)==null||z.toggleSpellCheck()};o.onUnmounted(()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",C)}),o.watch(s,z=>{!r.superTextElementId||r.superTextElementId===""||(b.value=z!==(r.superTextInit??""))});const L=o.computed(()=>{var z;return(z=l.value)==null?void 0:z.editor});return(z,q)=>{const ne=ph,de=fh,Ee=dh,oe=ch,me=pk,Z=iv,te=Fc,re=Vc,ae=BX;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(re,{open:z.open},{default:o.withCtx(()=>[o.createVNode(o.unref(Fg),null,{default:o.withCtx(()=>[o.createVNode(o.unref(jg),{class:"!pointer-events-none bg-black/30"}),o.createVNode(te,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>{var fe,Se;return[o.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${f.x}px, ${f.y}px)`,fontFamily:o.unref(P),fontWeight:o.unref(B)})},[o.createVNode(Ee,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(y,["prevent"])},{default:o.withCtx(()=>[o.createVNode(ne,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(de,{class:"absolute right-3 top-3 text-white",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(Sc),{class:"w-5 h-5"}),o.createElementVNode("span",QJ,o.toDisplayString(z.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(oe),o.createElementVNode("div",NJ,[o.createElementVNode("div",eZ,[q[5]||(q[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex gap-x-6",o.unref(F).length===mk&&"gap-x-4"))},[o.createVNode(vn,{class:"text-[#65558F] bg-[#ECE6F0] hover:bg-[#ECE6F0]/90 shadow text-xs rounded font-normal h-[25px] px-3",onClick:q[0]||(q[0]=_e=>u.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.insert.symbol")),1)]),_:1}),o.createElementVNode("div",tZ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref($),onChange:R},null,40,nZ),o.createElementVNode("label",rZ,o.toDisplayString(o.unref(i)("editor.menubar.menu.spellCheck")),1)]),o.createElementVNode("div",oZ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(F),_e=>(o.openBlock(),o.createBlock(vn,{key:_e,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:ze=>G(_e)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(_e),1)]),_:2},1032,["onClick"]))),128))]),o.createElementVNode("div",iZ,[o.unref(L)?(o.openBlock(),o.createBlock(me,{key:0,editor:o.unref(L),"is-enable-spell-check-real-time":(fe=o.unref(L))==null?void 0:fe.extensionStorage.spellchecker.spellchecker.proofreader.enabled,align:"left"},null,8,["editor","is-enable-spell-check-real-time"])):o.createCommentVNode("",!0)])],2),u.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent((Se=o.unref(_))==null?void 0:Se.component),o.mergeProps({key:0,"custom-class":"!z-[70] !pointer-events-auto","font-family":o.unref(P)},o.unref(_).props,{onSelectedChar:J,onClose:q[1]||(q[1]=_e=>u.value=!1)}),null,16,["font-family"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",sZ,[o.createElementVNode("label",aZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(Ev,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":q[2]||(q[2]=_e=>s.value=_e),"parent-editor":z.editor,class:""},null,8,["modelValue","parent-editor"])]),o.createElementVNode("div",lZ,[q[6]||(q[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(bs,{modelValue:a.value,"onUpdate:modelValue":q[3]||(q[3]=_e=>a.value=_e),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),o.createVNode(Z,{class:"sm:justify-center pb-3.5 pt-1"},{default:o.withCtx(()=>[o.createVNode(vn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:E},{default:o.withCtx(()=>[o.createVNode(o.unref(cb),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(o.unref(i)("editor.check")),1)]),_:1}),o.createVNode(vn,{as:"button",variant:"destructive",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(Sc),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(z.$t("editor.close")),1)]),_:1})]),_:1})],4)]}),_:1})]),_:1})]),_:1},8,["open"]),o.createVNode(ae,{open:g.value,onClose:T},null,8,["open"]),o.createVNode(ae,{title:"Information",message:"{ 과 } 는 입력이 제한된 문자열 입니다.",iconName:"MessageCircleWarning",confirmText:"Ok",open:v.value,onClose:q[4]||(q[4]=fe=>v.value=!1)},null,8,["open"])],64)}}}),kv=o.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=At(),i=o.ref(!1),s=o.reactive({from:0,to:0,text:""}),a=o.inject("isEditable",o.ref(!0)),l=o.inject("canEditSuper",o.ref(!0)),u=o.computed(()=>n.mode===Me.EDITOR||n.mode===Me.PLAIN_TEXT||!l.value||n.disableSuperInput);function c(){if(!n.editor)return"";const{from:C,to:k}=n.editor.state.selection,E=n.editor.state.doc.cut(C,k),_=$r.fromSchema(n.editor.schema).serializeFragment(E.content),A=document.createElement("div");return A.appendChild(_),A.innerHTML}const f=()=>{const{view:C}=n.editor,{from:k,to:E}=C.state.selection,T=c();s.text=T,s.from=k,s.to=E},p=()=>i.value=!i.value,m=()=>{u.value||(i.value=!0,f())},g=()=>i.value=!1,b=C=>{if(Wc(C.trim())){i.value=!1;return}const k=n==null?void 0:n.superTextStore.addMoreSuperText(C);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":k,"data-text":C}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},v=o.ref(!1),y=async C=>{var k,E;if(C){const T=await((E=(k=n.editor).hasClipboard)==null?void 0:E.call(k));v.value=!!T}},x=()=>{if(u.value||!n.editor)return;const{view:C,state:k}=n.editor,{from:E,to:T}=k.selection;s.from=E,s.to=T,s.text="",C.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:m,closeDialog:g}),(C,k)=>{const E=qc,T=ov,_=rv,A=nv,P=tv;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(E,{open:i.value,editor:C.editor,"super-text-init":s.text,onClose:p,onSave:b},null,8,["open","editor","super-text-init"]),o.createVNode(P,{"onUpdate:open":y},{default:o.withCtx(()=>[o.createVNode(T,{as:"template",class:"relative",disabled:o.unref(u),onDblclick:o.withModifiers(x,["prevent","stop"])},{default:o.withCtx(()=>[o.renderSlot(C.$slots,"default")]),_:3},8,["disabled"]),o.createVNode(A,null,{default:o.withCtx(()=>[C.disableSuperInput?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(_,{key:0,onSelect:m},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.inputSuper")),1)]),_:1})),o.unref(a)?(o.openBlock(),o.createBlock(_,{key:1,onSelect:k[0]||(k[0]=O=>{var B;return(B=C.editor)==null?void 0:B.commands.cutContent()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.cut")),1)]),_:1})):o.createCommentVNode("",!0),o.unref(a)?(o.openBlock(),o.createBlock(_,{key:2,onSelect:k[1]||(k[1]=O=>{var B;return(B=C.editor)==null?void 0:B.commands.copyContent()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.copy")),1)]),_:1})):o.createCommentVNode("",!0),o.unref(a)?(o.openBlock(),o.createBlock(_,{key:3,disabled:!v.value,onSelect:k[2]||(k[2]=O=>{var B;return(B=C.editor)==null?void 0:B.commands.pasteContent()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):o.createCommentVNode("",!0)]),_:1})]),_:3})],64)}}}),uZ={id:"editor-panel",class:"flex relative w-full h-full"},cZ=po(o.defineComponent({__name:"PageNode",props:na,setup(t){const{state:e,page:n,superTextStore:r}=xn(),{size:i,pagination:s,margin:a}=n.value,l=o.ref(null),u=o.ref(t.node.attrs.viewSuperTextArea),c=o.computed(()=>u.value&&t.editor.storage.page.mode!=="editor"),f=o.computed(()=>t.editor.storage.page.mode===Me.REPORT),{width:p,height:m}=i,g=o.computed(()=>s?`calc(${m} - ${(a==null?void 0:a.top)??0} - ${(a==null?void 0:a.bottom)??0}`:"max-content"),b=nt.useEventBus(hr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,v=>{b.emit(v.pageNumber)},{immediate:!0}),(v,y)=>{var C,k,E,T;const x=kv;return o.openBlock(),o.createBlock(o.unref(ta),{id:v.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":v.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":((C=o.unref(a))==null?void 0:C.top)??"0","--umo-page-margin-bottom":((k=o.unref(a))==null?void 0:k.bottom)??"0","--umo-page-margin-left":((E=o.unref(a))==null?void 0:E.left)??"0","--umo-page-margin-right":((T=o.unref(a))==null?void 0:T.right)??"0","--umo-page-width":o.unref(p),"--umo-page-height":o.unref(m),"--empty-node-left":"0px",left:100,"min-height":typeof o.unref(m)=="number"?`${o.unref(m)}px`:o.unref(m),height:f.value?typeof o.unref(m)=="number"?`${o.unref(m)}px`:o.unref(m):"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",uZ,[o.createVNode(x,{mode:c.value?o.unref(Me).REPORT:o.unref(Me).EDITOR,editor:v.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(ex),{class:"umo-page-node-content",style:o.normalizeStyle({height:g.value})},null,8,["style"])]),_:1},8,["mode","editor","super-text-store"])])]),_:1},8,["id","page-number","style"])}}}),[["__scopeId","data-v-7d55d7ea"]]);function gk(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const dZ=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=i.extensionManager.attributes,f=Sh(c,l.node().type.name,l.node().attrs);if(f.id=ev(),f.extend&&(f.extend=!1),s instanceof Pe&&s.node.isBlock)return!l.parentOffset||!Cr(a,l.pos)?!1:(r&&(t&&gk(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const p=u.parentOffset===u.parent.content.size;s instanceof Le&&e.deleteSelection();const m=l.depth===0?void 0:e4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=Cr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&Cr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(b=!0,g=m?[{type:m,attrs:f}]:void 0),b&&(g||(g=[{type:l.node().type,attrs:f}]),e.split(e.mapping.map(l.pos),1,g),m&&!p&&!l.parentOffset&&l.parent.type!==m)){const v=e.mapping.map(l.before()),y=e.doc.resolve(v);l.node(-1).canReplaceWith(y.index(),y.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&gk(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},fZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var v;const s=yn(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection instanceof Pe?n.selection.node:null;if(u!=null&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const c=a.node(-1);if(c.type!==s)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let y=be.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-x;A>=a.depth-3;A-=1)y=be.from(a.node(A).copy(y));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Sh(f,a.node().type.name,a.node().attrs),E=((v=s.contentMatch.defaultType)==null?void 0:v.createAndFill(k))??void 0;y=y.append(be.from(s.createAndFill(null,E)??void 0));const T=a.before(a.depth-(x-1));e.replace(T,a.after(-C),new Te(y,4-x,0));let _=-1;e.doc.nodesBetween(T,e.doc.content.size,(A,P)=>{if(_>-1)return!1;A.isTextblock&&A.content.size===0&&(_=P+1)}),_>-1&&e.setSelection(Le.near(e.doc.resolve(_))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,m=Sh(f,c.type.name,c.attrs),g=Sh(f,a.node().type.name,a.node().attrs);m.id=ev(),g.id=ev(),e.delete(a.pos,l.pos);const b=p?[{type:s,attrs:m},{type:p,attrs:g}]:[{type:s,attrs:m}];if(!Cr(e.doc,a.pos,2))return!1;if(r){const{selection:y,storedMarks:x}=n,{splittableMarks:C}=i.extensionManager,k=x??(y.$to.parentOffset&&y.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!k||!r)return!0;const E=k.filter(T=>C.includes(T.type.name));e.ensureMarks(E)}return!0},pZ=[Zf,Jf,Qf,_1,Nf,hs,A1,Bl,O1,I1,M1,ma,Il,wi,B1,R1,T1,Jr],hZ=Lt.create({priority:200,name:`${Jr}`,content:"block*",group:`${Jr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:ra(cZ),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:Zr(10)},pageNumber:{default:1},force:{default:!1},viewSuperTextArea:{default:!0},slots:{default:this.options.slots,renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){return["div",{...yt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:dZ,splitListItem:fZ,autoPaging:(t=!0)=>({tr:e,state:n,dispatch:r,editor:i})=>(r&&e.setMeta("runState",t),!0),setPageBreak:()=>({tr:t,state:e,dispatch:n,editor:r})=>(n&&t.setMeta("splitPage",!0),!0),togglePagePlugin:t=>({tr:e,dispatch:n})=>(e.setMeta("disablePage",t),n&&n(e),!0)}},addGlobalAttributes(){return[{types:pZ.concat(this.options.types||[]),attributes:{id:{default:null},extend:{default:!1}}}]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:r})=>[()=>r.undoInputRule(),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{empty:l,$anchor:u}=s,{pos:c,parent:f}=u,p=We.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>bk(r),()=>r.joinBackward(),()=>r.selectNodeBackward(),()=>r.command(({editor:i,tr:s})=>{const{selection:a,doc:l}=s,{$anchor:u}=a,{pos:c}=u;if(l.childCount===1)return!1;if(We.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(Jr);const f=di(p=>p.type.name===Jr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(Jr);const p=f.node.firstChild.type;if(f.start+We.atStart(f.node).from===c){const g=Le.create(l,f.start-2,f.start-2),b=di(v=>v.type.name===Jr)(g);if(b){const v=We.atEnd(b.node).from+b.start,y=Le.create(l,v,v);if(p===b.node.lastChild.type){const{parent:x}=y.$anchor;return SX(x,i.schema)?s.setSelection(y):s.step(new gn(v,c,Te.empty)),!0}s.setSelection(y)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>bk(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=di(f=>f.type.name===Bl)(s);return c&&c.start+We.atStart(c.node).from===l.pos&&c.node.childCount===1&&u.content.size===0?!0:r.joinForward()}),()=>r.selectNodeForward(),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,{pos:u}=l;if(a.childCount===1)return!1;if(We.atEnd(a).from===u)return r.deleteNode(Jr);const c=di(f=>f.type.name===Jr)(s);if(c&&c.start+We.atEnd(c.node).from===u){const p=Le.create(a,u+2,u+2),m=di(g=>g.type.name===Jr)(p);if(m){const g=We.atStart(m.node).from+m.start,b=Le.create(a,g,g);if(di(y=>y.attrs.extend)(b))return i.step(new gn(u,g,Te.empty)),!0}}return!1})]),Tab:()=>this.editor.commands.first(({commands:r})=>[()=>!this.editor.isActive("table")]),"Mod-Enter":()=>this.editor.commands.setPageBreak()}},addNodeView(){return this.options.View}});function Sh(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const bk=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=t4(r,{from:n.from,to:n.to},s=>s.type.name===Bl);for(const s of i){const a=s.pos+s.node.nodeSize;if(n.from<s.pos||n.to>a)return!0}return t.deleteSelection()}),mZ=et.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),gZ=["data-font"],bZ=o.defineComponent({__name:"FontFamilyMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""},showDefaultDivider:{type:Boolean,default:!1}},setup(t){const e=t,n=o.computed(()=>e.editor.extensionStorage["base-kit"].mode===Me.EDITOR),{t:r}=At(),i=[{label:r("editor.fontFamily.gulim"),value:"Gulim"},{label:r("editor.fontFamily.dotum"),value:"Dotum"},{label:r("editor.fontFamily.gungsuh"),value:"Gungsuh"}],s=o.inject("fontFamily"),a=o.computed(()=>{const f=e.editor.extensionManager.extensions.find(m=>m.name==="fontFamily").options;let p=[];return kt.isEmpty(f.fontFamilyList)?p=i:p=f.fontFamilyList.filter(m=>m.enabled!==!1).map(m=>({label:m.label,value:m.value})),[{label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")},...p]}),l=o.computed(()=>{const f={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?(L0(e.editor.state,"textStyle").fontFamily??e.editor.getAttributes("paragraph").fontFamily??e.editor.getAttributes("heading").fontFamily)||f.value:s.value||f.value});function u(f){f.value===l.value||f.value===r("editor.fontFamily.default")?(e.editor.chain().focus().unsetFontFamily().run(),s.value=null):(s.value=f.value,e.editor.chain().focus().setFontFamily(f.value).run()),e.editor.commands.setForceCloseBubble(!0)}e.editor.on("selectionUpdate",({editor:f})=>{f.state.selection.empty&&e.editor.commands.resetForceCloseBubble()});const c=o.computed(()=>{var p,m;const f=((p=a.value[0])==null?void 0:p.label)||r("editor.fontFamily.default");return((m=a.value.find(g=>g.value===l.value))==null?void 0:m.label)||f});return(f,p)=>(o.openBlock(),o.createBlock(ka,{disabled:f.disabled,tooltip:f.tooltip,title:c.value,btn_class:`min-w-20 ${f.customClass}`,class:"inside-toolbar"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(m,g)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:g},[o.createVNode(o.unref($l),{checked:l.value===m.value,onClick:b=>u(m)},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"ml-1 h-full","data-font":m.label,style:o.normalizeStyle({fontFamily:m.value??void 0})},o.toDisplayString(m.label),13,gZ)]),_:2},1032,["checked","onClick"]),m.label===o.unref(r)("editor.fontFamily.default")&&f.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(pb),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),vk=mZ.extend({name:"fontFamily",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontFamilyList:[],button({editor:e,extension:n,t:r}){return{component:bZ,componentProps:{editor:e,disabled:!e.can().setFontFamily(""),tooltip:r("editor.fontFamily.tooltip")}}}}},addGlobalAttributes(){return[{types:["paragraph","heading","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.style.fontFamily||null,renderHTML:t=>t.style?{style:`font-family: ${t.style}`}:{}},fontFamily:{default:null,parseHTML:t=>t.style.fontFamily.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).command(({tr:n})=>(y5(n,t),!0)).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().command(({tr:e})=>(y5(e,null),!0)).run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily??this.editor.getAttributes("paragraph").fontFamily??this.editor.getAttributes("heading").fontFamily},onSelectionUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily??this.editor.getAttributes("paragraph").fontFamily??this.editor.getAttributes("heading").fontFamily}}),vZ=et.create({name:"fontWeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"]}},addGlobalAttributes(){return[{types:["paragraph","textStyle"],attributes:{fontWeight:{default:null,parseHTML:t=>t.style.fontWeight||null,renderHTML:t=>t.fontWeight?{style:`font-weight: ${t.fontWeight}`}:{}}}}]},addCommands(){return{setFontWeight:t=>({chain:e})=>e().setMark("textStyle",{fontWeight:t}).run(),unsetFontWeight:()=>({chain:t})=>t().setMark("textStyle",{fontWeight:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontWeight}}),yZ={class:"flex gap-2"},wZ=["disabled"],xZ=po(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(lg[0])||parseInt(e.value)<parseInt(lg[0]):!1),r=nt.useEventBus(hr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=va,u=ba,c=ya;return o.openBlock(),o.createElementBlock("div",yZ,[o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[0]||(a[0]=f=>i(!0))},[o.createVNode(o.unref(Ot),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(vs),null,{default:o.withCtx(()=>a[2]||(a[2]=[o.createTextVNode(" 글꼴 크기 크게 ")])),_:1})]),_:1})]),_:1}),o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[1]||(a[1]=f=>i(!1)),disabled:o.unref(n)},[o.createVNode(o.unref(Ot),{name:"Minus",class:"w-6 h-6"})],8,wZ)]),_:1}),o.createVNode(o.unref(vs),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),CZ=Un.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:xZ,componentProps:{editor:t}}}}},addAttributes(){return{size:{default:this.options.defaultSize,parseHTML:t=>t.style.fontSize||this.options.defaultSize,renderHTML:t=>t.size?{style:`font-size: ${t.size}`}:{}}}},addCommands(){return{setFontSizeIncreaseDecrease:t=>({commands:e})=>e.setMark("textStyle",{fontSize:t})}}}),Sv=et.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Ge,componentProps:{action:()=>{e.commands.setPainter(e==null?void 0:e.state.selection.$head.marks())},icon:"PaintRoller",tooltip:r("editor.format")}})}},addCommands(){return{setPainter:t=>({view:{dispatch:e,state:{tr:n},dom:r}})=>{const a=`url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M9 22v-6H4V7q0-1.65 1.175-2.825T8 3h12v13h-5v6zM6 10h12V5h-1v4h-2V5h-1v2h-2V5H8q-.825 0-1.412.588T6 7zm0 4h12v-2H6zm0 0v-2z"/></svg>')}"), auto`;return r.style.cursor=a,e(n.setMeta("painterAction",{type:"start",marks:t})),!0}}},addProseMirrorPlugins(){return[new it({key:new Et("format-painter"),state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta("painterAction");return n&&n.type==="start"?e=n.marks:n&&n.type==="end"&&(e=[]),e}},props:{handleDOMEvents:{mousedown(t,e){const n=this.getState(t.state);if(!n||n.length==0)return t.dom.style.cursor="",!1;const r=()=>{document.removeEventListener("mouseup",r);const{dispatch:i,state:{selection:s},dom:a}=t;let l=t.state.tr;a.style.cursor="",l=l.removeMark(s.from,s.to);for(const u of n)u.type.name!="link"&&(l=l.addMark(s.from,s.to,u));i(l.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}}),_v=()=>Zr(10),yk=new Et("attrkey"),EZ=t=>new it({key:yk,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=yk.getState(i);if(n.some(c=>c.getMeta("composition")))return null;if(l||n.some(c=>c.docChanged)){const c=[];i.doc.descendants((f,p,m,g)=>{const{attrs:b}=f,v=c.includes(b.id)?_v():b.id||_v();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...b,id:v,"number-line":g+1}),a=!0),c.push(v)})}return a?s:null}}),wk=[Zf,Jf,Qf,_1,Nf,hs,A1,Bl,O1,I1,M1,ma,Il,wi,B1,R1,T1,Jr],kZ=et.create({name:"autoId",addGlobalAttributes(){return[{types:wk.concat(this.options.types||[]),attributes:{id:{default:_v()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[EZ(wk.concat(this.options.types||[]))]}}),SZ=["paragraph","heading","list_item","todo_item"];function _Z(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Le||n instanceof In))return t;const{from:i,to:s}=n,a=[],l=e&&e!==sx?e:null;return r.nodesBetween(i,s,(u,c)=>{const f=u.type;return SZ.includes(f.name)?((u.attrs.lineHeight||null)!==l&&a.push({node:u,pos:c,nodeType:f}),f.name!=="list_item"&&f.name!=="todo_item"):!0}),a.length&&a.forEach(u=>{const{node:c,pos:f,nodeType:p}=u;let{attrs:m}=c;m={...m,lineHeight:l},t=t.setNodeMarkup(f,p,m,c.marks)}),t}function TZ(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:i}=e;return i=i.setSelection(r),i=_Z(i,t),i.docChanged?(n&&n(i),!0):!1}}const AZ=o.defineComponent({__name:"LineHeightDropdown",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const{t:e}=At();function n(l){return parseFloat(l.replace("%",""))/100}const r=o.computed(()=>{const c=s.editor.extensionManager.extensions.find(f=>f.name==="lineHeight").options.lineHeights.map(f=>({label:n(f),value:f}));return c.unshift({label:o.unref(e)("editor.default"),value:"default"}),c}),i=o.ref("default"),s=t;function a(l){l==="default"?s.editor.chain().focus().unsetLineHeight().run():s.editor.chain().focus().setLineHeight(l).run(),i.value=l}return(l,u)=>(o.openBlock(),o.createBlock(ka,{icon:l.icon,tooltip:l.tooltip,disabled:l.disabled,class:"inside-toolbar"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(c,f)=>(o.openBlock(),o.createBlock(o.unref($l),{key:f,checked:c.value===i.value,onClick:p=>a(c.value)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(c.label),1)]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),xk=et.create({name:"lineHeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:sx,button({editor:e,t:n}){return{component:AZ,componentProps:{editor:e,icon:"LineHeight",tooltip:n("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight||this.options.defaultHeight,renderHTML:t=>t.lineHeight===this.options.defaultHeight||!t.lineHeight?{}:{style:`line-height: ${t.lineHeight}`}}}}]},addCommands(){return{setLineHeight:t=>TZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),MZ=Lt.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",yt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var Ba=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(Ba||{});const Tv=Lt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),layout:"two-column"}},addAttributes(){return{layout:{default:"two-column"}}},addCommands(){return{setColumns:()=>({commands:t})=>(t.insertContent('<div data-type="columns"><div data-type="column" data-position="left"><p></p></div><div data-type="column" data-position="right"><p></p></div></div>'),!0),setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addExtensions(){return[MZ.configure(this.options.columnOptions)]}}),OZ={class:"flex gap-x-2 items-center"},BZ={class:"sr-only"},IZ={class:"flex justify-end gap-x-2.5 flex-1"},RZ=["disabled"],Ck=po(o.defineComponent({__name:"SuperInputDialogMoblie",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextId:{},superTextElementId:{},isViewMode:{type:Boolean},title:{}},emits:["close","save","delete"],setup(t,{emit:e}){const n=e,r=t,{t:i}=At(),s=o.ref(""),a=o.ref(!1),l=o.ref(r.isViewMode??!1),u=o.ref(!1);o.watch(()=>r.isViewMode,g=>{l.value=g,g||(s.value="")});const c=o.computed(()=>{var b;if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,((b=g==null?void 0:g.textContent)==null?void 0:b.trim())===""});o.watch(()=>r.open,()=>{r.open&&r.superTextInit&&(s.value=r.superTextInit)},{immediate:!0});const f=()=>{n("close"),a.value=!1,l.value=!0,u.value=!1},p=()=>{n("save",s.value),s.value="",l.value=!0,u.value=!1},m=()=>{u.value=!0,l.value=!1};return(g,b)=>{const v=ph,y=fh,x=dh,C=ch,k=iv,E=Fc,T=Vc;return o.openBlock(),o.createBlock(T,{open:g.open},{default:o.withCtx(()=>[o.createVNode(E,{"is-overlay-transparent":"",class:"p-2.5 gap-0 gap-y-2.5 border-none w-[calc(100%-40px)] !shadow-ed rounded-[5px]"},{default:o.withCtx(()=>[o.createVNode(x,{class:"text-left flex-row justify-between"},{default:o.withCtx(()=>[o.createVNode(v,{class:"text-base font-normal"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(g.title?g.title:o.unref(i)("editor.superinput")),1)]),_:1}),o.createElementVNode("div",OZ,[o.withDirectives(o.createElementVNode("button",{onClick:m},[o.createVNode(o.unref(G1),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(y,{class:"outline-none",onClick:f},{default:o.withCtx(()=>[o.createVNode(o.unref(Sc),{class:"w-5 h-5"}),o.createElementVNode("span",BZ,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(C,{class:"hidden"}),o.createVNode(Ev,{modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=_=>s.value=_),"is-read-only":l.value,"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["modelValue","is-read-only","parent-editor"]),o.createVNode(k,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:b[1]||(b[1]=_=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",IZ,[o.createElementVNode("button",{onClick:f},o.toDisplayString(o.unref(i)("editor.menubar.menu.cancel")),1),o.createElementVNode("button",{disabled:o.unref(c),class:o.normalizeClass({"cursor-not-allowed":o.unref(c)}),onClick:p},o.toDisplayString(o.unref(i)("editor.menubar.menu.save")),11,RZ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-c6e8813c"]]),LZ=["innerHTML"],DZ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],PZ=o.defineComponent({__name:"ConfigPlan",props:na,setup(t){const e=t,n=o.ref(!1),r=o.ref(null),{selection:i,doc:s}=e.editor.state,a=o.inject("isMobile"),l=o.ref(!1),u=nt.useEventBus(hr.RENDER_SUPER_TEXT),c=o.computed(()=>{var T,_;const x=s.resolve(i.from),C=x==null?void 0:x.node(-1),k=(T=C==null?void 0:C.attrs)==null?void 0:T.id,E=(_=C==null?void 0:C.attrs)==null?void 0:_.pageNumber;return{pageId:k,pageNumber:E}}),f=o.computed(()=>{const x=e.getPos(),C=e.editor.state.doc.resolve(x);for(let k=C.depth;k>0;k--){const E=C.node(k);if(E.type.name==="paragraph")return E}return null}),p=o.computed(()=>{var x;return((x=f.value)==null?void 0:x.attrs.id)||""});function m(x){e.updateAttributes({"data-text":x}),n.value=!1}function g(x){const C=e.node.attrs[rt.TEXT],k=e.node.attrs[rt.ID],T={lineId:x.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:C};u.emit({action:"hover",payload:T})}function b(x){const C=e.node.attrs[rt.ID],E={lineId:x.target.querySelector(`[node-id="${C}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:E})}function v(){const{getPos:x,node:C,editor:k}=e,E=x(),T=E+1;k.commands.deleteRange({from:E,to:T})}function y(){n.value=!0,a&&(l.value=!0)}return(x,C)=>{const k=vn,E=ov,T=rv,_=nv,A=tv,P=qc;return o.openBlock(),o.createBlock(o.unref(ta),{as:"span",class:o.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":o.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:o.withCtx(()=>[o.createVNode(A,null,{default:o.withCtx(()=>[o.createVNode(E,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(k,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:y,onMouseenter:g,onMouseleave:b},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{name:"plan",class:o.normalizeClass({"w-[18px] h-auto pr-1":o.unref(a)})},null,8,["class"]),C[3]||(C[3]=o.createTextVNode(" [")),o.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[o.unref(rt).TEXT]},null,8,LZ),C[4]||(C[4]=o.createTextVNode("] ")),o.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[o.unref(rt).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(rt).TEXT],"node-id":e.node.attrs[o.unref(rt).ID],"line-id":p.value},null,8,DZ)]),_:1})]),_:1}),o.createVNode(_,null,{default:o.withCtx(()=>[o.createVNode(T,{onSelect:C[0]||(C[0]=O=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.edit")),1)]),_:1}),o.createVNode(T,{onSelect:v},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(Ck,{key:1,title:x.$t("editor.configPlan"),open:n.value,"is-view-mode":l.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(rt).TEXT],"super-text-id":e.node.attrs[o.unref(rt).ID],onClose:C[2]||(C[2]=O=>n.value=!1),onSave:m,onDelete:v},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(o.openBlock(),o.createBlock(P,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(rt).TEXT],"super-text-element-id":e.node.attrs[o.unref(rt).ELEMENT_ID],onClose:C[1]||(C[1]=O=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),Ek=Lt.create({name:"configPlan",inline:!0,group:"inline",atom:!0,draggable:!0,addStorage(){return{isShowConfigPlanInput:!1}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>[...n?[{component:Ge,componentProps:{action:()=>{t.commands.toggleConfigPlanInput()},isActive:()=>{},icon:"plan",title:e("editor.insertConfigPlan"),tooltip:e("editor.insertConfigPlan"),customClass:"whitespace-nowrap !bg-ed-blue !text-white !font-normal rounded-[3px] h-[26px] gap-x-1 ml-auto",customClassTooltip:"ml-auto"}}]:[]]}},addAttributes(){return{"data-id":{default:null},"data-text":{default:""},"data-position":{default:"0"}}},addCommands(){return{toggleConfigPlanInput:()=>({editor:t})=>t.storage.configPlan.isShowConfigPlanInput=!t.storage.configPlan.isShowConfigPlanInput}},parseHTML(){return[{tag:"button.config-plan"}]},renderHTML({HTMLAttributes:t}){return["button",yt(t,{class:"config-plan"})]},addNodeView(){return ra(PZ)},addProseMirrorPlugins(){return[new it({appendTransaction(t,e,n){let r=n.tr,i=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="configPlan"){const l=s.attrs["data-position"],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,"data-position":u}),i=!0)}}),i?r:null}})]}});var Av,Mv;if(typeof WeakMap<"u"){let t=new WeakMap;Av=e=>t.get(e),Mv=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Av=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Mv=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var cn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,a=i+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;a<this.height&&this.map[e+this.width*l]==n;l++)a++;return{left:r,top:i,right:s,bottom:a}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:a,right:l,top:u,bottom:c}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(i,u),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,a=this.map[s];n[a]||(n[a]=!0,!(i==t.left&&i&&this.map[s-1]==a||r==t.top&&r&&this.map[s-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const l=(t+1)*this.width;for(;a<l&&this.map[a]<i;)a++;return a==l?s-1:this.map[a]}i=s}}static get(t){return Av(t)||Mv(t,VZ(t))}};function VZ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=FZ(t),n=t.childCount,r=[];let i=0,s=null;const a=[];for(let c=0,f=e*n;c<f;c++)r[c]=0;for(let c=0,f=0;c<n;c++){const p=t.child(c);f++;for(let b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==p.childCount)break;const v=p.child(b),{colspan:y,rowspan:x,colwidth:C}=v.attrs;for(let k=0;k<x;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:x-k});break}const E=i+k*e;for(let T=0;T<y;T++){r[E+T]==0?r[E+T]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:y-T});const _=C&&C[T];if(_){const A=(E+T)%e*2,P=a[A];P==null||P!=_&&a[A+1]==1?(a[A]=_,a[A+1]=1):P==_&&a[A+1]++}}}i+=y,f+=v.nodeSize}const m=(c+1)*e;let g=0;for(;i<m;)r[i++]==0&&g++;g&&(s||(s=[])).push({type:"missing",row:c,n:g}),f++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new cn(e,n,r,s);let u=!1;for(let c=0;!u&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(u=!0);return u&&$Z(l,a,t),l}function FZ(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let a=0;a<r;a++){const l=t.child(a);for(let u=0;u<l.childCount;u++){const c=l.child(u);a+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let a=0;a<i.childCount;a++){const l=i.child(a);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function $Z(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let l=null;const u=a.attrs;for(let c=0;c<u.colspan;c++){const f=(i+c)%t.width,p=e[f*2];p!=null&&(!u.colwidth||u.colwidth[c]!=p)&&((l||(l=HZ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function HZ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Gn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var Ms=new Et("selectingCells");function Kl(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function zZ(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function _o(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function _h(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Kl(e.$head)||UZ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function UZ(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Ov(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function WZ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Bv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function kk(t,e,n){const r=t.node(-1),i=cn.get(r),s=t.start(-1),a=i.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function Ia(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Sk(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function jZ(t,e,n){const r=Gn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var jt=class Fi extends We{constructor(e,n=e){const r=e.node(-1),i=cn.get(r),s=e.start(-1),a=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=i.cellsInRect(a).filter(f=>f!=n.pos-s);u.unshift(n.pos-s);const c=u.map(f=>{const p=r.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=s+f+1;return new s3(l.resolve(m),l.resolve(m+p.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Ov(r)&&Ov(i)&&Bv(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Fi.rowSelection(r,i):s&&this.isColSelection()?Fi.colSelection(r,i):new Fi(r,i)}return Le.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=cn.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let u=i.top;u<i.bottom;u++){const c=[];for(let f=u*n.width+i.left,p=i.left;p<i.right;p++,f++){const m=n.map[f];if(s[m])continue;s[m]=!0;const g=n.findCell(m);let b=e.nodeAt(m);if(!b)throw RangeError(`No cell with offset ${m} found`);const v=i.left-g.left,y=g.right-i.right;if(v>0||y>0){let x=b.attrs;if(v>0&&(x=Ia(x,0,v)),y>0&&(x=Ia(x,x.colspan-y,y)),g.left<i.left){if(b=b.type.createAndFill(x),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else b=b.type.create(x,b.content)}if(g.top<i.top||g.bottom>i.bottom){const x={...b.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?b=b.type.createAndFill(x):b=b.type.create(x,b.content)}c.push(b)}a.push(e.child(u).copy(be.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new Te(be.from(l),1,1)}replace(e,n=Te.empty){const r=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){const{$from:l,$to:u}=i[a],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(u.pos),a?Te.empty:n)}const s=We.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Te(be.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=cn.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let a=0;a<s.length;a++)e(n.nodeAt(s[a]),i+s[a])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=cn.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.top<=l.top?(a.top>0&&(e=u.resolve(s+i.map[a.left])),l.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+i.map[l.left])),a.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))),new Fi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=cn.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const a=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,l)==n.width}eq(e){return e instanceof Fi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=cn.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.left<=l.left?(a.left>0&&(e=u.resolve(s+i.map[a.top*i.width])),l.right<i.width&&(n=u.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+i.map[l.top*i.width])),a.right<i.width&&(e=u.resolve(s+i.map[i.width*(a.top+1)-1]))),new Fi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Fi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Fi(e.resolve(n),e.resolve(r))}getBookmark(){return new qZ(this.$anchorCell.pos,this.$headCell.pos)}};jt.prototype.visible=!1,We.jsonID("cell",jt);var qZ=class eT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new eT(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Bv(n,r)?new jt(n,r):We.near(r,1)}};function KZ(t){if(!(t.selection instanceof jt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Kt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ut.create(t.doc,e)}function GZ({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function XZ({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function YZ(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof Pe&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=jt.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=jt.rowSelection(l,l)}else if(!n){const l=cn.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=jt.create(i,u+1,c)}}else r instanceof Le&&GZ(r)?s=Le.create(i,r.from):r instanceof Le&&XZ(r)&&(s=Le.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var JZ=new Et("fix-tables");function _k(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let a=0,l=0;a<s;a++){const u=e.child(a);for(let c=l,f=Math.min(i,a+3);c<f;c++)if(t.child(c)==u){l=c+1,n+=u.nodeSize;continue e}r(u,n),l<i&&t.child(l).sameMarkup(u)?_k(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function Tk(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=ZZ(t,i,s,n))};return e?e.doc!=t.doc&&_k(e.doc,t.doc,0,r):t.doc.descendants(r),n}function ZZ(t,e,n,r){const i=cn.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const c=i.problems[u];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const p=f.attrs;for(let m=0;m<p.rowspan;m++)s[c.row+m]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ia(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const f=r.mapping.map(n);r.delete(f,f+e.nodeSize)}}let a,l;for(let u=0;u<s.length;u++)s[u]&&(a==null&&(a=u),l=u);for(let u=0,c=n+1;u<i.height;u++){const f=e.child(u),p=c+f.nodeSize,m=s[u];if(m>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const b=[];for(let y=0;y<m;y++){const x=Gn(t.schema)[g].createAndFill();x&&b.push(x)}const v=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(v),b)}c=p}return r.setMeta(JZ,{fixTables:!0})}function No(t){const e=t.selection,n=_h(t),r=n.node(-1),i=n.start(-1),s=cn.get(r);return{...e instanceof jt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function Ak(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;jZ(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let a=0;a<e.height;a++){const l=a*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],c=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,Sk(c.attrs,i-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?Gn(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(a,i,r);t.insert(t.mapping.map(n+c),u.createAndFill())}}return t}function QZ(t,e){if(!_o(t))return!1;if(e){const n=No(t);e(Ak(t.tr,n,n.left))}return!0}function NZ(t,e){if(!_o(t))return!1;if(e){const n=No(t);e(Ak(t.tr,n,n.right))}return!0}function eQ(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const l=a*e.width+i,u=e.map[l],c=n.nodeAt(u),f=c.attrs;if(i>0&&e.map[l-1]==u||i<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Ia(f,i-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=f.rowspan}}function tQ(t,e){if(!_o(t))return!1;if(e){const n=No(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;eQ(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=cn.get(s)}e(r)}return!0}function nQ(t,e,n){var r;const i=Gn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))==null?void 0:r.type)!=i)return!1;return!0}function Mk(t,{map:e,tableStart:n,table:r},i){var s;let a=n;for(let c=0;c<i;c++)a+=r.child(c).nodeSize;const l=[];let u=i>0?-1:0;nQ(e,r,i+u)&&(u=i==0||i==e.height?null:0);for(let c=0,f=e.width*i;c<e.width;c++,f++)if(i>0&&i<e.height&&e.map[f]==e.map[f-e.width]){const p=e.map[f],m=r.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...m,rowspan:m.rowspan+1}),c+=m.colspan-1}else{const p=u==null?Gn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,m=p==null?void 0:p.createAndFill();m&&l.push(m)}return t.insert(a,Gn(r.type.schema).row.create(null,l)),t}function rQ(t,e){if(!_o(t))return!1;if(e){const n=No(t);e(Mk(t.tr,n,n.top))}return!0}function oQ(t,e){if(!_o(t))return!1;if(e){const n=No(t);e(Mk(t.tr,n,n.bottom))}return!0}function iQ(t,{map:e,table:n,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const a=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,a+r);const u=new Set;for(let c=0,f=i*e.width;c<e.width;c++,f++){const p=e.map[f];if(!u.has(p)){if(u.add(p),i>0&&p==e.map[f-e.width]){const m=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m,rowspan:m.rowspan-1}),c+=m.colspan-1}else if(i<e.height&&p==e.map[f+e.width]){const m=n.nodeAt(p),g=m.attrs,b=m.type.create({...g,rowspan:m.attrs.rowspan-1},m.content),v=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+v),b),c+=g.colspan-1}}}}function sQ(t,e){if(!_o(t))return!1;if(e){const n=No(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;iQ(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=cn.get(n.table)}e(r)}return!0}function Ok(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function aQ({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,a=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[a]==n[a+t])return!0;i++,a++}return!1}function Bk(t,e){const n=t.selection;if(!(n instanceof jt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=No(t),{map:i}=r;if(aQ(i,r))return!1;if(e){const s=t.tr,a={};let l=be.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const m=i.map[f*i.width+p],g=r.table.nodeAt(m);if(!(a[m]||!g))if(a[m]=!0,u==null)u=m,c=g;else{Ok(g)||(l=l.append(g.content));const b=s.mapping.map(m+r.tableStart);s.delete(b,b+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...Sk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=u+1+c.content.size,p=Ok(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new jt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function Ik(t,e){const n=Gn(t.schema);return lQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function lQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof jt){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=zZ(i.$from),!s)return!1;a=(r=Kl(i.$from))==null?void 0:r.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const u=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=No(e),p=e.tr;for(let g=0;g<f.right-f.left;g++)u.push(c?{...l,colwidth:c&&c[g]?[c[g]]:null}:l);let m;for(let g=f.top;g<f.bottom;g++){let b=f.map.positionAt(g,f.left,f.table);g==f.top&&(b+=s.nodeSize);for(let v=f.left,y=0;v<f.right;v++,y++)v==f.left&&g==f.top||p.insert(m=p.mapping.map(b+f.tableStart,1),t({node:s,row:g,col:v}).createAndFill(u[y]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),i instanceof jt&&p.setSelection(new jt(p.doc.resolve(i.$anchorCell.pos),m?p.doc.resolve(m):void 0)),n(p)}return!0}}function uQ(t,e){return function(n,r){if(!_o(n))return!1;const i=_h(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof jt?n.selection.forEachCell((a,l)=>{a.attrs[t]!==e&&s.setNodeMarkup(l,null,{...a.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function cQ(t){return function(e,n){if(!_o(e))return!1;if(n){const r=Gn(e.schema),i=No(e),s=e.tr,a=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=a.map(u=>i.table.nodeAt(u));for(let u=0;u<a.length;u++)l[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+a[u],r.cell,l[u].attrs);if(s.steps.length==0)for(let u=0;u<a.length;u++)s.setNodeMarkup(i.tableStart+a[u],r.header_cell,l[u].attrs);n(s)}return!0}}function Rk(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function Kc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?cQ(t):function(n,r){if(!_o(n))return!1;if(r){const i=Gn(n.schema),s=No(n),a=n.tr,l=Rk("row",s,i),u=Rk("column",s,i),f=(t==="column"?l:t==="row"?u:!1)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const b=g+s.tableStart,v=a.doc.nodeAt(b);v&&a.setNodeMarkup(b,m,v.attrs)}),r(a)}return!0}}Kc("row",{useDeprecatedLogic:!0}),Kc("column",{useDeprecatedLogic:!0});var dQ=Kc("cell",{useDeprecatedLogic:!0});function fQ(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),a=s.lastChild;if(a)return i-1-a.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Lk(t){return function(e,n){if(!_o(e))return!1;const r=fQ(_h(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Le.between(i,WZ(i))).scrollIntoView())}return!0}}function pQ(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Th(t,e){const n=t.selection;if(!(n instanceof jt))return!1;if(e){const r=t.tr,i=Gn(t.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(i)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new Te(i,0,0))}),r.docChanged&&e(r)}return!0}function hQ(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,a=i.type.schema,l=[];if(s=="row")for(let u=0;u<e.childCount;u++){let c=e.child(u).content;const f=u?0:Math.max(0,n-1),p=u<e.childCount-1?0:Math.max(0,r-1);(f||p)&&(c=Iv(Gn(a).row,new Te(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Iv(Gn(a).row,new Te(e,n,r)).content:e);else return null;return mQ(a,l)}function mQ(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let a=s.childCount-1;a>=0;a--){const{rowspan:l,colspan:u}=s.child(a).attrs;for(let c=i;c<i+l;c++)n[c]=(n[c]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(be.empty),n[i]<r){const s=Gn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(be.from(a))}return{height:e.length,width:r,rows:e}}function Iv(t,e){const n=t.createAndFill();return new Km(n).replace(0,n.content.size,e).doc}function gQ({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],a=[];for(let l=0;l<n.length;l++){const u=n[l],c=[];for(let f=s[l]||0,p=0;f<r;p++){let m=u.child(p%u.childCount);f+m.attrs.colspan>r&&(m=m.type.createChecked(Ia(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),c.push(m),f+=m.attrs.colspan;for(let g=1;g<m.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+m.attrs.colspan}a.push(be.from(c))}n=a,t=r}if(e!=i){const s=[];for(let a=0,l=0;a<i;a++,l++){const u=[],c=n[l%e];for(let f=0;f<c.childCount;f++){let p=c.child(f);a+p.attrs.rowspan>i&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,i-p.attrs.rowspan)},p.content)),u.push(p)}s.push(be.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function bQ(t,e,n,r,i,s,a){const l=t.doc.type.schema,u=Gn(l);let c,f;if(i>e.width)for(let p=0,m=0;p<e.height;p++){const g=n.child(p);m+=g.nodeSize;const b=[];let v;g.lastChild==null||g.lastChild.type==u.cell?v=c||(c=u.cell.createAndFill()):v=f||(f=u.header_cell.createAndFill());for(let y=e.width;y<i;y++)b.push(v);t.insert(t.mapping.slice(a).map(m-1+r),b)}if(s>e.height){const p=[];for(let b=0,v=(e.height-1)*e.width;b<Math.max(e.width,i);b++){const y=b>=e.width?!1:n.nodeAt(e.map[v+b]).type==u.header_cell;p.push(y?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const m=u.row.create(null,be.from(p)),g=[];for(let b=e.height;b<s;b++)g.push(m);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function Dk(t,e,n,r,i,s,a,l){if(a==0||a==e.height)return!1;let u=!1;for(let c=i;c<s;c++){const f=a*e.width+c,p=e.map[f];if(e.map[f-e.width]==p){u=!0;const m=n.nodeAt(p),{top:g,left:b}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m.attrs,rowspan:a-g}),t.insert(t.mapping.slice(l).map(e.positionAt(a,b,n)),m.type.createAndFill({...m.attrs,rowspan:g+m.attrs.rowspan-a})),c+=m.attrs.colspan-1}}return u}function Pk(t,e,n,r,i,s,a,l){if(a==0||a==e.width)return!1;let u=!1;for(let c=i;c<s;c++){const f=c*e.width+a,p=e.map[f];if(e.map[f-1]==p){u=!0;const m=n.nodeAt(p),g=e.colCount(p),b=t.mapping.slice(l).map(p+r);t.setNodeMarkup(b,null,Ia(m.attrs,a-g,m.attrs.colspan-(a-g))),t.insert(b+m.nodeSize,m.type.createAndFill(Ia(m.attrs,0,a-g))),c+=m.attrs.rowspan-1}}return u}function Vk(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let a=cn.get(s);const{top:l,left:u}=r,c=u+i.width,f=l+i.height,p=t.tr;let m=0;function g(){if(s=n?p.doc.nodeAt(n-1):p.doc,!s)throw new Error("No table found");a=cn.get(s),m=p.mapping.maps.length}bQ(p,a,s,n,c,f,m)&&g(),Dk(p,a,s,n,u,c,l,m)&&g(),Dk(p,a,s,n,u,c,f,m)&&g(),Pk(p,a,s,n,l,f,u,m)&&g(),Pk(p,a,s,n,l,f,c,m)&&g();for(let b=l;b<f;b++){const v=a.positionAt(b,u,s),y=a.positionAt(b,c,s);p.replace(p.mapping.slice(m).map(v+n),p.mapping.slice(m).map(y+n),new Te(i.rows[b-l],0,0))}g(),p.setSelection(new jt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var vQ=E0({ArrowLeft:Mh("horiz",-1),ArrowRight:Mh("horiz",1),ArrowUp:Mh("vert",-1),ArrowDown:Mh("vert",1),"Shift-ArrowLeft":Oh("horiz",-1),"Shift-ArrowRight":Oh("horiz",1),"Shift-ArrowUp":Oh("vert",-1),"Shift-ArrowDown":Oh("vert",1),Backspace:Th,"Mod-Backspace":Th,Delete:Th,"Mod-Delete":Th});function Ah(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Mh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof jt)return Ah(n,r,We.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=Fk(i,t,e);if(a==null)return!1;if(t=="horiz")return Ah(n,r,We.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=kk(l,t,e);let c;return u?c=We.near(u,1):e<0?c=We.near(n.doc.resolve(l.before(-1)),-1):c=We.near(n.doc.resolve(l.after(-1)),1),Ah(n,r,c)}}}function Oh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof jt)a=s;else{const u=Fk(i,t,e);if(u==null)return!1;a=new jt(n.doc.resolve(u))}const l=kk(a.$headCell,t,e);return l?Ah(n,r,new jt(a.$anchorCell,l)):!1}}function yQ(t,e){const n=t.state.doc,r=Kl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new jt(r))),!0):!1}function wQ(t,e,n){if(!_o(t.state))return!1;let r=hQ(n);const i=t.state.selection;if(i instanceof jt){r||(r={width:1,height:1,rows:[be.from(Iv(Gn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=cn.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=gQ(r,l.right-l.left,l.bottom-l.top),Vk(t.state,t.dispatch,a,l,r),!0}else if(r){const s=_h(t.state),a=s.start(-1);return Vk(t.state,t.dispatch,a,cn.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function xQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=$k(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof jt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Kl(t.state.selection.$anchor))!=null&&((n=Rv(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let f=Rv(t,c);const p=Ms.getState(t.state)==null;if(!f||!Bv(u,f))if(p)f=u;else return;const m=new jt(u,f);if(p||!t.state.selection.eq(m)){const g=t.state.tr.setSelection(m);p&&g.setMeta(Ms,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),Ms.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ms,-1))}function l(u){const c=u,f=Ms.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if($k(t,c.target)!=r&&(p=Rv(t,e),!p))return a();p&&s(p,c)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",l)}function Fk(t,e,n){if(!(t.state.selection instanceof Le))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?l:null}}return null}function $k(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Rv(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Kl(t.state.doc.resolve(n.pos)):null}var CQ=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Lv(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Lv(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Lv(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f){for(let p=0,m=0;p<f.childCount;p++){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let v=0;v<g;v++,m++){const y=i==m?s:b&&b[v],x=y?y+"px":"";if(l+=y||r,y||(u=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const C=document.createElement("col");C.style.width=x,e.appendChild(C)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)==null||a.removeChild(c),c=p}u?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var Br=new Et("tableColumnResizing");function EQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=CQ,lastColumnResizable:i=!0}={}){const s=new it({key:Br,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=Gn(l.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new kQ(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Br.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{SQ(a,l,t,i)},mouseleave:a=>{_Q(a)},mousedown:(a,l)=>{TQ(a,l,e,n)}},decorations:a=>{const l=Br.getState(a);if(l&&l.activeHandle>-1)return IQ(a,l.activeHandle)},nodeViews:{}}});return s}var kQ=class Mm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Br);if(r&&r.setHandle!=null)return new Mm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Mm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Ov(e.doc.resolve(i))||(i=-1),new Mm(i,n.dragging)}return n}};function SQ(t,e,n,r){if(!t.editable)return;const i=Br.getState(t.state);if(i&&!i.dragging){const s=MQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=Hk(t,e,"left",n):u-e.clientX<=n&&(a=Hk(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=cn.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Uk(t,a)}}}function _Q(t){if(!t.editable)return;const e=Br.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Uk(t,-1)}function TQ(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!=null?i:window,a=Br.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=AQ(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Br,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=Br.getState(t.state);m!=null&&m.dragging&&(OQ(t,m.activeHandle,zk(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Br,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=Br.getState(t.state);if(m&&m.dragging){const g=zk(m.dragging,p,n);Wk(t,m.activeHandle,g,r)}}return Wk(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function AQ(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],u--);return l/u}function MQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Hk(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:a}=s,l=Kl(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=cn.get(l.node(-1)),c=l.start(-1),f=u.map.indexOf(l.pos-c);return f%u.width==0?-1:c+u.map[f-1]}function zk(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Uk(t,e){t.dispatch(t.state.tr.setMeta(Br,{setHandle:e}))}function OQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=cn.get(i),a=r.start(-1),l=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let c=0;c<s.height;c++){const f=c*s.width+l;if(c&&s.map[f]==s.map[f-s.width])continue;const p=s.map[f],m=i.nodeAt(p).attrs,g=m.colspan==1?0:l-s.colCount(p);if(m.colwidth&&m.colwidth[g]==n)continue;const b=m.colwidth?m.colwidth.slice():BQ(m.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...m,colwidth:b})}u.docChanged&&t.dispatch(u)}function Wk(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=cn.get(s).colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&Lv(s,u.firstChild,u,r,l,n)}function BQ(t){return Array(t).fill(0)}function IQ(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return ut.empty;const a=cn.get(s),l=i.start(-1),u=a.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<a.height;c++){const f=u+c*a.width;if((u==a.width-1||a.map[f]!=a.map[f+1])&&(c==0||a.map[f]!=a.map[f-a.width])){const p=a.map[f],m=l+p+s.nodeAt(p).nodeSize-1,g=document.createElement("div");g.className="column-resize-handle",(n=Br.getState(t))!=null&&n.dragging&&r.push(Kt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(Kt.widget(m,g))}}return ut.create(t.doc,r)}function RQ({allowTableNodeSelection:t=!1}={}){return new it({key:Ms,state:{init(){return null},apply(e,n){const r=e.getMeta(Ms);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:KZ,handleDOMEvents:{mousedown:xQ},createSelectionBetween(e){return Ms.getState(e.state)!=null?e.state.selection:null},handleTripleClick:yQ,handleKeyDown:vQ,handlePaste:wQ},appendTransaction(e,n,r){return YZ(r,Tk(r,n),t)}})}const LQ=(t,e,n)=>{if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r||n===r.attrs.backgroundColor)return t;const i={...r.attrs,backgroundColor:n};return t.setNodeMarkup(e,r.type,i,r.marks)},DQ=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof jt)||i.forEachCell((s,a)=>{t=LQ(t,a,n)}),t},jk=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=DQ(n,e,t),n.docChanged?(i==null||i(n),!0):!1},PQ=et.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>jk(t,this.options),unsetTableCellBackground:()=>jk("",this.options)}}}),VQ=Lt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",yt(this.options.HTMLAttributes,t),0]}}),FQ=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}}),$Q=Lt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",yt(this.options.HTMLAttributes,t),0]}});function Dv(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function qk(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f!==null)for(let p=0,m=0;p<f.childCount;p+=1){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let v=0;v<g;v+=1,m+=1){const y=i===m?s:b&&b[v],x=y?`${y}px`:"";if(l+=y||r,y||(u=!1),c){if(c.style.width!==x){const[C,k]=Dv(r,y);c.style.setProperty(C,k)}c=c.nextSibling}else{const C=document.createElement("col"),[k,E]=Dv(r,y);C.style.setProperty(k,E),e.appendChild(C)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)===null||a===void 0||a.removeChild(c),c=p}u?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class HQ{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),qk(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,qk(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function zQ(t,e,n,r){let i=0,s=!0;const a=[],l=t.firstChild;if(!l)return{};for(let p=0,m=0;p<l.childCount;p+=1){const{colspan:g,colwidth:b}=l.child(p).attrs;for(let v=0;v<g;v+=1,m+=1){const y=n===m?r:b&&b[v];i+=y||e,y||(s=!1);const[x,C]=Dv(e,y);a.push(["col",{style:`${x}: ${C}`}])}}const u=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function Kk(t,e){return t.createAndFill()}function UQ(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function WQ(t,e,n,r,i){const s=UQ(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=Kk(s.cell);if(f&&l.push(f),r){const p=Kk(s.header_cell);p&&a.push(p)}}const u=[];for(let c=0;c<e;c+=1)u.push(s.row.createChecked(null,r&&c===0?a:l));return s.table.createChecked(null,u)}function jQ(t){return t instanceof jt}const Bh=({editor:t})=>{const{selection:e}=t.state;if(!jQ(e))return!1;let n=0;const r=n4(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},qQ=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:HQ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=zQ(t,this.options.cellMinWidth);return["table",yt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const a=WQ(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Le.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>QZ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>NZ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>tQ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>rQ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>oQ(t,e),deleteRow:()=>({state:t,dispatch:e})=>sQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>pQ(t,e),mergeCells:()=>({state:t,dispatch:e})=>Bk(t,e),splitCell:()=>({state:t,dispatch:e})=>Ik(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Kc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Kc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>dQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Bk(t,e)?!0:Ik(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>uQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Lk(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Lk(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Tk(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=jt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Bh,"Mod-Backspace":Bh,Delete:Bh,"Mod-Delete":Bh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[EQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],RQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt($e(t,"tableRole",e))}}}),KQ=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,GQ=/CrOS/,XQ=/android|ipad|playbook|silk/i;function Gk(t={}){let e=t.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(KQ.test(e)&&!GQ.test(e)||t.tablet&&XQ.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const YQ=["disabled"],JQ={"content-class":"table-grid-size-editor","content-style":"padding:0"},ZQ={class:"flex flex-col flex-wrap gap-1 justify-between"},QQ=["onMouseover","onMousedown"],NQ={class:"text-center text-sm text-zinc-600 mt-2"},eN=o.defineComponent({__name:"CreateTablePopover",props:{disabled:{type:Boolean,default:!1}},emits:["create-table"],setup(t,{emit:e}){const n=e,r=o.ref(!1),i=o.ref(!0),s=o.reactive({rows:Gk()?lf:af,cols:Gk()?lf:af}),a=o.reactive({rows:uf,cols:uf});function l(g,b){g===s.rows&&(s.rows=Math.min(g+1,lf)),b===s.cols&&(s.cols=Math.min(b+1,lf)),a.rows=g,a.cols=b}function u(g,b){n("create-table",{rows:g,cols:b,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=af,s.cols=af,a.rows=uf,a.cols=uf}const f=o.inject("isMobile",!1),{isOpen:p}=xp({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),m=o.computed(()=>f?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,b)=>(o.openBlock(),o.createBlock(o.unref(ms),o.normalizeProps(o.guardReactiveProps(o.unref(m))),{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,YQ)]),_:3}),o.createVNode(o.unref(gs),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",JQ,[o.createElementVNode("div",ZQ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,v=>(o.openBlock(),o.createElementBlock("div",{key:"r"+v,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,y=>(o.openBlock(),o.createElementBlock("div",{key:"c"+y,class:o.normalizeClass([[y<=a.cols&&v<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:x=>l(v,y),onMousedown:x=>u(v,y)},b[0]||(b[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,QQ))),128))]))),128))]),o.createElementVNode("div",NQ,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),tN={style:{display:"flex"}},nN=o.defineComponent({__name:"TableActionButton",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t;function n(r){e.editor.isActive("table")||e.editor.chain().focus().insertTable({...r,withHeaderRow:!1}).run()}return(r,i)=>(o.openBlock(),o.createBlock(eN,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",tN,[o.createVNode(Ge,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled,color:r.color,action:r.action,"is-active":r.isActive},null,8,["icon","tooltip","disabled","color","action","is-active"])])]),_:1},8,["disabled"]))}}),Pv=qQ.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toggleTableEditor:e=>({editor:n})=>n.storage.table?(n.storage.table.isTableEditorOpen=e,!0):!1}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({component:nN,componentProps:{icon:"Table",tooltip:n("editor.table.tooltip"),action:()=>{var i;const r=((i=e.storage.table)==null?void 0:i.isTableEditorOpen)??!1;e.commands.toggleTableEditor(!r)}}})}},addExtensions(){return[FQ.configure(this.options.tableRow),VQ.configure(this.options.tableHeader),$Q.configure(this.options.tableCell),PQ.configure(this.options.tableCellBackground)]}}),rN={class:"flex items-center gap-2 px-2"},oN=o.defineComponent({__name:"TextDropdown",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""}},setup(t){const e=t,{t:n}=At(),r=o.computed(()=>[{name:"paragraph",label:n("editor.paragraph.tooltip"),iconName:"Paragraph",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:n("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:n("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:n("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:n("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:n("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:n("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:n("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()},{name:"codeBlock",label:n("editor.codeblock.tooltip"),isActive:()=>e.editor.isActive("codeBlock"),iconName:"Code2",action:()=>e.editor.chain().focus().clearNodes().toggleCodeBlock().run()}]),i=o.computed(()=>r.value.filter(s=>s.isActive()).pop()??{label:n("editor.modify")});return(s,a)=>{var l;return o.openBlock(),o.createBlock(ka,{title:(l=i.value)==null?void 0:l.label,"side-offset":5},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(u,c)=>{var f;return o.openBlock(),o.createBlock(o.unref($l),{key:c,class:"cursor-pointer",checked:((f=u.isActive)==null?void 0:f.call(u))||!1,onClick:u.action},{default:o.withCtx(()=>[o.createElementVNode("div",rN,[o.createVNode(o.unref(Ot),{name:u.iconName,class:"h3 w-3"},null,8,["name"]),o.createElementVNode("span",null,o.toDisplayString(u.label),1)])]),_:2},1032,["checked","onClick"])}),128))]),_:1},8,["title"])}}}),iN=et.create({name:"text-bubble",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:()=>({component:oN,componentProps:{}})}}}),sN=[{label:"복합 표현 - 요일과 시간대",examples:["다음 월요일 저녁","이번 토요일 오전"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"시각 표현",examples:["오전 10시","오후 3시 30분","정오","자정","새벽 2시"],pattern:"((오전|오후|새벽|밤|저녁)\\s?\\d{1,2}(시(\\s?\\d{1,2}분)?)?|정오|자정)"},{label:"시간 표현 - 이른/늦은",examples:["이른 아침","늦은 밤"],pattern:"(이른\\s아침|늦은\\s밤)"},{label:"연도+월",examples:["2019년 6월","2025년12월","2024년 01월"],pattern:"\\d{4}년\\s?\\d{1,2}월"},{label:"오늘/내일/어제",examples:["오늘","내일","모레","어제","그제","그끄제"],pattern:"(오늘|내일|모레|어제|그제|그끄제)"},{label:"상대적 주 단위",examples:["이번 주","다음 주","지난 주"],pattern:"(이번|다음|지난)\\s?주"},{label:"상대적 월 단위",examples:["이번 달","다음 달","지난 달"],pattern:"(이번|다음|지난)\\s?달"},{label:"상대적 연도",examples:["올해","내년","작년","재작년","내후년"],pattern:"(올해|내년|작년|재작년|내후년)"},{label:"복합 표현 - 날짜와 시간대",examples:["1월 1일 오전","12월25일 저녁","다음 주 금요일 오전"],pattern:"(내년|올해|작년)?\\s?\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"정확한 날짜",examples:["1월1일","1월 1일","12월 25일","01월 01일"],pattern:"\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일"},{label:"요일",examples:["월요일","화요일","이번 금요일","다음 화요일"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일"},{label:"시간대",examples:["오전","오후","저녁","밤","새벽"],pattern:"(오전|오후|저녁|밤|새벽)"},{label:"짧은 시간 표현",examples:["방금","조금 전","금방","곧","잠시 후"],pattern:"(방금|조금\\s전|금방|곧|잠시\\s후)"},{label:"연도",examples:["2015년","2024년","1998년"],pattern:"\\d{4}년"}],aN=t=>{const e=[...t||[],...sN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},lN=et.create({name:np,addOptions(){return{additionalTimeWords:[],enabled:!0}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null,enabled:this.options.enabled}},addProseMirrorPlugins(){return[new it({props:{decorations:t=>{if(!this.storage.enabled)return ut.empty;const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=aN(this.options.additionalTimeWords)),t.doc.descendants((n,r)=>{if(!n.isText)return;let i;const s=this.storage.cachedRegex;for(;i=s.exec(n.text||"");){const a=r+i.index,l=a+i[0].length;e.push(Kt.inline(a,l,{class:"time-highlight"}))}}),ut.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[np];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Vv(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function uN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var i;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="CLIPBOARD_STATE"&&t(!!((i=r.data)!=null&&i.hasClipboard))},Vv({type:"REQUEST_CLIPBOARD_STATE"})})}function cN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var i;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="PASTE_RESULT"&&t(((i=r.data)==null?void 0:i.text)??null)},Vv({type:"PASTE"})})}function dN(t,e){Vv({type:"COPY",data:{html:t,text:e}})}async function fN(t,e){try{const n=new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});await navigator.clipboard.write([n])}catch(n){console.error("navigator clipboard write failed:",n)}}async function pN(){try{if("read"in navigator.clipboard){const t=await navigator.clipboard.read();for(const e of t){if(e.types.includes("text/html"))return await(await e.getType("text/html")).text();if(e.types.includes("text/plain"))return await(await e.getType("text/plain")).text()}}}catch(t){console.warn("navigator clipboard read failed:",t)}}const hN=et.create({name:"clipboard",addCommands(){return{copyContent:()=>({editor:t,state:e})=>{const{from:n,to:r}=e.selection;return n===r?!1:((async()=>{try{const i=e.doc.slice(n,r),a=$r.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
344
344
  `);t.storage.deviceEnv.isMobile?dN(u,c):await fN(u,c)}catch(i){console.warn("[clipboard] copy failed",i)}})(),!0)},cutContent:()=>({editor:t})=>((async()=>{try{await t.commands.copyContent(),t.chain().focus().deleteSelection().run()}catch(e){console.warn("[clipboard] cut failed",e)}})(),!0),pasteContent:()=>({editor:t})=>((async()=>{try{t.chain().focus().run();const e=t.storage.deviceEnv.isMobile?await cN():await pN();if(!e)return;const n=new DataTransfer;if(FJ(e)){n.setData("text/html",e);const i=document.createElement("div");i.innerHTML=e,n.setData("text/plain",i.innerText)}else n.setData("text/plain",e);const r=new ClipboardEvent("paste",{bubbles:!0,cancelable:!0});Object.defineProperty(r,"clipboardData",{value:n}),t.view.dom.dispatchEvent(r)}catch(e){console.warn("Clipboard paste failed:",e)}})(),!0)}},onCreate(){const t=this.editor;t.hasClipboard=async()=>{try{return!!(t.storage.deviceEnv.isMobile?await uN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),mN=et.create({name:"deviceEnv",addOptions(){return{initial:!1,specialCharModal:void 0}},addStorage(){return{isMobile:this.options.initial,specialCharModal:this.options.specialCharModal,isForceCloseBubble:!1}},addCommands(){return{setIsMobile:t=>({editor:e})=>{var n;return e.storage.deviceEnv.isMobile=t,(n=e.storage.spellchecker)==null||n.spellchecker.setIsMobile(t),!0},setForceCloseBubble:t=>({editor:e})=>(e.storage.deviceEnv.isForceCloseBubble=t,!0),resetForceCloseBubble:()=>({editor:t})=>(t.storage.deviceEnv.isForceCloseBubble=!1,!0)}}}),Ih=o.defineComponent({__name:"TabsContent",props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(UV),o.mergeProps({class:o.unref(ke)("mt-2 ring-offset-ed-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2",e.class)},n.value),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),gN={class:"flex items-center w-full p-3 my-3 hover:bg-ed-accent border border-ed-border text-ed-muted-foreground cursor-pointer rounded-sm transition-all"},bN={key:0,class:"flex justify-center items-center gap-3 text-s"},vN={key:1,class:"flex justify-between items-center w-full"},yN={class:"flex justify-center items-center gap-3"},wN={class:"text-sm"},xN={class:"flex items-center gap-2"},CN=o.defineComponent({__name:"VideoUploader",props:{...na},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=At();function l(p){var y;i.value=!0;const m=p.target,g=Array.from((m==null?void 0:m.files)||[]),b=(y=e.editor.extensionManager.extensions.find(x=>x.name==="videoUpload"))==null?void 0:y.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof(b==null?void 0:b.upload)!="function")return;const v=g[0];b.upload(v).then(x=>{e.editor.chain().setVideo({src:x}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run(),i.value=!1})}function u(){e.editor.chain().setVideo({src:r.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function c(){e.deleteNode()}function f(){var p;(p=s.value)==null||p.click()}return(p,m)=>(o.openBlock(),o.createBlock(o.unref(ta),{as:"div","data-drag-handle":"",class:o.normalizeClass(o.unref(ke)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{"default-open":o.unref(n)},{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",gN,[i.value?(o.openBlock(),o.createElementBlock("div",bN,[o.createVNode(o.unref(Ot),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(a)("editor.video.dialog.uploading"))+"...",1)])):(o.openBlock(),o.createElementBlock("div",vN,[o.createElementVNode("div",yN,[o.createVNode(o.unref(Ot),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",wN,o.toDisplayString(o.unref(a)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(c,["stop"])})]))])]),_:1}),o.createVNode(o.unref(gs),{"trap-focus":"",class:"w-full","on-open-auto-focus":g=>g.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(ip),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(sp),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Rl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Rl),{value:"link",disabled:i.value},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),o.createVNode(o.unref(Ih),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{class:"w-full mt-1",size:"sm",disabled:i.value,onClick:f},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),o.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"video/*",hidden:"",onChange:l},null,544)]),_:1}),o.createVNode(o.unref(Ih),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",xN,[o.createVNode(o.unref(bs),{modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=g=>r.value=g),type:"url",autofocus:"",required:"",placeholder:o.unref(a)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(vn),{onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["class"]))}}),Xk=Lt.create({name:ac,isolating:!0,defining:!0,group:"block",draggable:!0,selectable:!1,inline:!1,parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setVideoUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return ra(CN)},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("link video not found"),button:({editor:e,t:n})=>{var r,i;return{component:Ge,componentProps:{action:()=>e.commands.setVideoUpload(),isActive:()=>e.isActive("video")||!1,disabled:!((i=(r=e.can()).setVideo)!=null&&i.call(r,{})),icon:"Video",tooltip:n("editor.video.tooltip")}}}}}});function EN(t){return t=t.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),t=t.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(t)&&(t=t.replace(/\?.*$/i,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),t.includes("drive.google.com")&&(t=t.replace("/view","/preview")),t}function kN(t){return t?t.includes("youtube.com/embed")||t.includes("player.vimeo.com")||t.includes("player.bilibili.com")||t.includes("drive.google.com"):!1}const Yk=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:cf["size-medium"],controls:!0,autoplay:!1,HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}},addAttributes(){return{src:{default:null,renderHTML:({src:t})=>({src:t?EN(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:sn(t)})},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},controls:{default:this.options.controls}}},parseHTML(){return[{tag:"video"},{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){const{src:e,width:n,controls:r,allowfullscreen:i}=t??{},s=`max-width: ${sn(n)};`;return kN(e)?["iframe",{src:e,style:s,...i&&{allowfullscreen:i}}]:["video",{src:e?e.replace(/\\/g,"/"):"",style:s,...r&&{controls:r}}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateVideo:t=>({commands:e})=>e.updateAttributes(this.name,t)}}}),Gl=new Et("upload-image"),SN=()=>new it({key:Gl,state:{init(){return ut.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Gl);if(n!=null&&n.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=_N(a);return Kt.widget(s,l,{id:i,side:-1})});e=e.add(t.doc,r)}return n!=null&&n.remove&&n.remove.forEach(r=>{e=e.remove(e.find(void 0,void 0,i=>i.id===r))}),e}},props:{decorations(t){return this.getState(t)}}});function _N(t){const e=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=t,n.onload=()=>{e.setAttribute("class","img-placeholder")},e.appendChild(n),e}function TN(t,e){var i;const r=Gl.getState(t).find(void 0,void 0,s=>s.id===e);return r.length?(i=r[0])==null?void 0:i.from:null}const Jk=({validateFn:t,onUpload:e})=>async(n,r,i)=>{const s=[];for(const a of n){if(t&&!t(a))continue;const l=Zr(6),u=URL.createObjectURL(a);s.push({file:a,id:l,preview:u})}s.length!==0&&(r.dispatch(r.state.tr.setMeta(Gl,{add:s.map(({id:a,preview:l})=>({id:a,pos:i,src:l}))})),await Promise.all(s.map(async({file:a,id:l,preview:u})=>{var c,f;try{const p=await e(a),m=TN(r.state,l);if(m===null)return;const{schema:g}=r.state,b=typeof p=="object"?u:p,v=(c=g.nodes.image)==null?void 0:c.create({src:b}),y=(f=g.nodes.paragraph)==null?void 0:f.create();if(!v||!y)return;r.dispatch(r.state.tr.replaceWith(m,m,v).insert(m+v.nodeSize,y).setMeta(Gl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Gl,{remove:[l]}))}})))},AN=(t,e,n)=>{var i;const r=Array.from(((i=e.clipboardData)==null?void 0:i.files)||[]);if(r.length){e.preventDefault();const s=t.state.selection.from;return n(r,t,s+1),!0}return!1},MN=(t,e,n,r)=>{var s;const i=Array.from(((s=e.dataTransfer)==null?void 0:s.files)||[]);if(!n&&i.length){e.preventDefault();const a=t.posAtCoords({left:e.clientX,top:e.clientY});if(a)return r(i,t,a.pos+1),!0}return!1},ON={class:"flex items-center w-full p-3 my-3 transition-all border rounded-sm cursor-pointer hover:bg-ed-accent border-ed-border text-ed-muted-foreground"},BN={class:"flex items-center justify-between w-full"},IN={class:"flex items-center justify-center gap-3"},RN={class:"text-sm"},LN={class:"flex items-center gap-2"},DN=o.defineComponent({__name:"ImageUploader",props:{...na},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=At(),s=o.inject("isEditable",o.ref(!0));function a(f){var v,y;const p=(v=f==null?void 0:f.target)==null?void 0:v.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=Array.from(p),g=(y=e.editor.extensionManager.extensions.find(x=>x.name==="imageUpload"))==null?void 0:y.options;Jk({validateFn:x=>!0,onUpload:g.upload})(m,e.editor.view,e.getPos(),e.node.attrs.id)}function l(){e.editor.chain().setImage({src:n.value}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){var f;(f=r.value)==null||f.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(ta),{id:f.node.attrs.id,"data-drag-handle":"",class:o.normalizeClass(o.unref(ke)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{"default-open":o.unref(s)},{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",ON,[o.createElementVNode("div",BN,[o.createElementVNode("div",IN,[o.createVNode(o.unref(Ot),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",RN,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})])])]),_:1}),o.createVNode(o.unref(gs),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(ip),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(sp),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Rl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Rl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Ih),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{class:"w-full mt-1",size:"sm",onClick:c},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",multiple:"",hidden:"",onChange:a},null,544)]),_:1}),o.createVNode(o.unref(Ih),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",LN,[o.createVNode(o.unref(bs),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:o.unref(i)("editor.image.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(vn),{onClick:l},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["id","class"]))}}),PN=1,VN=1e6,Ai={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Fv=0;function FN(){return Fv=(Fv+1)%Number.MAX_VALUE,Fv.toString()}const $v=new Map;function Zk(t){if($v.has(t))return;const e=setTimeout(()=>{$v.delete(t),Gc({type:Ai.REMOVE_TOAST,toastId:t})},VN);$v.set(t,e)}const To=o.ref({toasts:[]});function Gc(t){switch(t.type){case Ai.ADD_TOAST:To.value.toasts=[t.toast,...To.value.toasts].slice(0,PN);break;case Ai.UPDATE_TOAST:To.value.toasts=To.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Ai.DISMISS_TOAST:{const{toastId:e}=t;e?Zk(e):To.value.toasts.forEach(n=>{Zk(n.id)}),To.value.toasts=To.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Ai.REMOVE_TOAST:t.toastId===void 0?To.value.toasts=[]:To.value.toasts=To.value.toasts.filter(e=>e.id!==t.toastId);break}}function Hv(){return{toasts:o.computed(()=>To.value.toasts),toast:$N,dismiss:t=>Gc({type:Ai.DISMISS_TOAST,toastId:t})}}function $N(t){const e=FN(),n=i=>Gc({type:Ai.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>Gc({type:Ai.DISMISS_TOAST,toastId:e});return Gc({type:Ai.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const HN={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},zN=t=>`${(t/1024/1024).toFixed(2)}MB`,Qk=Lt.create({name:wi,isolating:!0,defining:!0,group:"block",draggable:!1,selectable:!1,inline:!1,onCreate(){if(typeof this.options.upload!="function")throw new Error("Image upload function should be a function")},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addAttributes(){return{id:{default:Zr(6),parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},addCommands(){return{setImageUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return ra(DN)},addOptions(){var t;return{...HN,...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:n,t:r})=>{var i,s;return{component:Ge,componentProps:{action:()=>e.commands.setImageUpload(),disabled:!((s=(i=e.can()).setImage)!=null&&s.call(i,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip")}}}}},addProseMirrorPlugins(){const{toast:t}=Hv(),{t:e}=At(),r=Jk({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${zN(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new it({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:AN(i,s,r),handleDrop:(i,s,a,l)=>!(s instanceof DragEvent)||!s.dataTransfer||!Array.from(s.dataTransfer.files||[]).some(f=>this.options.acceptMimes.includes(f.type))?!1:MN(i,s,l,r)}}),SN()]}}),UN=et.create({name:"searchHighlight",addGlobalAttributes(){return[{types:["textStyle"],attributes:{searchHighlight:{default:null,parseHTML:t=>{const e=t,n=e.style.color,r=e.style.backgroundColor;return!n||!r?null:{color:n,backgroundColor:r}},renderHTML:t=>{if(!t.searchHighlight)return{};const{color:e,backgroundColor:n}=t.searchHighlight;return{style:`color: ${e}; background-color: ${n}`}}}}}]}}),WN=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:l4},setup(t){const e=t,{t:n}=At(),r=xn(),i=o.computed(()=>{var p;return(p=e.editor)==null?void 0:p.storage.specialCharacter.specialCharModal}),s=o.ref(!1);let a=null;function l(){const p=document.activeElement;if(p instanceof HTMLInputElement){a={type:"input",el:p};return}r.editorFocusedInstance.value&&(a={type:"editor"})}const u=()=>{if(!i.value||!i.value.component){console.error("Please configure specialCharModal!");return}s.value=!s.value};document.addEventListener("focusin",p=>{var b,v;if(!s.value)return;const m=p.target;if(m instanceof HTMLInputElement){a={type:"input",el:m};return}const g=r.editorFocusedInstance.value;(v=(b=g==null?void 0:g.view)==null?void 0:b.dom)!=null&&v.contains(m)&&(a={type:"editor"})});function c(p,m){const g=p.selectionStart??p.value.length,b=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+m+p.value.slice(b);const v=g+m.length;p.setSelectionRange(v,v),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const f=(p,m)=>{if(m){if((a==null?void 0:a.type)==="input"){c(a.el,p);return}if((a==null?void 0:a.type)==="editor"){const g=r.editorFocusedInstance.value;if(!g)return;const{view:b}=g,{from:v}=b.state.selection;g.commands.insertContentAt(v,p),g.commands.focus()}}};return(p,m)=>{const g=va,b=vs,v=ba,y=ya;return o.openBlock(),o.createBlock(y,null,{default:o.withCtx(()=>[o.createVNode(v,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(g,null,{default:o.withCtx(()=>[o.createVNode(vn,{class:"text-[#65558F] hover:bg-[#ECE6F0]/90 text-xs rounded-none font-normal h-[26px] px-3 border border-gray-300 bg-ed-gray-50 dark:bg-black dark:text-white dark:hover:bg-gray-700 transition-all",onPointerdown:l,onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),o.createVNode(b,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.unref(s)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(i).component),o.mergeProps({key:0},o.unref(i).props,{"custom-class":"!z-[70] !pointer-events-auto",onClose:m[0]||(m[0]=x=>s.value=!1),onSelectedChar:f}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),jN=et.create({name:rp,addOptions(){return{button:({editor:t})=>({component:WN,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),Nk=et.create({name:"base-kit",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),timeHighlighter:{additionalTimeWords:[]},bubble:{list:nR,defaultBubbleList:$G,button:({editor:e,extension:n,t:r})=>{var l;const{list:i={},defaultBubbleList:s}=((l=n.options)==null?void 0:l.bubble)??{},a=(s==null?void 0:s(e))??[];return HG(i,a,{editor:e,extension:n,t:r})}}}},addExtensions(){var n,r,i;const{t}=At(),e=[];this.options.placeholder!==!1&&e.push(eE.configure({placeholder:({node:s,pos:a})=>{var u;const l=(u=s==null?void 0:s.type)==null?void 0:u.name;return l==="heading"?`${t(`editor.heading.h${s.attrs.level}.tooltip`)}`:l==="table"||l==="codeBlock"?"":a===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(TG.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(rE.configure().extend({content:"page+"})),e.push(hZ.configure({types:((r=(n=this.options.page)==null?void 0:n.nodesComputedOption)==null?void 0:r.types)??[],slots:o.useSlots()}))):e.push(rE.configure())),this.options.dropcursor!==!1&&e.push(_G.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(EG.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(N5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(Q5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(PG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(VG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(Qk.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(Yk.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(Xk.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(zb.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(vk.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(w5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(vZ.configure(this.options.fontWeight)),this.options.mode!==Me.EDITOR&&e.push(jN.configure(this.options.specialCharacter)),this.options.mode!==Me.EDITOR&&e.push(CZ),this.options.superText!==!1&&this.options.mode!==Me.PLAIN_TEXT&&this.options.mode!==Me.EDITOR&&(typeof this.options.superText=="boolean"?e.push(ck.configure()):e.push(ck.configure(this.options.superText))),this.options.mode===Me.EDITOR&&(this.options.image!==!1&&e.push(Ku.configure()),e.push(m5.configure({spacer:!0}),F8,V8,$8,Fb,Pv,H8,x5.configure({spacer:!0}),g5.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),xk)),this.options.mode!==Me.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Me.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(Ek.configure()):e.push(Ek.configure({specialCharModal:(i=this.options.configPlan)==null?void 0:i.specialCharModal}))),this.options.mode!==Me.EDITOR&&this.options.mode!==Me.PLAIN_TEXT&&e.push(kZ),(this.options.mode===Me.STRAIGHT||this.options.mode===Me.REPORT||this.options.mode===Me.EDITOR)&&this.options.timeHighlighter&&e.push(lN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(hk.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(UN),e.push(oE,tE.configure(),iN.configure(),DG.configure(),Tv,Sv,hb,hN,mN.configure(this.options.deviceEnv),C5.configure({multicolor:!0}));for(const s in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,s)&&this.options.excludes[s]&&kt.remove(e,({name:l})=>l===s);return e},addStorage(){return{mode:this.options.mode}}}),eS=Un.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),tS=Un.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),qN=et.create({name:"subAndSuperScript",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>{const i=n.options.subscript,s=n.options.superscript,a={component:Ge,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Ge,componentProps:{action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",tooltip:r("editor.superscript.tooltip")}},u=[];return i!==!1&&u.push(a),s!==!1&&u.push(l),u}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(eS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(tS.configure(this.options.superscript)),t}}),KN={class:"ml-1"},GN=o.defineComponent({__name:"ActionMoreButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=o.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,i)=>(o.openBlock(),o.createBlock(ka,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.items,(s,a)=>(o.openBlock(),o.createBlock(o.unref($l),{key:a,checked:n.value.title===s.title,disabled:s.disabled,class:"flex gap-3 items-center",onClick:s.action},{default:o.withCtx(()=>[s.icon?(o.openBlock(),o.createBlock(o.unref(Ot),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",KN,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(p5),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(GC)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),XN=et.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,extension:n,t:r}){const i=n.options.subscript,s=n.options.superscript,a={action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",title:r("editor.subscript.tooltip"),shortcutKeys:["mod","."]},l={action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",title:r("editor.superscript.tooltip"),shortcutKeys:["mod",","]},u=pg(e,"code"),c=[];if(i!==!1&&c.push(a),s!==!1&&c.push(l),u){const f={action:()=>e.commands.toggleCode(),isActive:()=>e.isActive("code")||!1,disabled:!e.can().toggleCode(),icon:"Code",title:r("editor.code.tooltip"),shortcutKeys:["mod","E"]};u&&c.push(f)}return{component:GN,componentProps:{icon:"Type",tooltip:r("editor.moremark"),disabled:!e.isEditable||c.every(f=>f.disabled),items:c}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(eS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(tS.configure(this.options.superscript)),t}});var Ra=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(Ra||{});function YN(t,e,n){return t<e?e:t>n?n:t}function JN(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Le||s instanceof In))return t;const{from:a,to:l}=s;return i.nodesBetween(a,l,(u,c)=>{const f=u.type;return n.includes(f.name)?(t=ZN(t,c,e),!1):!$0(u.type.name,r.extensionManager.extensions)}),t}function ZN(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=YN((r.attrs.indent||0)+n,0,7);if(a===r.attrs.indent)return t;const l={...r.attrs,indent:a};return t.setNodeMarkup(e,r.type,l,r.marks)}function nS({delta:t,types:e}){return({state:n,dispatch:r,editor:i})=>{const{selection:s}=n;let{tr:a}=n;return a=a.setSelection(s),a=JN(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const QN=et.create({name:"indent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:Ra.min,maxIndent:Ra.max,button({editor:e,t:n}){var s,a;const{selection:r}=e.state,i=r.$anchor.parent;return[{component:Ge,componentProps:{action:()=>{e.commands.indent()},disabled:((s=i==null?void 0:i.attrs)==null?void 0:s.indent)>=Ra.max||!e.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:Ge,componentProps:{action:()=>{e.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:((a=i==null?void 0:i.attrs)==null?void 0:a.indent)<=Ra.min||!e.can().outdent(),icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.getAttribute("data-indent");return(e?parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>nS({delta:Ra.more,types:this.options.types}),outdent:()=>nS({delta:Ra.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function NN(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=fB(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",m=i?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${m}]*`,"gm"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const v=l.pos-b.length,y=Array.from(b.matchAll(g)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const x=y.input.slice(Math.max(0,y.index-1),y.index),C=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(x);if(s!==null&&!C)return null;const k=v+y.index;let E=k+y[0].length;return u&&f.test(b.slice(E-1,E+1))&&(y[0]+=" ",E+=1),k<l.pos&&E>=l.pos?{range:{from:k,to:E},query:y[0].slice(n.length),text:y[0]}:null}const eee=new Et("suggestion");function tee({pluginKey:t=eee,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:u="suggestion",command:c=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=NN}){let b;const v=p==null?void 0:p(),y=new it({key:t,view(){return{update:async(x,C)=>{var k,E,T,_,A,P,O;const B=(k=this.key)===null||k===void 0?void 0:k.getState(C),F=(E=this.key)===null||E===void 0?void 0:E.getState(x.state),H=B.active&&F.active&&B.range.from!==F.range.from,G=!B.active&&F.active,J=B.active&&!F.active,$=!G&&!J&&B.query!==F.query,R=G||H&&$,L=$||H,U=J||H&&$;if(!R&&!L&&!U)return;const V=U&&!R?B:F,z=x.dom.querySelector(`[data-decoration-id="${V.decorationId}"]`);b={editor:e,range:V.range,query:V.query,text:V.text,items:[],command:q=>c({editor:e,range:V.range,props:q}),decorationNode:z,clientRect:z?()=>{var q;const{decorationId:ne}=(q=this.key)===null||q===void 0?void 0:q.getState(e.state),de=x.dom.querySelector(`[data-decoration-id="${ne}"]`);return(de==null?void 0:de.getBoundingClientRect())||null}:null},R&&((T=v==null?void 0:v.onBeforeStart)===null||T===void 0||T.call(v,b)),L&&((_=v==null?void 0:v.onBeforeUpdate)===null||_===void 0||_.call(v,b)),(L||R)&&(b.items=await f({editor:e,query:V.query})),U&&((A=v==null?void 0:v.onExit)===null||A===void 0||A.call(v,b)),L&&((P=v==null?void 0:v.onUpdate)===null||P===void 0||P.call(v,b)),R&&((O=v==null?void 0:v.onStart)===null||O===void 0||O.call(v,b))},destroy:()=>{var x;b&&((x=v==null?void 0:v.onExit)===null||x===void 0||x.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,C,k,E){const{isEditable:T}=e,{composing:_}=e.view,{selection:A}=x,{empty:P,from:O}=A,B={...C};if(B.composing=_,T&&(P||e.view.composing)){(O<C.range.from||O>C.range.to)&&!_&&!C.composing&&(B.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:A.$from}),H=`id_${Math.floor(Math.random()*4294967295)}`;F&&m({editor:e,state:E,range:F.range,isActive:C.active})?(B.active=!0,B.decorationId=C.decorationId?C.decorationId:H,B.range=F.range,B.query=F.query,B.text=F.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(x,C){var k;const{active:E,range:T}=y.getState(x.state);return E&&((k=v==null?void 0:v.onKeyDown)===null||k===void 0?void 0:k.call(v,{view:x,event:C,range:T}))||!1},decorations(x){const{active:C,range:k,decorationId:E}=y.getState(x);return C?ut.create(x.doc,[Kt.inline(k.from,k.to,{nodeName:l,class:u,"data-decoration-id":E})]):null}}});return y}const nee=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],ree=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],oee=[{label:"墨刀",value:"modao",icon:"Modao"},{label:"蓝湖",value:"lanhu",icon:"Lanhu"},{label:"Figma",value:"figma",icon:"Figma"},{label:"Canva",value:"canva",icon:"Canva"},{label:"ProcessOn",value:"processon",icon:"Processon"}],iee=[{label:"CodePen",value:"codepen",icon:"Codepen"}],see=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],aee=[],lee=[...nee,...ree,...oee,...iee,...see,...aee];function uee(t){const{t:e}=At(),n=[{name:"format",title:e("editor.slash.format"),commands:[{name:"paragraph",label:e("editor.paragraph.tooltip"),aliases:["paragraph","zw"],iconName:"Paragraph",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading1",label:e("editor.heading.h1.tooltip"),aliases:["h1","bt","bt1"],iconName:"Heading1",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading2",label:e("editor.heading.h2.tooltip"),aliases:["h2","bt","bt2"],iconName:"Heading2",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:2}).run()}},{name:"heading3",label:e("editor.heading.h3.tooltip"),aliases:["h3","bt","bt3","heading3"],iconName:"Heading3",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:3}).run()}},{name:"bulletList",label:e("editor.bulletlist.tooltip"),aliases:["ul","yxlb","bulletList"],iconName:"List",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleBulletList().run()}},{name:"numberedList",label:e("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleOrderedList().run()}},{name:"codeBlock",label:e("editor.codeblock.tooltip"),iconName:"Code2",aliases:["codeBlock"],description:"Code block with syntax highlighting",shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setCodeBlock().run()}},{name:"blockquote",label:e("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setBlockquote().run()}},{name:"horizontalrule",label:e("editor.horizontalrule.tooltip"),aliases:["fgx","horizontalRule"],iconName:"Minus",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHorizontalRule().run()}},{name:"link",label:e("editor.link.tooltip"),aliases:["link","lianjie","lj"],iconName:"Link",action:({editor:i,range:s})=>{i.chain().deleteRange(s).extendMarkRange("link").insertContent({type:"text",text:"link",marks:[{type:"link",attrs:{href:"",target:"_blank"}}]}).setLink({href:""}).focus().run()}}]},{name:"insert",title:e("editor.slash.insert"),commands:[{name:"image",label:e("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setImageUpload().run()}},{name:"table",label:e("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}},{name:"video",label:e("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setVideoUpload().run()}},{name:"taskList",label:e("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleTaskList().run()}},{name:"columns",label:e("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",aliases:["columns","cols","2cols"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().deleteRange(s).setColumns().focus(i.state.selection.head-1).run()}}]}];if(pg(t,"iframes")){const i=lee;n.push({name:"others",title:e("editor.slash.embed"),commands:i.map(s=>({name:s.value,label:s.label,iconName:s.icon,aliases:[s.value,s.label],shouldBeHidden:a=>a.isActive("columns"),action:({editor:a,range:l})=>{a.chain().deleteRange(l).focus().setIframe({src:"",service:s.value}).run()}}))})}return n}const cee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},dee={className:"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-2 font-semibold tracking-wider select-none uppercase first:mt-0.5"},fee=["onClick"],pee=["src"],hee={key:1,class:"p-3"},mee={class:"text-xs text-gray-800 dark:text-gray-400"},gee=o.defineComponent({__name:"CommandsList",props:{editor:{},items:{default:void 0},command:{type:Function,default:void 0}},setup(t,{expose:e}){const n=o.ref(0),r=o.ref(0),i=o.ref(null),{t:s}=At(),a=o.ref([]),l=t;e({onKeyDown:u}),o.watch([()=>n.value,()=>r.value],async()=>{if(!i.value)return;await o.nextTick();const v=r.value*1e3+n.value,y=a.value[v];y&&y.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:v}){return v.key==="ArrowUp"?(c(),!0):v.key==="ArrowDown"?(f(),!0):v.key==="Enter"?(p(),!0):!1}function c(){var x;if(!l.items.length)return!1;let v=n.value-1,y=r.value;v<0&&(y=r.value-1,v=((x=l.items[y])==null?void 0:x.commands.length)-1||0),y<0&&(y=l.items.length-1,v=l.items[y].commands.length-1),n.value=v,r.value=y}function f(){if(!l.items.length)return!1;const v=l.items[r.value].commands;let y=n.value+1,x=r.value;v.length-1<y&&(y=0,x=r.value+1),l.items.length-1<x&&(x=0),n.value=y,r.value=x}function p(){if(!l.items.length||r.value===-1||n.value===-1)return!1;m(r.value,n.value)}function m(v,y){const x=l.items[v].commands[y];l.command(x)}function g(v,y){m(v,y)}function b(v,y,x){a.value[v*1e3+y]=x}return(v,y)=>{var x;return o.openBlock(),o.createElementBlock("div",{ref_key:"scrollContainer",ref:i,class:"bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800 text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-1"},[(x=v.items)!=null&&x.length?(o.openBlock(),o.createElementBlock("div",cee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.items,(C,k)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:C.title},[o.createElementVNode("div",dee,o.toDisplayString(C.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(C.commands,(E,T)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:_=>b(k,T,_),key:T,class:o.normalizeClass(["flex items-center gap-3 px-2 py-1.5 text-sm text-neutral-800 dark:text-neutral-200 text-left w-full rounded-sm outline-none transition-colors",[r.value===k&&n.value===T?"bg-ed-accent text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200":"hover:bg-ed-accent hover:text-neutral-800 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"]]),onClick:_=>g(k,T)},[E.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:E.iconUrl},null,8,pee)):o.createCommentVNode("",!0),E.iconName?(o.openBlock(),o.createBlock(o.unref(Ot),{key:1,name:E.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(E.label),1)],10,fee))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",hee,[o.createElementVNode("span",mee,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512)}}}),La="slashCommand";let Vt;const bee=et.create({name:La,priority:200,onCreate(){Vt=ea("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[tee({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new Et(La),allow:({state:t,range:e})=>{var c,f,p;const n=t.doc.resolve(e.from),r=n.depth===1,i=n.parent.type.name==="paragraph",s=((c=n.parent.textContent)==null?void 0:c.charAt(0))==="/",a=this.editor.isActive("column"),l=(p=n.parent.textContent)==null?void 0:p.substring((f=n.parent.textContent)==null?void 0:f.indexOf("/")),u=!(l!=null&&l.endsWith(" "));return(r&&i&&s||a&&i&&s)&&u},command:({editor:t,range:e,props:n})=>{const{view:r}=t;n.action({editor:t,range:e}),r.focus()},items:({query:t})=>uee(this.editor).map(s=>({...s,commands:s.commands.filter(a=>{const l=a.label.toLowerCase().trim(),u=t.toLowerCase().trim();if(a.aliases){const c=a.aliases.map(m=>m.toLowerCase().trim()),f=l.match(u),p=c.some(m=>m.match(u));return f||p}return l.match(u)}).filter(a=>a.shouldBeHidden?!a.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(a=>({...a,isEnabled:!0}))})),render:()=>{let t,e=null;return{onStart:n=>{var s;t=new tx(gee,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[La].rect;const a=n.clientRect();if(!a)return n.editor.storage[La].rect;let l=a.y;if(t.element instanceof HTMLElement&&a.top+t.element.offsetHeight+40>window.innerHeight){const u=a.top+t.element.offsetHeight-window.innerHeight+40;l=a.y-u}return new DOMRect(a.x,l,a.width,a.height)};e=()=>{Vt==null||Vt[0].setProps({getReferenceClientRect:i})},(s=r.dom.parentElement)==null||s.addEventListener("scroll",e),t.element&&(Vt==null||Vt[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element})),Vt==null||Vt[0].show()},onUpdate(n){var a;t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[La].rect;const l=n.clientRect();return l?new DOMRect(l.x,l.y,l.width,l.height):n.editor.storage[La].rect},s=()=>{Vt==null||Vt[0].setProps({getReferenceClientRect:i})};(a=r.dom.parentElement)==null||a.addEventListener("scroll",s),n.editor.storage[La].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Vt==null||Vt[0].setProps({getReferenceClientRect:i})},onKeyDown(n){var r;return n.event.key==="Escape"?(Vt==null||Vt[0].hide(),!0):(Vt!=null&&Vt[0].state.isShown||Vt==null||Vt[0].show(),(r=t.ref)==null?void 0:r.onKeyDown(n))},onExit(n){var r;if(Vt==null||Vt[0].hide(),e){const{view:i}=n.editor;(r=i.dom.parentElement)==null||r.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),vee=o.defineComponent({__name:"AIButton",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},customClass:{default:""},loading:{type:Boolean,default:!1},tooltipOptions:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=xn(),{toast:r}=Hv();function i(){var a,l,u;const s=(l=(a=e.editor.extensionManager.extensions.find(c=>c.name==="AI"))==null?void 0:a.options)==null?void 0:l.completions;if(typeof s!="function"){r({title:"AI completions method is not set or is not a valid function",variant:"destructive"});return}if(s.constructor.name!=="AsyncFunction"){r({title:"AI completions method must be an asynchronous function",variant:"destructive"});return}n.state.AIMenu=!0,(u=e.editor)==null||u.commands.focus()}return(s,a)=>(o.openBlock(),o.createBlock(Ge,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),yee=Lt.create({name:"AI",group:"block",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:({editor:e,t:n})=>({component:vee,componentProps:{icon:"Sparkles",tooltip:n("editor.AI.ask")}})}}});function wee(t,e){const n=atob(t.split(",")[1]),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);const i=new Uint8Array(r);return new Blob([i],{type:e})}function xee(t,e){return new File([t],e,{type:t.type})}const Cee=et.create({name:"importWord",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:e,extension:n,t:r})=>({component:Ge,componentProps:{action:()=>{var i;return(i=e.commands)==null?void 0:i.toggleImportWord()},disabled:!e.can().setHorizontalRule(),icon:"Word",tooltip:r("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=Hv(),{t:r}=At();async function i(u){var g;const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(pg(e,"image")){const b=(g=e.extensionManager.extensions.find(v=>v.name==="importWord"))==null?void 0:g.options;if(b&&typeof b.upload=="function"){const v=[];for(const x of p){const C=x.getAttribute("src"),k=wee(C,"image/jpeg"),E=xee(k,"image.jpeg");v.push(E)}const y=await b.upload(v);for(let x=0;x<p.length;x++){const C=p[x];C.setAttribute("src",y[x].src);const k=C.parentElement;(k==null?void 0:k.tagName)==="P"&&(k.insertAdjacentElement("beforebegin",C),!k.hasChildNodes()&&k.textContent===""&&k.remove())}return f.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),f.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),f.body.innerHTML}async function s(u){const c=await i(u);e.chain().setContent(c.toString(),!0).run(),n({title:r("editor.importWord.success")})}const{open:a,onChange:l}=nt.useFileDialog({accept:".docx",reset:!0,multiple:!1});return a(),l(async u=>{const[c]=Array.from(u??[]);if(c){if(c.size>this.options.limit){n({title:r("editor.importWord.fileTooLarge"),variant:"destructive"});return}if(this.options.convert){const f=await this.options.convert(c);s(f)}else{const f=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});f.append("config",p),f.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:f}).then(m=>m.json()).then(async m=>{s(m.html)}).catch(m=>{n({title:r("editor.importWord.error"),variant:"destructive"}),console.error("Error:",m)})}}}),!1}}}}),zv=xn(),Eee=et.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ge,componentProps:{icon:"Eye",action:()=>{zv.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>zv.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(zv.togglePreview(),!0)}}}),rS=xn(),kee=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function See(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ut.empty,results:[]};t==null||t.descendants((u,c)=>{u.isText?a[l]?a[l]={text:a[l].text+u.text,pos:a[l].pos}:a[l]={text:`${u.text}`,pos:c}:l+=1}),a=a.filter(Boolean);for(const u of a){const{text:c,pos:f}=u,p=Array.from(c.matchAll(e)).filter(([m])=>m.trim());for(const m of p){if(m[0]==="")break;m.index!==void 0&&s.push({from:f+m.index,to:f+m.index+m[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],f=u===r?`${n} ${n}-current`:n,p=Kt.inline(c.from,c.to,{class:f});i.push(p)}return{decorationsToReturn:ut.create(t,i),results:s}}const _ee=(t,e,{state:n,dispatch:r})=>{if(!e[0])return;const{from:s,to:a}=e[0];r&&r(n.tr.insertText(t,s,a))},Tee=(t,e,n,r)=>{const i=e+1;if(!r[i])return null;const{from:s,to:a}=r[e],l=a-s-t.length+n,{from:u,to:c}=r[i];return r[i]={to:c-l,from:u-l},[l,r]},Aee=(t,e,{tr:n,dispatch:r})=>{let i=0,s=e.slice();if(s.length){for(let a=0;a<s.length;a+=1){const{from:l,to:u}=s[a];n.insertText(t,l,u);const c=Tee(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},Mee=new Et("findAndReplacePlugin"),Oee=et.create({name:"findAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:e,extension:n,t:r})=>({component:Ge,componentProps:{icon:"DocSearch",tooltip:r("editor.findAndReplace.tooltip"),action:()=>{rS.toggleFindAndReplace()},isActive:()=>rS.state.findAndReplace}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e})=>(e.storage.findAndReplace.searchTerm=t,!1),setReplaceTerm:t=>({editor:e})=>(e.storage.findAndReplace.replaceTerm=t,!1),setCaseSensitive:t=>({editor:e})=>(e.storage.findAndReplace.caseSensitive=t,!1),resetIndex:()=>({editor:t})=>(t.storage.findAndReplace.resultIndex=0,!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n+1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n-1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return _ee(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return Aee(r,i,{tr:e,dispatch:n}),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:n}=this.options,r=a=>t.storage.findAndReplace.lastSearchTerm=a,i=a=>t.storage.findAndReplace.lastCaseSensitive=a,s=a=>t.storage.findAndReplace.lastResultIndex=a;return[new it({key:Mee,state:{init:()=>ut.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&b===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],ut.empty;const{decorationsToReturn:v,results:y}=See(a,kee(c,n,p),e,g);return t.storage.findAndReplace.results=y,v}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:Bee,state:Iee}=xn(),Ree=et.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ge,componentProps:{tooltip:e("editor.printer.tooltip"),action:()=>Bee(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>Iee.printer}})}}}),Lee=async function(t){let e=[];try{if(this.enabled===!1||t.length===0||t.trim()==="")return e;if(this.limit&&t.length>this.limit)throw new Error("Text is too long");const n=await un.post(this.getApi(),{value:t}),r=this.transfer(n.data);e=(r==null?void 0:r.map(i=>i.errorText))||[],this!=null&&this.setSuggestions&&this.setSuggestions(r)}catch(n){console.error(n)}return e};class oS{constructor({api:e,limit:n,transfer:r,enabled:i}){$t(this,"suggestions",[]);$t(this,"api","");$t(this,"enabled",!0);$t(this,"limit");$t(this,"transfer");this.suggestions=[],this.api=e,this.limit=n,this.transfer=r,this.enabled=i??!0}setSuggestions(e){this.suggestions=e}getSuggestions(e){var n;return Promise.resolve(((n=this.suggestions.find(r=>r.errorText.wrongWord===e))==null?void 0:n.spellData.correctWord)??[])}getApi(){return this.api}normalizeTextForLanguage(e){return e}proofreadText(e){return Promise.resolve(Lee.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Dee=Object.freeze(Object.defineProperty({__proto__:null,AI:yee,BaseKit:Nk,Blockquote:DK,Bold:V8,BulletList:_K,Clear:hb,Code:Bj,CodeBlock:Xq,Color:x5,Columns:Tv,FindAndReplace:Oee,FontFamily:vk,FontSize:w5,FormatPainter:Sv,Fullscreen:CG,Heading:m5,Highlight:xK,History:zb,HorizontalRule:dG,Image:Ku,ImageUpload:Qk,ImportWord:Cee,Indent:QN,Italic:F8,LineHeight:xk,Link:Fb,MoreMark:XN,OrderedList:OK,Preview:Eee,Printer:Ree,Proofreader:oS,SlashCommand:bee,SpellcheckerExtension:fk,Strike:H8,SubAndSuperScript:qN,Table:Pv,TaskList:RK,TextAlign:g5,Underline:$8,Video:Yk,VideoUpload:Xk},Symbol.toStringTag,{value:"Module"})),Pee='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend="&quot;false&quot;"><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend="&quot;false&quot;">MyMy Editor is open-source document editor based on Vue3 and Tiptap. MyMy Editor provides comprehensive document editing capabilities, supports pagination, supports Markdown syntax, offers basic rich text editing functions, allows for the insertion of various node types in multiple formats, provides a variety of practical tools, and supports setting page styles. It also supports exporting in various formats, printing and print preview, block-level document editing, adding custom extensions, multi-language settings, and a dark theme.</p><h1 id="jm9johtz" extend="&quot;false&quot;"><strong>소개(국문)</strong></h1><p id="0qei01hl" extend="&quot;false&quot;">마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.</p><blockquote class="blockquote"><p id="nekf7yi0" extend="false"><span style="color: rgb(115, 209, 61)"><strong><em>Make by VDC</em></strong></span></p></blockquote></page>';function Vee(){const t=window.localStorage.getItem("content"),e=o.ref(t||Pee),n=o.computed(()=>[Nk.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),zb,Tv,Sv,hb,Fb,Ku,Pv]),r=nt.useEventBus(hr.RENDER_SUPER_TEXT);function i(s,a){const l={action:"status",payload:{id:s,status:a}};r.emit(l)}return{defaultExtensions:n,content:e,dispatchUpdateStatusSuperText:i}}function Fee(){const t=o.ref(!1);return{hasEverFocused:t,markAsFocused:()=>{t.value=!0},insertHtml:(r,i)=>{const{state:s}=r,{doc:a,selection:l}=s,u=l.$from,c=a.firstChild,f=r.isEmpty;if(!t.value){if(f&&c){r.chain().insertContentAt({from:0,to:c.nodeSize},i).focus().run();return}const m=a.content.size;r.chain().insertContentAt(m,i).focus().run();return}const p=u.parent;if(p.type.name==="paragraph"&&p.textContent.trim().length===0){const m=u.before();r.chain().insertContentAt({from:m,to:m+p.nodeSize},i).focus().run();return}if(u.parentOffset===0&&p.type.name==="paragraph"&&p.content.size>0){const m=u.before();r.chain().insertContentAt(m,i).focus().run();return}r.chain().insertContentAt(r.state.selection,i).focus().run()}}}function Xl(t=250){const e=o.ref(!1);let n=null;const r=()=>{e.value=!0,n&&clearTimeout(n),n=setTimeout(()=>{e.value=!1},t)};return o.onUnmounted(()=>{n&&clearTimeout(n)}),{isScrolling:e,handleScroll:r}}function $ee(){const t=o.ref(!1);let e=!1;function n(){const l=Array.from(document.querySelectorAll(".inside-toolbar")),u=document.querySelector("#tool-bar-format"),c=document.querySelector("#tool-bar-image"),f=Array.from(document.querySelectorAll('[contenteditable="true"].tiptap:not(.simple-editor)'));return{popupInsideToolbars:l,toolBarFormat:u,toolBarImage:c,tiptapEditors:f}}function r(l){if(!l)return!1;const{popupInsideToolbars:u,toolBarFormat:c,toolBarImage:f,tiptapEditors:p}=n();return u.some(m=>m.contains(l))||((c==null?void 0:c.contains(l))??!1)||((f==null?void 0:f.contains(l))??!1)||p.some(m=>m.contains(l))}function i(l){e=r(l.target)}function s(l){const u=l.target;u&&r(u)&&(t.value=!0)}function a(l){const u=l.relatedTarget;r(u)||e&&u===null||(t.value=!1)}return nt.useEventListener(document,"mousedown",i,{capture:!0}),nt.useEventListener(document,"touchstart",i,{capture:!0}),nt.useEventListener(document,"focusin",s),nt.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}const Hee={class:"flex items-center h-[32px] hover:bg-ed-muted rounded-md"},zee={class:"text-sm flex items-center justify-center"},Uee={width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},Wee={id:"icon/填充色",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},jee={id:"icon/背景颜色"},qee=["fill"],iS=o.defineComponent({__name:"HighlightActionButton",props:{editor:{},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},tooltipOptions:{default:void 0}},setup(t){const e=t,n=o.ref(void 0),{state:r}=xn();function i(a){var l;(l=e.action)==null||l.call(e,a)}function s(a){var l;(l=e.action)==null||l.call(e,n.value)}return o.watchEffect(()=>{const{color:a}=e.editor.getAttributes("highlight");r.highlight=a}),(a,l)=>(o.openBlock(),o.createElementBlock("div",Hee,[o.createVNode(Ge,{id:"highlight",tooltip:a.tooltip,disabled:a.disabled,action:s,"tooltip-options":a.tooltipOptions},{icon:o.withCtx(()=>[o.createElementVNode("span",zee,[(o.openBlock(),o.createElementBlock("svg",Uee,[o.createElementVNode("g",Wee,[o.createElementVNode("g",jee,[l[1]||(l[1]=o.createElementVNode("g",{id:"编组",fill:"currentColor"},[o.createElementVNode("g",{id:"矩形",transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)"},[o.createElementVNode("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z","fill-rule":"nonzero"}),o.createElementVNode("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z","fill-rule":"evenodd"}),o.createElementVNode("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z","fill-rule":"nonzero"})])],-1)),o.createElementVNode("path",{id:"矩形",d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:n.value||"#FBDE28"},null,8,qee)])])]))])]),_:1},8,["tooltip","disabled","tooltip-options"]),o.createVNode(M8,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=u=>n.value=u),highlight:"",disabled:a.disabled,onChange:i},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{variant:"ghost",size:"icon",class:"w-3 h-[32px] rounded-l-none hover:bg-ed-muted-foreground/20",disabled:a.disabled},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"])]))}}),Kee={class:"h-full w-fit min-w-32 flex items-center leading-none gap-0.5 p-2 bg-ed-background rounded-lg shadow-sm border border-ed-border"},Rh=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:y})=>{var x;return y.isActive("table")&&(((x=y.storage.table)==null?void 0:x.isTableEditorOpen)??!1)},{t:i}=At();function s(){e.editor.chain().focus().addColumnBefore().run()}function a(){e.editor.chain().focus().addColumnAfter().run()}function l(){e.editor.chain().focus().deleteColumn().run()}function u(){e.editor.chain().focus().addRowBefore().run()}function c(){e.editor.chain().focus().addRowAfter().run()}function f(){e.editor.chain().focus().deleteRow().run()}function p(){e.editor.chain().focus().mergeCells().run()}function m(){var y;(y=e.editor)==null||y.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function b(y){e.editor.chain().focus().setTableCellBackground(y).run()}const v=()=>{const y=document.querySelector(".vdc-editor");if(!y)return new DOMRect(-1e3,-1e3,0,0);const x=y.getBoundingClientRect();return new DOMRect(x.left,x.top+10,x.width,0)};return(y,x)=>(o.openBlock(),o.createBlock(o.unref(ju),{editor:y.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:v,appendTo:n}},{default:o.withCtx(()=>{var C,k,E,T,_,A,P,O,B;return[o.createElementVNode("div",Kee,[o.createVNode(Ge,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!((C=y.editor)!=null&&C.can().addColumnBefore())},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerColumnInsertRight",tooltip:o.unref(i)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!((k=y.editor)!=null&&k.can().addColumnAfter())},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!((E=y.editor)!=null&&E.can().deleteColumn())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(vo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{icon:"TablerRowInsertTop",action:u,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!((T=y.editor)!=null&&T.can().addRowBefore())},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!((_=y.editor)!=null&&_.can().addRowAfter())},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!((A=y.editor)!=null&&A.can().deleteRow())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(vo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!((P=y.editor)!=null&&P.can().mergeCells())},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((O=y.editor)!=null&&O.can().splitCell())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(vo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(iS,{editor:y.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:b,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),o.createVNode(Ge,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!((B=y.editor)!=null&&B.can().deleteTable())},null,8,["tooltip","disabled"])])]}),_:1},8,["editor","tippy-options"]))}}),Gee={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},Xee={class:"flex items-center gap-1"},Lh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>F0(l.view.state,"columns"),r=()=>{const l=C8(e.editor,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},i=()=>{e.editor.chain().focus().setLayout(Ba.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(Ba.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(Ba.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(ju),{editor:l.editor,"plugin-key":"columns","should-show":n,"update-delay":0,"tippy-options":{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,plugins:[o.unref(KI)],sticky:"popper"}},{default:o.withCtx(()=>[o.createElementVNode("div",Gee,[o.createElementVNode("div",Xee,[o.createVNode(Ge,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ge,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ge,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),Yee={class:"flex items-center gap-2 p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},Jee=["href"],Zee={class:"flex flex-nowrap"},Qee=o.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=At(),r=e;function i(){r("clear")}function s(){r("edit")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",Yee,[o.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},o.toDisplayString(o.unref(kt.truncate)(a.link,{length:50,omission:"…"})),9,Jee),a.link?(o.openBlock(),o.createBlock(o.unref(vo),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",Zee,[o.createVNode(Ge,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Ge,{icon:"Unlink",tooltip:o.unref(n)("editor.link.unlink.tooltip"),action:i,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),Dh=o.defineComponent({__name:"LinkBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=o.ref(!1),r=o.computed(()=>{const{href:l}=e.editor.getAttributes("link");return l}),i=o.computed(()=>e.editor.isActive("link"));function s(l,u,c){e.editor.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:l,target:c?"_blank":""}}]}).setLink({href:l}).focus().run(),n.value=!1}function a(){e.editor.chain().extendMarkRange("link").unsetLink().focus().run(),n.value=!1}return(l,u)=>o.withDirectives((o.openBlock(),o.createBlock(o.unref(ju),{editor:l.editor,"update-delay":0,"tippy-options":{popperOptions:{modifiers:[{name:"flip",enabled:!0}]},appendTo:"parent",placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n.value=!1}}},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref($P),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Qee,{key:0,editor:l.editor,link:r.value,onClear:a,onEdit:u[0]||(u[0]=c=>n.value=!0)},null,8,["editor","link"]))]),_:1}),o.createVNode(o.unref(gs),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode(j5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),sS=(t,e,n,r,i)=>{const s=o.ref(0),a=nt.useEventBus(hr.RENDER_SUPER_TEXT),l=T=>{if(!e.value||!t)return;const _=e.value.index,A=e.value.id,{state:P}=t,{tr:O}=P;let B=!1;P.doc.descendants((F,H)=>{var G,J;if(((G=F.attrs)==null?void 0:G[rt.ID])===A){(J=F.attrs[rt.TEXT])!=null&&J.trim();const $=T.trim();if(Wc($))return O.delete(H,H+1),B=!0,!1;const{[rt.ELEMENT_ID]:R,...L}=F.attrs;return O.setNodeMarkup(H,void 0,{...L,[rt.TEXT]:$}),B=!0,!1}return!0}),B&&t&&t.view.dispatch(O),_!==-1&&(n.value[_].text=T,n.value[_].textOriginal=T)},u=o.ref(new Map),c=()=>{if(!(t!=null&&t.view.dom))return[];const T=[],_=t==null?void 0:t.view.dom.querySelectorAll("[node-id]"),A=new Map;return u.value.clear(),_.forEach(P=>{const O=P.getBoundingClientRect().top;A.has(O)||A.set(O,P),u.value.set(P.getAttribute("node-id")||"unknown",0)}),T.push(...A.values()),T},f=T=>{const _=T.closest(`#${r}`);if(!_)return;const A=_.getBoundingClientRect().top,P=_==null?void 0:_.scrollTop;return T.getBoundingClientRect().top-(A-P)},p=(T,_)=>{const A=n.value.findIndex(P=>P.id===T);A>-1&&(n.value[A].status=_)},m=T=>T.replace(/<p><\/p>/g,"<p>&nbsp;</p>"),g=()=>{if(!n.value||n.value.length===0){s.value=0,u.value.clear();return}if(!i.value||i.value.length===0)return;const T=i.value,_=new Set(n.value.map(O=>O.id)),A=T.map(O=>({isHidden:O.classList.contains("hidden"),isTruncated:O.classList.contains("super-text-truncate")}));T.forEach(O=>{O.classList.remove("hidden"),O.classList.remove("super-text-truncate")});for(const O of u.value.keys())_.has(O)||u.value.delete(O);T.forEach(O=>{const B=O.getAttribute("book-mark-id");if(!B)return;const F=O.offsetTop+O.offsetHeight,H=u.value.get(B)||0;u.value.set(B,Math.max(F,H))}),T.forEach((O,B)=>{A[B].isHidden&&O.classList.add("hidden"),A[B].isTruncated&&O.classList.add("super-text-truncate")});let P=0;for(const O of u.value.values())O>P&&(P=O);s.value=P},b=async()=>{await o.nextTick();const _=c().map(A=>{const P=A.getAttribute("node-id"),O=A.getAttribute("book-mark-content"),B=A.getAttribute("page-id"),F=A.getAttribute("page-number"),H=A.getBoundingClientRect(),G=A.getAttribute("line-id"),J=A.getAttribute("element-id");return{position:H,text:m(O),id:P,pageId:B,pageNumber:F,visiblePosition:f(A),status:0,lineId:G,elementId:J,textOriginal:m(O)}});n.value=_},v=(T,_)=>{const A=T.bottom<=_.top,P=T.top>=_.bottom;return!(A||P)};async function y(){const T=i.value;if(!T||T.length===0){g();return}T.sort((_,A)=>{const P=Number(_.getAttribute("index")),O=Number(A.getAttribute("index"));return P-O}),T.forEach(_=>_.classList.remove("super-text-truncate")),T.forEach((_,A)=>{const P=_.getBoundingClientRect();T.slice(A+1).forEach(O=>{const B=O.getBoundingClientRect();v(P,B)&&_.classList.add("super-text-truncate")})}),g()}const x=async T=>{await o.nextTick();const _=t==null?void 0:t.view.dom.querySelector(`[node-id='${T.dataId}']`),A=i.value.find(B=>{const F=B.getBoundingClientRect().top,H=_==null?void 0:_.getBoundingClientRect().top;if(H==null)return!1;const G=H-F;return Math.abs(G-9)<=2});if(!A)return;const P=Number(A.getAttribute("index"));if(!T.text){A.querySelector(".super-text-lines").innerHTML=n.value[P].textOriginal,i.value.forEach(B=>B.classList.remove("hidden")),y();return}A.querySelector(".super-text-lines").innerHTML=m(T.text),A.classList.remove("super-text-truncate");const O=A.getBoundingClientRect();i.value.forEach((B,F)=>{if(F!==P){const H=B.getBoundingClientRect();v(O,H)&&B.classList.add("hidden")}}),g()},C=T=>{switch(T.action){case"hover":x(T.payload);break;case"status":p(T.payload.id,T.payload.status);break;case"render":b();break;default:console.log("There is no action")}},k=(T,_)=>{const A=T.currentTarget;A.classList.remove("super-text-truncate");const P=A.getBoundingClientRect();i.value.forEach((O,B)=>{if(B!==_){const F=O.getBoundingClientRect();v(P,F)&&O.classList.add("hidden")}}),g()},E=()=>{i.value.forEach(T=>T.classList.remove("hidden")),y()};return o.onBeforeMount(()=>{a.on(C),window.addEventListener("resize",b)}),o.onBeforeUnmount(()=>{a.off(C),window.removeEventListener("resize",b)}),o.watch(()=>n,async()=>{await o.nextTick(),y()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:y,eventListener:C,handleMouseOver:k,handleMouseLeave:E,wrapperMinHeight:s}},Nee=["index","book-mark-id","line-id","onMouseover"],ete=["innerHTML"],tte=po(o.defineComponent({__name:"SuperTextView",props:{editor:{},superPreviewCustomClass:{},minChars:{},fontSize:{},fixedWidth:{type:Boolean}},setup(t,{expose:e}){const n=t,r=o.ref([]),i=o.ref([]),s=o.ref(!1),a=o.ref(!1),l=o.ref(null),u=o.inject("isMobile",!1),c=o.inject("fontWeight",o.ref("")),f=o.computed(()=>o.unref(c)||"normal"),p=o.inject("canEditSuper",o.ref(!0)),{onUpdate:m,handleMouseOver:g,handleMouseLeave:b,wrapperMinHeight:v}=sS(n.editor,l,i,"editor-container",r),y=(_,A)=>{p.value&&(l.value={id:_.id,text:_.text,elementId:_.elementId,index:A},s.value=!0,u&&(a.value=!0))},x=_=>{var A,P;return fd(_?((A=n.superPreviewCustomClass)==null?void 0:A.completedSuper)??"bg-black":((P=n.superPreviewCustomClass)==null?void 0:P.unproducedSuper)??"bg-red-500")},C=o.computed(()=>n.fontSize??""),k=o.computed(()=>n.fixedWidth??!1),{contentInner:E,measuredMinWidth:T}=pf({minChars:n.minChars,fontSize:C,fixed:k});return e({measuredMinWidthComment:T}),(_,A)=>{var O;const P=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:E,style:o.normalizeStyle({width:`${Number(o.unref(T))+25}px`,minHeight:`${o.unref(v)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",_.fixedWidth&&"overflow-hidden",((O=_.superPreviewCustomClass)==null?void 0:O.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(B,F)=>{var H,G,J;return o.openBlock(),o.createElementBlock("div",{key:B.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:F,"book-mark-id":B.id,"line-id":B.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${B.visiblePosition||((H=B.position)==null?void 0:H.top)}px`}),onMouseover:$=>o.unref(g)($,F),onMouseleave:A[0]||(A[0]=(...$)=>o.unref(b)&&o.unref(b)(...$))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("w-full px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",_.fixedWidth?"whitespace-nowrap overflow-hidden":"wrap-anywhere whitespace-break-spaces",B.elementId?((G=_.superPreviewCustomClass)==null?void 0:G.completedSuper)??"bg-black":((J=_.superPreviewCustomClass)==null?void 0:J.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(p)})),onDblclick:$=>y(B,F)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:f.value}),innerHTML:B.text},null,12,ete),o.createVNode(P,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",x(B.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,Nee)}),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(qc,{key:0,open:s.value,editor:n.editor,"super-text-init":l.value.text,"super-text-element-id":l.value.elementId,onClose:A[1]||(A[1]=B=>s.value=!1),onSave:o.unref(m)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-95cc6020"]]),nte=["index","book-mark-id","line-id","onMouseover"],rte=["innerHTML"],ote=po(o.defineComponent({__name:"SuperTextViewComment",props:{editor:{},disableSuperInput:{type:Boolean},superPreviewCustomClass:{},fixedWidth:{type:Boolean}},setup(t){const e=t,n=o.ref([]),r=o.ref([]),i=o.ref(!1),s=o.ref(!1),a=o.ref(null),l=o.inject("isMobile",!1),u=o.inject("fontWeight",o.ref("")),c=o.computed(()=>o.unref(u)||"normal"),f=o.inject("isEditable",o.ref(!0)),{onUpdate:p,handleMouseOver:m,handleMouseLeave:g,wrapperMinHeight:b}=sS(e.editor,a,r,"editor-container-comment",n),v=(C,k)=>{f.value&&(a.value={id:C.id,text:C.text,elementId:C.elementId,index:k},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},y=C=>{var k,E;return fd(C?((k=e.superPreviewCustomClass)==null?void 0:k.completedSuper)??"bg-black":((E=e.superPreviewCustomClass)==null?void 0:E.unproducedSuper)??"bg-red-500")},x=o.inject("measuredMinWidthComment",0);return(C,k)=>{var T;const E=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",style:o.normalizeStyle({width:`${Number(o.unref(x))+25}px`,minHeight:`${o.unref(b)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",C.fixedWidth&&"overflow-hidden",((T=C.superPreviewCustomClass)==null?void 0:T.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(_,A)=>{var P,O,B;return o.openBlock(),o.createElementBlock("div",{key:_.id,ref_for:!0,ref_key:"superTextRefs",ref:n,index:A,"book-mark-id":_.id,"line-id":_.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${_.visiblePosition||((P=_.position)==null?void 0:P.top)}px`}),onMouseover:F=>o.unref(m)(F,A),onMouseleave:k[0]||(k[0]=(...F)=>o.unref(g)&&o.unref(g)(...F))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("w-full px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",C.fixedWidth?"whitespace-nowrap overflow-hidden":"wrap-anywhere whitespace-break-spaces",_.elementId?((O=C.superPreviewCustomClass)==null?void 0:O.completedSuper)??"bg-black":((B=C.superPreviewCustomClass)==null?void 0:B.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(f)})),onDblclick:F=>v(_,A)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:c.value}),innerHTML:_.text},null,12,rte),o.createVNode(E,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",y(_.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,nte)}),128)),!o.unref(l)&&a.value&&!C.disableSuperInput?(o.openBlock(),o.createBlock(qc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:k[1]||(k[1]=_=>i.value=!1),onSave:o.unref(p)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-ef22c51f"]]),aS=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
345
- `).split(/\r?\n/),i=[];for(const a of r){const l=a.trim();if(l==="")i.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();i.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();i.push(`<p>${u}</p>`)}else/^<(?!p\b)[^>]+>/i.test(l)?i.push(`<p>${l}</p>`):i.push(l)}let s=i.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},Uv=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Wv=(t,e)=>{const{tr:n,selection:r,schema:i}=t.state,s=i.marks.link.create({href:e});return r.empty?(t.dispatch(n.insertText(e,r.from).addMark(r.from,r.from+e.length,s)),!0):(t.dispatch(n.addMark(r.from,r.to,s)),!0)},ite=(t,e)=>{const{tr:n,schema:r}=t.state,i=e.split(/(?:\r\n?|\n)/),s=[];if(i.forEach(u=>{let c={type:"paragraph"};u.length>0&&(c.content=[{type:"text",text:u}]);let f=Fr.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=be.fromArray(s),l=Te.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ste=xn(),Ph=t=>{const e=o.computed(()=>ste.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Kn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),jC(t)&&t.commands.focus()},{immediate:!0})},ate={id:"editor-container-comment",class:"flex flex-col"},lte={class:"flex flex-1"},ute={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},cte=o.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},showSuperElementIdColor:{type:Boolean},letterSpacingDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{},blockSeparatorPolicy:{},fixedSuperPreviewWidth:{type:Boolean}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=nt.useEventBus(hr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=xn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),y=new Vo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:cr.COMMENT,[cr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((_,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Ho),transformPastedHTML:_=>aS(_),handlePaste:(_,A)=>{const P=A.clipboardData;if(!P)return!1;const O=r.mode,B=P.getData("text/plain")||"",F=Array.from(P.items).some(H=>H.type.startsWith("image/"));return(O===Me.STRAIGHT||O===Me.REPORT)&&F?(A.preventDefault(),!0):O===Me.PLAIN_TEXT?(A.preventDefault(),_.dispatch(_.state.tr.insertText(B,_.state.selection.from)),!0):!1},clipboardTextParser:(_,A)=>{const P=_.split(/(?:\r\n?|\n)/),O=[];P.forEach(F=>{let H={type:"paragraph"};F.length>0&&(H.content=[{type:"text",text:F}]);let G=Fr.fromJSON(A.doc.type.schema,H);O.push(G)});const B=be.fromArray(O);return Te.maxOpen(B)}},onCreate:({editor:_})=>{f(_)},onUpdate:kt.throttle(({editor:_})=>{u.value=!0;const A=C(_,r.output);i("update:modelValue",A),i("change",{editor:_,output:A}),f(_),x()},Ho),extensions:r.extensions,editable:v.value,onFocus:_=>{g(k.value),b(_.editor)}});async function x(){await o.nextTick(),s.emit({action:"render"})}function C(_,A){if(!_)return"";if(_.isEmpty)return A==="json"?{}:"";switch(A){case"html":return _.getHTML();case"json":return _.getJSON();case"text":return _.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{const _=document.getElementById(cr.COMMENT);_==null||_.setAttribute(cr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),o.watch(()=>r.modelValue,_=>{if(!y||kt.isEqual(C(y,r.output),_))return;const{from:A,to:P}=y.state.selection;y.commands.setTextSelection({from:A,to:P}),y.commands.setContent(bn(_,r.disabled),!1),x()},{deep:!0}),o.watch(()=>v.value,_=>{var A;y==null||y.setEditable(_),(A=y==null?void 0:y.commands)!=null&&A.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(_)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:_})=>{i("changed:selection",{editor:_})})}),o.onUnmounted(()=>y==null?void 0:y.destroy()),xc(qu.SAVE,()=>{localStorage.setItem("comment",C(y,"html"))});const k=o.ref(null);function E(_){_===Me.REPORT&&g(k.value)}function T(_){_===Me.REPORT&&b(y)}return o.onMounted(()=>{E(r.mode),T(r.mode)}),o.watch(()=>r.mode,_=>{E(_),T(_)}),o.watch(()=>{var _,A;return(A=(_=r.editorContentInstance)==null?void 0:_.storage[np])==null?void 0:A.enabled},()=>{y.commands.toggleTimeHighlight()}),Ph(y),e({editor:y}),(_,A)=>(o.openBlock(),o.createElementBlock("div",ate,[o.createElementVNode("div",lte,[o.withDirectives(o.createVNode(ote,{"disable-super-input":_.disableSuperInput,editor:o.unref(y),"super-preview-custom-class":_.superPreviewCustomClass,"fixed-width":_.fixedSuperPreviewWidth},null,8,["disable-super-input","editor","super-preview-custom-class","fixed-width"]),[[o.vShow,_.isOpenSuperView]]),o.createElementVNode("div",ute,[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:k,"disable-super-input":_.disableSuperInput,editor:o.unref(y),mode:_.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(er),{editor:o.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function dte(t,e,n=!1,r=200){const{height:i}=nt.useElementSize(t),s=o.ref(0),a=o.ref(0),l=o.ref(r),u=o.ref(0),c=async()=>{await o.nextTick();const f=i.value-8;e.value===Me.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":i.value)};return n||o.watch(()=>i.value,c),o.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}var fte={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,m,g,b,v,y;function x(V){for(var z=V.length,q={0:0},ne=0;ne<z;ne++)V[ne]&&(q[V[ne].charCodeAt(0)]=ne);return q}p=x(s),m=x(a),g=x(l),b=x(u);function C(V){for(var z=V.length,q={},ne,de,Ee=0;Ee<z;Ee++)ne=V[Ee][0].charCodeAt(0),de=V[Ee][1].charCodeAt(0),typeof q[ne]>"u"&&(q[ne]={}),q[ne][de]=V[Ee][2].charCodeAt(0);return q}v=C(c),y=C(f);function k(V){return typeof p[V]<"u"}function E(V){return typeof m[V]<"u"}function T(V){return typeof g[V]<"u"}function _(V){return typeof b[V]<"u"}function A(V){return 44032<=V&&V<=55203}function P(V,z){return y[V]&&y[V][z]?y[V][z]:!1}function O(V,z){return v[V]&&v[V][z]?v[V][z]:!1}var B=function(V,z){if(V===null)throw new Error("Arguments cannot be null");typeof V=="object"&&(V=V.join(""));for(var q=[],ne=V.length,de,Ee,oe,me,Z,te=0;te<ne;te++){var re=[];me=V.charCodeAt(te),A(me)?(me-=i,oe=me%28,Ee=(me-oe)/28%21,de=parseInt((me-oe)/28/21),re.push(e[de]),typeof n[Ee]=="object"?re=re.concat(n[Ee]):re.push(n[Ee]),oe>0&&(typeof r[oe]=="object"?re=re.concat(r[oe]):re.push(r[oe]))):k(me)?(E(me)?Z=e[m[me]]:Z=r[b[me]],typeof Z=="string"?re.push(Z):re=re.concat(Z)):T(me)?(Z=n[g[me]],typeof Z=="string"?re.push(Z):re=re.concat(Z)):re.push(V.charAt(te)),z?q.push(re):q=q.concat(re)}return q},F=function(V){return typeof V!="string"?"":(V=B(V),V.join(""))},H=function(V){typeof V=="string"&&(V=B(V));var z=[],q=V.length,ne,de=0,Ee=-1,oe,me=!1;function Z(re){var ae,fe,Se,_e=0,ze,Ke="";if(me=!1,!(Ee+1>re))for(var je=1;;je++){if(je===1){if(ae=V[Ee+je].charCodeAt(0),T(ae))if(Ee+je+1<=re&&T(fe=V[Ee+je+1].charCodeAt(0))){z.push(String.fromCharCode(P(ae,fe))),Ee=re;return}else{z.push(V[Ee+je]),Ee=re;return}else if(!E(ae)){z.push(V[Ee+je]),Ee=re;return}Ke=V[Ee+je]}else if(je===2)if(fe=V[Ee+je].charCodeAt(0),E(fe)){ae=O(ae,fe),Ke=String.fromCharCode(ae),z.push(Ke),Ee=re;return}else Ke=String.fromCharCode((m[ae]*21+g[fe])*28+i);else je===3?(Se=V[Ee+je].charCodeAt(0),P(fe,Se)?fe=P(fe,Se):_e=Se,Ke=String.fromCharCode((m[ae]*21+g[fe])*28+b[_e]+i)):je===4?(ze=V[Ee+je].charCodeAt(0),O(_e,ze)?_e=O(_e,ze):_e=ze,Ke=String.fromCharCode((m[ae]*21+g[fe])*28+b[_e]+i)):je===5&&(ze=V[Ee+je].charCodeAt(0),_e=O(_e,ze),Ke=String.fromCharCode((m[ae]*21+g[fe])*28+b[_e]+i));if(Ee+je>=re){z.push(Ke),Ee=re;return}}}for(var te=0;te<q;te++){if(ne=V[te].charCodeAt(0),!E(ne)&&!T(ne)&&!_(ne)){Z(te-1),Z(te),de=0;continue}de===0?E(ne)?de=1:T(ne)&&(de=4):de==1?T(ne)?de=2:O(oe,ne)?de=5:Z(te-1):de==2?_(ne)?de=3:T(ne)?P(oe,ne)||(Z(te-1),de=4):(Z(te-1),de=1):de==3?_(ne)?!me&&O(oe,ne)?me=!0:(Z(te-1),de=1):E(ne)?(Z(te-1),de=1):T(ne)&&(Z(te-2),de=2):de==4?T(ne)?P(oe,ne)?(Z(te),de=0):Z(te-1):(Z(te-1),de=1):de==5&&(T(ne)?(Z(te-2),de=2):(Z(te-1),de=1)),oe=ne}return Z(te-1),z.join("")},G=function(V,z){var q=B(V).join(""),ne=B(z).join("");return q.indexOf(ne)},J=function(V,z){var q=B(V).join(""),ne=B(z).join(""),de=B(V,!0),Ee=new RegExp(ne,"gi"),oe=[],me;if(!z.length)return[];for(;me=Ee.exec(q);)oe.push(me.index);function Z(re){for(var ae=0,fe=0;ae<de.length;++ae)if(fe+=de[ae].length,re<fe)return ae}function te(re){for(var ae=0,fe=0;ae<de.length;++ae)if(fe+=de[ae].length,re+ne.length<=fe)return ae}return oe.map(function(re){return[Z(re),te(re)]})};function $(V){this.string=V,this.disassembled=B(V).join("")}$.prototype.search=function(V){return B(V).join("").indexOf(this.disassembled)};var R=function(V){typeof V=="object"&&(V=V.join(""));var z=V.charCodeAt(V.length-1);if(A(z)){z-=i;var q=z%28;if(q>0)return!0}else if(k(z))return!0;return!1},L=function(V,z){return B(V).pop()===z},U={disassemble:B,d:B,disassembleToString:F,ds:F,assemble:H,a:H,search:G,rangeSearch:J,Searcher:$,endsWithConsonant:R,endsWith:L,isHangul:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),A(V)},isComplete:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),A(V)},isConsonant:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),k(V)},isVowel:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),T(V)},isCho:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),E(V)},isJong:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),_(V)},isHangulAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!A(V.charCodeAt(z)))return!1;return!0},isCompleteAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!A(V.charCodeAt(z)))return!1;return!0},isConsonantAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!k(V.charCodeAt(z)))return!1;return!0},isVowelAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!T(V.charCodeAt(z)))return!1;return!0},isChoAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!E(V.charCodeAt(z)))return!1;return!0},isJongAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!_(V.charCodeAt(z)))return!1;return!0}};t.exports=U})()})(fte);const Yl=new Et("searchHighlight");function Vh(t,e,n){const r=[];if(!e)return r;const i=n.caseSensitive?e.normalize("NFC"):e.normalize("NFC").toLowerCase(),{doc:s}=t.state,a=l=>/[0-9A-Za-z가-힣_]/.test(l);return s.descendants((l,u)=>{if(!l.isText||!l.text)return;let c=l.text.normalize("NFC");n.caseSensitive||(c=c.toLowerCase());let f=0,p=c.indexOf(i,f);for(;p!==-1;){const m=p,g=p+i.length-1;if(n.wholeWord){const b=m>0?c[m-1]:"",v=g+1<c.length?c[g+1]:"";if(b&&a(b)||v&&a(v)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+m,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function jv(t){return t.state.selection.from}function lS(t){if(t.state.plugins.find(r=>r.spec.key===Yl))return;const n=new it({key:Yl,state:{init(){return ut.empty},apply(r,i){const s=r.getMeta(Yl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Yl.getState(r)}}});t.registerPlugin(n)}function uS(t,e,n){lS(t);const r=e.map((a,l)=>Kt.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=ut.create(t.state.doc,r),s=t.state.tr.setMeta(Yl,i);t.view.dispatch(s)}function Jl(t){lS(t);const e=t.state.tr.setMeta(Yl,ut.empty);t.view.dispatch(e)}function pte(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){var x;const m=t.value;if(!m||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,uS(m,n.value,e.value);const b=n.value[e.value],y=m.view.domAtPos(b.from).node;(x=y==null?void 0:y.scrollIntoView)==null||x.call(y,{block:"nearest",behavior:"smooth"}),m.chain().setTextSelection({from:b.from,to:b.to}).scrollIntoView().run()}function s(p){const m=t.value;if(!m)return;if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(v=>v.from>g);i(b===-1?0:b)}function a(p){const m=t.value;if(!m)return;if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m);let b=-1;for(let v=n.value.length-1;v>=0;v--)if(n.value[v].to<g){b=v;break}i(b===-1?n.value.length-1:b)}function l(p){const m=t.value;if(!m||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:b}=m,v=b.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?v===p.find:v.toLowerCase()===p.find.toLowerCase())){s(p);return}m.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const m=t.value;if(!m)return;const g=Vh(m,p.find,p);if(g.length===0)return;const b=m.chain().focus();[...g].reverse().forEach(v=>{b.setTextSelection({from:v.from,to:v.to}).insertContent(p.replace)}),b.run(),n.value=[],e.value=-1,Jl(m)}function c(p){const m=t.value;if(!m)return;if(!p.find){n.value=[],e.value=-1,Jl(m);return}if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(y=>y.from>=g),v=b===-1?0:b;e.value=v,i(v),uS(m,n.value,v)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Jl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const cS=o.defineComponent({__name:"Checkbox",props:{defaultChecked:{type:Boolean},checked:{type:[Boolean,String]},disabled:{type:Boolean},required:{type:Boolean},name:{},value:{},id:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,...l}=n;return l}),s=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(FD),o.mergeProps(o.unref(s),{class:o.unref(ke)("peer h-5 w-5 shrink-0 rounded-sm border border-ed-border shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50 text-ed-blue",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref($D),{class:"flex h-full w-full items-center justify-center"},{default:o.withCtx(()=>[o.renderSlot(a.$slots,"default",{},()=>[o.createVNode(o.unref(G1),{icon:"fa-solid:check"})])]),_:3})]),_:3},16,["class"]))}}),hte={class:"flex items-center justify-between px-5 pt-4 pb-2 cursor-move bg-[#F6FAFE]"},mte={class:"text-base font-semibold text-gray-800"},gte={class:"px-5 pt-[20px] pb-4 flex flex-col gap-y-3 bg-white"},bte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},vte={class:"text-right text-sm text-gray-600"},yte={class:"relative"},wte={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-400 pointer-events-none"},xte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},Cte={class:"text-right text-sm text-gray-600"},Ete={class:"grid grid-cols-[60px,1fr] gap-x-3"},kte={class:"flex gap-x-5"},Ste={class:"flex items-center space-x-2 text-sm"},_te={for:"caseSensitive",class:"select-none text-gray-700"},Tte={class:"grid grid-cols-[60px,1fr] gap-x-3"},Ate={class:"flex gap-x-2"},Mte=po(o.defineComponent({__name:"BatchReplaceDialog",props:{modelValue:{type:Boolean},totalMatches:{default:0},currentMatchIndex:{default:-1}},emits:["update:modelValue","search-down","search-up","replace","replace-all","refresh"],setup(t,{emit:e}){const n=t,r=e;function i(){return{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value}}const s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=o.ref(!1),f=o.computed(()=>s.value?n.totalMatches===0?"No matches":`${n.currentMatchIndex+1} / ${n.totalMatches}`:""),p=nt.useLocalStorage("findReplaceDialogPosition",null),m=o.reactive({x:0,y:0}),g=o.ref(!1),b={x:0,y:0},v=O=>{const B=O.target;if(B.closest("input")||B.closest("button")||B.closest("label")||B.closest(".content-area"))return;g.value=!0;const F=document.querySelector(".find-replace-dialog");if(!F)return;const H=F.getBoundingClientRect();b.x=O.clientX-H.left,b.y=O.clientY-H.top,document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},y=O=>{g.value&&(m.x=O.clientX-b.x,m.y=O.clientY-b.y)},x=()=>{g.value=!1,p.value={x:m.x,y:m.y},document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)};o.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)}),o.watch(()=>n.modelValue,async O=>{var G,J;if(!O)return;await o.nextTick();const B=document.querySelector(".find-replace-dialog");if(!B)return;const F=window.innerWidth,H=window.innerHeight;p.value&&p.value.x!==void 0&&p.value.y!==void 0?(m.x=p.value.x,m.y=p.value.y):(m.x=Math.max((F-B.offsetWidth)/2,0),m.y=Math.max((H-B.offsetHeight)/2,0)),s.value&&r("refresh",i()),await o.nextTick(),(J=(G=l.value)==null?void 0:G.$el)==null||J.focus()});const C=()=>{r("update:modelValue",!1)},k=()=>{s.value&&r("search-down",i())},E=()=>{s.value&&r("search-up",i())},T=()=>{r("replace",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})},_=()=>{r("replace-all",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})};function A(O){const B=O.target.value;s.value=B,r("refresh",i())}function P(O){const F=O.target.value+(O.data??"");r("refresh",{find:F,replace:a.value,caseSensitive:u.value,wholeWord:c.value})}return(O,B)=>{const F=bs,H=cS,G=vn,J=Fc,$=Vc;return o.openBlock(),o.createBlock($,{open:O.modelValue},{default:o.withCtx(()=>[o.createVNode(J,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"find-replace-dialog fixed z-[70] pointer-events-auto w-[460px] rounded-[10px] overflow-hidden bg-white shadow-xl",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${m.x}px, ${m.y}px)`}),onMousedown:v},[o.createElementVNode("div",hte,[o.createElementVNode("span",mte,o.toDisplayString(O.$t("찾기 및 바꾸기")),1),o.createElementVNode("button",{class:"bg-transparent text-gray-400 hover:text-gray-600 transition-colors p-1",onClick:C},[o.createVNode(o.unref(Sc),{class:"w-5 h-5"})])]),o.createElementVNode("div",gte,[o.createElementVNode("div",bte,[o.createElementVNode("label",vte,o.toDisplayString(O.$t("검색")),1),o.createElementVNode("div",yte,[o.createVNode(F,{ref_key:"findInputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":B[0]||(B[0]=R=>s.value=R),class:"rounded-md h-[36px] text-sm pr-[90px] !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none",onInput:A,onCompositionupdate:P,onKeydown:o.withKeys(o.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),o.unref(f)?(o.openBlock(),o.createElementBlock("span",wte,o.toDisplayString(o.unref(f)),1)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",xte,[o.createElementVNode("label",Cte,o.toDisplayString(O.$t("바꾸기")),1),o.createVNode(F,{modelValue:a.value,"onUpdate:modelValue":B[1]||(B[1]=R=>a.value=R),class:"rounded-md h-[36px] text-sm !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none"},null,8,["modelValue"])]),o.createElementVNode("div",Ete,[B[3]||(B[3]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",kte,[o.createElementVNode("div",Ste,[o.createVNode(H,{id:"caseSensitive",checked:u.value,"onUpdate:checked":B[2]||(B[2]=R=>{u.value=!!R})},null,8,["checked"]),o.createElementVNode("label",_te,o.toDisplayString(O.$t("대소문자 일치")),1)])])]),o.createElementVNode("div",Tte,[B[4]||(B[4]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",Ate,[o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("바꾸기")),1)]),_:1}),o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:_},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("모두 바꾸기")),1)]),_:1}),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:E},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("이전")),1)]),_:1},8,["disabled"]),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:k},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("다음")),1)]),_:1},8,["disabled"])])])])],36)]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-5ec84714"]]),Ote={class:"flex flex-1"},Fh=o.defineComponent({__name:"CoreEditorV2",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:"NanumGothicCoding"},fontWeightDefault:{default:void 0},showSuperElementIdColor:{type:Boolean},letterSpacingDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{default:null},fieldNameCommentCuesheet:{default:null},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean,default:!1},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean,default:!1},autoFocus:{type:Boolean},superPreviewCustomClass:{default:()=>({overall:"bg-ed-gray-50",unproducedSuper:"bg-red-500",completedSuper:"bg-black"})},minChar:{default:()=>({superPreview:29,content:26})},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{default:void 0},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{},blockSeparatorPolicy:{default:"paragraph"},fixedSuperPreviewWidth:{type:Boolean,default:!1}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur","open-batch-replace"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=nt.useEventBus(hr.RENDER_SUPER_TEXT),a=nt.useEventBus(hr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{isFullscreen:c,isReady:f,editor:p,updateEditorState:m,superTextStore:g,checkSpellStore:b,setEditorContextMenuRef:v,setEditorContentInstance:y,setEditorFocusedInstance:x}=u,C=o.computed(()=>!(r.disabled||r.readonly));o.provide("isEditable",C);const k=o.computed(()=>C.value?!0:r.canEditSuperReadOnly);o.provide("canEditSuper",k),o.provide("showSuperElementIdColor",o.computed(()=>r.showSuperElementIdColor??!1));const E=o.computed(()=>r.mode===Me.EDITOR),T=o.ref(r.fontSizeDefault),_=o.ref(r.fontFamilyDefault),A=o.ref(r.fontWeightDefault);o.provide("fontSize",T),o.provide("fontFamily",_),o.provide("fontWeight",A),o.watch(()=>r.fontFamilyDefault,se=>{_.value=se}),o.watch(()=>r.fontWeightDefault,se=>{A.value=se});const P=se=>{!C.value||!((se.ctrlKey||se.metaKey)&&se.key.toLowerCase()==="h")||(se.preventDefault(),se.stopPropagation(),se.stopImmediatePropagation(),F.value=!0)};o.onMounted(()=>{ze(),window.addEventListener("keydown",P,!0)}),o.onUnmounted(()=>{window.removeEventListener("keydown",P,!0)}),o.onActivated(()=>{window.addEventListener("keydown",P,!0)}),o.onDeactivated(()=>{window.removeEventListener("keydown",P,!0)});const O=se=>{const Oe=parseInt(T.value||"16px"),_t=se?Oe+2:Oe-2;T.value=_t+"px"};o.onBeforeMount(()=>{r.disabled||a.on(O)}),o.onBeforeUnmount(()=>{r.disabled||a.off(O)});const B=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?sn(r.minHeight):void 0,maxHeight:r.maxHeight?sn(r.maxHeight):void 0,height:r.height?sn(r.height):void 0},maxWidth:sn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),F=o.ref(!1),{searchUp:H,searchDown:G,replaceCurrent:J,replaceAll:$,totalMatches:R,currentMatchIndex:L,refreshMatches:U,clearSearch:V}=pte(p);o.watch(F,se=>{se||V()});const z=se=>{U(se)},q=se=>{G(se)},ne=se=>{H(se)},de=se=>{J(se)},Ee=se=>{$(se)},oe=new Vo({coreExtensionOptions:{clipboardTextSerializer:{blockSeparator:r.blockSeparatorPolicy==="line"?`
345
+ `).split(/\r?\n/),i=[];for(const a of r){const l=a.trim();if(l==="")i.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();i.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();i.push(`<p>${u}</p>`)}else/^<p\b/i.test(l)?i.push(l):i.push(`<p>${l}</p>`)}let s=i.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},Uv=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Wv=(t,e)=>{const{tr:n,selection:r,schema:i}=t.state,s=i.marks.link.create({href:e});return r.empty?(t.dispatch(n.insertText(e,r.from).addMark(r.from,r.from+e.length,s)),!0):(t.dispatch(n.addMark(r.from,r.to,s)),!0)},ite=(t,e)=>{const{tr:n,schema:r}=t.state,i=e.split(/(?:\r\n?|\n)/),s=[];if(i.forEach(u=>{let c={type:"paragraph"};u.length>0&&(c.content=[{type:"text",text:u}]);let f=Fr.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=be.fromArray(s),l=Te.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ste=xn(),Ph=t=>{const e=o.computed(()=>ste.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Kn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),jC(t)&&t.commands.focus()},{immediate:!0})},ate={id:"editor-container-comment",class:"flex flex-col"},lte={class:"flex flex-1"},ute={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},cte=o.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},showSuperElementIdColor:{type:Boolean},letterSpacingDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{},blockSeparatorPolicy:{},fixedSuperPreviewWidth:{type:Boolean}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=nt.useEventBus(hr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=xn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),y=new Vo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:cr.COMMENT,[cr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((_,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Ho),transformPastedHTML:_=>aS(_),handlePaste:(_,A)=>{const P=A.clipboardData;if(!P)return!1;const O=r.mode,B=P.getData("text/plain")||"",F=Array.from(P.items).some(H=>H.type.startsWith("image/"));return(O===Me.STRAIGHT||O===Me.REPORT)&&F?(A.preventDefault(),!0):O===Me.PLAIN_TEXT?(A.preventDefault(),_.dispatch(_.state.tr.insertText(B,_.state.selection.from)),!0):!1},clipboardTextParser:(_,A)=>{const P=_.split(/(?:\r\n?|\n)/),O=[];P.forEach(F=>{let H={type:"paragraph"};F.length>0&&(H.content=[{type:"text",text:F}]);let G=Fr.fromJSON(A.doc.type.schema,H);O.push(G)});const B=be.fromArray(O);return Te.maxOpen(B)}},onCreate:({editor:_})=>{f(_)},onUpdate:kt.throttle(({editor:_})=>{u.value=!0;const A=C(_,r.output);i("update:modelValue",A),i("change",{editor:_,output:A}),f(_),x()},Ho),extensions:r.extensions,editable:v.value,onFocus:_=>{g(k.value),b(_.editor)}});async function x(){await o.nextTick(),s.emit({action:"render"})}function C(_,A){if(!_)return"";if(_.isEmpty)return A==="json"?{}:"";switch(A){case"html":return _.getHTML();case"json":return _.getJSON();case"text":return _.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{const _=document.getElementById(cr.COMMENT);_==null||_.setAttribute(cr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),o.watch(()=>r.modelValue,_=>{if(!y||kt.isEqual(C(y,r.output),_))return;const{from:A,to:P}=y.state.selection;y.commands.setTextSelection({from:A,to:P}),y.commands.setContent(bn(_,r.disabled),!1),x()},{deep:!0}),o.watch(()=>v.value,_=>{var A;y==null||y.setEditable(_),(A=y==null?void 0:y.commands)!=null&&A.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(_)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:_})=>{i("changed:selection",{editor:_})})}),o.onUnmounted(()=>y==null?void 0:y.destroy()),xc(qu.SAVE,()=>{localStorage.setItem("comment",C(y,"html"))});const k=o.ref(null);function E(_){_===Me.REPORT&&g(k.value)}function T(_){_===Me.REPORT&&b(y)}return o.onMounted(()=>{E(r.mode),T(r.mode)}),o.watch(()=>r.mode,_=>{E(_),T(_)}),o.watch(()=>{var _,A;return(A=(_=r.editorContentInstance)==null?void 0:_.storage[np])==null?void 0:A.enabled},()=>{y.commands.toggleTimeHighlight()}),Ph(y),e({editor:y}),(_,A)=>(o.openBlock(),o.createElementBlock("div",ate,[o.createElementVNode("div",lte,[o.withDirectives(o.createVNode(ote,{"disable-super-input":_.disableSuperInput,editor:o.unref(y),"super-preview-custom-class":_.superPreviewCustomClass,"fixed-width":_.fixedSuperPreviewWidth},null,8,["disable-super-input","editor","super-preview-custom-class","fixed-width"]),[[o.vShow,_.isOpenSuperView]]),o.createElementVNode("div",ute,[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:k,"disable-super-input":_.disableSuperInput,editor:o.unref(y),mode:_.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(er),{editor:o.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function dte(t,e,n=!1,r=200){const{height:i}=nt.useElementSize(t),s=o.ref(0),a=o.ref(0),l=o.ref(r),u=o.ref(0),c=async()=>{await o.nextTick();const f=i.value-8;e.value===Me.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":i.value)};return n||o.watch(()=>i.value,c),o.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}var fte={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,m,g,b,v,y;function x(V){for(var z=V.length,q={0:0},ne=0;ne<z;ne++)V[ne]&&(q[V[ne].charCodeAt(0)]=ne);return q}p=x(s),m=x(a),g=x(l),b=x(u);function C(V){for(var z=V.length,q={},ne,de,Ee=0;Ee<z;Ee++)ne=V[Ee][0].charCodeAt(0),de=V[Ee][1].charCodeAt(0),typeof q[ne]>"u"&&(q[ne]={}),q[ne][de]=V[Ee][2].charCodeAt(0);return q}v=C(c),y=C(f);function k(V){return typeof p[V]<"u"}function E(V){return typeof m[V]<"u"}function T(V){return typeof g[V]<"u"}function _(V){return typeof b[V]<"u"}function A(V){return 44032<=V&&V<=55203}function P(V,z){return y[V]&&y[V][z]?y[V][z]:!1}function O(V,z){return v[V]&&v[V][z]?v[V][z]:!1}var B=function(V,z){if(V===null)throw new Error("Arguments cannot be null");typeof V=="object"&&(V=V.join(""));for(var q=[],ne=V.length,de,Ee,oe,me,Z,te=0;te<ne;te++){var re=[];me=V.charCodeAt(te),A(me)?(me-=i,oe=me%28,Ee=(me-oe)/28%21,de=parseInt((me-oe)/28/21),re.push(e[de]),typeof n[Ee]=="object"?re=re.concat(n[Ee]):re.push(n[Ee]),oe>0&&(typeof r[oe]=="object"?re=re.concat(r[oe]):re.push(r[oe]))):k(me)?(E(me)?Z=e[m[me]]:Z=r[b[me]],typeof Z=="string"?re.push(Z):re=re.concat(Z)):T(me)?(Z=n[g[me]],typeof Z=="string"?re.push(Z):re=re.concat(Z)):re.push(V.charAt(te)),z?q.push(re):q=q.concat(re)}return q},F=function(V){return typeof V!="string"?"":(V=B(V),V.join(""))},H=function(V){typeof V=="string"&&(V=B(V));var z=[],q=V.length,ne,de=0,Ee=-1,oe,me=!1;function Z(re){var ae,fe,Se,_e=0,ze,Ke="";if(me=!1,!(Ee+1>re))for(var je=1;;je++){if(je===1){if(ae=V[Ee+je].charCodeAt(0),T(ae))if(Ee+je+1<=re&&T(fe=V[Ee+je+1].charCodeAt(0))){z.push(String.fromCharCode(P(ae,fe))),Ee=re;return}else{z.push(V[Ee+je]),Ee=re;return}else if(!E(ae)){z.push(V[Ee+je]),Ee=re;return}Ke=V[Ee+je]}else if(je===2)if(fe=V[Ee+je].charCodeAt(0),E(fe)){ae=O(ae,fe),Ke=String.fromCharCode(ae),z.push(Ke),Ee=re;return}else Ke=String.fromCharCode((m[ae]*21+g[fe])*28+i);else je===3?(Se=V[Ee+je].charCodeAt(0),P(fe,Se)?fe=P(fe,Se):_e=Se,Ke=String.fromCharCode((m[ae]*21+g[fe])*28+b[_e]+i)):je===4?(ze=V[Ee+je].charCodeAt(0),O(_e,ze)?_e=O(_e,ze):_e=ze,Ke=String.fromCharCode((m[ae]*21+g[fe])*28+b[_e]+i)):je===5&&(ze=V[Ee+je].charCodeAt(0),_e=O(_e,ze),Ke=String.fromCharCode((m[ae]*21+g[fe])*28+b[_e]+i));if(Ee+je>=re){z.push(Ke),Ee=re;return}}}for(var te=0;te<q;te++){if(ne=V[te].charCodeAt(0),!E(ne)&&!T(ne)&&!_(ne)){Z(te-1),Z(te),de=0;continue}de===0?E(ne)?de=1:T(ne)&&(de=4):de==1?T(ne)?de=2:O(oe,ne)?de=5:Z(te-1):de==2?_(ne)?de=3:T(ne)?P(oe,ne)||(Z(te-1),de=4):(Z(te-1),de=1):de==3?_(ne)?!me&&O(oe,ne)?me=!0:(Z(te-1),de=1):E(ne)?(Z(te-1),de=1):T(ne)&&(Z(te-2),de=2):de==4?T(ne)?P(oe,ne)?(Z(te),de=0):Z(te-1):(Z(te-1),de=1):de==5&&(T(ne)?(Z(te-2),de=2):(Z(te-1),de=1)),oe=ne}return Z(te-1),z.join("")},G=function(V,z){var q=B(V).join(""),ne=B(z).join("");return q.indexOf(ne)},J=function(V,z){var q=B(V).join(""),ne=B(z).join(""),de=B(V,!0),Ee=new RegExp(ne,"gi"),oe=[],me;if(!z.length)return[];for(;me=Ee.exec(q);)oe.push(me.index);function Z(re){for(var ae=0,fe=0;ae<de.length;++ae)if(fe+=de[ae].length,re<fe)return ae}function te(re){for(var ae=0,fe=0;ae<de.length;++ae)if(fe+=de[ae].length,re+ne.length<=fe)return ae}return oe.map(function(re){return[Z(re),te(re)]})};function $(V){this.string=V,this.disassembled=B(V).join("")}$.prototype.search=function(V){return B(V).join("").indexOf(this.disassembled)};var R=function(V){typeof V=="object"&&(V=V.join(""));var z=V.charCodeAt(V.length-1);if(A(z)){z-=i;var q=z%28;if(q>0)return!0}else if(k(z))return!0;return!1},L=function(V,z){return B(V).pop()===z},U={disassemble:B,d:B,disassembleToString:F,ds:F,assemble:H,a:H,search:G,rangeSearch:J,Searcher:$,endsWithConsonant:R,endsWith:L,isHangul:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),A(V)},isComplete:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),A(V)},isConsonant:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),k(V)},isVowel:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),T(V)},isCho:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),E(V)},isJong:function(V){return typeof V=="string"&&(V=V.charCodeAt(0)),_(V)},isHangulAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!A(V.charCodeAt(z)))return!1;return!0},isCompleteAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!A(V.charCodeAt(z)))return!1;return!0},isConsonantAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!k(V.charCodeAt(z)))return!1;return!0},isVowelAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!T(V.charCodeAt(z)))return!1;return!0},isChoAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!E(V.charCodeAt(z)))return!1;return!0},isJongAll:function(V){if(typeof V!="string")return!1;for(var z=0;z<V.length;z++)if(!_(V.charCodeAt(z)))return!1;return!0}};t.exports=U})()})(fte);const Yl=new Et("searchHighlight");function Vh(t,e,n){const r=[];if(!e)return r;const i=n.caseSensitive?e.normalize("NFC"):e.normalize("NFC").toLowerCase(),{doc:s}=t.state,a=l=>/[0-9A-Za-z가-힣_]/.test(l);return s.descendants((l,u)=>{if(!l.isText||!l.text)return;let c=l.text.normalize("NFC");n.caseSensitive||(c=c.toLowerCase());let f=0,p=c.indexOf(i,f);for(;p!==-1;){const m=p,g=p+i.length-1;if(n.wholeWord){const b=m>0?c[m-1]:"",v=g+1<c.length?c[g+1]:"";if(b&&a(b)||v&&a(v)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+m,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function jv(t){return t.state.selection.from}function lS(t){if(t.state.plugins.find(r=>r.spec.key===Yl))return;const n=new it({key:Yl,state:{init(){return ut.empty},apply(r,i){const s=r.getMeta(Yl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Yl.getState(r)}}});t.registerPlugin(n)}function uS(t,e,n){lS(t);const r=e.map((a,l)=>Kt.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=ut.create(t.state.doc,r),s=t.state.tr.setMeta(Yl,i);t.view.dispatch(s)}function Jl(t){lS(t);const e=t.state.tr.setMeta(Yl,ut.empty);t.view.dispatch(e)}function pte(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){var x;const m=t.value;if(!m||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,uS(m,n.value,e.value);const b=n.value[e.value],y=m.view.domAtPos(b.from).node;(x=y==null?void 0:y.scrollIntoView)==null||x.call(y,{block:"nearest",behavior:"smooth"}),m.chain().setTextSelection({from:b.from,to:b.to}).scrollIntoView().run()}function s(p){const m=t.value;if(!m)return;if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(v=>v.from>g);i(b===-1?0:b)}function a(p){const m=t.value;if(!m)return;if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m);let b=-1;for(let v=n.value.length-1;v>=0;v--)if(n.value[v].to<g){b=v;break}i(b===-1?n.value.length-1:b)}function l(p){const m=t.value;if(!m||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:b}=m,v=b.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?v===p.find:v.toLowerCase()===p.find.toLowerCase())){s(p);return}m.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const m=t.value;if(!m)return;const g=Vh(m,p.find,p);if(g.length===0)return;const b=m.chain().focus();[...g].reverse().forEach(v=>{b.setTextSelection({from:v.from,to:v.to}).insertContent(p.replace)}),b.run(),n.value=[],e.value=-1,Jl(m)}function c(p){const m=t.value;if(!m)return;if(!p.find){n.value=[],e.value=-1,Jl(m);return}if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(y=>y.from>=g),v=b===-1?0:b;e.value=v,i(v),uS(m,n.value,v)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Jl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const cS=o.defineComponent({__name:"Checkbox",props:{defaultChecked:{type:Boolean},checked:{type:[Boolean,String]},disabled:{type:Boolean},required:{type:Boolean},name:{},value:{},id:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,...l}=n;return l}),s=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(FD),o.mergeProps(o.unref(s),{class:o.unref(ke)("peer h-5 w-5 shrink-0 rounded-sm border border-ed-border shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50 text-ed-blue",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref($D),{class:"flex h-full w-full items-center justify-center"},{default:o.withCtx(()=>[o.renderSlot(a.$slots,"default",{},()=>[o.createVNode(o.unref(G1),{icon:"fa-solid:check"})])]),_:3})]),_:3},16,["class"]))}}),hte={class:"flex items-center justify-between px-5 pt-4 pb-2 cursor-move bg-[#F6FAFE]"},mte={class:"text-base font-semibold text-gray-800"},gte={class:"px-5 pt-[20px] pb-4 flex flex-col gap-y-3 bg-white"},bte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},vte={class:"text-right text-sm text-gray-600"},yte={class:"relative"},wte={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-400 pointer-events-none"},xte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},Cte={class:"text-right text-sm text-gray-600"},Ete={class:"grid grid-cols-[60px,1fr] gap-x-3"},kte={class:"flex gap-x-5"},Ste={class:"flex items-center space-x-2 text-sm"},_te={for:"caseSensitive",class:"select-none text-gray-700"},Tte={class:"grid grid-cols-[60px,1fr] gap-x-3"},Ate={class:"flex gap-x-2"},Mte=po(o.defineComponent({__name:"BatchReplaceDialog",props:{modelValue:{type:Boolean},totalMatches:{default:0},currentMatchIndex:{default:-1}},emits:["update:modelValue","search-down","search-up","replace","replace-all","refresh"],setup(t,{emit:e}){const n=t,r=e;function i(){return{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value}}const s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=o.ref(!1),f=o.computed(()=>s.value?n.totalMatches===0?"No matches":`${n.currentMatchIndex+1} / ${n.totalMatches}`:""),p=nt.useLocalStorage("findReplaceDialogPosition",null),m=o.reactive({x:0,y:0}),g=o.ref(!1),b={x:0,y:0},v=O=>{const B=O.target;if(B.closest("input")||B.closest("button")||B.closest("label")||B.closest(".content-area"))return;g.value=!0;const F=document.querySelector(".find-replace-dialog");if(!F)return;const H=F.getBoundingClientRect();b.x=O.clientX-H.left,b.y=O.clientY-H.top,document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},y=O=>{g.value&&(m.x=O.clientX-b.x,m.y=O.clientY-b.y)},x=()=>{g.value=!1,p.value={x:m.x,y:m.y},document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)};o.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)}),o.watch(()=>n.modelValue,async O=>{var G,J;if(!O)return;await o.nextTick();const B=document.querySelector(".find-replace-dialog");if(!B)return;const F=window.innerWidth,H=window.innerHeight;p.value&&p.value.x!==void 0&&p.value.y!==void 0?(m.x=p.value.x,m.y=p.value.y):(m.x=Math.max((F-B.offsetWidth)/2,0),m.y=Math.max((H-B.offsetHeight)/2,0)),s.value&&r("refresh",i()),await o.nextTick(),(J=(G=l.value)==null?void 0:G.$el)==null||J.focus()});const C=()=>{r("update:modelValue",!1)},k=()=>{s.value&&r("search-down",i())},E=()=>{s.value&&r("search-up",i())},T=()=>{r("replace",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})},_=()=>{r("replace-all",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})};function A(O){const B=O.target.value;s.value=B,r("refresh",i())}function P(O){const F=O.target.value+(O.data??"");r("refresh",{find:F,replace:a.value,caseSensitive:u.value,wholeWord:c.value})}return(O,B)=>{const F=bs,H=cS,G=vn,J=Fc,$=Vc;return o.openBlock(),o.createBlock($,{open:O.modelValue},{default:o.withCtx(()=>[o.createVNode(J,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"find-replace-dialog fixed z-[70] pointer-events-auto w-[460px] rounded-[10px] overflow-hidden bg-white shadow-xl",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${m.x}px, ${m.y}px)`}),onMousedown:v},[o.createElementVNode("div",hte,[o.createElementVNode("span",mte,o.toDisplayString(O.$t("찾기 및 바꾸기")),1),o.createElementVNode("button",{class:"bg-transparent text-gray-400 hover:text-gray-600 transition-colors p-1",onClick:C},[o.createVNode(o.unref(Sc),{class:"w-5 h-5"})])]),o.createElementVNode("div",gte,[o.createElementVNode("div",bte,[o.createElementVNode("label",vte,o.toDisplayString(O.$t("검색")),1),o.createElementVNode("div",yte,[o.createVNode(F,{ref_key:"findInputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":B[0]||(B[0]=R=>s.value=R),class:"rounded-md h-[36px] text-sm pr-[90px] !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none",onInput:A,onCompositionupdate:P,onKeydown:o.withKeys(o.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),o.unref(f)?(o.openBlock(),o.createElementBlock("span",wte,o.toDisplayString(o.unref(f)),1)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",xte,[o.createElementVNode("label",Cte,o.toDisplayString(O.$t("바꾸기")),1),o.createVNode(F,{modelValue:a.value,"onUpdate:modelValue":B[1]||(B[1]=R=>a.value=R),class:"rounded-md h-[36px] text-sm !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none"},null,8,["modelValue"])]),o.createElementVNode("div",Ete,[B[3]||(B[3]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",kte,[o.createElementVNode("div",Ste,[o.createVNode(H,{id:"caseSensitive",checked:u.value,"onUpdate:checked":B[2]||(B[2]=R=>{u.value=!!R})},null,8,["checked"]),o.createElementVNode("label",_te,o.toDisplayString(O.$t("대소문자 일치")),1)])])]),o.createElementVNode("div",Tte,[B[4]||(B[4]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",Ate,[o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("바꾸기")),1)]),_:1}),o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:_},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("모두 바꾸기")),1)]),_:1}),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:E},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("이전")),1)]),_:1},8,["disabled"]),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:k},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("다음")),1)]),_:1},8,["disabled"])])])])],36)]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-5ec84714"]]),Ote={class:"flex flex-1"},Fh=o.defineComponent({__name:"CoreEditorV2",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:"NanumGothicCoding"},fontWeightDefault:{default:void 0},showSuperElementIdColor:{type:Boolean},letterSpacingDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{default:null},fieldNameCommentCuesheet:{default:null},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean,default:!1},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean,default:!1},autoFocus:{type:Boolean},superPreviewCustomClass:{default:()=>({overall:"bg-ed-gray-50",unproducedSuper:"bg-red-500",completedSuper:"bg-black"})},minChar:{default:()=>({superPreview:29,content:26})},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{default:void 0},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{},blockSeparatorPolicy:{default:"paragraph"},fixedSuperPreviewWidth:{type:Boolean,default:!1}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur","open-batch-replace"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=nt.useEventBus(hr.RENDER_SUPER_TEXT),a=nt.useEventBus(hr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{isFullscreen:c,isReady:f,editor:p,updateEditorState:m,superTextStore:g,checkSpellStore:b,setEditorContextMenuRef:v,setEditorContentInstance:y,setEditorFocusedInstance:x}=u,C=o.computed(()=>!(r.disabled||r.readonly));o.provide("isEditable",C);const k=o.computed(()=>C.value?!0:r.canEditSuperReadOnly);o.provide("canEditSuper",k),o.provide("showSuperElementIdColor",o.computed(()=>r.showSuperElementIdColor??!1));const E=o.computed(()=>r.mode===Me.EDITOR),T=o.ref(r.fontSizeDefault),_=o.ref(r.fontFamilyDefault),A=o.ref(r.fontWeightDefault);o.provide("fontSize",T),o.provide("fontFamily",_),o.provide("fontWeight",A),o.watch(()=>r.fontFamilyDefault,se=>{_.value=se}),o.watch(()=>r.fontWeightDefault,se=>{A.value=se});const P=se=>{!C.value||!((se.ctrlKey||se.metaKey)&&se.key.toLowerCase()==="h")||(se.preventDefault(),se.stopPropagation(),se.stopImmediatePropagation(),F.value=!0)};o.onMounted(()=>{ze(),window.addEventListener("keydown",P,!0)}),o.onUnmounted(()=>{window.removeEventListener("keydown",P,!0)}),o.onActivated(()=>{window.addEventListener("keydown",P,!0)}),o.onDeactivated(()=>{window.removeEventListener("keydown",P,!0)});const O=se=>{const Oe=parseInt(T.value||"16px"),_t=se?Oe+2:Oe-2;T.value=_t+"px"};o.onBeforeMount(()=>{r.disabled||a.on(O)}),o.onBeforeUnmount(()=>{r.disabled||a.off(O)});const B=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?sn(r.minHeight):void 0,maxHeight:r.maxHeight?sn(r.maxHeight):void 0,height:r.height?sn(r.height):void 0},maxWidth:sn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),F=o.ref(!1),{searchUp:H,searchDown:G,replaceCurrent:J,replaceAll:$,totalMatches:R,currentMatchIndex:L,refreshMatches:U,clearSearch:V}=pte(p);o.watch(F,se=>{se||V()});const z=se=>{U(se)},q=se=>{G(se)},ne=se=>{H(se)},de=se=>{J(se)},Ee=se=>{$(se)},oe=new Vo({coreExtensionOptions:{clipboardTextSerializer:{blockSeparator:r.blockSeparatorPolicy==="line"?`
346
346
  `:`
347
347
 
348
348
  `}},enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((se,Oe)=>Oe.key==="Enter"&&l.enter&&!Oe.shiftKey?(i("enter"),!0):!1,Ho),transformPastedHTML:se=>r.mode===Me.EDITOR?cx(se):aS(se),handlePaste:(se,Oe)=>{var Gt;const _t=Oe.clipboardData;if(!_t)return!1;const ie=r.mode,Ae=Array.from(_t.items),He=Ae.some(Nt=>Nt.type.startsWith("image/")),ot=Ae.some(Nt=>Nt.type.startsWith("video/"));if((ie===Me.STRAIGHT||ie===Me.REPORT)&&(He||ot))return Oe.preventDefault(),!0;if(ot)return Oe.preventDefault(),je(["video"])&&Ae.forEach(async Nt=>{var Mn;if(!Nt.type.startsWith("video/"))return;const mr=Nt.getAsFile();if(!mr)return;const An=oe.extensionManager.extensions.find(Zl=>Zl.name==="video"),Xn=(Mn=An==null?void 0:An.options)==null?void 0:Mn.upload,gr=Xn?await Xn(mr):URL.createObjectURL(mr);oe.commands.focus(),oe.commands.setVideo({src:gr})}),!0;const Je=((Gt=Oe.clipboardData)==null?void 0:Gt.getData("text/plain"))||"";if(r.mode===Me.EDITOR&&Uv(Je))return Oe.preventDefault(),Wv(se,Je.trim());const Ft=_t.getData("text/html");if(Ft&&Je&&/hwpEditorBoardContent|data-hwpjson/i.test(Ft)){Oe.preventDefault();const Nt=cx(Ft).normalize("NFC");return setTimeout(()=>{oe.chain().focus().insertContent(Nt,{parseOptions:{preserveWhitespace:!1}}).run()},0),!0}return!1},clipboardTextParser:(se,Oe)=>{const _t=se.split(/(?:\r\n?|\n)/),ie=[];_t.forEach(He=>{let ot={type:"paragraph"};He.length>0&&(ot.content=[{type:"text",text:He}]);let Je=Fr.fromJSON(Oe.doc.type.schema,ot);ie.push(Je)});const Ae=be.fromArray(ie);return Te.maxOpen(Ae)}},onCreate:({editor:se})=>{m(se)},onUpdate:kt.throttle(({editor:se})=>{f.value=!0;const Oe=Ke(se,r.output);i("update:modelValue",Oe),i("change",{editor:se,output:Oe}),m(se),o.nextTick(()=>{ze()}),ae()},Ho),extensions:kt.uniqBy(KC(r.extensions,r),"name"),editable:C.value,onFocus:se=>{v(qe.value),x(se.editor),i("onFocus",se)},onBlur:se=>i("onBlur",se),parseOptions:{preserveWhitespace:"full"}}),me=o.computed(()=>r.mode===Me.REPORT||r.mode===Me.STRAIGHT||r.mode===Me.PLAIN_TEXT),Z=o.computed(()=>{const se={height:"auto",minHeight:r.minHeight?sn(r.minHeight):void 0,maxHeight:r.maxHeight?sn(r.maxHeight):void 0,overflowY:"auto"},Oe={fontFamily:op(oe,cc)&&_.value||r.fontFamilyDefault,fontSize:op(oe,ep)&&T.value||r.fontSizeDefault,...op(oe,zC)&&(A.value||r.fontWeightDefault)?{fontWeight:A.value||r.fontWeightDefault}:{}};return E.value&&!r.autoHeight?{}:E.value&&r.autoHeight?se:!E.value&&r.autoHeight?{...se,...Oe}:Oe});o.watch(()=>[Z.value,r.disabled],async()=>{ze()}),o.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:te,measuredMinWidth:re,measure:ae}=pf({minChars:r.minChar.content,fontSize:T,editor:oe}),fe=o.ref(null),Se=o.computed(()=>{var se;return(se=fe.value)==null?void 0:se.measuredMinWidthComment});o.provide("measuredMinWidthComment",Se);const _e=o.computed(()=>E.value?0:It.value?Number(re==null?void 0:re.value)+Number(Se==null?void 0:Se.value)+30:Number(re==null?void 0:re.value));async function ze(){await o.nextTick(),s.emit({action:"render"})}function Ke(se,Oe){if(!se)return"";if(se.isEmpty)return Oe==="json"?{}:"";if(r.mode===Me.PLAIN_TEXT)return se.getText({blockSeparator:`