vdc-editor 0.1.316 → 0.1.319

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 @@ ${c}`:u)}else throw a},onCacheKey:a=>hz(e,n,a)}}function oW(t){if(Be(t))return t
342
342
  `});if(!(!T||!S))try{const{data:A}=await sn.post(T,{value:S});if(!A.success&&A.code!==mL.NOTHING_TO_CHANGE){x=!0,t[E].wrongWords=[];continue}if(A.data?.wrongWordResponseDto){C=!0,t[E].wrongWords=A.data.wrongWordResponseDto;continue}t[E].wrongWords=[]}catch(A){console.error("handleRunSpellCheck error: ",A),x=!0}}n.value=i(x,C)}const a=o.computed(()=>Object.values(t).reduce((C,{wrongWords:x})=>C+x.length,0));o.watch(a,C=>{C===0&&(n.value=i(!1,!1))});const l=o.computed(()=>{const C=Object.values(t).flatMap(x=>x.wrongWords);return C.length===0?!1:C.every(x=>!Array.isArray(x.correctWord)||x.correctWord.length===0)});function u(C){const x=C.extensionManager.extensions.find(E=>E.name==="spellchecker")?.options;return{mode:x?.spellcheckHighlightMode??Io.ERROR_TYPE,color:x?.spellcheckHighlightColor??Qi}}function c(){for(const[C,{editor:x,wrongWords:E}]of Object.entries(t)){if(!x)continue;const{mode:k,color:T}=u(x);db(x,E,k,T)}}function f(){for(const[C,{editor:x}]of Object.entries(t))x&&XX(x)}async function p(){await s(),c()}let h=!0;function g(C){if(h=C,!!C)for(const[x,{editor:E}]of Object.entries(t))E&&(E.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!1),E.view.dispatch(E.state.tr.setMeta(Rn.IS_ACTIVE_SPELLCHECK,!1)))}function v(){if(h)for(const[C,{editor:x}]of Object.entries(t))x&&(x.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!0),x.view.dispatch(x.state.tr.setMeta(Rn.IS_ACTIVE_SPELLCHECK,!0)))}function b(C,x,E=`
343
343
  `){if(!C||!x.length)return;const k=_k(C,E);function T(F){if(F<0&&(F=0),F>=k.length)return C.state.doc.content.size;if(k[F]!=null)return k[F];for(let H=F;H<k.length;H++)if(k[H]!=null)return k[H];for(let H=F-1;H>=0;H--)if(k[H]!=null)return k[H];return C.state.doc.content.size}const A=x.map(F=>{const H=T(F.startIndex),Y=T(Math.max(0,F.endIndex-1))+1,Q=F.correctWord?.[0]??F.wrongWord;return{item:F,from:H,to:Y,replacement:Q}}).filter(F=>typeof F.from=="number"&&typeof F.to=="number"&&F.from<F.to);if(!A.length)return;A.sort((F,H)=>H.from-F.from);const V=C.state.tr;let B=Number.POSITIVE_INFINITY;const O=new Set;for(const F of A)F.to>B||(V.insertText(F.replacement,F.from,F.to),O.add(F.item),B=F.from);O.size>0&&(C.view.dispatch(V),C.view.focus()),O.size>0&&(x=x.filter(F=>![...O].some(H=>H===F))),db(C,x)}function w(){for(const[C,{editor:x,wrongWords:E}]of Object.entries(t))x&&b(x,E)}return{editorsState:t,spellCheckStatus:n,countTotalWrongWords:a,allWrongWordsMissSuggestions:l,setEditor:e,resetAllEditorWrongWords:r,disableSpellCheckRealTime:g,resetEnableSpellCheckRealTime:v,applyAllEditorHighlightErrors:c,clearAllEditorHighlightErrors:f,reRunSpellCheckAndHighlight:p,handleRunSpellCheck:s,replaceAllEditorErrors:w}},tZ=o.defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(o.openBlock(),o.createBlock(o.unref(RD),o.normalizeProps(o.guardReactiveProps(e)),{default:o.withCtx(()=>[o.renderSlot(n.$slots,"default")]),_:3},16))}}),nZ={key:0,class:"border-blue-500 text-white text-xs text-nowrap px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80 flex items-center rounded"},yE=o.defineComponent({__name:"BulkSpellChecker",props:{editor:{},editorComment:{},isEnableSpellCheckRealTime:{type:Boolean},align:{default:"right"}},setup(t){const e=t,{editorsState:n,countTotalWrongWords:r,spellCheckStatus:i,allWrongWordsMissSuggestions:s,setEditor:a,disableSpellCheckRealTime:l,resetEnableSpellCheckRealTime:u,handleRunSpellCheck:c,resetAllEditorWrongWords:f,applyAllEditorHighlightErrors:p,clearAllEditorHighlightErrors:h,reRunSpellCheckAndHighlight:g,replaceAllEditorErrors:v}=eZ(),b=o.ref(!1),w=o.reactive({x:0,y:0}),C=o.ref(!1),x={x:0,y:0},E=O=>{C.value=!0,x.x=O.clientX-w.x,x.y=O.clientY-w.y,document.addEventListener("mousemove",k),document.addEventListener("mouseup",T)},k=O=>{C.value&&(w.x=O.clientX-x.x,w.y=O.clientY-x.y)},T=()=>{C.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",T)};o.onUnmounted(()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",T)});const S=o.ref(null),A=o.ref({top:0,right:0,left:0}),V=()=>{if(S.value){const O=S.value.$el.getBoundingClientRect();A.value={top:O.bottom+window.scrollY+5,right:window.innerWidth-O.right-window.scrollX,left:O.left+window.scrollX},w.x=0,w.y=0}};o.onMounted(async()=>{e.editorComment&&a(Oo.EDITOR_COMMENT,e.editorComment),a(Oo.EDITOR_CONTENT,e.editor)}),o.onUnmounted(()=>{a(Oo.EDITOR_COMMENT,null),a(Oo.EDITOR_CONTENT,null)}),o.watch(b,async O=>{O?(await o.nextTick(),V(),l(e.isEnableSpellCheckRealTime),await c(),p()):(f(),u(),h())});const B=e.editor?.extensionManager.extensions.find(O=>O.name==="spellchecker")?.options.bulkSpellCheckerButton;return(O,F)=>{const H=Bt,Y=pb,Q=hh,U=ph,D=fh,L=dh,j=vY,P=Pc,G=Dc;return o.openBlock(),o.createBlock(G,{open:o.unref(b)},{default:o.withCtx(()=>[o.createVNode(o.unref(tZ),{"as-child":"",ref_key:"triggerRef",ref:S,onClick:F[0]||(F[0]=K=>b.value=!o.unref(b))},{default:o.withCtx(()=>[o.unref(B)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(B).component),{key:1,buttonName:o.unref(B).props.buttonName,icon:o.unref(B).props.icon,type:o.unref(B).props.type,disabled:o.unref(B).props.disabled,iconPosition:o.unref(B).props.iconPosition,buttonSize:o.unref(B).props.buttonSize,iconClass:o.unref(B).props.iconClass},null,8,["buttonName","icon","type","disabled","iconPosition","buttonSize","iconClass"])):(o.openBlock(),o.createElementBlock("button",nZ,[o.createVNode(H,{name:"checkUnderline"}),F[4]||(F[4]=o.createTextVNode("맞춤법 일괄 교정 "))]))]),_:1},512),o.createVNode(P,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none dark:border-ed-muted","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"z-[70]",style:o.normalizeStyle({transform:`translate(${o.unref(w).x}px, ${o.unref(w).y}px)`,top:`${o.unref(A).top}px`,right:O.align==="left"?"auto":`${o.unref(A).right}px`,left:O.align==="left"?`${o.unref(A).left}px`:"auto"})},[o.createVNode(D,{class:"bg-ed-blue-light py-3.5 px-6 rounded-t-[5px] cursor-move text-blue-500 dark:text-dark-blue-100 flex-row items-center justify-between",onMousedown:o.withModifiers(E,["prevent"])},{default:o.withCtx(()=>[o.createVNode(Q,{class:"text-base space-x-2"},{default:o.withCtx(()=>[F[5]||(F[5]=o.createElementVNode("span",null,"맞춤법/문법 오류",-1)),o.createVNode(Y,{class:"text-sm bg-blue-500 hover:bg-blue-500 dark:bg-dark-blue-100 px-2"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r))+"개",1)]),_:1})]),_:1}),o.createVNode(U,{onClick:F[1]||(F[1]=K=>b.value=!1),class:"text-xs flex items-center gap-x-1"},{default:o.withCtx(()=>[o.createVNode(H,{name:"Close",class:"w-4 h-4"}),o.createTextVNode(o.toDisplayString(O.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(L),o.createVNode(j,{editorsState:o.unref(n),spellCheckStatus:o.unref(i),allWrongWordsMissSuggestions:o.unref(s),onCloseModal:F[2]||(F[2]=K=>b.value=!1),onRunSpellcheck:o.unref(g),onReplaceAllEditorErrors:F[3]||(F[3]=K=>(o.unref(v)(),b.value=!1))},null,8,["editorsState","spellCheckStatus","allWrongWordsMissSuggestions","onRunSpellcheck"])],4)]),_:1})]),_:1},8,["open"])}}}),rZ=Object.freeze(Object.defineProperty({__proto__:null,default:yE},Symbol.toStringTag,{value:"Module"})),wE=nt.create({name:"invalidCharFocus",addOptions(){return{invalidChars:["{","}"]}},addCommands(){return{focusInvalidChar:()=>({state:t,dispatch:e,view:n})=>{let r=null;if(t.doc.descendants((s,a)=>{if(!s.isText)return!0;const l=s.text??"";for(let u=0;u<l.length;u++)if(this.options.invalidChars.includes(l[u])){const c=a+u+1;(r==null||c<r)&&(r=c)}return!0}),r==null)return!1;const i=t.tr.setSelection(Le.create(t.doc,r));return e&&e(i.scrollIntoView()),n&&n.focus(),!0},hasInvalidChar:()=>({state:t})=>{let e=!1;return t.doc.descendants(n=>{if(!n.isText)return!0;const r=n.text??"";return this.options.invalidChars.some(i=>r.includes(i))?(e=!0,!1):!0}),e}}}}),Ab=o.defineComponent({__name:"SimpleEditor",props:{modelValue:{default:""},parentEditor:{default:null},isReadOnly:{type:Boolean},autofocus:{type:[String,Number,Boolean,null],default:"start"},spellcheckEnabled:{type:Boolean,default:!0},suppressInlineSpellPopover:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=o.inject("isMobile",!1),a=o.inject("minCharSuperInput",0),l=[Q5,Y5,Z5,X5,J5.configure({placeholder:"수퍼를 입력하세요"}),wE,ek],u=o.ref(r.spellcheckEnabled),c=o.computed(()=>r.parentEditor?.extensionManager.extensions.find(H=>H.name==="spellchecker")),f=o.computed(()=>bE.configure({proofreader:new pS({api:c.value?.options.proofreader?.api,limit:c.value?.options.proofreader?.limit,transfer:c.value?.options.proofreader?.transfer,enabled:u.value}),uiStrings:c.value?.options.uiStrings,bulkSpellCheckerButton:c.value?.options.bulkSpellCheckerButton,spellcheckHighlightMode:c.value?.options.spellcheckHighlightMode,spellcheckHighlightColor:c.value?.options.spellcheckHighlightColor,suppressInlinePopover:r.suppressInlineSpellPopover})),p=new Bo({enablePasteRules:!1,enableInputRules:!1,content:r.modelValue,extensions:l.concat(f.value),editable:!r.isReadOnly,autofocus:r.autofocus,onUpdate:({editor:H})=>{i("update:modelValue",H.getHTML())},parseOptions:{preserveWhitespace:"full"}});o.watch(()=>r.isReadOnly,H=>{p.setEditable(!H),p?.commands?.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(!H)},{immediate:!0});function h(H){const{view:Y}=p,{from:Q}=Y.state.selection;p.commands.insertContentAt(Q,H),p.commands.focus()}function g(){u.value=!u.value,p.commands.handleActiveSpellCheck(u.value),p?.commands?.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(u.value)}const{contentInner:v,measuredMinWidth:b,measure:w}=ff({minChars:a,fontSize:"",editor:p});o.watch(()=>r.modelValue,()=>{w(),p&&p.getHTML()!==r.modelValue&&p.commands.setContent(r.modelValue??"",!1,{preserveWhitespace:"full"})});const C=o.inject("fontSize",""),x=o.inject("fontFamily",""),E=o.inject("fontWeight",""),k=o.inject("letterSpacing",""),T=o.computed(()=>s?{fontSize:o.unref(C),fontFamily:o.unref(x),fontWeight:o.unref(E),letterSpacing:o.unref(k)}:{}),S=o.computed(()=>s?{paddingLeft:"7px",paddingRight:"7px"}:{width:`${b.value}px`});let A=null;typeof document<"u"&&(A=document.createElement("span"),A.style.position="absolute",A.style.left="-9999px",A.style.top="-9999px",A.style.whiteSpace="pre",A.style.visibility="hidden",document.body.appendChild(A)),o.onBeforeUnmount(()=>{A&&A.parentNode&&(A.parentNode.removeChild(A),A=null)});function V(){if(!b.value||!(v.value instanceof Element)||!A)return;const H=A,Y=p.getText({blockSeparator:`
344
344
  `}),Q=getComputedStyle(v.value);H.style.fontFamily=Q.fontFamily||"",H.style.fontSize=Q.fontSize||"",H.style.fontWeight=Q.fontWeight||"",H.style.letterSpacing=Q.letterSpacing||"";const U=ee=>(H.textContent=ee,H.getBoundingClientRect().width),D=20,L=()=>Math.max(0,(b.value||0)-D);function j(ee,de){let Ee=1,se=ee.length,ge=0;for(;Ee<=se;){const J=Math.floor((Ee+se)/2);U(ee.slice(0,J))<=de?(ge=J,Ee=J+1):se=J-1}return ge}let P="";const G=[];for(const ee of Y){if(ee===`
345
- `){G.push(P),P="";continue}if(P+=ee,U(P)>L())for(;U(P)>L();){const de=j(P,L());de<=0?(G.push(P.charAt(0)),P=P.slice(1)):(G.push(P.slice(0,de)),P=P.slice(de))}}return G.push(P),G.map(ee=>`<p>${ee}</p>`).join("")}const B=o.computed(()=>{const H=r.parentEditor?.storage.superText.superInputModal?.props?.guidelineLeftOffset;return s.value||!H?{}:{backgroundImage:"linear-gradient(to right, #d1d5db 1px, transparent 1px)",backgroundSize:"1px 100%",backgroundRepeat:"no-repeat",backgroundPosition:Yt(H)}}),{isScrolling:O,handleScroll:F}=Yl();return e({insertSpecialCharater:h,isChecked:u,toggleSpellCheck:g,wrapText:V,editor:p}),(H,Y)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:v,class:o.normalizeClass(o.unref(ke)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5 relative",H.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(O)&&"scrollbar-thumb-transparent")),style:o.normalizeStyle([o.unref(S),o.unref(B),o.unref(T)]),onScroll:Y[0]||(Y[0]=(...Q)=>o.unref(F)&&o.unref(F)(...Q))},[o.createVNode(o.unref(Jn),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(ke)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),oZ={class:"sr-only"},iZ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},sZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},aZ={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"},lZ=["checked"],uZ={for:"spellcheck",class:"select-none whitespace-nowrap"},cZ={class:"flex gap-x-1"},dZ={class:"ml-auto"},fZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},pZ={class:"text-right text-sm p-2"},hZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},CE=5,Uc=o.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){const n=e,r=t,{t:i}=Pt(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=lt.useLocalStorage("superInputModalPosition",null),f=o.reactive({x:0,y:0}),p=o.ref(!1),h={x:0,y:0},g=o.ref(!1),v=o.ref(!1),b=o.ref(!1),w=K=>{p.value=!0;const ee=K.currentTarget.closest(".draggable-dialog").getBoundingClientRect();h.x=K.clientX-ee.left,h.y=K.clientY-ee.top,document.addEventListener("mousemove",C),document.addEventListener("mouseup",x)},C=K=>{p.value&&(f.x=K.clientX-h.x,f.y=K.clientY-h.y)},x=()=>{p.value=!1,c.value={x:f.x,y:f.y},document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",x)};o.watch(()=>r.open,async K=>{if(!K)return;v.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await o.nextTick();const ee=document.querySelector(".draggable-dialog");if(!ee)return;ee.getBoundingClientRect();const de=window.innerWidth,Ee=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((de-ee.offsetWidth)/2,0),f.y=Math.max((Ee-ee.offsetHeight)/2,0))},{immediate:!0});const E=()=>{n("close"),s.value="",a.value="",u.value=!1},k=()=>{if(l.value?.editor.commands.hasInvalidChar()){b.value=!0;return}s.value=l.value.wrapText(),a.value="",v.value?g.value=!0:n("close"),n("save",s.value),s.value=""},T=()=>{g.value=!1,n("close")},S=r.editor?.extensionManager.extensions.find(K=>K.name==="superText")?.options.specialCharModal,A=o.inject("isEditable",void 0),V=o.computed(()=>A?!o.unref(A):r.editor?!r.editor.isEditable:!1),B=o.inject("fontFamily",""),O=o.computed(()=>r.editor?.storage.superText.superInputModal?.props?.fontFamily??o.unref(B)??void 0),F=o.inject("fontSize",o.ref("")),H=o.computed(()=>r.editor?.storage.superText.superInputModal?.props?.fontSize??o.unref(F)??"14px"),Y=lt.useLocalStorage("recentSpecialChars",[]),Q=lt.useLocalStorage("superInputSpellCheck",!0),U=K=>{if(!K)return;const ee=(Y.value??[]).filter(de=>de!==K);ee.unshift(K),Y.value=ee.slice(0,CE)},D=K=>{l.value?.insertSpecialCharater(K)},L=(K,ee)=>{ee&&(l.value?.insertSpecialCharater(K),U(K))},j=o.computed(()=>l.value?.isChecked),P=()=>{l.value?.toggleSpellCheck(),Q.value=l.value?.isChecked??Q.value};o.onUnmounted(()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",x)}),o.watch(s,K=>{!r.superTextElementId||r.superTextElementId===""||(v.value=K!==(r.superTextInit??""))});const G=o.computed(()=>l.value?.editor);return(K,ee)=>{const de=hh,Ee=ph,se=fh,ge=dh,J=yE,te=VX,oe=ub,ae=Pc,fe=Dc,Te=RX;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(fe,{open:K.open,modal:!o.unref(V)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ng),null,{default:o.withCtx(()=>[o.createVNode(o.unref(i1),{class:"!pointer-events-none bg-black/30"}),o.createVNode(ae,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[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(O),fontWeight:"normal",fontSize:o.unref(H)})},[o.createVNode(se,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(w,["prevent"])},{default:o.withCtx(()=>[o.createVNode(de,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(Ee,{class:"absolute right-3 top-3 text-white",onClick:E},{default:o.withCtx(()=>[o.createVNode(o.unref(dc),{class:"w-5 h-5"}),o.createElementVNode("span",oZ,o.toDisplayString(K.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(ge),o.createElementVNode("div",iZ,[o.createElementVNode("div",sZ,[ee[5]||(ee[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex gap-x-6",o.unref(Y).length===CE&&"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:ee[0]||(ee[0]=Se=>u.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.insert.symbol")),1)]),_:1}),o.createElementVNode("div",aZ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref(j),onChange:P},null,40,lZ),o.createElementVNode("label",uZ,o.toDisplayString(o.unref(i)("editor.menubar.menu.spellCheck")),1)]),o.createElementVNode("div",cZ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Y),Se=>(o.openBlock(),o.createBlock(vn,{key:Se,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:We=>D(Se)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(Se),1)]),_:2},1032,["onClick"]))),128))]),o.createElementVNode("div",dZ,[o.unref(G)?(o.openBlock(),o.createBlock(J,{key:0,editor:o.unref(G),"is-enable-spell-check-real-time":o.unref(G)?.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(o.unref(S)?.component),o.mergeProps({key:0,"custom-class":"!z-[70] !pointer-events-auto","font-family":o.unref(O)},o.unref(S).props,{onSelectedChar:L,onClose:ee[1]||(ee[1]=Se=>u.value=!1)}),null,16,["font-family"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",fZ,[o.createElementVNode("label",pZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(te,{editor:o.unref(G)},{default:o.withCtx(()=>[o.createVNode(Ab,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":ee[2]||(ee[2]=Se=>s.value=Se),"parent-editor":K.editor,"spellcheck-enabled":o.unref(Q),"suppress-inline-spell-popover":!0,class:""},null,8,["modelValue","parent-editor","spellcheck-enabled"])]),_:1},8,["editor"])]),o.createElementVNode("div",hZ,[ee[6]||(ee[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(ws,{modelValue:a.value,"onUpdate:modelValue":ee[3]||(ee[3]=Se=>a.value=Se),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),o.createVNode(oe,{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:k},{default:o.withCtx(()=>[o.createVNode(o.unref(M1),{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:E},{default:o.withCtx(()=>[o.createVNode(o.unref(dc),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(K.$t("editor.close")),1)]),_:1})]),_:1})],4)]),_:1})]),_:1})]),_:1},8,["open","modal"]),o.createVNode(Te,{open:g.value,onClose:T},null,8,["open"]),o.createVNode(Te,{title:"Information",message:"{ 과 } 는 입력이 제한된 문자열 입니다.",iconName:"MessageCircleWarning",confirmText:"Ok",open:b.value,onClose:ee[4]||(ee[4]=Se=>b.value=!1)},null,8,["open"])],64)}}}),Mb=o.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Pt(),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:x,to:E}=n.editor.state.selection,k=n.editor.state.doc.cut(x,E),S=hn.fromSchema(n.editor.schema).serializeFragment(k.content),A=document.createElement("div");return A.appendChild(S),A.innerHTML}const f=()=>{const{view:x}=n.editor,{from:E,to:k}=x.state.selection,T=c();s.text=T,s.from=E,s.to=k},p=()=>i.value=!i.value,h=()=>{u.value||(i.value=!0,f())},g=()=>i.value=!1,v=x=>{if(zc(x.trim())){i.value=!1;return}const E=n?.superTextStore.addMoreSuperText(x);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":E,"data-text":x}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},b=o.ref(!1),w=async x=>{if(x){const E=await n.editor.hasClipboard?.();b.value=!!E}},C=()=>{if(u.value||!n.editor)return;const{view:x,state:E}=n.editor,{from:k,to:T}=E.selection;s.from=k,s.to=T,s.text="",x.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:h,closeDialog:g}),(x,E)=>{const k=Uc,T=ch,S=uh,A=lh,V=ah;return x.disabled?o.renderSlot(x.$slots,"default",{key:0}):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(k,{open:i.value,editor:x.editor,"super-text-init":s.text,onClose:p,onSave:v},null,8,["open","editor","super-text-init"]),o.createVNode(V,{"onUpdate:open":w},{default:o.withCtx(()=>[o.createVNode(T,{as:"template",class:"relative",disabled:o.unref(u),onDblclick:o.withModifiers(C,["prevent","stop"])},{default:o.withCtx(()=>[o.renderSlot(x.$slots,"default")]),_:3},8,["disabled"]),o.createVNode(A,null,{default:o.withCtx(()=>[x.disableSuperInput?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(S,{key:0,onSelect:h},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.inputSuper")),1)]),_:1})),o.unref(a)?(o.openBlock(),o.createBlock(S,{key:1,onSelect:E[0]||(E[0]=B=>x.editor?.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(S,{key:2,onSelect:E[1]||(E[1]=B=>x.editor?.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(S,{key:3,disabled:!b.value,onSelect:E[2]||(E[2]=B=>x.editor?.commands.pasteContent())},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):o.createCommentVNode("",!0)]),_:1})]),_:3})],64))}}}),mZ={id:"editor-panel",class:"flex relative w-full h-full"},gZ=Xr(o.defineComponent({__name:"PageNode",props:ta,setup(t){const{state:e,page:n,superTextStore:r}=yn(),{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:h}=i,g=o.computed(()=>s?`calc(${h} - ${a?.top??0} - ${a?.bottom??0}`:"max-content"),v=lt.useEventBus(cr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,b=>{v.emit(b.pageNumber)},{immediate:!0}),(b,w)=>{const C=Mb;return o.openBlock(),o.createBlock(o.unref(ea),{id:b.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":b.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":o.unref(a)?.top??"0","--umo-page-margin-bottom":o.unref(a)?.bottom??"0","--umo-page-margin-left":o.unref(a)?.left??"0","--umo-page-margin-right":o.unref(a)?.right??"0","--umo-page-width":o.unref(p),"--umo-page-height":o.unref(h),"--empty-node-left":"0px",left:100,"min-height":typeof o.unref(h)=="number"?`${o.unref(h)}px`:o.unref(h),height:f.value?typeof o.unref(h)=="number"?`${o.unref(h)}px`:o.unref(h):"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",mZ,[o.createVNode(C,{mode:c.value?o.unref(Me).REPORT:o.unref(Me).EDITOR,editor:b.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(iC),{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 xE(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const vZ=({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=_h(c,l.node().type.name,l.node().attrs);if(f.id=Nv(),f.extend&&(f.extend=!1),s instanceof De&&s.node.isBlock)return!l.parentOffset||!gr(a,l.pos)?!1:(r&&(t&&xE(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 h=l.depth===0?void 0:i4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&h?[{type:h,attrs:f}]:void 0,v=gr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!v&&gr(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(v=!0,g=h?[{type:h,attrs:f}]:void 0),v&&(g||(g=[{type:l.node().type,attrs:f}]),e.split(e.mapping.map(l.pos),1,g),h&&!p&&!l.parentOffset&&l.parent.type!==h)){const b=e.mapping.map(l.before()),w=e.doc.resolve(b);l.node(-1).canReplaceWith(w.index(),w.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&xE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},bZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{const s=bn(t,n.schema),{$from:a,$to:l}=n.selection;if((n.selection instanceof De?n.selection.node:null)?.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 b=me.empty;const w=a.index(-1)?1:a.index(-2)?2:3;for(let S=a.depth-w;S>=a.depth-3;S-=1)b=me.from(a.node(S).copy(b));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,x=_h(f,a.node().type.name,a.node().attrs),E=s.contentMatch.defaultType?.createAndFill(x)??void 0;b=b.append(me.from(s.createAndFill(null,E)??void 0));const k=a.before(a.depth-(w-1));e.replace(k,a.after(-C),new _e(b,4-w,0));let T=-1;e.doc.nodesBetween(k,e.doc.content.size,(S,A)=>{if(T>-1)return!1;S.isTextblock&&S.content.size===0&&(T=A+1)}),T>-1&&e.setSelection(Le.near(e.doc.resolve(T))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,h=_h(f,c.type.name,c.attrs),g=_h(f,a.node().type.name,a.node().attrs);h.id=Nv(),g.id=Nv(),e.delete(a.pos,l.pos);const v=p?[{type:s,attrs:h},{type:p,attrs:g}]:[{type:s,attrs:h}];if(!gr(e.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:w}=n,{splittableMarks:C}=i.extensionManager,x=w??(b.$to.parentOffset&&b.$from.marks());if(e.split(a.pos,2,v).scrollIntoView(),!x||!r)return!0;const E=x.filter(k=>C.includes(k.type.name));e.ensureMarks(E)}return!0},yZ=[Np,Qp,eh,eb,th,Ss,nb,zl,ob,sb,rb,_a,Ul,xi,ib,ab,tb,Gr],wZ=Lt.create({priority:200,name:`${Gr}`,content:"block*",group:`${Gr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:na(gZ),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:$r(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",{...Ct(e),"data-type":this.name},0]},addCommands(){return{splitBlock:vZ,splitListItem:bZ,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:yZ.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=Ue.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>kE(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(Ue.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(Gr);const f=ai(p=>p.type.name===Gr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(Gr);const p=f.node.firstChild.type;if(f.start+Ue.atStart(f.node).from===c){const g=Le.create(l,f.start-2,f.start-2),v=ai(b=>b.type.name===Gr)(g);if(v){const b=Ue.atEnd(v.node).from+v.start,w=Le.create(l,b,b);if(p===v.node.lastChild.type){const{parent:C}=w.$anchor;return XG(C,i.schema)?s.setSelection(w):s.step(new gn(b,c,_e.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>kE(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=ai(f=>f.type.name===zl)(s);return c&&c.start+Ue.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(Ue.atEnd(a).from===u)return r.deleteNode(Gr);const c=ai(f=>f.type.name===Gr)(s);if(c&&c.start+Ue.atEnd(c.node).from===u){const p=Le.create(a,u+2,u+2),h=ai(g=>g.type.name===Gr)(p);if(h){const g=Ue.atStart(h.node).from+h.start,v=Le.create(a,g,g);if(ai(w=>w.attrs.extend)(v))return i.step(new gn(u,g,_e.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 _h(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 kE=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=s4(r,{from:n.from,to:n.to},s=>s.type.name===zl);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()}),EE={"editor.remove":"Remove","editor.copy":"Copy","editor.words":"WORDS","editor.characters":"CHARACTERS","editor.default":"Default","editor.recent":"Recently Used","editor.nofill":"Remove Color","editor.format":"Format Painter","editor.close":"Close","editor.modify":"Modify","editor.preview.tooltip":"Preview","editor.draghandle.tooltip":"Click And Drag","editor.copyToClipboard":"CopyToClipboard","editor.importWord.tooltip":"Import from Word","editor.importWord.success":"Import Success","editor.importWord.fileTooLarge":"File is Too large","editor.importWord.error":"Import Failed, File not supported","editor.slash":"Press '/' for commands","editor.slash.empty":"No Result","editor.slash.format":"Format","editor.slash.insert":"Insert","editor.slash.embed":"Embed Services","editor.content":"Please input content","editor.slash.hint":"Please input content","editor.moremark":"More Text Styles","editor.size.small.tooltip":"Small","editor.size.medium.tooltip":"Medium","editor.size.large.tooltip":"Cover","editor.bold.tooltip":"Bold","editor.italic.tooltip":"Italic","editor.underline.tooltip":"Underline","editor.strike.tooltip":"Strike","editor.color.tooltip":"Color","editor.color.more":"Color Picker","editor.highlight.tooltip":"Highlight","editor.lineheight.tooltip":"Line Height","editor.heading.tooltip":"Headings","editor.heading.h1.tooltip":"Heading 1","editor.heading.h2.tooltip":"Heading 2","editor.heading.h3.tooltip":"Heading 3","editor.heading.h4.tooltip":"Heading 4","editor.heading.h5.tooltip":"Heading 5","editor.heading.h6.tooltip":"Heading 6","editor.paragraph.tooltip":"Paragraph","editor.textalign.tooltip":"Align","editor.textalign.left.tooltip":"Left","editor.textalign.center.tooltip":"Center","editor.textalign.right.tooltip":"Right","editor.textalign.justify.tooltip":"Justify","editor.indent":"Indent","editor.indent.indent":"Increase Indent","editor.indent.outdent":"Decrease Indent","editor.fontFamily.tooltip":"Font family","editor.fontFamily.default":"Default","editor.fontFamily.gulim":"Gulim","editor.fontFamily.dotum":"Dotum","editor.fontFamily.gungsuh":"Gungsuh","editor.fontSize.tooltip":"Font size","editor.fontSize.default.tooltip":"Default","editor.superscript.tooltip":"Superscript","editor.subscript.tooltip":"Subscript","editor.bulletlist.tooltip":"Bullet List","editor.bulletlist.disc.tooltip":"Disc","editor.bulletlist.circle.tooltip":"Circle","editor.bulletlist.square.tooltip":"Square","editor.orderedlist.tooltip":"Ordered List","editor.orderedlist.decimal.tooltip":"Decimal","editor.orderedlist.decimalLeadingZero.tooltip":"Decimal with leading zero","editor.orderedlist.lowerRoman.tooltip":"Lower Roman","editor.orderedlist.upperRoman.tooltip":"Upper Roman","editor.orderedlist.lowerLatin.tooltip":"Lower Latin","editor.orderedlist.upperLatin.tooltip":"Upper Latin","editor.orderedlist.tradChineseInformal.tooltip":"Trad Chinese Informal","editor.orderedlist.simpChineseFormal.tooltip":"Simp Chinese Informal","editor.tasklist.tooltip":"Task List","editor.indent.tooltip":"Indent","editor.outdent.tooltip":"Outdent","editor.columns.tooltip":"Columns","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"UnLink","editor.link.open.tooltip":"Open Link","editor.link.edit.tooltip":"Edit Link","editor.link.dialog.title":"Insert Link","editor.link.dialog.link":"Link","editor.link.dialog.text":"Text","editor.link.dialog.openInNewTab":"Open In New Tab","editor.link.dialog.link.placeholder":"Link Address","editor.link.dialog.text.placeholder":"Add Description","editor.link.dialog.button.apply":"Apply","editor.image.tooltip":"Image","editor.image.menu.flipX":"Flip vertical","editor.image.menu.flipY":"Flip horizontal","editor.image.menu.moveUp":"Move up","editor.image.menu.moveDown":"Move down","editor.image.menu.size":"Set Size","editor.image.menu.size.width":"Width","editor.image.menu.size.height":"Height","editor.image.dragger.tooltip":"Click or drag the image to the area to upload","editor.image.float.left.tooltip":"Float left","editor.image.float.none.tooltip":"Float none","editor.image.float.right.tooltip":"Float right","editor.image.dialog.title":"Add an image","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Upload","editor.image.dialog.uploading":"Uploading","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Lock original aspect ratio","editor.image.dialog.form.file":"File","editor.image.dialog.button.apply":"apply","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Upload","editor.video.dialog.uploading":"Uploading","editor.video.dialog.title":"Embed or upload a video","editor.video.dialog.link":"link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"apply","editor.table.tooltip":"Table","editor.table.menu.insert_table":"Insert Table","editor.table.menu.insert_table.with_header_row":"With header row","editor.table.menu.insertColumnBefore":"Insert Column Before","editor.table.menu.insertColumnAfter":"Insert Column After","editor.table.menu.deleteColumn":"Delete Column","editor.table.menu.insertRowAbove":"Insert Row Above","editor.table.menu.insertRowBelow":"Insert Row Below","editor.table.menu.deleteRow":"Delete Row","editor.table.menu.mergeCells":"Merge Cells","editor.table.menu.splitCells":"Split Cells","editor.table.menu.deleteTable":"Delete Table","editor.table.menu.setCellsBgColor":"Cell Background Color","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Horizontal Rule","editor.code.tooltip":"Code","editor.codeblock.tooltip":"Code Block","editor.clear.tooltip":"Clear Format","editor.undo.tooltip":"Undo","editor.redo.tooltip":"Redo","editor.fullscreen.tooltip.fullscreen":"Fullscreen","editor.fullscreen.tooltip.exit":"Fullscreen Exit","editor.imageUpload.fileTypeNotSupported":"File type not supported","editor.imageUpload.fileSizeTooBig":"File size too big, Maximum size is","editor.AI.placeholder":"Ask AI ...","editor.AI.generating":"Generating","editor.AI.insert":"Insert below selection","editor.AI.replace":"Replace selected content","editor.AI.regenerate":"Regenerate","editor.AI.close":"Close","editor.AI.stop":"Stop","editor.AI.ask":"Ask AI","editor.menubar.file":"File","editor.menubar.edit":"Edit","editor.menubar.view":"View","editor.menubar.insert":"Insert","editor.menubar.format":"Format","editor.menubar.menu.newDoc":"New Document","editor.menubar.menu.restoreLastDraft":"Restore last draft","editor.menubar.menu.print":"Print","editor.menubar.menu.cut":"Cut","editor.menubar.menu.copy":"Copy","editor.menubar.menu.paste":"Paste","editor.menubar.menu.pasteAsText":"Paste as text","editor.menubar.menu.selectAll":"Select all","editor.menubar.menu.preview":"Preview","editor.menubar.menu.spellCheck":"Spell check","editor.menubar.menu.spelling":"spelling","editor.menubar.menu.superView":"Super view","editor.menubar.menu.insertSuper":"Insert super","editor.menubar.menu.articleContent":"Article content","editor.menubar.menu.articleComment":"Article comment","editor.menubar.menu.cancel":"Cancel","editor.menubar.menu.save":"Save","editor.findAndReplace.tooltip":"Find and replace","editor.findAndReplace.find":"Find","editor.findAndReplace.replace":"Replace","editor.findAndReplace.replaceAll":"Replace All","editor.findAndReplace.caseSensitive":"Case Sensitive","editor.printer.tooltip":"Print","editor.superinput":"Super input","editor.insert.symbol":"Insert symbol","editor.check":"Check","editor.detail":"Detail","editor.inputSuper":"Input Super","editor.insertSpecial":"Special characters","editor.cut":"Cut","editor.paste":"Paste","editor.selectAll":"SelectAll","editor.delete":"Delete","editor.super.edit":"Super edit","editor.super.delete":"Super delete","editor.configPlan.edit":"Config plan edit","editor.configPlan.delete":"Config plan delete","editor.super":"Super","editor.configPlan":"Config plan","editor.insertConfigPlan":"Insert config plan","editor.alert":"Super has been changed. Super ID will be deleted.","editor.alertConfirm":"Confirm","editor.alertYes":"OK"},SE={"editor.remove":"제거","editor.copy":"복사","editor.words":"낱말","editor.characters":"문자","editor.default":"기본값","editor.recent":"최근 사용됨","editor.nofill":"색상 제거","editor.format":"형식 페인터","editor.close":"닫기","editor.modify":"수정","editor.preview.tooltip":"미리보기","editor.draghandle.tooltip":"클릭하여 드래그","editor.copyToClipboard":"클립보드에 복사","editor.importWord.tooltip":"Word에서 가져오기","editor.importWord.success":"가져오기 성공","editor.importWord.fileTooLarge":"파일이 너무 큽니다","editor.importWord.error":"가져오기 실패, 파일이 지원되지 않음","editor.slash":"명령을 보려면 '/'를 누르세요.","editor.slash.empty":"결과 없음","editor.slash.format":"형식","editor.slash.insert":"삽입","editor.slash.embed":"서비스 삽입","editor.content":"내용을 입력해주세요","editor.slash.hint":"내용을 입력해주세요","editor.moremark":"추가 텍스트 스타일","editor.size.small.tooltip":"작음","editor.size.medium.tooltip":"중간","editor.size.large.tooltip":"표지","editor.bold.tooltip":"굵게","editor.italic.tooltip":"기울임꼴","editor.underline.tooltip":"밑줄","editor.strike.tooltip":"취소선","editor.color.tooltip":"색상","editor.color.more":"색상 선택기","editor.highlight.tooltip":"강조 표시","editor.lineheight.tooltip":"줄간격","editor.heading.tooltip":"제목","editor.heading.h1.tooltip":"제목 1","editor.heading.h2.tooltip":"제목 2","editor.heading.h3.tooltip":"제목 3","editor.heading.h4.tooltip":"제목 4","editor.heading.h5.tooltip":"제목 5","editor.heading.h6.tooltip":"제목 6","editor.paragraph.tooltip":"단락","editor.textalign.tooltip":"양쪽정렬","editor.textalign.left.tooltip":"왼쪽","editor.textalign.center.tooltip":"가운데","editor.textalign.right.tooltip":"오른쪽","editor.textalign.justify.tooltip":"양쪽정렬","editor.indent":"들여쓰기","editor.indent.indent":"들여쓰기","editor.indent.outdent":"들여쓰기 줄이기","editor.fontFamily.tooltip":"맑은고딕","editor.fontFamily.default":"맑은고딕","editor.fontFamily.gulim":"굴림","editor.fontFamily.dotum":"돋움","editor.fontFamily.gungsuh":"궁서","editor.fontSize.tooltip":"기본값","editor.fontSize.default.tooltip":"기본값","editor.superscript.tooltip":"위 첨자","editor.subscript.tooltip":"아래첨자","editor.bulletlist.tooltip":"글머리 기호 목록","editor.bulletlist.disc.tooltip":"디스크","editor.bulletlist.circle.tooltip":"원","editor.bulletlist.square.tooltip":"사각형","editor.orderedlist.tooltip":"순서가 지정된 목록","editor.orderedlist.decimal.tooltip":"십진수","editor.orderedlist.decimalLeadingZero.tooltip":"앞에 0이 있는 십진수","editor.orderedlist.lowerRoman.tooltip":"하위 로마자","editor.orderedlist.upperRoman.tooltip":"상위 로마자","editor.orderedlist.lowerLatin.tooltip":"하위 라틴어","editor.orderedlist.upperLatin.tooltip":"상위 라틴어","editor.orderedlist.tradChinaInformal.tooltip":"중국어 비공식","editor.orderedlist.simpChinaFormal.tooltip":"간체 중국어 비공식","editor.tasklist.tooltip":"작업 목록","editor.indent.tooltip":"들여쓰기","editor.outdent.tooltip":"내어쓰기","editor.columns.tooltip":"열","editor.link.tooltip":"링크","editor.link.unlink.tooltip":"링크 해제","editor.link.open.tooltip":"링크 열기","editor.link.edit.tooltip":"링크 편집","editor.link.dialog.title":"링크 삽입","editor.link.dialog.link":"링크","editor.link.dialog.text":"텍스트","editor.link.dialog.openInNewTab":"새 탭에서 열기","editor.link.dialog.link.placeholder":"링크 주소","editor.link.dialog.text.placeholder":"설명 추가","editor.link.dialog.button.apply":"적용","editor.image.tooltip":"이미지","editor.image.menu.flipX":"세로 뒤집기","editor.image.menu.flipY":"가로 뒤집기","editor.image.menu.moveUp":"위로 이동","editor.image.menu.moveDown":"아래로 이동","editor.image.menu.size":"크기 설정","editor.image.menu.size.width":"너비","editor.image.menu.size.height":"높이","editor.image.dragger.tooltip":"업로드할 영역으로 이미지를 클릭하거나 드래그하세요.","editor.image.float.left.tooltip":"왼쪽으로 부동","editor.image.float.none.tooltip":"부동 없음","editor.image.float.right.tooltip":"오른쪽으로 부동","editor.image.dialog.title":"이미지 추가","editor.image.dialog.tab.url":"URL","editor.image.dialog.tab.upload":"업로드","editor.image.dialog.uploading":"업로드 중","editor.image.dialog.form.link":"링크","editor.image.dialog.placeholder":"링크","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"원본 가로 세로 비율 잠금","editor.image.dialog.form.file":"파일","editor.image.dialog.button.apply":"적용","editor.video.tooltip":"비디오","editor.video.dialog.tab.upload":"업로드","editor.video.dialog.uploading":"업로드 중","editor.video.dialog.title":"동영상 삽입 또는 업로드","editor.video.dialog.link":"링크","editor.video.dialog.placeholder":"링크","editor.video.dialog.button.apply":"적용","editor.table.tooltip":"표","editor.table.menu.insert_table":"테이블 삽입","editor.table.menu.insert_table.with_header_row":"머리글 행 포함","editor.table.menu.insertColumnBefore":"앞에 열 삽입","editor.table.menu.insertColumnAfter":"다음에 열 삽입","editor.table.menu.deleteColumn":"열 삭제","editor.table.menu.insertRowAbove":"위에 행 삽입","editor.table.menu.insertRowBelow":"아래에 행 삽입","editor.table.menu.deleteRow":"행 삭제","editor.table.menu.mergeCells":"셀 병합","editor.table.menu.splitCells":"셀 분할","editor.table.menu.deleteTable":"테이블 삭제","editor.table.menu.setCellsBgColor":"셀 배경색","editor.blockquote.tooltip":"블록인용","editor.horizontalrule.tooltip":"수평 규칙","editor.code.tooltip":"코드","editor.codeblock.tooltip":"코드 블록","editor.clear.tooltip":"형식 지우기","editor.undo.tooltip":"실행 취소","editor.redo.tooltip":"다시 실행","editor.fullscreen.tooltip.fullscreen":"전체 화면","editor.fullscreen.tooltip.exit":"전체 화면 종료","editor.imageUpload.fileTypeNotSupported":"지원되지 않는 파일 형식","editor.imageUpload.fileSizeTooBig":"파일 크기가 너무 큽니다. 최대 크기는 다음과 같습니다.","editor.AI.placeholder":"AI에게 물어보세요...","editor.AI.geneating":"생성","editor.AI.insert":"선택 항목 아래에 삽입","editor.AI.replace":"선택한 콘텐츠 교체","editor.AI.regenerate":"재생성","editor.AI.close":"닫기","editor.AI.stop":"중지","editor.AI.ask":"AI에게 물어보세요","editor.menubar.file":"파일","editor.menubar.edit":"편집","editor.menubar.view":"보기","editor.menubar.insert":"삽입","editor.menubar.format":"형식","editor.menubar.menu.newDoc":"새 문서","editor.menubar.menu.restoreLastDraft":"마지막 초안 복원","editor.menubar.menu.print":"인쇄","editor.menubar.menu.cut":"잘라내기","editor.menubar.menu.copy":"복사","editor.menubar.menu.paste":"붙여넣기","editor.menubar.menu.pasteAsText":"텍스트로 붙여넣기","editor.menubar.menu.selectAll":"모두 선택","editor.menubar.menu.preview":"미리보기","editor.menubar.menu.spellCheck":"맞춤법 검사","editor.menubar.menu.spelling":"맞춤법","editor.menubar.menu.superView":"수퍼보기","editor.menubar.menu.insertSuper":"수퍼 넣기","editor.menubar.menu.articleContent":"앵커멘트","editor.menubar.menu.articleComment":"상세 텍스트","editor.menubar.menu.cancel":"취소","editor.menubar.menu.save":"저장","editor.findAndReplace.tooltip":"찾기 및 바꾸기","editor.findAndReplace.find":"찾기","editor.findAndReplace.replace":"바꾸기","editor.findAndReplace.replaceAll":"모두 바꾸기","editor.findAndReplace.caseSensitive":"대소문자 구분","editor.printer.tooltip":"인쇄","editor.superinput":"수퍼입력","editor.insert.symbol":"기호삽입","editor.check":"확인","editor.detail":"내용","editor.inputSuper":"수퍼 작성","editor.insertSpecial":"특수문자","editor.cut":"잘라내기","editor.paste":"붙여넣기","editor.selectAll":"모두선택","editor.delete":"삭제","editor.super.edit":"수퍼 수정","editor.super.delete":"수퍼 삭제","editor.configPlan.edit":"구성안 수정","editor.configPlan.delete":"구성안 삭제","editor.super":"수퍼","editor.configPlan":"구성안","editor.insertConfigPlan":"구성안넣기","editor.alert":"수퍼가 변경되었습니다. 수퍼아이디를 삭제합니다.","editor.alertConfirm":"확인","editor.alertYes":"확인"},Oa=zW({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:EE,ko:SE}}),CZ=nt.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()}}}),xZ=["data-font"],kZ=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}=Pt(),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(h=>h.name==="fontFamily").options;let p=[];return _t.isEmpty(f.fontFamilyList)?p=i:p=f.fontFamilyList.filter(h=>h.enabled!==!1).map(h=>({label:h.label,value:h.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?(U0(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(()=>{const f=a.value[0]?.label||r("editor.fontFamily.default");return a.value.find(p=>p.value===l.value)?.label||f});return(f,p)=>(o.openBlock(),o.createBlock(ga,{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,(h,g)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:g},[o.createVNode(o.unref(Bl),{checked:l.value===h.value,onClick:v=>u(h)},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"ml-1 h-full","data-font":h.label,style:o.normalizeStyle({fontFamily:h.value??void 0})},o.toDisplayString(h.label),13,xZ)]),_:2},1032,["checked","onClick"]),h.label===o.unref(r)("editor.fontFamily.default")&&f.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(I1),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),_E=CZ.extend({name:"fontFamily",addOptions(){return{...this.parent?.(),types:["textStyle"],fontFamilyList:[],button({editor:t,extension:e,t:n}){return{component:kZ,componentProps:{editor:t,disabled:!t.can().setFontFamily(""),tooltip:n("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})=>(l5(n,t),!0)).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().command(({tr:e})=>(l5(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}}),EZ=nt.create({name:"fontWeight",addOptions(){return{...this.parent?.(),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}}),SZ={class:"flex gap-2"},_Z=["disabled"],TZ=Xr(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(gg[0])||parseInt(e.value)<parseInt(gg[0]):!1),r=lt.useEventBus(cr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=da,u=ca,c=fa;return o.openBlock(),o.createElementBlock("div",SZ,[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(Bt),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(is),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(Bt),{name:"Minus",class:"w-6 h-6"})],8,_Z)]),_:1}),o.createVNode(o.unref(is),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),AZ=Hn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:TZ,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})}}}),Bb=nt.create({name:"painter",addOptions(){return{...this.parent?.(),button:({editor:t,extension:e,t:n})=>({component:Ye,componentProps:{action:()=>{t.commands.setPainter(t?.state.selection.$head.marks())},icon:"PaintRoller",tooltip:n("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 St("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}}}})]}}),Ob=()=>$r(10),TE=new St("attrkey"),MZ=t=>new it({key:TE,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=TE.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,h,g)=>{const{attrs:v}=f,b=c.includes(v.id)?Ob():v.id||Ob();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...v,id:b,"number-line":g+1}),a=!0),c.push(b)})}return a?s:null}}),AE=[Np,Qp,eh,eb,th,Ss,nb,zl,ob,sb,rb,_a,Ul,xi,ib,ab,tb,Gr],BZ=nt.create({name:"autoId",addGlobalAttributes(){return[{types:AE.concat(this.options.types||[]),attributes:{id:{default:Ob()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[MZ(AE.concat(this.options.types||[]))]}}),OZ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,IZ=Lt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ct(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[h4({find:OZ,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),LZ=["src","alt"],RZ={key:0,class:"image-resizer"},DZ=["onMousedown","onTouchstart"],PZ=o.defineComponent({__name:"ImageView",props:{...ta,selected:{type:Boolean,required:!0}},setup(t){const e=t,n={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},r=o.inject("isMobile",!1),i=o.ref({width:uC,height:uC}),s=o.ref({width:0,height:0}),a=o.ref(!1),l=o.ref({x:0,y:0,w:0,h:0,dir:""}),u=o.computed(()=>{const{src:k,alt:T,width:S,height:A,flipX:V,flipY:B}=e.node.attrs,O=[];V&&O.push("rotateX(180deg)"),B&&O.push("rotateY(180deg)");const F=O.join(" ");return{src:k||void 0,alt:T||void 0,style:{width:yg(S)?`${S}px`:S,height:yg(A)?`${A}px`:A,transform:F||"none"}}});o.computed(()=>({width:o.unref(u).style.width==="100%"?"100%":void 0}));const c=o.ref(null),f=new ResizeObserver(k=>{for(const T of k){const{width:S,height:A}=T.contentRect;s.value={width:S,height:A},e.updateAttributes({originWidth:S,originHeight:A})}});function p(){const{editor:k,getPos:T,extension:S,node:A}=e;if(k.isEditable)return k.commands.setNodeSelection(T());S.options.onImageClick?.(A.attrs.src)}const h=_t.throttle(()=>{const{editor:k}=e;i.value.width=parseInt(getComputedStyle(k.view.dom).width,10)},cC);function g(k,T){k.preventDefault(),k.stopPropagation();let S=0,A=0;const V=document.querySelector(".image-resizer");if(V&&(V.style.borderColor="#3b82f6"),"touches"in k&&k.touches.length>0)S=k.touches[0].clientX,A=k.touches[0].clientY;else if("clientX"in k)S=k.clientX,A=k.clientY;else return;const{width:B,height:O}=o.unref(s),F=B/O;let H=Number(e.node.attrs.width)||B,Y=Number(e.node.attrs.height)||Math.round(H/F);const Q=o.unref(i).width;H=Math.min(H>Q?Q:H,Q),Y=Math.round(H/F),Object.assign(l.value,{x:S,y:A,w:H,h:Y,dir:T}),a.value=!0,w()}const v=_t.throttle(k=>{if(!o.unref(a))return;let T=0;if("touches"in k&&k.touches.length>0)T=k.touches[0].clientX;else if("clientX"in k)T=k.clientX;else return;const{x:S,w:A,dir:V}=o.unref(l),B=(T-S)*(/l/.test(V)?-1:1),O=TL(A+B,vL,o.unref(i).width);e.updateAttributes({width:O})},cC),b=k=>{k.preventDefault(),k.stopPropagation();const T=document.querySelector(".image-resizer");T&&(T.style.borderColor=""),o.unref(a)&&(a.value=!1,Object.assign(l.value,{x:0,y:0,w:0,h:0,dir:""}),C(),p())};function w(){document.addEventListener("mousemove",v,!0),document.addEventListener("mouseup",b,!0),document.addEventListener("touchmove",v,!0),document.addEventListener("touchend",b,!0)}function C(){document.removeEventListener("mousemove",v,!0),document.removeEventListener("mouseup",b,!0),document.removeEventListener("touchmove",v,!0),document.removeEventListener("touchend",b,!0)}const x=new ResizeObserver(h),E=o.computed(()=>{const{textAlign:k}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[k]||""});return o.onMounted(()=>{c.value&&f.observe(c.value),x.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{C(),f.disconnect(),x.disconnect()}),(k,T)=>(o.openBlock(),o.createBlock(o.unref(ea),{class:"node-image",style:o.normalizeStyle({"pointer-events":o.unref(r)&&t.selected&&k.editor.isEditable?"none":"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"image-view",style:o.normalizeStyle([{width:u.value.style.width,height:u.value.style.height},E.value])},[o.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:o.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":a.value},"image-view__body"])},[o.createElementVNode("img",{ref_key:"imageRef",ref:c,src:u.value.src,alt:u.value.alt,class:"block w-full image-view__body__image",style:o.normalizeStyle([{transform:u.value.style.transform}]),onClick:p,onMousedown:T[0]||(T[0]=(...S)=>o.unref(df)&&o.unref(df)(...S))},null,44,LZ),k.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",RZ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.values(n),S=>(o.openBlock(),o.createElementBlock("span",{key:S,class:o.normalizeClass(o.unref(ke)(`image-resizer__handler--${S}`,"image-resizer__handler",o.unref(r)&&t.selected&&"pointer-events-auto")),onMousedown:A=>g(A,S),onTouchstart:o.withModifiers(A=>g(A,S),["prevent"])},null,42,DZ))),128))],512)),[[o.vShow,t.selected||a.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1},8,["style"]))}}),VZ=Xr(PZ,[["__scopeId","data-v-7eba98b1"]]),Th=IZ.extend({group:"block",defining:!0,isolating:!0,addAttributes(){return{...this.parent?.(),src:{default:null,parseHTML:t=>(t.tagName==="P"?t.querySelector("img"):t)?.getAttribute("src")},flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:t=>t.style.textAlign||t.getAttribute("textAlign")||null,renderHTML:t=>({textAlign:t.textAlign})},width:{default:"100%",parseHTML:t=>{const e=t.tagName==="P"?t.querySelector("img"):t,n=e&&(e.style.width||e.getAttribute("width"))||null;return n&&n.endsWith("%")?n:n==null?null:parseInt(n,10)},renderHTML:t=>({width:t.width})},height:{default:"auto",parseHTML:t=>{const e=t.style.height||t.getAttribute("height")||null;return e==null||e==="auto"?null:parseInt(e,10)},renderHTML:t=>({height:t.height})},class:{default:"",parseHTML:t=>t.getAttribute("class")||"",renderHTML:t=>({class:t.class})},"data-memo":{default:"",parseHTML:t=>t.getAttribute("data-memo")||"",renderHTML:t=>({"data-memo":t["data-memo"]})}}},addOptions(){return{...this.parent?.(),onImageClick:void 0}},addNodeView(){return na(VZ)},addCommands(){return{...this.parent?.(),updateImage:t=>({commands:e,editor:n})=>e.updateAttributes(this.name,t)}},renderHTML({node:t,HTMLAttributes:e}){const{textAlign:n,flipX:r,flipY:i}=t.attrs,l=`${{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[n]||""} ${r||i?`transform: rotateX(${r?"180":"0"}deg) rotateY(${i?"180":"0"}deg);`:""}`;return["img",Ct(this.options.HTMLAttributes,e,{style:l})]},parseHTML(){return[{tag:"img[src]"},{tag:"p",priority:1001,getAttrs:t=>{const e=t;return e.children.length===1&&e.firstElementChild?.tagName==="IMG"&&!!!e.textContent?.trim()&&e.firstElementChild.hasAttribute("src")?null:!1}}]},addProseMirrorPlugins(){return[new it({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof De&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof De&&e.node.type.name==="image"}}})]}}),FZ=["paragraph","heading","list_item","todo_item"];function $Z(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Le||n instanceof Mn))return t;const{from:i,to:s}=n,a=[],l=e&&e!==dC?e:null;return r.nodesBetween(i,s,(u,c)=>{const f=u.type;return FZ.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:h}=c;h={...h,lineHeight:l},t=t.setNodeMarkup(f,p,h,c.marks)}),t}function HZ(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 zZ=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}=Pt();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(ga,{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(Bl),{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"]))}}),ME=nt.create({name:"lineHeight",addOptions(){return{...this.parent?.(),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:dC,button({editor:t,t:e}){return{component:zZ,componentProps:{editor:t,icon:"LineHeight",tooltip:e("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=>HZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),UZ=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",Ct(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var Ia=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(Ia||{});const Ib=Lt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){return{...this.parent?.(),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[UZ.configure(this.options.columnOptions)]}}),WZ={class:"flex gap-x-2 items-center"},jZ={class:"sr-only"},qZ={class:"flex justify-end gap-x-2.5 flex-1"},KZ=["disabled"],BE=Xr(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}=Pt(),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(()=>{if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,g?.textContent?.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},h=()=>{u.value=!0,l.value=!1};return(g,v)=>{const b=hh,w=ph,C=fh,x=dh,E=ub,k=Pc,T=Dc;return o.openBlock(),o.createBlock(T,{open:g.open},{default:o.withCtx(()=>[o.createVNode(k,{"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(C,{class:"text-left flex-row justify-between"},{default:o.withCtx(()=>[o.createVNode(b,{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",WZ,[o.withDirectives(o.createElementVNode("button",{onClick:h},[o.createVNode(o.unref(k1),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(w,{class:"outline-none",onClick:f},{default:o.withCtx(()=>[o.createVNode(o.unref(dc),{class:"w-5 h-5"}),o.createElementVNode("span",jZ,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(x,{class:"hidden"}),o.createVNode(Ab,{modelValue:s.value,"onUpdate:modelValue":v[0]||(v[0]=S=>s.value=S),"is-read-only":l.value,"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["modelValue","is-read-only","parent-editor"]),o.createVNode(E,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:v[1]||(v[1]=S=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",qZ,[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,KZ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-c6e8813c"]]),GZ=["innerHTML"],XZ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],YZ=o.defineComponent({__name:"ConfigPlan",props:ta,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=lt.useEventBus(cr.RENDER_SUPER_TEXT),c=o.computed(()=>{const x=s.resolve(i.from)?.node(-1),E=x?.attrs?.id,k=x?.attrs?.pageNumber;return{pageId:E,pageNumber:k}}),f=o.computed(()=>{const C=e.getPos(),x=e.editor.state.doc.resolve(C);for(let E=x.depth;E>0;E--){const k=x.node(E);if(k.type.name==="paragraph")return k}return null}),p=o.computed(()=>f.value?.attrs.id||"");function h(C){e.updateAttributes({"data-text":C}),n.value=!1}function g(C){const x=e.node.attrs[Qe.TEXT],E=e.node.attrs[Qe.ID],T={lineId:C.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:x};u.emit({action:"hover",payload:T})}function v(C){const x=e.node.attrs[Qe.ID],k={lineId:C.target.querySelector(`[node-id="${x}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:k})}function b(){const{getPos:C,node:x,editor:E}=e,k=C(),T=k+1;E.commands.deleteRange({from:k,to:T})}function w(){n.value=!0,a&&(l.value=!0)}return(C,x)=>{const E=vn,k=ch,T=uh,S=lh,A=ah,V=Uc;return o.openBlock(),o.createBlock(o.unref(ea),{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(k,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(E,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:w,onMouseenter:g,onMouseleave:v},{default:o.withCtx(()=>[o.createVNode(o.unref(Bt),{name:"plan",class:o.normalizeClass({"w-[18px] h-auto pr-1":o.unref(a)})},null,8,["class"]),x[3]||(x[3]=o.createTextVNode(" [")),o.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[o.unref(Qe).TEXT]},null,8,GZ),x[4]||(x[4]=o.createTextVNode("] ")),o.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[o.unref(Qe).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(Qe).TEXT],"node-id":e.node.attrs[o.unref(Qe).ID],"line-id":p.value},null,8,XZ)]),_:1})]),_:1}),o.createVNode(S,null,{default:o.withCtx(()=>[o.createVNode(T,{onSelect:x[0]||(x[0]=B=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.$t("editor.configPlan.edit")),1)]),_:1}),o.createVNode(T,{onSelect:b},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(BE,{key:1,title:C.$t("editor.configPlan"),open:n.value,"is-view-mode":l.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Qe).TEXT],"super-text-id":e.node.attrs[o.unref(Qe).ID],onClose:x[2]||(x[2]=B=>n.value=!1),onSave:h,onDelete:b},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(o.openBlock(),o.createBlock(V,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Qe).TEXT],"super-text-element-id":e.node.attrs[o.unref(Qe).ELEMENT_ID],onClose:x[1]||(x[1]=B=>n.value=!1),onSave:h},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),OE=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:Ye,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",Ct(t,{class:"config-plan"})]},addNodeView(){return na(YZ)},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 Lb,Rb;if(typeof WeakMap<"u"){let t=new WeakMap;Lb=e=>t.get(e),Rb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Lb=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Rb=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var an=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 Lb(t)||Rb(t,JZ(t))}};function JZ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=ZZ(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 v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==p.childCount)break;const b=p.child(v),{colspan:w,rowspan:C,colwidth:x}=b.attrs;for(let E=0;E<C;E++){if(E+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:C-E});break}const k=i+E*e;for(let T=0;T<w;T++){r[k+T]==0?r[k+T]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:w-T});const S=x&&x[T];if(S){const A=(k+T)%e*2,V=a[A];V==null||V!=S&&a[A+1]==1?(a[A]=S,a[A+1]=1):V==S&&a[A+1]++}}}i+=w,f+=b.nodeSize}const h=(c+1)*e;let g=0;for(;i<h;)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 an(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&&QZ(l,a,t),l}function ZZ(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 QZ(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=NZ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function NZ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function jn(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 _s=new St("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 eQ(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 bo(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 Ah(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)||tQ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function tQ(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 Db(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function nQ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Pb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function IE(t,e,n){const r=t.node(-1),i=an.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 La(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 LE(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 rQ(t,e,n){const r=jn(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 zt=class Di extends Ue{constructor(e,n=e){const r=e.node(-1),i=an.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 h=s+f+1;return new d3(l.resolve(h),l.resolve(h+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(Db(r)&&Db(i)&&Pb(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Di.rowSelection(r,i):s&&this.isColSelection()?Di.colSelection(r,i):new Di(r,i)}return Le.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=an.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 h=n.map[f];if(s[h])continue;s[h]=!0;const g=n.findCell(h);let v=e.nodeAt(h);if(!v)throw RangeError(`No cell with offset ${h} found`);const b=i.left-g.left,w=g.right-i.right;if(b>0||w>0){let C=v.attrs;if(b>0&&(C=La(C,0,b)),w>0&&(C=La(C,C.colspan-w,w)),g.left<i.left){if(v=v.type.createAndFill(C),!v)throw RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else v=v.type.create(C,v.content)}if(g.top<i.top||g.bottom>i.bottom){const C={...v.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?v=v.type.createAndFill(C):v=v.type.create(C,v.content)}c.push(v)}a.push(e.child(u).copy(me.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new _e(me.from(l),1,1)}replace(e,n=_e.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?_e.empty:n)}const s=Ue.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new _e(me.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=an.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=an.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 Di(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=an.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 Di&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=an.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 Di(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Di(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Di(e.resolve(n),e.resolve(r))}getBookmark(){return new oQ(this.$anchorCell.pos,this.$headCell.pos)}};zt.prototype.visible=!1,Ue.jsonID("cell",zt);var oQ=class bT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new bT(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&&Pb(n,r)?new zt(n,r):Ue.near(r,1)}};function iQ(t){if(!(t.selection instanceof zt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(jt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ut.create(t.doc,e)}function sQ({$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 aQ({$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 lQ(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof De&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=zt.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=zt.rowSelection(l,l)}else if(!n){const l=an.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=zt.create(i,u+1,c)}}else r instanceof Le&&sQ(r)?s=Le.create(i,r.from):r instanceof Le&&aQ(r)&&(s=Le.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var uQ=new St("fix-tables");function RE(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)?RE(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function DE(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=cQ(t,i,s,n))};return e?e.doc!=t.doc&&RE(e.doc,t.doc,0,r):t.doc.descendants(r),n}function cQ(t,e,n,r){const i=an.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 h=0;h<p.rowspan;h++)s[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,La(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,h=s[u];if(h>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const v=[];for(let w=0;w<h;w++){const C=jn(t.schema)[g].createAndFill();C&&v.push(C)}const b=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(b),v)}c=p}return r.setMeta(uQ,{fixTables:!0})}function Ko(t){const e=t.selection,n=Ah(t),r=n.node(-1),i=n.start(-1),s=an.get(r);return{...e instanceof zt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function PE(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;rQ(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,LE(c.attrs,i-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?jn(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 dQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(PE(t.tr,n,n.left))}return!0}function fQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(PE(t.tr,n,n.right))}return!0}function pQ(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,La(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 hQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;pQ(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=an.get(s)}e(r)}return!0}function mQ(t,e,n){var r;const i=jn(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 VE(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;mQ(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],h=r.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{const p=u==null?jn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,h=p?.createAndFill();h&&l.push(h)}return t.insert(a,jn(r.type.schema).row.create(null,l)),t}function gQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(VE(t.tr,n,n.top))}return!0}function vQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(VE(t.tr,n,n.bottom))}return!0}function bQ(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 h=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&p==e.map[f+e.width]){const h=n.nodeAt(p),g=h.attrs,v=h.type.create({...g,rowspan:h.attrs.rowspan-1},h.content),b=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+b),v),c+=g.colspan-1}}}}function yQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;bQ(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=an.get(n.table)}e(r)}return!0}function FE(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function wQ({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 $E(t,e){const n=t.selection;if(!(n instanceof zt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ko(t),{map:i}=r;if(wQ(i,r))return!1;if(e){const s=t.tr,a={};let l=me.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const h=i.map[f*i.width+p],g=r.table.nodeAt(h);if(!(a[h]||!g))if(a[h]=!0,u==null)u=h,c=g;else{FE(g)||(l=l.append(g.content));const v=s.mapping.map(h+r.tableStart);s.delete(v,v+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...LE(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=FE(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new zt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function HE(t,e){const n=jn(t.schema);return CQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function CQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof zt){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=eQ(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=Ko(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 h;for(let g=f.top;g<f.bottom;g++){let v=f.map.positionAt(g,f.left,f.table);g==f.top&&(v+=s.nodeSize);for(let b=f.left,w=0;b<f.right;b++,w++)b==f.left&&g==f.top||p.insert(h=p.mapping.map(v+f.tableStart,1),t({node:s,row:g,col:b}).createAndFill(u[w]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),i instanceof zt&&p.setSelection(new zt(p.doc.resolve(i.$anchorCell.pos),h?p.doc.resolve(h):void 0)),n(p)}return!0}}function xQ(t,e){return function(n,r){if(!bo(n))return!1;const i=Ah(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof zt?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 kQ(t){return function(e,n){if(!bo(e))return!1;if(n){const r=jn(e.schema),i=Ko(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 zE(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 Wc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?kQ(t):function(n,r){if(!bo(n))return!1;if(r){const i=jn(n.schema),s=Ko(n),a=n.tr,l=zE("row",s,i),u=zE("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,h=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 v=g+s.tableStart,b=a.doc.nodeAt(v);b&&a.setNodeMarkup(v,h,b.attrs)}),r(a)}return!0}}Wc("row",{useDeprecatedLogic:!0}),Wc("column",{useDeprecatedLogic:!0});var EQ=Wc("cell",{useDeprecatedLogic:!0});function SQ(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 UE(t){return function(e,n){if(!bo(e))return!1;const r=SQ(Ah(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Le.between(i,nQ(i))).scrollIntoView())}return!0}}function _Q(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 Mh(t,e){const n=t.selection;if(!(n instanceof zt))return!1;if(e){const r=t.tr,i=jn(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 _e(i,0,0))}),r.docChanged&&e(r)}return!0}function TQ(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=Vb(jn(a).row,new _e(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Vb(jn(a).row,new _e(e,n,r)).content:e);else return null;return AQ(a,l)}function AQ(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(me.empty),n[i]<r){const s=jn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(me.from(a))}return{height:e.length,width:r,rows:e}}function Vb(t,e){const n=t.createAndFill();return new e0(n).replace(0,n.content.size,e).doc}function MQ({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 h=u.child(p%u.childCount);f+h.attrs.colspan>r&&(h=h.type.createChecked(La(h.attrs,h.attrs.colspan,f+h.attrs.colspan-r),h.content)),c.push(h),f+=h.attrs.colspan;for(let g=1;g<h.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+h.attrs.colspan}a.push(me.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(me.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=jn(l);let c,f;if(i>e.width)for(let p=0,h=0;p<e.height;p++){const g=n.child(p);h+=g.nodeSize;const v=[];let b;g.lastChild==null||g.lastChild.type==u.cell?b=c||(c=u.cell.createAndFill()):b=f||(f=u.header_cell.createAndFill());for(let w=e.width;w<i;w++)v.push(b);t.insert(t.mapping.slice(a).map(h-1+r),v)}if(s>e.height){const p=[];for(let v=0,b=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const w=v>=e.width?!1:n.nodeAt(e.map[b+v]).type==u.header_cell;p.push(w?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const h=u.row.create(null,me.from(p)),g=[];for(let v=e.height;v<s;v++)g.push(h);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function WE(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 h=n.nodeAt(p),{top:g,left:v}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...h.attrs,rowspan:a-g}),t.insert(t.mapping.slice(l).map(e.positionAt(a,v,n)),h.type.createAndFill({...h.attrs,rowspan:g+h.attrs.rowspan-a})),c+=h.attrs.colspan-1}}return u}function jE(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 h=n.nodeAt(p),g=e.colCount(p),v=t.mapping.slice(l).map(p+r);t.setNodeMarkup(v,null,La(h.attrs,a-g,h.attrs.colspan-(a-g))),t.insert(v+h.nodeSize,h.type.createAndFill(La(h.attrs,0,a-g))),c+=h.attrs.rowspan-1}}return u}function qE(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=an.get(s);const{top:l,left:u}=r,c=u+i.width,f=l+i.height,p=t.tr;let h=0;function g(){if(s=n?p.doc.nodeAt(n-1):p.doc,!s)throw new Error("No table found");a=an.get(s),h=p.mapping.maps.length}BQ(p,a,s,n,c,f,h)&&g(),WE(p,a,s,n,u,c,l,h)&&g(),WE(p,a,s,n,u,c,f,h)&&g(),jE(p,a,s,n,l,f,u,h)&&g(),jE(p,a,s,n,l,f,c,h)&&g();for(let v=l;v<f;v++){const b=a.positionAt(v,u,s),w=a.positionAt(v,c,s);p.replace(p.mapping.slice(h).map(b+n),p.mapping.slice(h).map(w+n),new _e(i.rows[v-l],0,0))}g(),p.setSelection(new zt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var OQ=O0({ArrowLeft:Oh("horiz",-1),ArrowRight:Oh("horiz",1),ArrowUp:Oh("vert",-1),ArrowDown:Oh("vert",1),"Shift-ArrowLeft":Ih("horiz",-1),"Shift-ArrowRight":Ih("horiz",1),"Shift-ArrowUp":Ih("vert",-1),"Shift-ArrowDown":Ih("vert",1),Backspace:Mh,"Mod-Backspace":Mh,Delete:Mh,"Mod-Delete":Mh});function Bh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Oh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof zt)return Bh(n,r,Ue.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=KE(i,t,e);if(a==null)return!1;if(t=="horiz")return Bh(n,r,Ue.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=IE(l,t,e);let c;return u?c=Ue.near(u,1):e<0?c=Ue.near(n.doc.resolve(l.before(-1)),-1):c=Ue.near(n.doc.resolve(l.after(-1)),1),Bh(n,r,c)}}}function Ih(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof zt)a=s;else{const u=KE(i,t,e);if(u==null)return!1;a=new zt(n.doc.resolve(u))}const l=IE(a.$headCell,t,e);return l?Bh(n,r,new zt(a.$anchorCell,l)):!1}}function IQ(t,e){const n=t.state.doc,r=Kl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new zt(r))),!0):!1}function LQ(t,e,n){if(!bo(t.state))return!1;let r=TQ(n);const i=t.state.selection;if(i instanceof zt){r||(r={width:1,height:1,rows:[me.from(Vb(jn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=an.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=MQ(r,l.right-l.left,l.bottom-l.top),qE(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Ah(t.state),a=s.start(-1);return qE(t.state,t.dispatch,a,an.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function RQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=GE(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof zt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Kl(t.state.selection.$anchor))!=null&&((n=Fb(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let f=Fb(t,c);const p=_s.getState(t.state)==null;if(!f||!Pb(u,f))if(p)f=u;else return;const h=new zt(u,f);if(p||!t.state.selection.eq(h)){const g=t.state.tr.setSelection(h);p&&g.setMeta(_s,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),_s.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_s,-1))}function l(u){const c=u,f=_s.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if(GE(t,c.target)!=r&&(p=Fb(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 KE(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 GE(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Fb(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Kl(t.state.doc.resolve(n.pos)):null}var DQ=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")),$b(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,$b(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function $b(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,h=0;p<f.childCount;p++){const{colspan:g,colwidth:v}=f.child(p).attrs;for(let b=0;b<g;b++,h++){const w=i==h?s:v&&v[b],C=w?w+"px":"";if(l+=w||r,w||(u=!1),c)c.style.width!=C&&(c.style.width=C),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=C,e.appendChild(x)}}}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 Sr=new St("tableColumnResizing");function PQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=DQ,lastColumnResizable:i=!0}={}){const s=new it({key:Sr,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=jn(l.schema).table.name;return r&&f&&(f[p]=(h,g)=>new r(h,n,g)),new VQ(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Sr.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{FQ(a,l,t,i)},mouseleave:a=>{$Q(a)},mousedown:(a,l)=>{HQ(a,l,e,n)}},decorations:a=>{const l=Sr.getState(a);if(l&&l.activeHandle>-1)return qQ(a,l.activeHandle)},nodeViews:{}}});return s}var VQ=class Vm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Sr);if(r&&r.setHandle!=null)return new Vm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Vm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Db(e.doc.resolve(i))||(i=-1),new Vm(i,n.dragging)}return n}};function FQ(t,e,n,r){if(!t.editable)return;const i=Sr.getState(t.state);if(i&&!i.dragging){const s=UQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=XE(t,e,"left",n):u-e.clientX<=n&&(a=XE(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=an.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}JE(t,a)}}}function $Q(t){if(!t.editable)return;const e=Sr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&JE(t,-1)}function HQ(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!=null?i:window,a=Sr.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=zQ(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Sr,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const h=Sr.getState(t.state);h?.dragging&&(WQ(t,h.activeHandle,YE(h.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Sr,{setDragging:null})))}function f(p){if(!p.which)return c(p);const h=Sr.getState(t.state);if(h&&h.dragging){const g=YE(h.dragging,p,n);ZE(t,h.activeHandle,g,r)}}return ZE(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function zQ(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 UQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function XE(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=an.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 YE(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function JE(t,e){t.dispatch(t.state.tr.setMeta(Sr,{setHandle:e}))}function WQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=an.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],h=i.nodeAt(p).attrs,g=h.colspan==1?0:l-s.colCount(p);if(h.colwidth&&h.colwidth[g]==n)continue;const v=h.colwidth?h.colwidth.slice():jQ(h.colspan);v[g]=n,u.setNodeMarkup(a+p,null,{...h,colwidth:v})}u.docChanged&&t.dispatch(u)}function ZE(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=an.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&&$b(s,u.firstChild,u,r,l,n)}function jQ(t){return Array(t).fill(0)}function qQ(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return ut.empty;const a=an.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],h=l+p+s.nodeAt(p).nodeSize-1,g=document.createElement("div");g.className="column-resize-handle",(n=Sr.getState(t))!=null&&n.dragging&&r.push(jt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(jt.widget(h,g))}}return ut.create(t.doc,r)}function KQ({allowTableNodeSelection:t=!1}={}){return new it({key:_s,state:{init(){return null},apply(e,n){const r=e.getMeta(_s);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:iQ,handleDOMEvents:{mousedown:RQ},createSelectionBetween(e){return _s.getState(e.state)!=null?e.state.selection:null},handleTripleClick:IQ,handleKeyDown:OQ,handlePaste:LQ},appendTransaction(e,n,r){return lQ(r,DE(r,n),t)}})}const GQ=(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)},XQ=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof zt)||i.forEachCell((s,a)=>{t=GQ(t,a,n)}),t},QE=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=XQ(n,e,t),n.docChanged?(i?.(n),!0):!1},YQ=nt.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=>QE(t,this.options),unsetTableCellBackground:()=>QE("",this.options)}}}),JQ=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",Ct(this.options.HTMLAttributes,t),0]}}),ZQ=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ct(this.options.HTMLAttributes,t),0]}}),QQ=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",Ct(this.options.HTMLAttributes,t),0]}});function Hb(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function NE(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,h=0;p<f.childCount;p+=1){const{colspan:g,colwidth:v}=f.child(p).attrs;for(let b=0;b<g;b+=1,h+=1){const w=i===h?s:v&&v[b],C=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==C){const[x,E]=Hb(r,w);c.style.setProperty(x,E)}c=c.nextSibling}else{const x=document.createElement("col"),[E,k]=Hb(r,w);x.style.setProperty(E,k),e.appendChild(x)}}}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 NQ{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")),NE(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,NE(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function eN(t,e,n,r){let i=0,s=!0;const a=[],l=t.firstChild;if(!l)return{};for(let p=0,h=0;p<l.childCount;p+=1){const{colspan:g,colwidth:v}=l.child(p).attrs;for(let b=0;b<g;b+=1,h+=1){const w=n===h?r:v&&v[b];i+=w||e,w||(s=!1);const[C,x]=Hb(e,w);a.push(["col",{style:`${C}: ${x}`}])}}const u=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function eS(t,e){return t.createAndFill()}function tN(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 nN(t,e,n,r,i){const s=tN(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=eS(s.cell);if(f&&l.push(f),r){const p=eS(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 rN(t){return t instanceof zt}const Lh=({editor:t})=>{const{selection:e}=t.state;if(!rN(e))return!1;let n=0;const r=a4(e.ranges[0].$from,s=>s.type.name==="table");return 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},oN=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:NQ,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}=eN(t,this.options.cellMinWidth);return["table",Ct(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=nN(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})=>dQ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>fQ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>hQ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>gQ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>vQ(t,e),deleteRow:()=>({state:t,dispatch:e})=>yQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>_Q(t,e),mergeCells:()=>({state:t,dispatch:e})=>$E(t,e),splitCell:()=>({state:t,dispatch:e})=>HE(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Wc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Wc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>EQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>$E(t,e)?!0:HE(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>xQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>UE(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>UE(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&DE(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=zt.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:Lh,"Mod-Backspace":Lh,Delete:Lh,"Mod-Delete":Lh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[PQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],KQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt($e(t,"tableRole",e))}}}),iN=/(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,sN=/CrOS/,aN=/android|ipad|playbook|silk/i;function tS(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:!!(iN.test(e)&&!sN.test(e)||t.tablet&&aN.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const lN=["disabled"],uN={"content-class":"table-grid-size-editor","content-style":"padding:0"},cN={class:"flex flex-col flex-wrap gap-1 justify-between"},dN=["onMouseover","onMousedown"],fN={class:"text-center text-sm text-zinc-600 mt-2"},pN=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:tS()?af:sf,cols:tS()?af:sf}),a=o.reactive({rows:lf,cols:lf});function l(g,v){g===s.rows&&(s.rows=Math.min(g+1,af)),v===s.cols&&(s.cols=Math.min(v+1,af)),a.rows=g,a.cols=v}function u(g,v){n("create-table",{rows:g,cols:v,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=sf,s.cols=sf,a.rows=lf,a.cols=lf}const f=o.inject("isMobile",!1),{isOpen:p}=Qf({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),h=o.computed(()=>f?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,v)=>(o.openBlock(),o.createBlock(o.unref(ms),o.normalizeProps(o.guardReactiveProps(o.unref(h))),{default:o.withCtx(()=>[o.createVNode(o.unref(xa),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,lN)]),_:3}),o.createVNode(o.unref(gs),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",uN,[o.createElementVNode("div",cN,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,b=>(o.openBlock(),o.createElementBlock("div",{key:"r"+b,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,w=>(o.openBlock(),o.createElementBlock("div",{key:"c"+w,class:o.normalizeClass([[w<=a.cols&&b<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:C=>l(b,w),onMousedown:C=>u(b,w)},v[0]||(v[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,dN))),128))]))),128))]),o.createElementVNode("div",fN,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),hN={style:{display:"flex"}},mN=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(pN,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",hN,[o.createVNode(Ye,{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"]))}}),zb=oN.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){return{...this.parent?.(),toggleTableEditor:t=>({editor:e})=>e.storage.table?(e.storage.table.isTableEditorOpen=t,!0):!1}},addOptions(){return{...this.parent?.(),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:t,t:e})=>({component:mN,componentProps:{icon:"Table",tooltip:e("editor.table.tooltip"),action:()=>{const n=t.storage.table?.isTableEditorOpen??!1;t.commands.toggleTableEditor(!n)}}})}},addExtensions(){return[ZQ.configure(this.options.tableRow),JQ.configure(this.options.tableHeader),QQ.configure(this.options.tableCell),YQ.configure(this.options.tableCellBackground)]},addProseMirrorPlugins(){const{onTableClick:t}=this.options;return[new it({props:{handleClick:(e,n,r)=>{if(e.editable||!t)return!1;const{state:i}=e,s=i.doc.resolve(n);for(let a=s.depth;a>0;a--)if(s.node(a).type.name==="table"){const u=e.nodeDOM(s.before(a));if(u)return t(u.outerHTML),!0}return!1}}})]}}),gN={class:"flex items-center gap-2 px-2"},vN=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}=Pt(),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)=>(o.openBlock(),o.createBlock(ga,{title:i.value?.label,"side-offset":5},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(l,u)=>(o.openBlock(),o.createBlock(o.unref(Bl),{key:u,class:"cursor-pointer",checked:l.isActive?.()||!1,onClick:l.action},{default:o.withCtx(()=>[o.createElementVNode("div",gN,[o.createVNode(o.unref(Bt),{name:l.iconName,class:"h3 w-3"},null,8,["name"]),o.createElementVNode("span",null,o.toDisplayString(l.label),1)])]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["title"]))}}),bN=nt.create({name:"text-bubble",addOptions(){return{...this.parent?.(),toolbar:!1,button:()=>({component:vN,componentProps:{}})}}}),yN=[{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}년"}],nS=t=>{const e=[...t||[],...yN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},wN=nt.create({name:ih,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=nS(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(jt.inline(a,l,{class:"time-highlight"}))}}),ut.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[ih];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Ub(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function CN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}r?.type==="CLIPBOARD_STATE"&&t(!!r.data?.hasClipboard)},Ub({type:"REQUEST_CLIPBOARD_STATE"})})}function xN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}r?.type==="PASTE_RESULT"&&t(r.data?.text??null)},Ub({type:"PASTE"})})}function kN(t,e){Ub({type:"COPY",data:{html:t,text:e}})}async function EN(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 SN(){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 _N=nt.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=hn.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
345
+ `){G.push(P),P="";continue}if(P+=ee,U(P)>L())for(;U(P)>L();){const de=j(P,L());de<=0?(G.push(P.charAt(0)),P=P.slice(1)):(G.push(P.slice(0,de)),P=P.slice(de))}}return G.push(P),G.map(ee=>`<p>${ee}</p>`).join("")}const B=o.computed(()=>{const H=r.parentEditor?.storage.superText.superInputModal?.props?.guidelineLeftOffset;return s.value||!H?{}:{backgroundImage:"linear-gradient(to right, #d1d5db 1px, transparent 1px)",backgroundSize:"1px 100%",backgroundRepeat:"no-repeat",backgroundPosition:Yt(H)}}),{isScrolling:O,handleScroll:F}=Yl();return e({insertSpecialCharater:h,isChecked:u,toggleSpellCheck:g,wrapText:V,editor:p}),(H,Y)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:v,class:o.normalizeClass(o.unref(ke)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5 relative",H.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(O)&&"scrollbar-thumb-transparent")),style:o.normalizeStyle([o.unref(S),o.unref(B),o.unref(T)]),onScroll:Y[0]||(Y[0]=(...Q)=>o.unref(F)&&o.unref(F)(...Q))},[o.createVNode(o.unref(Jn),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(ke)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),oZ={class:"sr-only"},iZ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},sZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},aZ={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"},lZ=["checked"],uZ={for:"spellcheck",class:"select-none whitespace-nowrap"},cZ={class:"flex gap-x-1"},dZ={class:"ml-auto"},fZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},pZ={class:"text-right text-sm p-2"},hZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},CE=5,Uc=o.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){const n=e,r=t,{t:i}=Pt(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=lt.useLocalStorage("superInputModalPosition",null),f=o.reactive({x:0,y:0}),p=o.ref(!1),h={x:0,y:0},g=o.ref(!1),v=o.ref(!1),b=o.ref(!1),w=K=>{p.value=!0;const ee=K.currentTarget.closest(".draggable-dialog").getBoundingClientRect();h.x=K.clientX-ee.left,h.y=K.clientY-ee.top,document.addEventListener("mousemove",C),document.addEventListener("mouseup",x)},C=K=>{p.value&&(f.x=K.clientX-h.x,f.y=K.clientY-h.y)},x=()=>{p.value=!1,c.value={x:f.x,y:f.y},document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",x)};o.watch(()=>r.open,async K=>{if(!K)return;v.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await o.nextTick();const ee=document.querySelector(".draggable-dialog");if(!ee)return;ee.getBoundingClientRect();const de=window.innerWidth,Ee=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((de-ee.offsetWidth)/2,0),f.y=Math.max((Ee-ee.offsetHeight)/2,0))},{immediate:!0});const E=()=>{n("close"),s.value="",a.value="",u.value=!1},k=()=>{if(l.value?.editor.commands.hasInvalidChar()){b.value=!0;return}s.value=l.value.wrapText(),a.value="",v.value?g.value=!0:n("close"),n("save",s.value),s.value=""},T=()=>{g.value=!1,n("close")},S=r.editor?.extensionManager.extensions.find(K=>K.name==="superText")?.options.specialCharModal,A=o.inject("isEditable",void 0),V=o.computed(()=>A?!o.unref(A):r.editor?!r.editor.isEditable:!1),B=o.inject("fontFamily",""),O=o.computed(()=>r.editor?.storage.superText.superInputModal?.props?.fontFamily??o.unref(B)??void 0),F=o.inject("fontSize",o.ref("")),H=o.computed(()=>r.editor?.storage.superText.superInputModal?.props?.fontSize??o.unref(F)??"14px"),Y=lt.useLocalStorage("recentSpecialChars",[]),Q=lt.useLocalStorage("superInputSpellCheck",!0),U=K=>{if(!K)return;const ee=(Y.value??[]).filter(de=>de!==K);ee.unshift(K),Y.value=ee.slice(0,CE)},D=K=>{l.value?.insertSpecialCharater(K)},L=(K,ee)=>{ee&&(l.value?.insertSpecialCharater(K),U(K))},j=o.computed(()=>l.value?.isChecked),P=()=>{l.value?.toggleSpellCheck(),Q.value=l.value?.isChecked??Q.value};o.onUnmounted(()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",x)}),o.watch(s,K=>{!r.superTextElementId||r.superTextElementId===""||(v.value=K!==(r.superTextInit??""))});const G=o.computed(()=>l.value?.editor);return(K,ee)=>{const de=hh,Ee=ph,se=fh,ge=dh,J=yE,te=VX,oe=ub,ae=Pc,fe=Dc,Te=RX;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(fe,{open:K.open,modal:!o.unref(V)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ng),null,{default:o.withCtx(()=>[o.createVNode(o.unref(i1),{class:"!pointer-events-none bg-black/30"}),o.createVNode(ae,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[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(O),fontWeight:"normal",fontSize:o.unref(H)})},[o.createVNode(se,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(w,["prevent"])},{default:o.withCtx(()=>[o.createVNode(de,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(Ee,{class:"absolute right-3 top-3 text-white",onClick:E},{default:o.withCtx(()=>[o.createVNode(o.unref(dc),{class:"w-5 h-5"}),o.createElementVNode("span",oZ,o.toDisplayString(K.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(ge),o.createElementVNode("div",iZ,[o.createElementVNode("div",sZ,[ee[5]||(ee[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex gap-x-6",o.unref(Y).length===CE&&"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:ee[0]||(ee[0]=Se=>u.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.insert.symbol")),1)]),_:1}),o.createElementVNode("div",aZ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref(j),onChange:P},null,40,lZ),o.createElementVNode("label",uZ,o.toDisplayString(o.unref(i)("editor.menubar.menu.spellCheck")),1)]),o.createElementVNode("div",cZ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Y),Se=>(o.openBlock(),o.createBlock(vn,{key:Se,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:We=>D(Se)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(Se),1)]),_:2},1032,["onClick"]))),128))]),o.createElementVNode("div",dZ,[o.unref(G)?(o.openBlock(),o.createBlock(J,{key:0,editor:o.unref(G),"is-enable-spell-check-real-time":o.unref(G)?.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(o.unref(S)?.component),o.mergeProps({key:0,"custom-class":"!z-[70] !pointer-events-auto","font-family":o.unref(O)},o.unref(S).props,{onSelectedChar:L,onClose:ee[1]||(ee[1]=Se=>u.value=!1)}),null,16,["font-family"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",fZ,[o.createElementVNode("label",pZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(te,{editor:o.unref(G)},{default:o.withCtx(()=>[o.createVNode(Ab,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":ee[2]||(ee[2]=Se=>s.value=Se),"parent-editor":K.editor,"spellcheck-enabled":o.unref(Q),"suppress-inline-spell-popover":!0,class:""},null,8,["modelValue","parent-editor","spellcheck-enabled"])]),_:1},8,["editor"])]),o.createElementVNode("div",hZ,[ee[6]||(ee[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(ws,{modelValue:a.value,"onUpdate:modelValue":ee[3]||(ee[3]=Se=>a.value=Se),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),o.createVNode(oe,{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:k},{default:o.withCtx(()=>[o.createVNode(o.unref(M1),{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:E},{default:o.withCtx(()=>[o.createVNode(o.unref(dc),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(K.$t("editor.close")),1)]),_:1})]),_:1})],4)]),_:1})]),_:1})]),_:1},8,["open","modal"]),o.createVNode(Te,{open:g.value,onClose:T},null,8,["open"]),o.createVNode(Te,{title:"Information",message:"{ 과 } 는 입력이 제한된 문자열 입니다.",iconName:"MessageCircleWarning",confirmText:"Ok",open:b.value,onClose:ee[4]||(ee[4]=Se=>b.value=!1)},null,8,["open"])],64)}}}),Mb=o.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Pt(),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:x,to:E}=n.editor.state.selection,k=n.editor.state.doc.cut(x,E),S=hn.fromSchema(n.editor.schema).serializeFragment(k.content),A=document.createElement("div");return A.appendChild(S),A.innerHTML}const f=()=>{const{view:x}=n.editor,{from:E,to:k}=x.state.selection,T=c();s.text=T,s.from=E,s.to=k},p=()=>i.value=!i.value,h=()=>{u.value||(i.value=!0,f())},g=()=>i.value=!1,v=x=>{if(zc(x.trim())){i.value=!1;return}const E=n?.superTextStore.addMoreSuperText(x);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":E,"data-text":x}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},b=o.ref(!1),w=async x=>{if(x){const E=await n.editor.hasClipboard?.();b.value=!!E}},C=()=>{if(u.value||!n.editor)return;const{view:x,state:E}=n.editor,{from:k,to:T}=E.selection;s.from=k,s.to=T,s.text="",x.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:h,closeDialog:g}),(x,E)=>{const k=Uc,T=ch,S=uh,A=lh,V=ah;return x.disabled?o.renderSlot(x.$slots,"default",{key:0}):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(k,{open:i.value,editor:x.editor,"super-text-init":s.text,onClose:p,onSave:v},null,8,["open","editor","super-text-init"]),o.createVNode(V,{"onUpdate:open":w},{default:o.withCtx(()=>[o.createVNode(T,{as:"template",class:"relative",disabled:o.unref(u),onDblclick:o.withModifiers(C,["prevent","stop"])},{default:o.withCtx(()=>[o.renderSlot(x.$slots,"default")]),_:3},8,["disabled"]),o.createVNode(A,null,{default:o.withCtx(()=>[x.disableSuperInput?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(S,{key:0,onSelect:h},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.inputSuper")),1)]),_:1})),o.unref(a)?(o.openBlock(),o.createBlock(S,{key:1,onSelect:E[0]||(E[0]=B=>x.editor?.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(S,{key:2,onSelect:E[1]||(E[1]=B=>x.editor?.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(S,{key:3,disabled:!b.value,onSelect:E[2]||(E[2]=B=>x.editor?.commands.pasteContent())},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):o.createCommentVNode("",!0)]),_:1})]),_:3})],64))}}}),mZ={id:"editor-panel",class:"flex relative w-full h-full"},gZ=Xr(o.defineComponent({__name:"PageNode",props:ta,setup(t){const{state:e,page:n,superTextStore:r}=yn(),{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:h}=i,g=o.computed(()=>s?`calc(${h} - ${a?.top??0} - ${a?.bottom??0}`:"max-content"),v=lt.useEventBus(cr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,b=>{v.emit(b.pageNumber)},{immediate:!0}),(b,w)=>{const C=Mb;return o.openBlock(),o.createBlock(o.unref(ea),{id:b.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":b.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":o.unref(a)?.top??"0","--umo-page-margin-bottom":o.unref(a)?.bottom??"0","--umo-page-margin-left":o.unref(a)?.left??"0","--umo-page-margin-right":o.unref(a)?.right??"0","--umo-page-width":o.unref(p),"--umo-page-height":o.unref(h),"--empty-node-left":"0px",left:100,"min-height":typeof o.unref(h)=="number"?`${o.unref(h)}px`:o.unref(h),height:f.value?typeof o.unref(h)=="number"?`${o.unref(h)}px`:o.unref(h):"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",mZ,[o.createVNode(C,{mode:c.value?o.unref(Me).REPORT:o.unref(Me).EDITOR,editor:b.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(iC),{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 xE(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const vZ=({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=_h(c,l.node().type.name,l.node().attrs);if(f.id=Nv(),f.extend&&(f.extend=!1),s instanceof De&&s.node.isBlock)return!l.parentOffset||!gr(a,l.pos)?!1:(r&&(t&&xE(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 h=l.depth===0?void 0:i4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&h?[{type:h,attrs:f}]:void 0,v=gr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!v&&gr(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(v=!0,g=h?[{type:h,attrs:f}]:void 0),v&&(g||(g=[{type:l.node().type,attrs:f}]),e.split(e.mapping.map(l.pos),1,g),h&&!p&&!l.parentOffset&&l.parent.type!==h)){const b=e.mapping.map(l.before()),w=e.doc.resolve(b);l.node(-1).canReplaceWith(w.index(),w.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&xE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},bZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{const s=bn(t,n.schema),{$from:a,$to:l}=n.selection;if((n.selection instanceof De?n.selection.node:null)?.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 b=me.empty;const w=a.index(-1)?1:a.index(-2)?2:3;for(let S=a.depth-w;S>=a.depth-3;S-=1)b=me.from(a.node(S).copy(b));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,x=_h(f,a.node().type.name,a.node().attrs),E=s.contentMatch.defaultType?.createAndFill(x)??void 0;b=b.append(me.from(s.createAndFill(null,E)??void 0));const k=a.before(a.depth-(w-1));e.replace(k,a.after(-C),new _e(b,4-w,0));let T=-1;e.doc.nodesBetween(k,e.doc.content.size,(S,A)=>{if(T>-1)return!1;S.isTextblock&&S.content.size===0&&(T=A+1)}),T>-1&&e.setSelection(Le.near(e.doc.resolve(T))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,h=_h(f,c.type.name,c.attrs),g=_h(f,a.node().type.name,a.node().attrs);h.id=Nv(),g.id=Nv(),e.delete(a.pos,l.pos);const v=p?[{type:s,attrs:h},{type:p,attrs:g}]:[{type:s,attrs:h}];if(!gr(e.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:w}=n,{splittableMarks:C}=i.extensionManager,x=w??(b.$to.parentOffset&&b.$from.marks());if(e.split(a.pos,2,v).scrollIntoView(),!x||!r)return!0;const E=x.filter(k=>C.includes(k.type.name));e.ensureMarks(E)}return!0},yZ=[Np,Qp,eh,eb,th,Ss,nb,zl,ob,sb,rb,_a,Ul,xi,ib,ab,tb,Gr],wZ=Lt.create({priority:200,name:`${Gr}`,content:"block*",group:`${Gr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:na(gZ),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:$r(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",{...Ct(e),"data-type":this.name},0]},addCommands(){return{splitBlock:vZ,splitListItem:bZ,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:yZ.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=Ue.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>kE(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(Ue.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(Gr);const f=ai(p=>p.type.name===Gr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(Gr);const p=f.node.firstChild.type;if(f.start+Ue.atStart(f.node).from===c){const g=Le.create(l,f.start-2,f.start-2),v=ai(b=>b.type.name===Gr)(g);if(v){const b=Ue.atEnd(v.node).from+v.start,w=Le.create(l,b,b);if(p===v.node.lastChild.type){const{parent:C}=w.$anchor;return XG(C,i.schema)?s.setSelection(w):s.step(new gn(b,c,_e.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>kE(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=ai(f=>f.type.name===zl)(s);return c&&c.start+Ue.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(Ue.atEnd(a).from===u)return r.deleteNode(Gr);const c=ai(f=>f.type.name===Gr)(s);if(c&&c.start+Ue.atEnd(c.node).from===u){const p=Le.create(a,u+2,u+2),h=ai(g=>g.type.name===Gr)(p);if(h){const g=Ue.atStart(h.node).from+h.start,v=Le.create(a,g,g);if(ai(w=>w.attrs.extend)(v))return i.step(new gn(u,g,_e.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 _h(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 kE=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=s4(r,{from:n.from,to:n.to},s=>s.type.name===zl);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()}),EE={"editor.remove":"Remove","editor.copy":"Copy","editor.words":"WORDS","editor.characters":"CHARACTERS","editor.default":"Default","editor.recent":"Recently Used","editor.nofill":"Remove Color","editor.format":"Format Painter","editor.close":"Close","editor.modify":"Modify","editor.preview.tooltip":"Preview","editor.draghandle.tooltip":"Click And Drag","editor.copyToClipboard":"CopyToClipboard","editor.importWord.tooltip":"Import from Word","editor.importWord.success":"Import Success","editor.importWord.fileTooLarge":"File is Too large","editor.importWord.error":"Import Failed, File not supported","editor.slash":"Press '/' for commands","editor.slash.empty":"No Result","editor.slash.format":"Format","editor.slash.insert":"Insert","editor.slash.embed":"Embed Services","editor.content":"Please input content","editor.slash.hint":"Please input content","editor.moremark":"More Text Styles","editor.size.small.tooltip":"Small","editor.size.medium.tooltip":"Medium","editor.size.large.tooltip":"Cover","editor.bold.tooltip":"Bold","editor.italic.tooltip":"Italic","editor.underline.tooltip":"Underline","editor.strike.tooltip":"Strike","editor.color.tooltip":"Color","editor.color.more":"Color Picker","editor.highlight.tooltip":"Highlight","editor.lineheight.tooltip":"Line Height","editor.heading.tooltip":"Headings","editor.heading.h1.tooltip":"Heading 1","editor.heading.h2.tooltip":"Heading 2","editor.heading.h3.tooltip":"Heading 3","editor.heading.h4.tooltip":"Heading 4","editor.heading.h5.tooltip":"Heading 5","editor.heading.h6.tooltip":"Heading 6","editor.paragraph.tooltip":"Paragraph","editor.textalign.tooltip":"Align","editor.textalign.left.tooltip":"Left","editor.textalign.center.tooltip":"Center","editor.textalign.right.tooltip":"Right","editor.textalign.justify.tooltip":"Justify","editor.indent":"Indent","editor.indent.indent":"Increase Indent","editor.indent.outdent":"Decrease Indent","editor.fontFamily.tooltip":"Font family","editor.fontFamily.default":"Default","editor.fontFamily.gulim":"Gulim","editor.fontFamily.dotum":"Dotum","editor.fontFamily.gungsuh":"Gungsuh","editor.fontSize.tooltip":"Font size","editor.fontSize.default.tooltip":"Default","editor.superscript.tooltip":"Superscript","editor.subscript.tooltip":"Subscript","editor.bulletlist.tooltip":"Bullet List","editor.bulletlist.disc.tooltip":"Disc","editor.bulletlist.circle.tooltip":"Circle","editor.bulletlist.square.tooltip":"Square","editor.orderedlist.tooltip":"Ordered List","editor.orderedlist.decimal.tooltip":"Decimal","editor.orderedlist.decimalLeadingZero.tooltip":"Decimal with leading zero","editor.orderedlist.lowerRoman.tooltip":"Lower Roman","editor.orderedlist.upperRoman.tooltip":"Upper Roman","editor.orderedlist.lowerLatin.tooltip":"Lower Latin","editor.orderedlist.upperLatin.tooltip":"Upper Latin","editor.orderedlist.tradChineseInformal.tooltip":"Trad Chinese Informal","editor.orderedlist.simpChineseFormal.tooltip":"Simp Chinese Informal","editor.tasklist.tooltip":"Task List","editor.indent.tooltip":"Indent","editor.outdent.tooltip":"Outdent","editor.columns.tooltip":"Columns","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"UnLink","editor.link.open.tooltip":"Open Link","editor.link.edit.tooltip":"Edit Link","editor.link.dialog.title":"Insert Link","editor.link.dialog.link":"Link","editor.link.dialog.text":"Text","editor.link.dialog.openInNewTab":"Open In New Tab","editor.link.dialog.link.placeholder":"Link Address","editor.link.dialog.text.placeholder":"Add Description","editor.link.dialog.button.apply":"Apply","editor.image.tooltip":"Image","editor.image.menu.flipX":"Flip vertical","editor.image.menu.flipY":"Flip horizontal","editor.image.menu.moveUp":"Move up","editor.image.menu.moveDown":"Move down","editor.image.menu.size":"Set Size","editor.image.menu.size.width":"Width","editor.image.menu.size.height":"Height","editor.image.dragger.tooltip":"Click or drag the image to the area to upload","editor.image.float.left.tooltip":"Float left","editor.image.float.none.tooltip":"Float none","editor.image.float.right.tooltip":"Float right","editor.image.dialog.title":"Add an image","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Upload","editor.image.dialog.uploading":"Uploading","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Lock original aspect ratio","editor.image.dialog.form.file":"File","editor.image.dialog.button.apply":"apply","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Upload","editor.video.dialog.uploading":"Uploading","editor.video.dialog.title":"Embed or upload a video","editor.video.dialog.link":"link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"apply","editor.table.tooltip":"Table","editor.table.menu.insert_table":"Insert Table","editor.table.menu.insert_table.with_header_row":"With header row","editor.table.menu.insertColumnBefore":"Insert Column Before","editor.table.menu.insertColumnAfter":"Insert Column After","editor.table.menu.deleteColumn":"Delete Column","editor.table.menu.insertRowAbove":"Insert Row Above","editor.table.menu.insertRowBelow":"Insert Row Below","editor.table.menu.deleteRow":"Delete Row","editor.table.menu.mergeCells":"Merge Cells","editor.table.menu.splitCells":"Split Cells","editor.table.menu.deleteTable":"Delete Table","editor.table.menu.setCellsBgColor":"Cell Background Color","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Horizontal Rule","editor.code.tooltip":"Code","editor.codeblock.tooltip":"Code Block","editor.clear.tooltip":"Clear Format","editor.undo.tooltip":"Undo","editor.redo.tooltip":"Redo","editor.fullscreen.tooltip.fullscreen":"Fullscreen","editor.fullscreen.tooltip.exit":"Fullscreen Exit","editor.imageUpload.fileTypeNotSupported":"File type not supported","editor.imageUpload.fileSizeTooBig":"File size too big, Maximum size is","editor.AI.placeholder":"Ask AI ...","editor.AI.generating":"Generating","editor.AI.insert":"Insert below selection","editor.AI.replace":"Replace selected content","editor.AI.regenerate":"Regenerate","editor.AI.close":"Close","editor.AI.stop":"Stop","editor.AI.ask":"Ask AI","editor.menubar.file":"File","editor.menubar.edit":"Edit","editor.menubar.view":"View","editor.menubar.insert":"Insert","editor.menubar.format":"Format","editor.menubar.menu.newDoc":"New Document","editor.menubar.menu.restoreLastDraft":"Restore last draft","editor.menubar.menu.print":"Print","editor.menubar.menu.cut":"Cut","editor.menubar.menu.copy":"Copy","editor.menubar.menu.paste":"Paste","editor.menubar.menu.pasteAsText":"Paste as text","editor.menubar.menu.selectAll":"Select all","editor.menubar.menu.preview":"Preview","editor.menubar.menu.spellCheck":"Spell check","editor.menubar.menu.spelling":"spelling","editor.menubar.menu.superView":"Super view","editor.menubar.menu.insertSuper":"Insert super","editor.menubar.menu.articleContent":"Article content","editor.menubar.menu.articleComment":"Article comment","editor.menubar.menu.cancel":"Cancel","editor.menubar.menu.save":"Save","editor.findAndReplace.tooltip":"Find and replace","editor.findAndReplace.find":"Find","editor.findAndReplace.replace":"Replace","editor.findAndReplace.replaceAll":"Replace All","editor.findAndReplace.caseSensitive":"Case Sensitive","editor.printer.tooltip":"Print","editor.superinput":"Super input","editor.insert.symbol":"Insert symbol","editor.check":"Check","editor.detail":"Detail","editor.inputSuper":"Input Super","editor.insertSpecial":"Special characters","editor.cut":"Cut","editor.paste":"Paste","editor.selectAll":"SelectAll","editor.delete":"Delete","editor.super.edit":"Super edit","editor.super.delete":"Super delete","editor.configPlan.edit":"Config plan edit","editor.configPlan.delete":"Config plan delete","editor.super":"Super","editor.configPlan":"Config plan","editor.insertConfigPlan":"Insert config plan","editor.alert":"Super has been changed. Super ID will be deleted.","editor.alertConfirm":"Confirm","editor.alertYes":"OK"},SE={"editor.remove":"제거","editor.copy":"복사","editor.words":"낱말","editor.characters":"문자","editor.default":"기본값","editor.recent":"최근 사용됨","editor.nofill":"색상 제거","editor.format":"형식 페인터","editor.close":"닫기","editor.modify":"수정","editor.preview.tooltip":"미리보기","editor.draghandle.tooltip":"클릭하여 드래그","editor.copyToClipboard":"클립보드에 복사","editor.importWord.tooltip":"Word에서 가져오기","editor.importWord.success":"가져오기 성공","editor.importWord.fileTooLarge":"파일이 너무 큽니다","editor.importWord.error":"가져오기 실패, 파일이 지원되지 않음","editor.slash":"명령을 보려면 '/'를 누르세요.","editor.slash.empty":"결과 없음","editor.slash.format":"형식","editor.slash.insert":"삽입","editor.slash.embed":"서비스 삽입","editor.content":"내용을 입력해주세요","editor.slash.hint":"내용을 입력해주세요","editor.moremark":"추가 텍스트 스타일","editor.size.small.tooltip":"작음","editor.size.medium.tooltip":"중간","editor.size.large.tooltip":"표지","editor.bold.tooltip":"굵게","editor.italic.tooltip":"기울임꼴","editor.underline.tooltip":"밑줄","editor.strike.tooltip":"취소선","editor.color.tooltip":"색상","editor.color.more":"색상 선택기","editor.highlight.tooltip":"강조 표시","editor.lineheight.tooltip":"줄간격","editor.heading.tooltip":"제목","editor.heading.h1.tooltip":"제목 1","editor.heading.h2.tooltip":"제목 2","editor.heading.h3.tooltip":"제목 3","editor.heading.h4.tooltip":"제목 4","editor.heading.h5.tooltip":"제목 5","editor.heading.h6.tooltip":"제목 6","editor.paragraph.tooltip":"단락","editor.textalign.tooltip":"양쪽정렬","editor.textalign.left.tooltip":"왼쪽","editor.textalign.center.tooltip":"가운데","editor.textalign.right.tooltip":"오른쪽","editor.textalign.justify.tooltip":"양쪽정렬","editor.indent":"들여쓰기","editor.indent.indent":"들여쓰기","editor.indent.outdent":"들여쓰기 줄이기","editor.fontFamily.tooltip":"맑은고딕","editor.fontFamily.default":"맑은고딕","editor.fontFamily.gulim":"굴림","editor.fontFamily.dotum":"돋움","editor.fontFamily.gungsuh":"궁서","editor.fontSize.tooltip":"기본값","editor.fontSize.default.tooltip":"기본값","editor.superscript.tooltip":"위 첨자","editor.subscript.tooltip":"아래첨자","editor.bulletlist.tooltip":"글머리 기호 목록","editor.bulletlist.disc.tooltip":"디스크","editor.bulletlist.circle.tooltip":"원","editor.bulletlist.square.tooltip":"사각형","editor.orderedlist.tooltip":"순서가 지정된 목록","editor.orderedlist.decimal.tooltip":"십진수","editor.orderedlist.decimalLeadingZero.tooltip":"앞에 0이 있는 십진수","editor.orderedlist.lowerRoman.tooltip":"하위 로마자","editor.orderedlist.upperRoman.tooltip":"상위 로마자","editor.orderedlist.lowerLatin.tooltip":"하위 라틴어","editor.orderedlist.upperLatin.tooltip":"상위 라틴어","editor.orderedlist.tradChinaInformal.tooltip":"중국어 비공식","editor.orderedlist.simpChinaFormal.tooltip":"간체 중국어 비공식","editor.tasklist.tooltip":"작업 목록","editor.indent.tooltip":"들여쓰기","editor.outdent.tooltip":"내어쓰기","editor.columns.tooltip":"열","editor.link.tooltip":"링크","editor.link.unlink.tooltip":"링크 해제","editor.link.open.tooltip":"링크 열기","editor.link.edit.tooltip":"링크 편집","editor.link.dialog.title":"링크 삽입","editor.link.dialog.link":"링크","editor.link.dialog.text":"텍스트","editor.link.dialog.openInNewTab":"새 탭에서 열기","editor.link.dialog.link.placeholder":"링크 주소","editor.link.dialog.text.placeholder":"설명 추가","editor.link.dialog.button.apply":"적용","editor.image.tooltip":"이미지","editor.image.menu.flipX":"세로 뒤집기","editor.image.menu.flipY":"가로 뒤집기","editor.image.menu.moveUp":"위로 이동","editor.image.menu.moveDown":"아래로 이동","editor.image.menu.size":"크기 설정","editor.image.menu.size.width":"너비","editor.image.menu.size.height":"높이","editor.image.dragger.tooltip":"업로드할 영역으로 이미지를 클릭하거나 드래그하세요.","editor.image.float.left.tooltip":"왼쪽으로 부동","editor.image.float.none.tooltip":"부동 없음","editor.image.float.right.tooltip":"오른쪽으로 부동","editor.image.dialog.title":"이미지 추가","editor.image.dialog.tab.url":"URL","editor.image.dialog.tab.upload":"업로드","editor.image.dialog.uploading":"업로드 중","editor.image.dialog.form.link":"링크","editor.image.dialog.placeholder":"링크","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"원본 가로 세로 비율 잠금","editor.image.dialog.form.file":"파일","editor.image.dialog.button.apply":"적용","editor.video.tooltip":"비디오","editor.video.dialog.tab.upload":"업로드","editor.video.dialog.uploading":"업로드 중","editor.video.dialog.title":"동영상 삽입 또는 업로드","editor.video.dialog.link":"링크","editor.video.dialog.placeholder":"링크","editor.video.dialog.button.apply":"적용","editor.table.tooltip":"표","editor.table.menu.insert_table":"테이블 삽입","editor.table.menu.insert_table.with_header_row":"머리글 행 포함","editor.table.menu.insertColumnBefore":"앞에 열 삽입","editor.table.menu.insertColumnAfter":"다음에 열 삽입","editor.table.menu.deleteColumn":"열 삭제","editor.table.menu.insertRowAbove":"위에 행 삽입","editor.table.menu.insertRowBelow":"아래에 행 삽입","editor.table.menu.deleteRow":"행 삭제","editor.table.menu.mergeCells":"셀 병합","editor.table.menu.splitCells":"셀 분할","editor.table.menu.deleteTable":"테이블 삭제","editor.table.menu.setCellsBgColor":"셀 배경색","editor.blockquote.tooltip":"블록인용","editor.horizontalrule.tooltip":"수평 규칙","editor.code.tooltip":"코드","editor.codeblock.tooltip":"코드 블록","editor.clear.tooltip":"형식 지우기","editor.undo.tooltip":"실행 취소","editor.redo.tooltip":"다시 실행","editor.fullscreen.tooltip.fullscreen":"전체 화면","editor.fullscreen.tooltip.exit":"전체 화면 종료","editor.imageUpload.fileTypeNotSupported":"지원되지 않는 파일 형식","editor.imageUpload.fileSizeTooBig":"파일 크기가 너무 큽니다. 최대 크기는 다음과 같습니다.","editor.AI.placeholder":"AI에게 물어보세요...","editor.AI.geneating":"생성","editor.AI.insert":"선택 항목 아래에 삽입","editor.AI.replace":"선택한 콘텐츠 교체","editor.AI.regenerate":"재생성","editor.AI.close":"닫기","editor.AI.stop":"중지","editor.AI.ask":"AI에게 물어보세요","editor.menubar.file":"파일","editor.menubar.edit":"편집","editor.menubar.view":"보기","editor.menubar.insert":"삽입","editor.menubar.format":"형식","editor.menubar.menu.newDoc":"새 문서","editor.menubar.menu.restoreLastDraft":"마지막 초안 복원","editor.menubar.menu.print":"인쇄","editor.menubar.menu.cut":"잘라내기","editor.menubar.menu.copy":"복사","editor.menubar.menu.paste":"붙여넣기","editor.menubar.menu.pasteAsText":"텍스트로 붙여넣기","editor.menubar.menu.selectAll":"모두 선택","editor.menubar.menu.preview":"미리보기","editor.menubar.menu.spellCheck":"맞춤법 검사","editor.menubar.menu.spelling":"맞춤법","editor.menubar.menu.superView":"수퍼보기","editor.menubar.menu.insertSuper":"수퍼 넣기","editor.menubar.menu.articleContent":"앵커멘트","editor.menubar.menu.articleComment":"상세 텍스트","editor.menubar.menu.cancel":"취소","editor.menubar.menu.save":"저장","editor.findAndReplace.tooltip":"찾기 및 바꾸기","editor.findAndReplace.find":"찾기","editor.findAndReplace.replace":"바꾸기","editor.findAndReplace.replaceAll":"모두 바꾸기","editor.findAndReplace.caseSensitive":"대소문자 구분","editor.printer.tooltip":"인쇄","editor.superinput":"수퍼입력","editor.insert.symbol":"기호삽입","editor.check":"확인","editor.detail":"내용","editor.inputSuper":"수퍼 작성","editor.insertSpecial":"특수문자","editor.cut":"잘라내기","editor.paste":"붙여넣기","editor.selectAll":"모두선택","editor.delete":"삭제","editor.super.edit":"수퍼 수정","editor.super.delete":"수퍼 삭제","editor.configPlan.edit":"구성안 수정","editor.configPlan.delete":"구성안 삭제","editor.super":"수퍼","editor.configPlan":"구성안","editor.insertConfigPlan":"구성안넣기","editor.alert":"수퍼가 변경되었습니다. 수퍼아이디를 삭제합니다.","editor.alertConfirm":"확인","editor.alertYes":"확인"},Oa=zW({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:EE,ko:SE}}),CZ=nt.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()}}}),xZ=["data-font"],kZ=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}=Pt(),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(h=>h.name==="fontFamily").options;let p=[];return _t.isEmpty(f.fontFamilyList)?p=i:p=f.fontFamilyList.filter(h=>h.enabled!==!1).map(h=>({label:h.label,value:h.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?(U0(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(()=>{const f=a.value[0]?.label||r("editor.fontFamily.default");return a.value.find(p=>p.value===l.value)?.label||f});return(f,p)=>(o.openBlock(),o.createBlock(ga,{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,(h,g)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:g},[o.createVNode(o.unref(Bl),{checked:l.value===h.value,onClick:v=>u(h)},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"ml-1 h-full","data-font":h.label,style:o.normalizeStyle({fontFamily:h.value??void 0})},o.toDisplayString(h.label),13,xZ)]),_:2},1032,["checked","onClick"]),h.label===o.unref(r)("editor.fontFamily.default")&&f.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(I1),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),_E=CZ.extend({name:"fontFamily",addOptions(){return{...this.parent?.(),types:["textStyle"],fontFamilyList:[],button({editor:t,extension:e,t:n}){return{component:kZ,componentProps:{editor:t,disabled:!t.can().setFontFamily(""),tooltip:n("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})=>(l5(n,t),!0)).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().command(({tr:e})=>(l5(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}}),EZ=nt.create({name:"fontWeight",addOptions(){return{...this.parent?.(),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}}),SZ={class:"flex gap-2"},_Z=["disabled"],TZ=Xr(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(gg[0])||parseInt(e.value)<parseInt(gg[0]):!1),r=lt.useEventBus(cr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=da,u=ca,c=fa;return o.openBlock(),o.createElementBlock("div",SZ,[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(Bt),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(is),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(Bt),{name:"Minus",class:"w-6 h-6"})],8,_Z)]),_:1}),o.createVNode(o.unref(is),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),AZ=Hn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:TZ,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})}}}),Bb=nt.create({name:"painter",addOptions(){return{...this.parent?.(),button:({editor:t,extension:e,t:n})=>({component:Ye,componentProps:{action:()=>{t.commands.setPainter(t?.state.selection.$head.marks())},icon:"PaintRoller",tooltip:n("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 St("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}}}})]}}),Ob=()=>$r(10),TE=new St("attrkey"),MZ=t=>new it({key:TE,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=TE.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,h,g)=>{const{attrs:v}=f,b=c.includes(v.id)?Ob():v.id||Ob();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...v,id:b,"number-line":g+1}),a=!0),c.push(b)})}return a?s:null}}),AE=[Np,Qp,eh,eb,th,Ss,nb,zl,ob,sb,rb,_a,Ul,xi,ib,ab,tb,Gr],BZ=nt.create({name:"autoId",addGlobalAttributes(){return[{types:AE.concat(this.options.types||[]),attributes:{id:{default:Ob()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[MZ(AE.concat(this.options.types||[]))]}}),OZ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,IZ=Lt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ct(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[h4({find:OZ,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),LZ=["src","alt"],RZ={key:0,class:"image-resizer"},DZ=["onMousedown","onTouchstart"],PZ=o.defineComponent({__name:"ImageView",props:{...ta,selected:{type:Boolean,required:!0}},setup(t){const e=t,n={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},r=o.inject("isMobile",!1),i=o.ref({width:uC,height:uC}),s=o.ref({width:0,height:0}),a=o.ref(!1),l=o.ref({x:0,y:0,w:0,h:0,dir:""}),u=o.computed(()=>{const{src:k,alt:T,width:S,height:A,flipX:V,flipY:B}=e.node.attrs,O=[];V&&O.push("rotateX(180deg)"),B&&O.push("rotateY(180deg)");const F=O.join(" ");return{src:k||void 0,alt:T||void 0,style:{width:yg(S)?`${S}px`:S,height:yg(A)?`${A}px`:A,transform:F||"none"}}});o.computed(()=>({width:o.unref(u).style.width==="100%"?"100%":void 0}));const c=o.ref(null),f=new ResizeObserver(k=>{for(const T of k){const{width:S,height:A}=T.contentRect;s.value={width:S,height:A},e.updateAttributes({originWidth:S,originHeight:A})}});function p(){const{editor:k,getPos:T,extension:S,node:A}=e;if(k.isEditable)return k.commands.setNodeSelection(T());S.options.onImageClick?.(A.attrs.src)}const h=_t.throttle(()=>{const{editor:k}=e;i.value.width=parseInt(getComputedStyle(k.view.dom).width,10)},cC);function g(k,T){k.preventDefault(),k.stopPropagation();let S=0,A=0;const V=document.querySelector(".image-resizer");if(V&&(V.style.borderColor="#3b82f6"),"touches"in k&&k.touches.length>0)S=k.touches[0].clientX,A=k.touches[0].clientY;else if("clientX"in k)S=k.clientX,A=k.clientY;else return;const{width:B,height:O}=o.unref(s),F=B/O;let H=Number(e.node.attrs.width)||B,Y=Number(e.node.attrs.height)||Math.round(H/F);const Q=o.unref(i).width;H=Math.min(H>Q?Q:H,Q),Y=Math.round(H/F),Object.assign(l.value,{x:S,y:A,w:H,h:Y,dir:T}),a.value=!0,w()}const v=_t.throttle(k=>{if(!o.unref(a))return;let T=0;if("touches"in k&&k.touches.length>0)T=k.touches[0].clientX;else if("clientX"in k)T=k.clientX;else return;const{x:S,w:A,dir:V}=o.unref(l),B=(T-S)*(/l/.test(V)?-1:1),O=TL(A+B,vL,o.unref(i).width);e.updateAttributes({width:O})},cC),b=k=>{k.preventDefault(),k.stopPropagation();const T=document.querySelector(".image-resizer");T&&(T.style.borderColor=""),o.unref(a)&&(a.value=!1,Object.assign(l.value,{x:0,y:0,w:0,h:0,dir:""}),C(),p())};function w(){document.addEventListener("mousemove",v,!0),document.addEventListener("mouseup",b,!0),document.addEventListener("touchmove",v,!0),document.addEventListener("touchend",b,!0)}function C(){document.removeEventListener("mousemove",v,!0),document.removeEventListener("mouseup",b,!0),document.removeEventListener("touchmove",v,!0),document.removeEventListener("touchend",b,!0)}const x=new ResizeObserver(h),E=o.computed(()=>{const{textAlign:k}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[k]||""});return o.onMounted(()=>{c.value&&f.observe(c.value),x.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{C(),f.disconnect(),x.disconnect()}),(k,T)=>(o.openBlock(),o.createBlock(o.unref(ea),{class:"node-image",style:o.normalizeStyle({"pointer-events":o.unref(r)&&t.selected&&k.editor.isEditable?"none":"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"image-view",style:o.normalizeStyle([{width:u.value.style.width,height:u.value.style.height},E.value])},[o.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:o.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":a.value},"image-view__body"])},[o.createElementVNode("img",{ref_key:"imageRef",ref:c,src:u.value.src,alt:u.value.alt,class:"block w-full image-view__body__image",style:o.normalizeStyle([{transform:u.value.style.transform}]),onClick:p,onMousedown:T[0]||(T[0]=(...S)=>o.unref(df)&&o.unref(df)(...S))},null,44,LZ),k.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",RZ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.values(n),S=>(o.openBlock(),o.createElementBlock("span",{key:S,class:o.normalizeClass(o.unref(ke)(`image-resizer__handler--${S}`,"image-resizer__handler",o.unref(r)&&t.selected&&"pointer-events-auto")),onMousedown:A=>g(A,S),onTouchstart:o.withModifiers(A=>g(A,S),["prevent"])},null,42,DZ))),128))],512)),[[o.vShow,t.selected||a.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1},8,["style"]))}}),VZ=Xr(PZ,[["__scopeId","data-v-7eba98b1"]]),Th=IZ.extend({group:"block",defining:!0,isolating:!0,addAttributes(){return{...this.parent?.(),src:{default:null,parseHTML:t=>(t.tagName==="P"?t.querySelector("img"):t)?.getAttribute("src")},flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:t=>t.style.textAlign||t.getAttribute("textAlign")||null,renderHTML:t=>({textAlign:t.textAlign})},width:{default:"100%",parseHTML:t=>{const e=t.tagName==="P"?t.querySelector("img"):t,n=e&&(e.style.width||e.getAttribute("width"))||null;return n&&n.endsWith("%")?n:n==null?null:parseInt(n,10)},renderHTML:t=>({width:t.width})},height:{default:"auto",parseHTML:t=>{const e=t.style.height||t.getAttribute("height")||null;return e==null||e==="auto"?null:parseInt(e,10)},renderHTML:t=>({height:t.height})},class:{default:"",parseHTML:t=>t.getAttribute("class")||"",renderHTML:t=>({class:t.class})},"data-memo":{default:"",parseHTML:t=>t.getAttribute("data-memo")||"",renderHTML:t=>({"data-memo":t["data-memo"]})}}},addOptions(){return{...this.parent?.(),onImageClick:void 0}},addNodeView(){return na(VZ)},addCommands(){return{...this.parent?.(),updateImage:t=>({commands:e,editor:n})=>e.updateAttributes(this.name,t)}},renderHTML({node:t,HTMLAttributes:e}){const{textAlign:n,flipX:r,flipY:i}=t.attrs,l=`${{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[n]||""} ${r||i?`transform: rotateX(${r?"180":"0"}deg) rotateY(${i?"180":"0"}deg);`:""}`;return["img",Ct(this.options.HTMLAttributes,e,{style:l})]},parseHTML(){return[{tag:"img[src]"},{tag:"p",priority:1001,getAttrs:t=>{const e=t;return e.children.length===1&&e.firstElementChild?.tagName==="IMG"&&!!!e.textContent?.trim()&&e.firstElementChild.hasAttribute("src")?null:!1}}]},addProseMirrorPlugins(){return[new it({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof De&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof De&&e.node.type.name==="image"}}})]}}),FZ=["paragraph","heading","list_item","todo_item"];function $Z(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Le||n instanceof Mn))return t;const{from:i,to:s}=n,a=[],l=e&&e!==dC?e:null;return r.nodesBetween(i,s,(u,c)=>{const f=u.type;return FZ.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:h}=c;h={...h,lineHeight:l},t=t.setNodeMarkup(f,p,h,c.marks)}),t}function HZ(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 zZ=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}=Pt();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(ga,{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(Bl),{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"]))}}),ME=nt.create({name:"lineHeight",addOptions(){return{...this.parent?.(),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:dC,button({editor:t,t:e}){return{component:zZ,componentProps:{editor:t,icon:"LineHeight",tooltip:e("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=>HZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),UZ=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",Ct(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var Ia=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(Ia||{});const Ib=Lt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){return{...this.parent?.(),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[UZ.configure(this.options.columnOptions)]}}),WZ={class:"flex gap-x-2 items-center"},jZ={class:"sr-only"},qZ={class:"flex justify-end gap-x-2.5 flex-1"},KZ=["disabled"],BE=Xr(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}=Pt(),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(()=>{if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,g?.textContent?.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},h=()=>{u.value=!0,l.value=!1};return(g,v)=>{const b=hh,w=ph,C=fh,x=dh,E=ub,k=Pc,T=Dc;return o.openBlock(),o.createBlock(T,{open:g.open},{default:o.withCtx(()=>[o.createVNode(k,{"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(C,{class:"text-left flex-row justify-between"},{default:o.withCtx(()=>[o.createVNode(b,{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",WZ,[o.withDirectives(o.createElementVNode("button",{onClick:h},[o.createVNode(o.unref(k1),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(w,{class:"outline-none",onClick:f},{default:o.withCtx(()=>[o.createVNode(o.unref(dc),{class:"w-5 h-5"}),o.createElementVNode("span",jZ,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(x,{class:"hidden"}),o.createVNode(Ab,{modelValue:s.value,"onUpdate:modelValue":v[0]||(v[0]=S=>s.value=S),"is-read-only":l.value,"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["modelValue","is-read-only","parent-editor"]),o.createVNode(E,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:v[1]||(v[1]=S=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",qZ,[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,KZ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-c6e8813c"]]),GZ=["innerHTML"],XZ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],YZ=o.defineComponent({__name:"ConfigPlan",props:ta,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=lt.useEventBus(cr.RENDER_SUPER_TEXT),c=o.computed(()=>{const x=s.resolve(i.from)?.node(-1),E=x?.attrs?.id,k=x?.attrs?.pageNumber;return{pageId:E,pageNumber:k}}),f=o.computed(()=>{const C=e.getPos(),x=e.editor.state.doc.resolve(C);for(let E=x.depth;E>0;E--){const k=x.node(E);if(k.type.name==="paragraph")return k}return null}),p=o.computed(()=>f.value?.attrs.id||"");function h(C){e.updateAttributes({"data-text":C}),n.value=!1}function g(C){const x=e.node.attrs[Qe.TEXT],E=e.node.attrs[Qe.ID],T={lineId:C.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:x};u.emit({action:"hover",payload:T})}function v(C){const x=e.node.attrs[Qe.ID],k={lineId:C.target.querySelector(`[node-id="${x}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:k})}function b(){const{getPos:C,node:x,editor:E}=e,k=C(),T=k+1;E.commands.deleteRange({from:k,to:T})}function w(){n.value=!0,a&&(l.value=!0)}return(C,x)=>{const E=vn,k=ch,T=uh,S=lh,A=ah,V=Uc;return o.openBlock(),o.createBlock(o.unref(ea),{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(k,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(E,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:w,onMouseenter:g,onMouseleave:v},{default:o.withCtx(()=>[o.createVNode(o.unref(Bt),{name:"plan",class:o.normalizeClass({"w-[18px] h-auto pr-1":o.unref(a)})},null,8,["class"]),x[3]||(x[3]=o.createTextVNode(" [")),o.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[o.unref(Qe).TEXT]},null,8,GZ),x[4]||(x[4]=o.createTextVNode("] ")),o.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[o.unref(Qe).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(Qe).TEXT],"node-id":e.node.attrs[o.unref(Qe).ID],"line-id":p.value},null,8,XZ)]),_:1})]),_:1}),o.createVNode(S,null,{default:o.withCtx(()=>[o.createVNode(T,{onSelect:x[0]||(x[0]=B=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.$t("editor.configPlan.edit")),1)]),_:1}),o.createVNode(T,{onSelect:b},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(BE,{key:1,title:C.$t("editor.configPlan"),open:n.value,"is-view-mode":l.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Qe).TEXT],"super-text-id":e.node.attrs[o.unref(Qe).ID],onClose:x[2]||(x[2]=B=>n.value=!1),onSave:h,onDelete:b},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(o.openBlock(),o.createBlock(V,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Qe).TEXT],"super-text-element-id":e.node.attrs[o.unref(Qe).ELEMENT_ID],onClose:x[1]||(x[1]=B=>n.value=!1),onSave:h},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),OE=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:Ye,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",Ct(t,{class:"config-plan"})]},addNodeView(){return na(YZ)},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 Lb,Rb;if(typeof WeakMap<"u"){let t=new WeakMap;Lb=e=>t.get(e),Rb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Lb=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Rb=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var an=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 Lb(t)||Rb(t,JZ(t))}};function JZ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=ZZ(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 v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==p.childCount)break;const b=p.child(v),{colspan:w,rowspan:C,colwidth:x}=b.attrs;for(let E=0;E<C;E++){if(E+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:C-E});break}const k=i+E*e;for(let T=0;T<w;T++){r[k+T]==0?r[k+T]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:w-T});const S=x&&x[T];if(S){const A=(k+T)%e*2,V=a[A];V==null||V!=S&&a[A+1]==1?(a[A]=S,a[A+1]=1):V==S&&a[A+1]++}}}i+=w,f+=b.nodeSize}const h=(c+1)*e;let g=0;for(;i<h;)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 an(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&&QZ(l,a,t),l}function ZZ(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 QZ(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=NZ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function NZ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function jn(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 _s=new St("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 eQ(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 bo(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 Ah(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)||tQ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function tQ(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 Db(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function nQ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Pb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function IE(t,e,n){const r=t.node(-1),i=an.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 La(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 LE(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 rQ(t,e,n){const r=jn(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 zt=class Di extends Ue{constructor(e,n=e){const r=e.node(-1),i=an.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 h=s+f+1;return new d3(l.resolve(h),l.resolve(h+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(Db(r)&&Db(i)&&Pb(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Di.rowSelection(r,i):s&&this.isColSelection()?Di.colSelection(r,i):new Di(r,i)}return Le.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=an.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 h=n.map[f];if(s[h])continue;s[h]=!0;const g=n.findCell(h);let v=e.nodeAt(h);if(!v)throw RangeError(`No cell with offset ${h} found`);const b=i.left-g.left,w=g.right-i.right;if(b>0||w>0){let C=v.attrs;if(b>0&&(C=La(C,0,b)),w>0&&(C=La(C,C.colspan-w,w)),g.left<i.left){if(v=v.type.createAndFill(C),!v)throw RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else v=v.type.create(C,v.content)}if(g.top<i.top||g.bottom>i.bottom){const C={...v.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?v=v.type.createAndFill(C):v=v.type.create(C,v.content)}c.push(v)}a.push(e.child(u).copy(me.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new _e(me.from(l),1,1)}replace(e,n=_e.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?_e.empty:n)}const s=Ue.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new _e(me.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=an.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=an.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 Di(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=an.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 Di&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=an.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 Di(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Di(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Di(e.resolve(n),e.resolve(r))}getBookmark(){return new oQ(this.$anchorCell.pos,this.$headCell.pos)}};zt.prototype.visible=!1,Ue.jsonID("cell",zt);var oQ=class bT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new bT(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&&Pb(n,r)?new zt(n,r):Ue.near(r,1)}};function iQ(t){if(!(t.selection instanceof zt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(jt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ut.create(t.doc,e)}function sQ({$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 aQ({$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 lQ(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof De&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=zt.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=zt.rowSelection(l,l)}else if(!n){const l=an.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=zt.create(i,u+1,c)}}else r instanceof Le&&sQ(r)?s=Le.create(i,r.from):r instanceof Le&&aQ(r)&&(s=Le.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var uQ=new St("fix-tables");function RE(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)?RE(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function DE(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=cQ(t,i,s,n))};return e?e.doc!=t.doc&&RE(e.doc,t.doc,0,r):t.doc.descendants(r),n}function cQ(t,e,n,r){const i=an.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 h=0;h<p.rowspan;h++)s[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,La(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,h=s[u];if(h>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const v=[];for(let w=0;w<h;w++){const C=jn(t.schema)[g].createAndFill();C&&v.push(C)}const b=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(b),v)}c=p}return r.setMeta(uQ,{fixTables:!0})}function Ko(t){const e=t.selection,n=Ah(t),r=n.node(-1),i=n.start(-1),s=an.get(r);return{...e instanceof zt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function PE(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;rQ(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,LE(c.attrs,i-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?jn(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 dQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(PE(t.tr,n,n.left))}return!0}function fQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(PE(t.tr,n,n.right))}return!0}function pQ(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,La(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 hQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;pQ(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=an.get(s)}e(r)}return!0}function mQ(t,e,n){var r;const i=jn(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 VE(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;mQ(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],h=r.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{const p=u==null?jn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,h=p?.createAndFill();h&&l.push(h)}return t.insert(a,jn(r.type.schema).row.create(null,l)),t}function gQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(VE(t.tr,n,n.top))}return!0}function vQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(VE(t.tr,n,n.bottom))}return!0}function bQ(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 h=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&p==e.map[f+e.width]){const h=n.nodeAt(p),g=h.attrs,v=h.type.create({...g,rowspan:h.attrs.rowspan-1},h.content),b=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+b),v),c+=g.colspan-1}}}}function yQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;bQ(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=an.get(n.table)}e(r)}return!0}function FE(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function wQ({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 $E(t,e){const n=t.selection;if(!(n instanceof zt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ko(t),{map:i}=r;if(wQ(i,r))return!1;if(e){const s=t.tr,a={};let l=me.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const h=i.map[f*i.width+p],g=r.table.nodeAt(h);if(!(a[h]||!g))if(a[h]=!0,u==null)u=h,c=g;else{FE(g)||(l=l.append(g.content));const v=s.mapping.map(h+r.tableStart);s.delete(v,v+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...LE(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=FE(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new zt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function HE(t,e){const n=jn(t.schema);return CQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function CQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof zt){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=eQ(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=Ko(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 h;for(let g=f.top;g<f.bottom;g++){let v=f.map.positionAt(g,f.left,f.table);g==f.top&&(v+=s.nodeSize);for(let b=f.left,w=0;b<f.right;b++,w++)b==f.left&&g==f.top||p.insert(h=p.mapping.map(v+f.tableStart,1),t({node:s,row:g,col:b}).createAndFill(u[w]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),i instanceof zt&&p.setSelection(new zt(p.doc.resolve(i.$anchorCell.pos),h?p.doc.resolve(h):void 0)),n(p)}return!0}}function xQ(t,e){return function(n,r){if(!bo(n))return!1;const i=Ah(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof zt?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 kQ(t){return function(e,n){if(!bo(e))return!1;if(n){const r=jn(e.schema),i=Ko(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 zE(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 Wc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?kQ(t):function(n,r){if(!bo(n))return!1;if(r){const i=jn(n.schema),s=Ko(n),a=n.tr,l=zE("row",s,i),u=zE("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,h=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 v=g+s.tableStart,b=a.doc.nodeAt(v);b&&a.setNodeMarkup(v,h,b.attrs)}),r(a)}return!0}}Wc("row",{useDeprecatedLogic:!0}),Wc("column",{useDeprecatedLogic:!0});var EQ=Wc("cell",{useDeprecatedLogic:!0});function SQ(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 UE(t){return function(e,n){if(!bo(e))return!1;const r=SQ(Ah(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Le.between(i,nQ(i))).scrollIntoView())}return!0}}function _Q(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 Mh(t,e){const n=t.selection;if(!(n instanceof zt))return!1;if(e){const r=t.tr,i=jn(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 _e(i,0,0))}),r.docChanged&&e(r)}return!0}function TQ(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=Vb(jn(a).row,new _e(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Vb(jn(a).row,new _e(e,n,r)).content:e);else return null;return AQ(a,l)}function AQ(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(me.empty),n[i]<r){const s=jn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(me.from(a))}return{height:e.length,width:r,rows:e}}function Vb(t,e){const n=t.createAndFill();return new e0(n).replace(0,n.content.size,e).doc}function MQ({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 h=u.child(p%u.childCount);f+h.attrs.colspan>r&&(h=h.type.createChecked(La(h.attrs,h.attrs.colspan,f+h.attrs.colspan-r),h.content)),c.push(h),f+=h.attrs.colspan;for(let g=1;g<h.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+h.attrs.colspan}a.push(me.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(me.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=jn(l);let c,f;if(i>e.width)for(let p=0,h=0;p<e.height;p++){const g=n.child(p);h+=g.nodeSize;const v=[];let b;g.lastChild==null||g.lastChild.type==u.cell?b=c||(c=u.cell.createAndFill()):b=f||(f=u.header_cell.createAndFill());for(let w=e.width;w<i;w++)v.push(b);t.insert(t.mapping.slice(a).map(h-1+r),v)}if(s>e.height){const p=[];for(let v=0,b=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const w=v>=e.width?!1:n.nodeAt(e.map[b+v]).type==u.header_cell;p.push(w?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const h=u.row.create(null,me.from(p)),g=[];for(let v=e.height;v<s;v++)g.push(h);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function WE(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 h=n.nodeAt(p),{top:g,left:v}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...h.attrs,rowspan:a-g}),t.insert(t.mapping.slice(l).map(e.positionAt(a,v,n)),h.type.createAndFill({...h.attrs,rowspan:g+h.attrs.rowspan-a})),c+=h.attrs.colspan-1}}return u}function jE(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 h=n.nodeAt(p),g=e.colCount(p),v=t.mapping.slice(l).map(p+r);t.setNodeMarkup(v,null,La(h.attrs,a-g,h.attrs.colspan-(a-g))),t.insert(v+h.nodeSize,h.type.createAndFill(La(h.attrs,0,a-g))),c+=h.attrs.rowspan-1}}return u}function qE(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=an.get(s);const{top:l,left:u}=r,c=u+i.width,f=l+i.height,p=t.tr;let h=0;function g(){if(s=n?p.doc.nodeAt(n-1):p.doc,!s)throw new Error("No table found");a=an.get(s),h=p.mapping.maps.length}BQ(p,a,s,n,c,f,h)&&g(),WE(p,a,s,n,u,c,l,h)&&g(),WE(p,a,s,n,u,c,f,h)&&g(),jE(p,a,s,n,l,f,u,h)&&g(),jE(p,a,s,n,l,f,c,h)&&g();for(let v=l;v<f;v++){const b=a.positionAt(v,u,s),w=a.positionAt(v,c,s);p.replace(p.mapping.slice(h).map(b+n),p.mapping.slice(h).map(w+n),new _e(i.rows[v-l],0,0))}g(),p.setSelection(new zt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var OQ=O0({ArrowLeft:Oh("horiz",-1),ArrowRight:Oh("horiz",1),ArrowUp:Oh("vert",-1),ArrowDown:Oh("vert",1),"Shift-ArrowLeft":Ih("horiz",-1),"Shift-ArrowRight":Ih("horiz",1),"Shift-ArrowUp":Ih("vert",-1),"Shift-ArrowDown":Ih("vert",1),Backspace:Mh,"Mod-Backspace":Mh,Delete:Mh,"Mod-Delete":Mh});function Bh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Oh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof zt)return Bh(n,r,Ue.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=KE(i,t,e);if(a==null)return!1;if(t=="horiz")return Bh(n,r,Ue.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=IE(l,t,e);let c;return u?c=Ue.near(u,1):e<0?c=Ue.near(n.doc.resolve(l.before(-1)),-1):c=Ue.near(n.doc.resolve(l.after(-1)),1),Bh(n,r,c)}}}function Ih(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof zt)a=s;else{const u=KE(i,t,e);if(u==null)return!1;a=new zt(n.doc.resolve(u))}const l=IE(a.$headCell,t,e);return l?Bh(n,r,new zt(a.$anchorCell,l)):!1}}function IQ(t,e){const n=t.state.doc,r=Kl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new zt(r))),!0):!1}function LQ(t,e,n){if(!bo(t.state))return!1;let r=TQ(n);const i=t.state.selection;if(i instanceof zt){r||(r={width:1,height:1,rows:[me.from(Vb(jn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=an.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=MQ(r,l.right-l.left,l.bottom-l.top),qE(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Ah(t.state),a=s.start(-1);return qE(t.state,t.dispatch,a,an.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function RQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=GE(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof zt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Kl(t.state.selection.$anchor))!=null&&((n=Fb(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let f=Fb(t,c);const p=_s.getState(t.state)==null;if(!f||!Pb(u,f))if(p)f=u;else return;const h=new zt(u,f);if(p||!t.state.selection.eq(h)){const g=t.state.tr.setSelection(h);p&&g.setMeta(_s,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),_s.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_s,-1))}function l(u){const c=u,f=_s.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if(GE(t,c.target)!=r&&(p=Fb(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 KE(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 GE(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Fb(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Kl(t.state.doc.resolve(n.pos)):null}var DQ=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")),$b(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,$b(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function $b(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,h=0;p<f.childCount;p++){const{colspan:g,colwidth:v}=f.child(p).attrs;for(let b=0;b<g;b++,h++){const w=i==h?s:v&&v[b],C=w?w+"px":"";if(l+=w||r,w||(u=!1),c)c.style.width!=C&&(c.style.width=C),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=C,e.appendChild(x)}}}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 Sr=new St("tableColumnResizing");function PQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=DQ,lastColumnResizable:i=!0}={}){const s=new it({key:Sr,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=jn(l.schema).table.name;return r&&f&&(f[p]=(h,g)=>new r(h,n,g)),new VQ(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Sr.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{FQ(a,l,t,i)},mouseleave:a=>{$Q(a)},mousedown:(a,l)=>{HQ(a,l,e,n)}},decorations:a=>{const l=Sr.getState(a);if(l&&l.activeHandle>-1)return qQ(a,l.activeHandle)},nodeViews:{}}});return s}var VQ=class Vm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Sr);if(r&&r.setHandle!=null)return new Vm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Vm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Db(e.doc.resolve(i))||(i=-1),new Vm(i,n.dragging)}return n}};function FQ(t,e,n,r){if(!t.editable)return;const i=Sr.getState(t.state);if(i&&!i.dragging){const s=UQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=XE(t,e,"left",n):u-e.clientX<=n&&(a=XE(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=an.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}JE(t,a)}}}function $Q(t){if(!t.editable)return;const e=Sr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&JE(t,-1)}function HQ(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!=null?i:window,a=Sr.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=zQ(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Sr,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const h=Sr.getState(t.state);h?.dragging&&(WQ(t,h.activeHandle,YE(h.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Sr,{setDragging:null})))}function f(p){if(!p.which)return c(p);const h=Sr.getState(t.state);if(h&&h.dragging){const g=YE(h.dragging,p,n);ZE(t,h.activeHandle,g,r)}}return ZE(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function zQ(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 UQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function XE(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=an.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 YE(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function JE(t,e){t.dispatch(t.state.tr.setMeta(Sr,{setHandle:e}))}function WQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=an.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],h=i.nodeAt(p).attrs,g=h.colspan==1?0:l-s.colCount(p);if(h.colwidth&&h.colwidth[g]==n)continue;const v=h.colwidth?h.colwidth.slice():jQ(h.colspan);v[g]=n,u.setNodeMarkup(a+p,null,{...h,colwidth:v})}u.docChanged&&t.dispatch(u)}function ZE(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=an.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&&$b(s,u.firstChild,u,r,l,n)}function jQ(t){return Array(t).fill(0)}function qQ(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return ut.empty;const a=an.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],h=l+p+s.nodeAt(p).nodeSize-1,g=document.createElement("div");g.className="column-resize-handle",(n=Sr.getState(t))!=null&&n.dragging&&r.push(jt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(jt.widget(h,g))}}return ut.create(t.doc,r)}function KQ({allowTableNodeSelection:t=!1}={}){return new it({key:_s,state:{init(){return null},apply(e,n){const r=e.getMeta(_s);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:iQ,handleDOMEvents:{mousedown:RQ},createSelectionBetween(e){return _s.getState(e.state)!=null?e.state.selection:null},handleTripleClick:IQ,handleKeyDown:OQ,handlePaste:LQ},appendTransaction(e,n,r){return lQ(r,DE(r,n),t)}})}const GQ=(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)},XQ=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof zt)||i.forEachCell((s,a)=>{t=GQ(t,a,n)}),t},QE=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=XQ(n,e,t),n.docChanged?(i?.(n),!0):!1},YQ=nt.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=>QE(t,this.options),unsetTableCellBackground:()=>QE("",this.options)}}}),JQ=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",Ct(this.options.HTMLAttributes,t),0]}}),ZQ=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ct(this.options.HTMLAttributes,t),0]}}),QQ=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",Ct(this.options.HTMLAttributes,t),0]}});function Hb(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function NE(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,h=0;p<f.childCount;p+=1){const{colspan:g,colwidth:v}=f.child(p).attrs;for(let b=0;b<g;b+=1,h+=1){const w=i===h?s:v&&v[b],C=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==C){const[x,E]=Hb(r,w);c.style.setProperty(x,E)}c=c.nextSibling}else{const x=document.createElement("col"),[E,k]=Hb(r,w);x.style.setProperty(E,k),e.appendChild(x)}}}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 NQ{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")),NE(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,NE(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function eN(t,e,n,r){let i=0,s=!0;const a=[],l=t.firstChild;if(!l)return{};for(let p=0,h=0;p<l.childCount;p+=1){const{colspan:g,colwidth:v}=l.child(p).attrs;for(let b=0;b<g;b+=1,h+=1){const w=n===h?r:v&&v[b];i+=w||e,w||(s=!1);const[C,x]=Hb(e,w);a.push(["col",{style:`${C}: ${x}`}])}}const u=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function eS(t,e){return t.createAndFill()}function tN(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 nN(t,e,n,r,i){const s=tN(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=eS(s.cell);if(f&&l.push(f),r){const p=eS(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 rN(t){return t instanceof zt}const Lh=({editor:t})=>{const{selection:e}=t.state;if(!rN(e))return!1;let n=0;const r=a4(e.ranges[0].$from,s=>s.type.name==="table");return 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},oN=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:NQ,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}=eN(t,this.options.cellMinWidth);return["table",Ct(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=nN(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})=>dQ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>fQ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>hQ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>gQ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>vQ(t,e),deleteRow:()=>({state:t,dispatch:e})=>yQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>_Q(t,e),mergeCells:()=>({state:t,dispatch:e})=>$E(t,e),splitCell:()=>({state:t,dispatch:e})=>HE(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Wc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Wc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>EQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>$E(t,e)?!0:HE(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>xQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>UE(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>UE(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&DE(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=zt.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:Lh,"Mod-Backspace":Lh,Delete:Lh,"Mod-Delete":Lh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[PQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],KQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt($e(t,"tableRole",e))}}}),iN=/(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,sN=/CrOS/,aN=/android|ipad|playbook|silk/i;function tS(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:!!(iN.test(e)&&!sN.test(e)||t.tablet&&aN.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const lN=["disabled"],uN={"content-class":"table-grid-size-editor","content-style":"padding:0"},cN={class:"flex flex-col flex-wrap gap-1 justify-between"},dN=["onMouseover","onMousedown"],fN={class:"text-center text-sm text-zinc-600 mt-2"},pN=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:tS()?af:sf,cols:tS()?af:sf}),a=o.reactive({rows:lf,cols:lf});function l(g,v){g===s.rows&&(s.rows=Math.min(g+1,af)),v===s.cols&&(s.cols=Math.min(v+1,af)),a.rows=g,a.cols=v}function u(g,v){n("create-table",{rows:g,cols:v,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=sf,s.cols=sf,a.rows=lf,a.cols=lf}const f=o.inject("isMobile",!1),{isOpen:p}=Qf({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),h=o.computed(()=>f?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,v)=>(o.openBlock(),o.createBlock(o.unref(ms),o.normalizeProps(o.guardReactiveProps(o.unref(h))),{default:o.withCtx(()=>[o.createVNode(o.unref(xa),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,lN)]),_:3}),o.createVNode(o.unref(gs),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",uN,[o.createElementVNode("div",cN,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,b=>(o.openBlock(),o.createElementBlock("div",{key:"r"+b,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,w=>(o.openBlock(),o.createElementBlock("div",{key:"c"+w,class:o.normalizeClass([[w<=a.cols&&b<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:C=>l(b,w),onMousedown:C=>u(b,w)},v[0]||(v[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,dN))),128))]))),128))]),o.createElementVNode("div",fN,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),hN={style:{display:"flex"}},mN=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(pN,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",hN,[o.createVNode(Ye,{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"]))}}),zb=oN.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){return{...this.parent?.(),toggleTableEditor:t=>({editor:e})=>e.storage.table?(e.storage.table.isTableEditorOpen=t,!0):!1}},addOptions(){return{...this.parent?.(),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:t,t:e})=>({component:mN,componentProps:{icon:"Table",tooltip:e("editor.table.tooltip"),action:()=>{const n=t.storage.table?.isTableEditorOpen??!1;t.commands.toggleTableEditor(!n)}}})}},addExtensions(){return[ZQ.configure(this.options.tableRow),JQ.configure(this.options.tableHeader),QQ.configure(this.options.tableCell),YQ.configure(this.options.tableCellBackground)]},addProseMirrorPlugins(){const{onTableClick:t}=this.options;return[...this.parent?.()??[],new it({props:{handleClick:(e,n,r)=>{if(e.editable||!t)return!1;const{state:i}=e,s=i.doc.resolve(n);for(let a=s.depth;a>0;a--)if(s.node(a).type.name==="table"){const u=e.nodeDOM(s.before(a));if(u)return t(u.outerHTML),!0}return!1}}})]}}),gN={class:"flex items-center gap-2 px-2"},vN=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}=Pt(),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)=>(o.openBlock(),o.createBlock(ga,{title:i.value?.label,"side-offset":5},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(l,u)=>(o.openBlock(),o.createBlock(o.unref(Bl),{key:u,class:"cursor-pointer",checked:l.isActive?.()||!1,onClick:l.action},{default:o.withCtx(()=>[o.createElementVNode("div",gN,[o.createVNode(o.unref(Bt),{name:l.iconName,class:"h3 w-3"},null,8,["name"]),o.createElementVNode("span",null,o.toDisplayString(l.label),1)])]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["title"]))}}),bN=nt.create({name:"text-bubble",addOptions(){return{...this.parent?.(),toolbar:!1,button:()=>({component:vN,componentProps:{}})}}}),yN=[{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}년"}],nS=t=>{const e=[...t||[],...yN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},wN=nt.create({name:ih,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=nS(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(jt.inline(a,l,{class:"time-highlight"}))}}),ut.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[ih];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Ub(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function CN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}r?.type==="CLIPBOARD_STATE"&&t(!!r.data?.hasClipboard)},Ub({type:"REQUEST_CLIPBOARD_STATE"})})}function xN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}r?.type==="PASTE_RESULT"&&t(r.data?.text??null)},Ub({type:"PASTE"})})}function kN(t,e){Ub({type:"COPY",data:{html:t,text:e}})}async function EN(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 SN(){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 _N=nt.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=hn.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
346
346
  `);t.storage.deviceEnv.isMobile?kN(u,c):await EN(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 xN():await SN();if(!e)return;const n=new DataTransfer;if(jJ(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 CN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),TN=nt.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})=>(e.storage.deviceEnv.isMobile=t,e.storage.spellchecker?.spellchecker.setIsMobile(t),!0),setForceCloseBubble:t=>({editor:e})=>(e.storage.deviceEnv.isForceCloseBubble=t,!0),resetForceCloseBubble:()=>({editor:t})=>(t.storage.deviceEnv.isForceCloseBubble=!1,!0)}}}),Rh=o.defineComponent({__name:"Tabs",props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},asChild:{type:Boolean},as:{}},emits:["update:modelValue"],setup(t,{emit:e}){const i=Rt(t,e);return(s,a)=>(o.openBlock(),o.createBlock(o.unref(fF),o.normalizeProps(o.guardReactiveProps(o.unref(i))),{default:o.withCtx(()=>[o.renderSlot(s.$slots,"default")]),_:3},16))}}),AN={class:"truncate"},Gl=o.defineComponent({__name:"TabsTrigger",props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:i,...s}=e;return s}),r=Zn(n);return(i,s)=>(o.openBlock(),o.createBlock(o.unref(mF),o.mergeProps(o.unref(r),{class:o.unref(ke)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-ed-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-ed-background data-[state=active]:text-ed-foreground data-[state=active]:shadow-sm",e.class)}),{default:o.withCtx(()=>[o.createElementVNode("span",AN,[o.renderSlot(i.$slots,"default")])]),_:3},16,["class"]))}}),Dh=o.defineComponent({__name:"TabsList",props:{loop:{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(pF),o.mergeProps(n.value,{class:o.unref(ke)("inline-flex items-center justify-center rounded-md bg-ed-muted p-1 text-ed-muted-foreground",e.class)}),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),Ph=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(hF),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"]))}}),MN={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"},ON={key:1,class:"flex justify-between items-center w-full"},IN={class:"flex justify-center items-center gap-3"},LN={class:"text-sm"},RN={class:"flex items-center gap-2"},DN=o.defineComponent({__name:"VideoUploader",props:{...ta},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=Pt();function l(p){i.value=!0;const h=p.target,g=Array.from(h?.files||[]),v=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload")?.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof v?.upload!="function")return;const b=g[0];v.upload(b).then(w=>{e.editor.chain().setVideo({src:w}).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(){s.value?.click()}return(p,h)=>(o.openBlock(),o.createBlock(o.unref(ea),{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(xa),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",MN,[i.value?(o.openBlock(),o.createElementBlock("div",BN,[o.createVNode(o.unref(Bt),{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",ON,[o.createElementVNode("div",IN,[o.createVNode(o.unref(Bt),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",LN,o.toDisplayString(o.unref(a)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Bt),{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(Rh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Dh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Gl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Gl),{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(Ph),{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(Ph),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",RN,[o.createVNode(o.unref(ws),{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[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"]))}}),rS=Lt.create({name:Ic,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,state:e})=>{const n=`<div data-type="${this.name}"></div>`;return e.selection instanceof De?t.insertContentAt(e.selection.to,n):t.insertContent(n)}}},addNodeView(){return na(DN)},addOptions(){return{...this.parent?.(),upload:()=>Promise.reject("link video not found"),button:({editor:t,t:e})=>({component:Ye,componentProps:{action:()=>t.commands.setVideoUpload(),isActive:()=>t.isActive("video")||!1,disabled:!t.can().setVideo?.({}),icon:"Video",tooltip:e("editor.video.tooltip")}})}}});function PN(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 VN(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 oS=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:uf["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?PN(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:Yt(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: ${Yt(n)};`;return VN(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)}}}),Xl=new St("upload-image"),FN=()=>new it({key:Xl,state:{init(){return ut.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Xl);if(n?.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=$N(a);return jt.widget(s,l,{id:i,side:-1})});e=e.add(t.doc,r)}return 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 HN(t,e){const r=Xl.getState(t).find(void 0,void 0,i=>i.id===e);return r.length?r[0]?.from:null}const iS=({validateFn:t,onUpload:e})=>async(n,r,i)=>{const s=[];for(const a of n){if(t&&!t(a))continue;const l=$r(6),u=URL.createObjectURL(a);s.push({file:a,id:l,preview:u})}s.length!==0&&(r.dispatch(r.state.tr.setMeta(Xl,{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})=>{try{const c=await e(a),f=HN(r.state,l);if(f===null)return;const{schema:p}=r.state,h=typeof c=="object"?u:c,g=p.nodes.image?.create({src:h}),v=p.nodes.paragraph?.create();if(!g||!v)return;r.dispatch(r.state.tr.replaceWith(f,f,g).insert(f+g.nodeSize,v).setMeta(Xl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Xl,{remove:[l]}))}})))},zN=(t,e,n)=>{const r=Array.from(e.clipboardData?.files||[]);if(r.length){e.preventDefault();const i=t.state.selection.from;return n(r,t,i+1),!0}return!1},UN=(t,e,n,r)=>{const i=Array.from(e.dataTransfer?.files||[]);if(!n&&i.length){e.preventDefault();const s=t.posAtCoords({left:e.clientX,top:e.clientY});if(s)return r(i,t,s.pos+1),!0}return!1},WN={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"},jN={class:"flex items-center justify-between w-full"},qN={class:"flex items-center justify-center gap-3"},KN={class:"text-sm"},GN={class:"flex items-center gap-2"},XN=o.defineComponent({__name:"ImageUploader",props:{...ta},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Pt(),s=o.inject("isEditable",o.ref(!0));function a(f){const p=f?.target?.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const h=Array.from(p),g=e.editor.extensionManager.extensions.find(b=>b.name==="imageUpload")?.options;iS({validateFn:b=>!0,onUpload:g.upload})(h,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(){r.value?.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(ea),{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(xa),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",WN,[o.createElementVNode("div",jN,[o.createElementVNode("div",qN,[o.createVNode(o.unref(Bt),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",KN,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Bt),{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":h=>h.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Rh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Dh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Gl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Gl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Ph),{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(Ph),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",GN,[o.createVNode(o.unref(ws),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=h=>n.value=h),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"]))}}),YN=1,JN=1e6,Ei={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Wb=0;function ZN(){return Wb=(Wb+1)%Number.MAX_VALUE,Wb.toString()}const jb=new Map;function sS(t){if(jb.has(t))return;const e=setTimeout(()=>{jb.delete(t),jc({type:Ei.REMOVE_TOAST,toastId:t})},JN);jb.set(t,e)}const yo=o.ref({toasts:[]});function jc(t){switch(t.type){case Ei.ADD_TOAST:yo.value.toasts=[t.toast,...yo.value.toasts].slice(0,YN);break;case Ei.UPDATE_TOAST:yo.value.toasts=yo.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Ei.DISMISS_TOAST:{const{toastId:e}=t;e?sS(e):yo.value.toasts.forEach(n=>{sS(n.id)}),yo.value.toasts=yo.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Ei.REMOVE_TOAST:t.toastId===void 0?yo.value.toasts=[]:yo.value.toasts=yo.value.toasts.filter(e=>e.id!==t.toastId);break}}function qb(){return{toasts:o.computed(()=>yo.value.toasts),toast:QN,dismiss:t=>jc({type:Ei.DISMISS_TOAST,toastId:t})}}function QN(t){const e=ZN(),n=i=>jc({type:Ei.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>jc({type:Ei.DISMISS_TOAST,toastId:e});return jc({type:Ei.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const NN={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},eee=t=>`${(t/1024/1024).toFixed(2)}MB`,aS=Lt.create({name:xi,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:$r(6),parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},addCommands(){return{setImageUpload:()=>({commands:t,state:e})=>{const n=`<div data-type="${this.name}"></div>`;return e.selection instanceof De?t.insertContentAt(e.selection.to,n):t.insertContent(n)}}},addNodeView(){return na(XN)},addOptions(){return{...NN,...this.parent?.(),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:e,t:n})=>({component:Ye,componentProps:{action:()=>t.commands.setImageUpload(),disabled:!t.can().setImage?.({}),icon:"ImageUp",tooltip:n("editor.image.tooltip")}})}},addProseMirrorPlugins(){const{toast:t}=qb(),e=Oa.global.t,r=iS({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${eee(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:zN(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:UN(i,s,l,r)}}),FN()]}}),tee=nt.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}`}}}}}]}}),nee=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:p4},setup(t){const e=t,{t:n}=Pt(),r=yn(),i=o.computed(()=>e.editor?.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=>{if(!s.value)return;const h=p.target;if(h instanceof HTMLInputElement){a={type:"input",el:h};return}r.editorFocusedInstance.value?.view?.dom?.contains(h)&&(a={type:"editor"})});function c(p,h){const g=p.selectionStart??p.value.length,v=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+h+p.value.slice(v);const b=g+h.length;p.setSelectionRange(b,b),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const f=(p,h)=>{if(h){if(a?.type==="input"){c(a.el,p);return}if(a?.type==="editor"){const g=r.editorFocusedInstance.value;if(!g)return;const{view:v}=g,{from:b}=v.state.selection;g.commands.insertContentAt(b,p),g.commands.focus()}}};return(p,h)=>{const g=da,v=is,b=ca,w=fa;return o.openBlock(),o.createBlock(w,null,{default:o.withCtx(()=>[o.createVNode(b,{"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(v,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:h[0]||(h[0]=C=>s.value=!1),onSelectedChar:f}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),ree=nt.create({name:sh,addOptions(){return{button:({editor:t})=>({component:nee,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),lS=nt.create({name:"base-kit",addOptions(){return{...this.parent?.(),timeHighlighter:{additionalTimeWords:[]},bubble:{list:wL,defaultBubbleList:lG,button:({editor:t,extension:e,t:n})=>{const{list:r={},defaultBubbleList:i}=e.options?.bubble??{},s=i?.(t)??[];return uG(r,s,{editor:t,extension:e,t:n})}}}},addExtensions(){const t=Oa.global.t,e=[];this.options.placeholder!==!1&&e.push(J5.configure({placeholder:({node:n,pos:r})=>{const i=n?.type?.name;return i==="heading"?`${t(`editor.heading.h${n.attrs.level}.tooltip`)}`:i==="table"||i==="codeBlock"?"":r===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(JK.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(N5.configure().extend({content:"page+"})),e.push(wZ.configure({types:this.options.page?.nodesComputedOption?.types??[],slots:o.useSlots()}))):e.push(N5.configure())),this.options.dropcursor!==!1&&e.push(YK.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(KK.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(Y5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(X5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(iG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(sG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(aS.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(oS.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(rS.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(Hv.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(_E.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(u5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(EZ.configure(this.options.fontWeight)),this.options.mode!==Me.EDITOR&&e.push(ree.configure(this.options.specialCharacter)),this.options.mode!==Me.EDITOR&&e.push(AZ),this.options.superText!==!1&&this.options.mode!==Me.PLAIN_TEXT&&this.options.mode!==Me.EDITOR&&(typeof this.options.superText=="boolean"?e.push(fE.configure()):e.push(fE.configure(this.options.superText))),this.options.mode===Me.EDITOR&&(this.options.image!==!1&&e.push(Th.configure(typeof this.options.image=="object"?this.options.image:{})),e.push(Q6.configure({spacer:!0}),C6,w6,x6,Vv,zb.configure(this.options.table!==!1?this.options.table:{}),k6,g5.configure({spacer:!0}),N6.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),ME)),this.options.mode!==Me.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Me.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(OE.configure()):e.push(OE.configure({specialCharModal:this.options.configPlan?.specialCharModal}))),this.options.mode!==Me.EDITOR&&this.options.mode!==Me.PLAIN_TEXT&&e.push(BZ),(this.options.mode===Me.STRAIGHT||this.options.mode===Me.REPORT||this.options.mode===Me.EDITOR)&&this.options.timeHighlighter&&e.push(wN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(wE.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(tee),e.push(ek,Z5.configure(),bN.configure(),oG.configure(),Ib,Bb,pv,_N,TN.configure(this.options.deviceEnv),v5.configure({multicolor:!0}));for(const n in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,n)&&this.options.excludes[n]&&_t.remove(e,({name:i})=>i===n);return e},addStorage(){return{mode:this.options.mode}}}),uS=Hn.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",Ct(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()}}}),cS=Hn.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",Ct(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()}}}),oee=nt.create({name:"subAndSuperScript",addOptions(){return{...this.parent?.(),button:({editor:t,extension:e,t:n})=>{const r=e.options.subscript,i=e.options.superscript,s={component:Ye,componentProps:{action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",tooltip:n("editor.subscript.tooltip")}},a={component:Ye,componentProps:{action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",tooltip:n("editor.superscript.tooltip")}},l=[];return r!==!1&&l.push(s),i!==!1&&l.push(a),l}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(uS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(cS.configure(this.options.superscript)),t}}),iee={class:"ml-1"},see=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(ga,{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(Bl),{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(Bt),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",iee,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(J6),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(_C)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),aee=nt.create({name:"moreMark",addOptions(){return{...this.parent?.(),button({editor:t,extension:e,t:n}){const r=e.options.subscript,i=e.options.superscript,s={action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",title:n("editor.subscript.tooltip"),shortcutKeys:["mod","."]},a={action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",title:n("editor.superscript.tooltip"),shortcutKeys:["mod",","]},l=Cg(t,"code"),u=[];if(r!==!1&&u.push(s),i!==!1&&u.push(a),l){const c={action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code")||!1,disabled:!t.can().toggleCode(),icon:"Code",title:n("editor.code.tooltip"),shortcutKeys:["mod","E"]};l&&u.push(c)}return{component:see,componentProps:{icon:"Type",tooltip:n("editor.moremark"),disabled:!t.isEditable||u.every(c=>c.disabled),items:u}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(uS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(cS.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 lee(t,e,n){return t<e?e:t>n?n:t}function uee(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Le||s instanceof Mn))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=cee(t,c,e),!1):!G0(u.type.name,r.extensionManager.extensions)}),t}function cee(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=lee((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 dS({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=uee(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const dee=nt.create({name:"indent",addOptions(){return{...this.parent?.(),types:["paragraph","heading","blockquote"],minIndent:Ra.min,maxIndent:Ra.max,button({editor:t,t:e}){const{selection:n}=t.state,r=n.$anchor.parent;return[{component:Ye,componentProps:{action:()=>{t.commands.indent()},disabled:r?.attrs?.indent>=Ra.max||!t.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:e("editor.indent.tooltip")}},{component:Ye,componentProps:{action:()=>{t.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:r?.attrs?.indent<=Ra.min||!t.can().outdent(),icon:"IndentDecrease",tooltip:e("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:()=>dS({delta:Ra.more,types:this.options.types}),outdent:()=>dS({delta:Ra.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function fee(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=BO(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",h=i?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${h}]*`,"gm"),v=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!v)return null;const b=l.pos-v.length,w=Array.from(v.matchAll(g)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const C=w.input.slice(Math.max(0,w.index-1),w.index),x=new RegExp(`^[${s?.join("")}\0]?$`).test(C);if(s!==null&&!x)return null;const E=b+w.index;let k=E+w[0].length;return u&&f.test(v.slice(k-1,k+1))&&(w[0]+=" ",k+=1),E<l.pos&&k>=l.pos?{range:{from:E,to:k},query:w[0].slice(n.length),text:w[0]}:null}const pee=new St("suggestion");function hee({pluginKey:t=pee,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:h=()=>!0,findSuggestionMatch:g=fee}){let v;const b=p?.(),w=new it({key:t,view(){return{update:async(C,x)=>{var E,k,T,S,A,V,B;const O=(E=this.key)===null||E===void 0?void 0:E.getState(x),F=(k=this.key)===null||k===void 0?void 0:k.getState(C.state),H=O.active&&F.active&&O.range.from!==F.range.from,Y=!O.active&&F.active,Q=O.active&&!F.active,U=!Y&&!Q&&O.query!==F.query,D=Y||H&&U,L=U||H,j=Q||H&&U;if(!D&&!L&&!j)return;const P=j&&!D?O:F,G=C.dom.querySelector(`[data-decoration-id="${P.decorationId}"]`);v={editor:e,range:P.range,query:P.query,text:P.text,items:[],command:K=>c({editor:e,range:P.range,props:K}),decorationNode:G,clientRect:G?()=>{var K;const{decorationId:ee}=(K=this.key)===null||K===void 0?void 0:K.getState(e.state),de=C.dom.querySelector(`[data-decoration-id="${ee}"]`);return de?.getBoundingClientRect()||null}:null},D&&((T=b?.onBeforeStart)===null||T===void 0||T.call(b,v)),L&&((S=b?.onBeforeUpdate)===null||S===void 0||S.call(b,v)),(L||D)&&(v.items=await f({editor:e,query:P.query})),j&&((A=b?.onExit)===null||A===void 0||A.call(b,v)),L&&((V=b?.onUpdate)===null||V===void 0||V.call(b,v)),D&&((B=b?.onStart)===null||B===void 0||B.call(b,v))},destroy:()=>{var C;v&&((C=b?.onExit)===null||C===void 0||C.call(b,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,x,E,k){const{isEditable:T}=e,{composing:S}=e.view,{selection:A}=C,{empty:V,from:B}=A,O={...x};if(O.composing=S,T&&(V||e.view.composing)){(B<x.range.from||B>x.range.to)&&!S&&!x.composing&&(O.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&&h({editor:e,state:k,range:F.range,isActive:x.active})?(O.active=!0,O.decorationId=x.decorationId?x.decorationId:H,O.range=F.range,O.query=F.query,O.text=F.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(C,x){var E;const{active:k,range:T}=w.getState(C.state);return k&&((E=b?.onKeyDown)===null||E===void 0?void 0:E.call(b,{view:C,event:x,range:T}))||!1},decorations(C){const{active:x,range:E,decorationId:k}=w.getState(C);return x?ut.create(C.doc,[jt.inline(E.from,E.to,{nodeName:l,class:u,"data-decoration-id":k})]):null}}});return w}const mee=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],gee=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],vee=[{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"}],bee=[{label:"CodePen",value:"codepen",icon:"Codepen"}],yee=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],wee=[],Cee=[...mee,...gee,...vee,...bee,...yee,...wee];function xee(t){const e=Oa.global.t,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(Cg(t,"iframes")){const i=Cee;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 kee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},Eee={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"},See=["onClick"],_ee=["src"],Tee={key:1,class:"p-3"},Aee={class:"text-xs text-gray-800 dark:text-gray-400"},Mee=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}=Pt(),a=o.ref([]),l=t;e({onKeyDown:u}),o.watch([()=>n.value,()=>r.value],async()=>{if(!i.value)return;await o.nextTick();const b=r.value*1e3+n.value,w=a.value[b];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:b}){return b.key==="ArrowUp"?(c(),!0):b.key==="ArrowDown"?(f(),!0):b.key==="Enter"?(p(),!0):!1}function c(){if(!l.items.length)return!1;let b=n.value-1,w=r.value;b<0&&(w=r.value-1,b=l.items[w]?.commands.length-1||0),w<0&&(w=l.items.length-1,b=l.items[w].commands.length-1),n.value=b,r.value=w}function f(){if(!l.items.length)return!1;const b=l.items[r.value].commands;let w=n.value+1,C=r.value;b.length-1<w&&(w=0,C=r.value+1),l.items.length-1<C&&(C=0),n.value=w,r.value=C}function p(){if(!l.items.length||r.value===-1||n.value===-1)return!1;h(r.value,n.value)}function h(b,w){const C=l.items[b].commands[w];l.command(C)}function g(b,w){h(b,w)}function v(b,w,C){a.value[b*1e3+w]=C}return(b,w)=>(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"},[b.items?.length?(o.openBlock(),o.createElementBlock("div",kee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(b.items,(C,x)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:C.title},[o.createElementVNode("div",Eee,o.toDisplayString(C.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(C.commands,(E,k)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:T=>v(x,k,T),key:k,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===x&&n.value===k?"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:T=>g(x,k)},[E.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:E.iconUrl},null,8,_ee)):o.createCommentVNode("",!0),E.iconName?(o.openBlock(),o.createBlock(o.unref(Bt),{key:1,name:E.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(E.label),1)],10,See))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",Tee,[o.createElementVNode("span",Aee,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512))}}),Da="slashCommand";let Go;const Bee=nt.create({name:Da,priority:200,onCreate(){Go=Ns("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[hee({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new St(Da),allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=n.depth===1,i=n.parent.type.name==="paragraph",s=n.parent.textContent?.charAt(0)==="/",a=this.editor.isActive("column"),u=!n.parent.textContent?.substring(n.parent.textContent?.indexOf("/"))?.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})=>xee(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(h=>h.toLowerCase().trim()),f=l.match(u),p=c.some(h=>h.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=>{t=new sC(Mee,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Da].rect;const s=n.clientRect();if(!s)return n.editor.storage[Da].rect;let a=s.y;if(t.element instanceof HTMLElement&&s.top+t.element.offsetHeight+40>window.innerHeight){const l=s.top+t.element.offsetHeight-window.innerHeight+40;a=s.y-l}return new DOMRect(s.x,a,s.width,s.height)};e=()=>{Go?.[0].setProps({getReferenceClientRect:i})},r.dom.parentElement?.addEventListener("scroll",e),t.element&&Go?.[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element}),Go?.[0].show()},onUpdate(n){t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Da].rect;const a=n.clientRect();return a?new DOMRect(a.x,a.y,a.width,a.height):n.editor.storage[Da].rect},s=()=>{Go?.[0].setProps({getReferenceClientRect:i})};r.dom.parentElement?.addEventListener("scroll",s),n.editor.storage[Da].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Go?.[0].setProps({getReferenceClientRect:i})},onKeyDown(n){return n.event.key==="Escape"?(Go?.[0].hide(),!0):(Go?.[0].state.isShown||Go?.[0].show(),t.ref?.onKeyDown(n))},onExit(n){if(Go?.[0].hide(),e){const{view:r}=n.editor;r.dom.parentElement?.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),Oee=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=yn(),{toast:r}=qb();function i(){const s=e.editor.extensionManager.extensions.find(a=>a.name==="AI")?.options?.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,e.editor?.commands.focus()}return(s,a)=>(o.openBlock(),o.createBlock(Ye,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),Iee=Lt.create({name:"AI",group:"block",addOptions(){return{...this.parent?.(),toolbar:!1,button:({editor:t,t:e})=>({component:Oee,componentProps:{icon:"Sparkles",tooltip:e("editor.AI.ask")}})}}});function Lee(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 Ree(t,e){return new File([t],e,{type:t.type})}const Dee=nt.create({name:"importWord",addOptions(){return{...this.parent?.(),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:t,extension:e,t:n})=>({component:Ye,componentProps:{action:()=>t.commands?.toggleImportWord(),disabled:!t.can().setHorizontalRule(),icon:"Word",tooltip:n("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=qb(),r=Oa.global.t;async function i(u){const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(Cg(e,"image")){const g=e.extensionManager.extensions.find(v=>v.name==="importWord")?.options;if(g&&typeof g.upload=="function"){const v=[];for(const w of p){const C=w.getAttribute("src"),x=Lee(C,"image/jpeg"),E=Ree(x,"image.jpeg");v.push(E)}const b=await g.upload(v);for(let w=0;w<p.length;w++){const C=p[w];C.setAttribute("src",b[w].src);const x=C.parentElement;x?.tagName==="P"&&(x.insertAdjacentElement("beforebegin",C),!x.hasChildNodes()&&x.textContent===""&&x.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}=lt.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(h=>h.json()).then(async h=>{s(h.html)}).catch(h=>{n({title:r("editor.importWord.error"),variant:"destructive"}),console.error("Error:",h)})}}}),!1}}}}),Kb=yn(),Pee=nt.create({name:"preview",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ye,componentProps:{icon:"Eye",action:()=>{Kb.togglePreview()},tooltip:t("editor.preview.tooltip"),isActive:()=>Kb.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Kb.togglePreview(),!0)}}}),fS=yn(),Vee=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function Fee(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ut.empty,results:[]};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(([h])=>h.trim());for(const h of p){if(h[0]==="")break;h.index!==void 0&&s.push({from:f+h.index,to:f+h.index+h[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],f=u===r?`${n} ${n}-current`:n,p=jt.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))},Hee=(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]},zee=(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=Hee(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},Uee=new St("findAndReplacePlugin"),Wee=nt.create({name:"findAndReplace",addOptions(){return{...this.parent?.(),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:t,extension:e,t:n})=>({component:Ye,componentProps:{icon:"DocSearch",tooltip:n("editor.findAndReplace.tooltip"),action:()=>{fS.toggleFindAndReplace()},isActive:()=>fS.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 zee(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:Uee,state:{init:()=>ut.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:h,resultIndex:g,lastResultIndex:v}=t.storage.findAndReplace;if(!l&&f===c&&h===p&&v===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],ut.empty;const{decorationsToReturn:b,results:w}=Fee(a,Vee(c,n,p),e,g);return t.storage.findAndReplace.results=w,b}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:jee,state:qee}=yn(),Kee=nt.create({name:"printer",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ye,componentProps:{tooltip:t("editor.printer.tooltip"),action:()=>jee(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>qee.printer}})}}}),Gee=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 sn.post(this.getApi(),{value:t}),r=this.transfer(n.data);e=r?.map(i=>i.errorText)||[],this?.setSuggestions&&this.setSuggestions(r)}catch(n){console.error(n)}return e};class pS{suggestions=[];api="";enabled=!0;limit;transfer;constructor({api:e,limit:n,transfer:r,enabled:i}){this.suggestions=[],this.api=e,this.limit=n,this.transfer=r,this.enabled=i??!0}setSuggestions(e){this.suggestions=e}getSuggestions(e){return Promise.resolve(this.suggestions.find(n=>n.errorText.wrongWord===e)?.spellData.correctWord??[])}getApi(){return this.api}normalizeTextForLanguage(e){return e}proofreadText(e){return Promise.resolve(Gee.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Xee=Object.freeze(Object.defineProperty({__proto__:null,AI:Iee,BaseKit:lS,Blockquote:oK,Bold:w6,BulletList:Yq,Clear:pv,Code:P$,CodeBlock:NH,Color:g5,Columns:Ib,FindAndReplace:Wee,FontFamily:_E,FontSize:u5,FormatPainter:Bb,Fullscreen:qK,Heading:Q6,Highlight:jq,History:Hv,HorizontalRule:RK,Image:Th,ImageUpload:aS,ImportWord:Dee,Indent:dee,Italic:C6,LineHeight:ME,Link:Vv,MoreMark:aee,OrderedList:Nq,Preview:Pee,Printer:Kee,Proofreader:pS,SlashCommand:Bee,SpellcheckerExtension:bE,Strike:k6,SubAndSuperScript:oee,Table:zb,TaskList:nK,TextAlign:N6,Underline:x6,Video:oS,VideoUpload:rS},Symbol.toStringTag,{value:"Module"})),Yee='<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 Jee(){const t=window.localStorage.getItem("content"),e=o.ref(t||Yee),n=o.computed(()=>[lS.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),Hv,Ib,Bb,pv,Vv,Th,zb]),r=lt.useEventBus(cr.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 Zee(){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 h=a.content.size;r.chain().insertContentAt(h,i).focus().run();return}const p=u.parent;if(p.type.name==="paragraph"&&p.textContent.trim().length===0){const h=u.before();r.chain().insertContentAt({from:h,to:h+p.nodeSize},i).focus().run();return}if(u.parentOffset===0&&p.type.name==="paragraph"&&p.content.size>0){const h=u.before();r.chain().insertContentAt(h,i).focus().run();return}r.chain().insertContentAt(r.state.selection,i).focus().run()}}}function Yl(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 Qee(){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(h=>h.contains(l))||(c?.contains(l)??!1)||(f?.contains(l)??!1)||p.some(h=>h.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 lt.useEventListener(document,"mousedown",i,{capture:!0}),lt.useEventListener(document,"touchstart",i,{capture:!0}),lt.useEventListener(document,"focusin",s),lt.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}function qc(){try{const{locale:t}=Pt();o.watch(t,e=>{const n=String(e);n&&Oa.global.locale.value!==n&&(Oa.global.locale.value=n)},{immediate:!0})}catch{}}const Nee={key:0,class:"p-2.5 space-y-1.5"},ete=["innerHTML"],tte={key:1,class:"p-2.5 space-y-1.5"},nte=["innerHTML"],rte={key:2,class:"p-2.5 space-y-1.5"},ote=["innerHTML"],ite=Xr(o.defineComponent({__name:"ArticleFullViewer",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},minChars:{},fontSize:{}},setup(t){const e=t;qc();const n=o.computed(()=>{const x=e.extensions?.filter(E=>E.name!=="spellchecker")||[];return x.some(E=>E.name==="image")||x.push(Th.configure()),x}),r=o.computed(()=>ra(e.comment)),i=o.computed(()=>ra(e.commentCuesheet)),s=o.computed(()=>ra(e.content));function a(x){return vg(x).replace(/<script\b[\s\S]*?<\/script\s*>/gi,"")}const l=o.computed(()=>r.value?a(e.comment):""),u=o.computed(()=>i.value?a(e.commentCuesheet):""),c=o.computed(()=>s.value?a(e.content):""),f=o.ref(),p=o.ref(),h=o.ref();o.onBeforeUnmount(()=>{f.value&&f.value.destroy(),p.value&&p.value.destroy(),h.value&&h.value.destroy()});function g(x){return new Bo({extensions:n.value,content:x,editable:!1,parseOptions:{preserveWhitespace:"full"}})}o.onMounted(async()=>{!r.value&&e.comment&&(f.value=g(cn(e.comment,!0,e.mode)),await o.nextTick()),!i.value&&e.commentCuesheet&&(p.value=g(cn(e.commentCuesheet,!0,e.mode)),await o.nextTick()),!s.value&&e.content&&(h.value=g(cn(e.content,!0,e.mode)))});function v(x,E){if(!x)return;const k=cn(E,!0,e.mode);_t.isEqual(x.getHTML(),k)||x.commands.setContent(k,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,x=>{r.value||v(f.value,x)}),o.watch(()=>e.commentCuesheet,x=>{i.value||v(p.value,x)}),o.watch(()=>e.content,x=>{s.value||v(h.value,x)});const b=o.computed(()=>e.fontSize??""),{contentInner:w,measuredMinWidth:C}=ff({minChars:e.minChars,fontSize:b});return(x,E)=>{const k=ZT;return o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:w,style:o.normalizeStyle({minWidth:`${Number(o.unref(C))+23}px`}),class:"flex-1 border border-[#999] rounded-[3px] divide-y divide-[#999] divide-dashed overflow-y-auto"},[x.comment&&!x.hideComment?(o.openBlock(),o.createElementBlock("div",Nee,[x.fieldNameComment?.label?(o.openBlock(),o.createBlock(k,{key:0,label:x.fieldNameComment.label,"custom-class":x.fieldNameComment.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(r)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(l)},null,8,ete)):o.unref(f)?(o.openBlock(),o.createBlock(o.unref(Jn),{key:2,editor:o.unref(f)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),x.commentCuesheet&&!x.hideComment?(o.openBlock(),o.createElementBlock("div",tte,[x.fieldNameCommentCuesheet?.label?(o.openBlock(),o.createBlock(k,{key:0,label:x.fieldNameCommentCuesheet.label,"custom-class":x.fieldNameCommentCuesheet.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(i)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(u)},null,8,nte)):o.unref(p)?(o.openBlock(),o.createBlock(o.unref(Jn),{key:2,editor:o.unref(p)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),x.content?(o.openBlock(),o.createElementBlock("div",rte,[x.fieldNameContent?.label?(o.openBlock(),o.createBlock(k,{key:0,label:x.fieldNameContent.label,"custom-class":x.fieldNameContent.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,ote)):o.unref(h)?(o.openBlock(),o.createBlock(o.unref(Jn),{key:2,editor:o.unref(h)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-3357e31b"]]),wo=o.defineComponent({__name:"Separator",props:{orientation:{},decorative:{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(oF),o.mergeProps(n.value,{class:o.unref(ke)("shrink-0 bg-ed-separator",e.orientation==="vertical"?"w-px h-full":"h-px w-full",e.class)}),null,16,["class"]))}}),ste={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-1.5"},ate={class:"flex-1 flex justify-end items-center gap-x-3"},lte=o.defineComponent({__name:"Toolbar",props:{editor:{},editorComment:{},disabled:{type:Boolean,default:!1},mode:{},class:{},customClassToolbar:{},toolbarExtensionOrder:{}},setup(t){const e=o.defineAsyncComponent(()=>Promise.resolve().then(()=>rZ)),{t:n}=Pt(),r=t,i=o.inject("isEditable",o.ref(!0)),s=[nh,rh,sh,oh,ki,Rc],a=o.computed(()=>{const f=[...r.editor.extensionManager.extensions],p={[ki]:-1},h={[nh]:1,[rh]:2,[sh]:3,[oh]:4,[ki]:5,[Rc]:6},g=r.toolbarExtensionOrder??(r.mode===Me.EDITOR?p:h),v=mE(f,g);let b=[];for(const w of v){const{button:C,divider:x=!1,spacer:E=!1,toolbar:k=!0}=w.options;if(!C||!wg(C)||!k)continue;const T=C({editor:r.editor,extension:w,t:o.unref(n)});if(Array.isArray(T)){const S=T.map((A,V)=>({id:`${w.name}`,button:A,divider:V===T.length-1?x:!1,spacer:V===0?E:!1}));b=[...b,...S];continue}b.push({button:T,divider:x,spacer:E,id:`${w.name}`})}if(r.mode!==Me.EDITOR)return b.filter(w=>w.id&&s.includes(w.id));if(b=b.filter(w=>w.id!=="superText"),!i.value){b=b.map(C=>(C.button.componentProps.disabled=!0,C));const w=b.find(C=>C.id==="spellchecker");w&&(w.button.componentProps.disabled=!1)}return b}),l=f=>f.id==="spellchecker"?"!text-[#2977D9] border border-gray-300 dark:!text-white hover:!bg-gray-200 dark:hover:!bg-gray-700 rounded-none [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] p-0 w-[26px] h-[26px]":f.button.componentProps.customClass,u=f=>f.id==="spellchecker"?"Spellchecker":f.button.componentProps.icon,c=o.computed(()=>r.editor?.extensionManager.extensions.find(f=>f.name==="spellchecker"));return(f,p)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(ke)(r.class,f.customClassToolbar))},[o.createElementVNode("div",ste,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(h,g)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:g},[h.spacer&&g!==0?(o.openBlock(),o.createBlock(o.unref(wo),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(h.button.component),o.mergeProps({id:h.id,ref_for:!0},h.button.componentProps,{editor:f.editor,disabled:f.disabled||h.button.componentProps?.disabled,"custom-class":l(h),icon:u(h)}),o.createSlots({_:2},[o.renderList(h.button.componentSlots,(v,b,w)=>({name:`${b}`,fn:o.withCtx(C=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(v),o.mergeProps({ref_for:!0},C?.props,{id:h.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),h.divider?(o.openBlock(),o.createBlock(o.unref(wo),{key:1,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64))),128)),o.createElementVNode("div",ate,[p[0]||(p[0]=o.createElementVNode("div",{id:"tool-bar-auto-save"},null,-1)),c.value?(o.openBlock(),o.createBlock(o.unref(e),{key:0,editor:f.editor,"editor-comment":f.editorComment,isEnableSpellCheckRealTime:f.editor?.extensionStorage.spellchecker.spellchecker.proofreader.enabled},null,8,["editor","editor-comment","isEnableSpellCheckRealTime"])):o.createCommentVNode("",!0)])])],2))}}),hS=(t,e)=>{const{view:n,state:{selection:{from:r}}}=t,i=document.querySelectorAll(".focus"),s=i.length,l=i[s-1];if(l&&l.getAttribute("data-type")&&l.getAttribute("data-type")===e||l&&l.classList&&l.classList.contains(e))return l;const u=n.domAtPos(r).node;let c=u;for(c.tagName||(c=u.parentElement);c&&!(c.getAttribute("data-type")&&c.getAttribute("data-type")===e)&&!c.classList.contains(e);)c=c.parentElement;return c},ute={class:"w-max px-3 py-2 transition-all border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-ed-background"},cte={class:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative gap-0.5"},dte={class:"flex items-center gap-2"},fte={class:"mt-3"},mS=o.defineComponent({__name:"ImageBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,{t:n}=Pt(),r=o.ref("100"),i=o.ref(),s=o.ref(),a=o.ref(),l=["left","center","right"],u={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"},c=()=>document.body;function f(B){B?.preventDefault(),e.editor.getAttributes("image").src&&e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:i.value?`${i.value}px`:null}).run()}function p(B){const O=Math.max(0,Math.min(100,parseInt(r.value)));e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:`${O}%`}).run()}const h=o.ref(!1),g=o.ref(null),v=({editor:B})=>K0(B.view.state,"image")||h.value;function b(){const B=hS(e.editor,"node-image");return B?(g.value=B,B.getBoundingClientRect()):h.value&&g.value?g.value.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)}function w(B){e.editor.commands.updateAttributes("image",{textAlign:B})}o.watch(r,()=>{r.value&&p()}),o.watch(()=>e.editor.getAttributes("image"),B=>{B&&(i.value=Math.round(parseFloat(B.originWidth)),s.value=Math.round(parseFloat(B.originHeight)),a.value=B.originWidth/B.originHeight)});function C(){s.value&&a.value?i.value=Math.max(30,Math.round(s.value*a.value)):i.value=null}function x(){i.value&&a.value?s.value=Math.max(20,Math.round(i.value/a.value)):s.value=null}function E(B){w(B)}function k(){const B=e.editor.getAttributes("image"),{flipX:O}=B;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!O}).run()}function T(){const B=e.editor.getAttributes("image"),{flipY:O}=B;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!O}).run()}function S(){const{state:B,dispatch:O}=e.editor.view;il(B,O)}function A(){const{state:B,dispatch:O}=e.editor.view,{tr:F,selection:H}=B;if(!(H instanceof De))return;const Y=H.from,Q=B.doc.nodeAt(Y);if(!Q)return;const D=B.doc.resolve(Y).nodeBefore;if(!D)return;const L=Y-D.nodeSize,j=F.delete(Y,Y+Q.nodeSize).insert(L,Q).setSelection(De.create(F.doc,L));O(j),e.editor.commands.focus()}function V(){const{state:B,dispatch:O}=e.editor.view,{tr:F,doc:H,selection:Y}=B;if(!(Y instanceof De))return;const Q=Y.from,U=H.nodeAt(Q);if(!U)return;const D=Q+U.nodeSize;if(D>=H.content.size)return;const L=H.nodeAt(D);if(!L)return;const j=D+L.nodeSize-U.nodeSize,P=Q+L.nodeSize,G=F.delete(Q,Q+U.nodeSize).insert(j,U).setSelection(De.create(F.doc,P));O(G),e.editor.commands.focus()}return(B,O)=>{const F=Ye,H=wo,Y=xa,Q=Bc,U=ws,D=Gl,L=Dh,j=Rh,P=gs,G=ms;return o.openBlock(),o.createBlock(o.unref(ju),{editor:B.editor,"plugin-key":"image-menus-123","should-show":v,"update-delay":0,"tippy-options":{zIndex:9999,appendTo:c,getReferenceClientRect:()=>b()}},{default:o.withCtx(()=>[o.createElementVNode("div",ute,[o.createElementVNode("div",cte,[o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:k},null,8,["tooltip"]),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipY"),icon:"FlipHorizontal",action:T},null,8,["tooltip"]),o.createVNode(H,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.moveUp"),icon:"MoveUp",action:A,disabled:!B.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.moveDown"),icon:"MoveDown",action:V,disabled:!B.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(H,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(G,{open:h.value,"onUpdate:open":O[4]||(O[4]=K=>h.value=K)},{default:o.withCtx(()=>[o.createVNode(Y,null,{default:o.withCtx(()=>[o.createVNode(F,{title:o.unref(n)("editor.image.menu.size"),icon:"ImageSize"},null,8,["title"])]),_:1}),o.createVNode(P,{class:"w-84"},{default:o.withCtx(()=>[o.createElementVNode("div",dte,[o.createVNode(Q,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.width")),1)]),_:1}),o.createVNode(U,{id:"maxWidth",modelValue:i.value,"onUpdate:modelValue":O[0]||(O[0]=K=>i.value=K),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:x,onKeyup:o.withKeys(f,["enter"])},null,8,["modelValue"]),o.createVNode(Q,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.height")),1)]),_:1}),o.createVNode(U,{id:"maxWidth",modelValue:s.value,"onUpdate:modelValue":O[1]||(O[1]=K=>s.value=K),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:C,onKeyup:o.withKeys(f,["enter"])},null,8,["modelValue"])]),o.createElementVNode("div",fte,[o.createVNode(j,{"model-value":r.value,"onUpdate:modelValue":[O[2]||(O[2]=K=>r.value=K),O[3]||(O[3]=K=>{r.value=K})]},{default:o.withCtx(()=>[o.createVNode(L,null,{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(["25","50","75","100"],K=>o.createVNode(D,{key:K,value:K},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(K)+"% ",1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])])]),_:1})]),_:1},8,["open"]),o.createVNode(H,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(l,(K,ee)=>o.createVNode(F,{key:ee,tooltip:o.unref(n)(`editor.textalign.${K}.tooltip`),icon:u[K],action:()=>E(K),disabled:!B.editor.can().setTextAlign(K),"is-active":()=>B.editor.isActive({textAlign:K})||!1},null,8,["tooltip","icon","action","disabled","is-active"])),64)),o.createVNode(H,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(F,{tooltip:o.unref(n)("editor.remove"),icon:"Trash2",action:S,disabled:!B.editor.isEditable},null,8,["tooltip","disabled"])])])]),_:1},8,["editor","tippy-options"])}}}),pte={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"},Vh=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:w})=>w.isActive("table")&&(w.storage.table?.isTableEditorOpen??!1),{t:i}=Pt();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 h(){e.editor?.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function v(w){e.editor.chain().focus().setTableCellBackground(w).run()}const b=()=>{const w=document.querySelector(".vdc-editor");if(!w)return new DOMRect(-1e3,-1e3,0,0);const C=w.getBoundingClientRect();return new DOMRect(C.left,C.top+10,C.width,0)};return(w,C)=>(o.openBlock(),o.createBlock(o.unref(ju),{editor:w.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:b,appendTo:n}},{default:o.withCtx(()=>[o.createElementVNode("div",pte,[o.createVNode(Ye,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addColumnBefore()},null,8,["tooltip","disabled"]),o.createVNode(Ye,{icon:"TablerColumnInsertRight",tooltip:o.unref(i)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addColumnAfter()},null,8,["tooltip","disabled"]),o.createVNode(Ye,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteColumn()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ye,{icon:"TablerRowInsertTop",action:u,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addRowBefore()},null,8,["tooltip","disabled"]),o.createVNode(Ye,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addRowAfter()},null,8,["tooltip","disabled"]),o.createVNode(Ye,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteRow()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ye,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().mergeCells()},null,8,["tooltip","disabled"]),o.createVNode(Ye,{icon:"TableCellsSplit",action:h,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().splitCell()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(b5,{editor:w.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:v,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),o.createVNode(Ye,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteTable()},null,8,["tooltip","disabled"])])]),_:1},8,["editor","tippy-options"]))}}),hte={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},mte={class:"flex items-center gap-1"},Fh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>K0(l.view.state,"columns"),r=()=>hS(e.editor,"columns")?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0),i=()=>{e.editor.chain().focus().setLayout(Ia.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(Ia.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(Ia.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(cL)],sticky:"popper"}},{default:o.withCtx(()=>[o.createElementVNode("div",hte,[o.createElementVNode("div",mte,[o.createVNode(Ye,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ia).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ye,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ia).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ye,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ia).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),gte={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"},vte=["href"],bte={class:"flex flex-nowrap"},yte=o.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=Pt(),r=e;function i(){r("clear")}function s(){r("edit")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",gte,[o.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},o.toDisplayString(o.unref(_t.truncate)(a.link,{length:50,omission:"…"})),9,vte),a.link?(o.openBlock(),o.createBlock(o.unref(wo),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",bte,[o.createVNode(Ye,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Ye,{icon:"Unlink",tooltip:o.unref(n)("editor.link.unlink.tooltip"),action:i,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),$h=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(dV),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(yte,{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(H5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),gS=(t,e,n,r,i)=>{const s=o.ref(0),a=lt.useEventBus(cr.RENDER_SUPER_TEXT),l=T=>{if(!e.value||!t)return;const S=e.value.index,A=e.value.id,{state:V}=t,{tr:B}=V;let O=!1;V.doc.descendants((F,H)=>{if(F.attrs?.[Qe.ID]===A){if(zc(T))return B.delete(H,H+1),O=!0,!1;const{[Qe.ELEMENT_ID]:Y,...Q}=F.attrs;return B.setNodeMarkup(H,void 0,{...Q,[Qe.TEXT]:T}),O=!0,!1}return!0}),O&&t&&t.view.dispatch(B),S!==-1&&(n.value[S].text=T,n.value[S].textOriginal=T,n.value[S].hoverElementId=null)},u=o.ref(new Map),c=()=>{if(!t?.view.dom)return[];const T=[],S=t?.view.dom.querySelectorAll("[node-id]"),A=new Map;return u.value.clear(),S.forEach(V=>{const B=V.getBoundingClientRect().top;A.has(B)||A.set(B,V),u.value.set(V.getAttribute("node-id")||"unknown",0)}),T.push(...A.values()),T},f=T=>{const S=T.closest(`#${r}`);if(!S)return;const A=S.getBoundingClientRect().top,V=S?.scrollTop;return T.getBoundingClientRect().top-(A-V)},p=(T,S)=>{const A=n.value.findIndex(V=>V.id===T);A>-1&&(n.value[A].status=S)},h=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,S=new Set(n.value.map(B=>B.id)),A=T.map(B=>({isHidden:B.classList.contains("hidden"),isTruncated:B.classList.contains("super-text-truncate")}));T.forEach(B=>{B.classList.remove("hidden"),B.classList.remove("super-text-truncate")});for(const B of u.value.keys())S.has(B)||u.value.delete(B);T.forEach(B=>{const O=B.getAttribute("book-mark-id");if(!O)return;const F=B.offsetTop+B.offsetHeight,H=u.value.get(O)||0;u.value.set(O,Math.max(F,H))}),T.forEach((B,O)=>{A[O].isHidden&&B.classList.add("hidden"),A[O].isTruncated&&B.classList.add("super-text-truncate")});let V=0;for(const B of u.value.values())B>V&&(V=B);s.value=V},v=async()=>{await o.nextTick();const S=c().map(A=>{const V=A.getAttribute("node-id"),B=A.getAttribute("book-mark-content"),O=A.getAttribute("page-id"),F=A.getAttribute("page-number"),H=A.getBoundingClientRect(),Y=A.getAttribute("line-id"),Q=A.getAttribute("element-id");return{position:H,text:h(B),id:V,pageId:O,pageNumber:F,visiblePosition:f(A),status:0,lineId:Y,elementId:Q,hoverElementId:null,textOriginal:h(B)}});n.value=S},b=(T,S)=>{const A=T.bottom<=S.top,V=T.top>=S.bottom;return!(A||V)};async function w(){const T=i.value;if(!T||T.length===0){g();return}T.sort((S,A)=>{const V=Number(S.getAttribute("index")),B=Number(A.getAttribute("index"));return V-B}),T.forEach(S=>S.classList.remove("super-text-truncate")),T.forEach((S,A)=>{const V=S.getBoundingClientRect();T.slice(A+1).forEach(B=>{const O=B.getBoundingClientRect();b(V,O)&&S.classList.add("super-text-truncate")})}),g()}const C=async T=>{await o.nextTick();const S=t?.view.dom.querySelector(`[node-id='${T.dataId}']`),A=i.value.find(O=>{const F=O.getBoundingClientRect().top,H=S?.getBoundingClientRect().top;if(H==null)return!1;const Y=H-F;return Math.abs(Y-9)<=2});if(!A)return;const V=Number(A.getAttribute("index"));if(!T.text){A.querySelector(".super-text-lines").innerHTML=n.value[V].textOriginal,n.value[V].hoverElementId=null,i.value.forEach(O=>O.classList.remove("hidden")),w();return}n.value[V].hoverElementId=T.elementId??null,A.querySelector(".super-text-lines").innerHTML=h(T.text),A.classList.remove("super-text-truncate");const B=A.getBoundingClientRect();i.value.forEach((O,F)=>{if(F!==V){const H=O.getBoundingClientRect();b(B,H)&&O.classList.add("hidden")}}),g()},x=T=>{switch(T.action){case"hover":C(T.payload);break;case"status":p(T.payload.id,T.payload.status);break;case"render":v();break;default:console.log("There is no action")}},E=(T,S)=>{const A=T.currentTarget;A.classList.remove("super-text-truncate");const V=A.getBoundingClientRect();i.value.forEach((B,O)=>{if(O!==S){const F=B.getBoundingClientRect();b(V,F)&&B.classList.add("hidden")}}),g()},k=()=>{i.value.forEach(T=>T.classList.remove("hidden")),w()};return o.onBeforeMount(()=>{a.on(x),window.addEventListener("resize",v)}),o.onBeforeUnmount(()=>{a.off(x),window.removeEventListener("resize",v)}),o.watch(()=>n,async()=>{await o.nextTick(),w()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:w,eventListener:x,handleMouseOver:E,handleMouseLeave:k,wrapperMinHeight:s}},wte=["index","book-mark-id","line-id","onMouseover"],Cte=["innerHTML"],xte=Xr(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(()=>n.fixedWidth&&o.unref(c)||"normal"),p=o.inject("canEditSuper",o.ref(!0)),{onUpdate:h,handleMouseOver:g,handleMouseLeave:v,wrapperMinHeight:b}=gS(n.editor,l,i,"editor-container",r),w=(S,A)=>{p.value&&(l.value={id:S.id,text:S.text,elementId:S.elementId,index:A},s.value=!0,u&&(a.value=!0))},C=S=>dd(S?n.superPreviewCustomClass?.completedSuper??"bg-black":n.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),x=o.computed(()=>n.fontSize??""),E=o.computed(()=>n.fixedWidth??!1),{contentInner:k,measuredMinWidth:T}=ff({minChars:n.minChars,fontSize:x,fixed:E});return e({measuredMinWidthComment:T}),(S,A)=>{const V=Bt;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:k,style:o.normalizeStyle({width:`${Number(o.unref(T))+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",S.fixedWidth&&"overflow-hidden",S.superPreviewCustomClass?.overall??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(B,O)=>(o.openBlock(),o.createElementBlock("div",{key:B.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:O,"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||B.position?.top}px`}),onMouseover:F=>o.unref(g)(F,O),onMouseleave:A[0]||(A[0]=(...F)=>o.unref(v)&&o.unref(v)(...F))},[o.createVNode(o.unref(pb),{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",S.fixedWidth?"whitespace-pre overflow-hidden":"wrap-anywhere whitespace-break-spaces",B.hoverElementId??B.elementId?S.superPreviewCustomClass?.completedSuper??"bg-black":S.superPreviewCustomClass?.unproducedSuper??"bg-red-500",{"cursor-default":!o.unref(p)})),onDblclick:F=>w(B,O)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:f.value}),innerHTML:B.text},null,12,Cte),o.createVNode(V,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",C(B.hoverElementId??B.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,wte))),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(Uc,{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(h)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-51843f23"]]),kte=["index","book-mark-id","line-id","onMouseover"],Ete=["innerHTML"],Ste=Xr(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(()=>e.fixedWidth&&o.unref(u)||"normal"),f=o.inject("isEditable",o.ref(!0)),{onUpdate:p,handleMouseOver:h,handleMouseLeave:g,wrapperMinHeight:v}=gS(e.editor,a,r,"editor-container-comment",n),b=(x,E)=>{f.value&&(a.value={id:x.id,text:x.text,elementId:x.elementId,index:E},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},w=x=>dd(x?e.superPreviewCustomClass?.completedSuper??"bg-black":e.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),C=o.inject("measuredMinWidthComment",0);return(x,E)=>{const k=Bt;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",style:o.normalizeStyle({width:`${Number(o.unref(C))+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",x.fixedWidth&&"overflow-hidden",x.superPreviewCustomClass?.overall??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(T,S)=>(o.openBlock(),o.createElementBlock("div",{key:T.id,ref_for:!0,ref_key:"superTextRefs",ref:n,index:S,"book-mark-id":T.id,"line-id":T.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${T.visiblePosition||T.position?.top}px`}),onMouseover:A=>o.unref(h)(A,S),onMouseleave:E[0]||(E[0]=(...A)=>o.unref(g)&&o.unref(g)(...A))},[o.createVNode(o.unref(pb),{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",x.fixedWidth?"whitespace-pre overflow-hidden":"wrap-anywhere whitespace-break-spaces",T.elementId?x.superPreviewCustomClass?.completedSuper??"bg-black":x.superPreviewCustomClass?.unproducedSuper??"bg-red-500",{"cursor-default":!o.unref(f)})),onDblclick:A=>b(T,S)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:c.value}),innerHTML:T.text},null,12,Ete),o.createVNode(k,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",w(T.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,kte))),128)),!o.unref(l)&&a.value&&!x.disableSuperInput?(o.openBlock(),o.createBlock(Uc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:E[1]||(E[1]=T=>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-2bddcb10"]]),vS=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,`
347
347
  `).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},Gb=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Xb=(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)},_te=(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=Ir.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=me.fromArray(s),l=_e.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},Tte=yn(),Hh=t=>{const e=o.computed(()=>Tte.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Rn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),hE(t)&&t.commands.focus()},{immediate:!0})},Ate={id:"editor-container-comment",class:"flex flex-col"},Mte={class:"flex flex-1"},Bte={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},Ote=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:{},lineHeightDefault:{},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:{},transformPaste:{},transformCopy:{},fixedSuperPreviewWidth:{type:Boolean},onBeforeSuperDelete:{}},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=lt.useEventBus(cr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=yn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:h,setEditorContextMenuRef:g,setEditorFocusedInstance:v}=l,b=o.inject("isEditable",o.ref(!0)),w=new Bo({enablePasteRules:!1,enableInputRules:!1,content:cn(r.modelValue,r.disabled),editorProps:{attributes:{id:sr.COMMENT,[sr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:_t.throttle((S,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Lo),transformPastedHTML:S=>{const A=vS(S);return r.transformPaste?r.transformPaste(A):A},clipboardSerializer:{serializeFragment:(S,A,V)=>{const O=hn.fromSchema(w.schema).serializeFragment(S,A,V);if(!r.transformCopy)return O;const F=document.createElement("div");F.appendChild(O.cloneNode(!0));const H=r.transformCopy(F.innerHTML);if(H===F.innerHTML)return O;const Y=document.createElement("template");return Y.innerHTML=H,Y.content},serializeNode:(S,A)=>{const B=hn.fromSchema(w.schema).serializeNode(S,A);if(!r.transformCopy||B.nodeType!==globalThis.Node.ELEMENT_NODE)return B;const O=B,F=r.transformCopy(O.outerHTML);if(F===O.outerHTML)return B;const H=document.createElement("template");return H.innerHTML=F,H.content.firstElementChild??B}},handlePaste:(S,A)=>{const V=A.clipboardData;if(!V)return!1;const B=r.mode,O=V.getData("text/plain")||"",F=Array.from(V.items).some(H=>H.type.startsWith("image/"));return(B===Me.STRAIGHT||B===Me.REPORT)&&F?(A.preventDefault(),!0):B===Me.PLAIN_TEXT?(A.preventDefault(),S.dispatch(S.state.tr.insertText(O,S.state.selection.from)),!0):!1},clipboardTextParser:(S,A)=>{const V=S.split(/(?:\r\n?|\n)/),B=[];V.forEach(F=>{let H={type:"paragraph"};F.length>0&&(H.content=[{type:"text",text:F}]);let Y=Ir.fromJSON(A.doc.type.schema,H);B.push(Y)});const O=me.fromArray(B);return _e.maxOpen(O)}},onCreate:({editor:S})=>{f(S)},onUpdate:_t.throttle(({editor:S})=>{u.value=!0;const A=x(S,r.output);i("update:modelValue",A),i("change",{editor:S,output:A}),f(S),C()},Lo),extensions:r.extensions,editable:b.value,onFocus:S=>{g(E.value),v(S.editor)}});async function C(){await o.nextTick(),s.emit({action:"render"})}function x(S,A){if(!S)return"";if(S.isEmpty)return A==="json"?{}:"";switch(A){case"html":return S.getHTML();case"json":return S.getJSON();case"text":return S.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{document.getElementById(sr.COMMENT)?.setAttribute(sr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>h.languages,()=>{w.commands.checkSpelling()}),o.watch(()=>r.modelValue,S=>{if(!w||_t.isEqual(x(w,r.output),S))return;const{from:A,to:V}=w.state.selection;w.commands.setTextSelection({from:A,to:V}),w.commands.setContent(cn(S,r.disabled),!1),C()},{deep:!0}),o.watch(()=>b.value,S=>{w?.setEditable(S),w?.commands?.setIsEnableSuggestion&&w.commands.setIsEnableSuggestion(S)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:S})=>{i("changed:selection",{editor:S})})}),o.onUnmounted(()=>w?.destroy()),Zu(qu.SAVE,()=>{localStorage.setItem("comment",x(w,"html"))});const E=o.ref(null);function k(S){S===Me.REPORT&&g(E.value)}function T(S){S===Me.REPORT&&v(w)}return o.onMounted(()=>{k(r.mode),T(r.mode)}),o.watch(()=>r.mode,S=>{k(S),T(S)}),o.watch(()=>r.editorContentInstance?.storage[ih]?.enabled,()=>{w.commands.toggleTimeHighlight()}),Hh(w),e({editor:w}),(S,A)=>(o.openBlock(),o.createElementBlock("div",Ate,[o.createElementVNode("div",Mte,[S.isOpenSuperView?(o.openBlock(),o.createBlock(Ste,{key:0,"disable-super-input":S.disableSuperInput,editor:o.unref(w),"super-preview-custom-class":S.superPreviewCustomClass,"fixed-width":S.fixedSuperPreviewWidth},null,8,["disable-super-input","editor","super-preview-custom-class","fixed-width"])):o.createCommentVNode("",!0),o.createElementVNode("div",Bte,[o.createVNode(Mb,{ref_key:"selectContextMenuRef",ref:E,"disable-super-input":S.disableSuperInput,editor:o.unref(w),mode:S.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(Jn),{editor:o.unref(w),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function Ite(t,e,n=!1,r=200){const{height:i}=lt.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 Lte={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,h,g,v,b,w;function C(P){for(var G=P.length,K={0:0},ee=0;ee<G;ee++)P[ee]&&(K[P[ee].charCodeAt(0)]=ee);return K}p=C(s),h=C(a),g=C(l),v=C(u);function x(P){for(var G=P.length,K={},ee,de,Ee=0;Ee<G;Ee++)ee=P[Ee][0].charCodeAt(0),de=P[Ee][1].charCodeAt(0),typeof K[ee]>"u"&&(K[ee]={}),K[ee][de]=P[Ee][2].charCodeAt(0);return K}b=x(c),w=x(f);function E(P){return typeof p[P]<"u"}function k(P){return typeof h[P]<"u"}function T(P){return typeof g[P]<"u"}function S(P){return typeof v[P]<"u"}function A(P){return 44032<=P&&P<=55203}function V(P,G){return w[P]&&w[P][G]?w[P][G]:!1}function B(P,G){return b[P]&&b[P][G]?b[P][G]:!1}var O=function(P,G){if(P===null)throw new Error("Arguments cannot be null");typeof P=="object"&&(P=P.join(""));for(var K=[],ee=P.length,de,Ee,se,ge,J,te=0;te<ee;te++){var oe=[];ge=P.charCodeAt(te),A(ge)?(ge-=i,se=ge%28,Ee=(ge-se)/28%21,de=parseInt((ge-se)/28/21),oe.push(e[de]),typeof n[Ee]=="object"?oe=oe.concat(n[Ee]):oe.push(n[Ee]),se>0&&(typeof r[se]=="object"?oe=oe.concat(r[se]):oe.push(r[se]))):E(ge)?(k(ge)?J=e[h[ge]]:J=r[v[ge]],typeof J=="string"?oe.push(J):oe=oe.concat(J)):T(ge)?(J=n[g[ge]],typeof J=="string"?oe.push(J):oe=oe.concat(J)):oe.push(P.charAt(te)),G?K.push(oe):K=K.concat(oe)}return K},F=function(P){return typeof P!="string"?"":(P=O(P),P.join(""))},H=function(P){typeof P=="string"&&(P=O(P));var G=[],K=P.length,ee,de=0,Ee=-1,se,ge=!1;function J(oe){var ae,fe,Te,Se=0,We,qe="";if(ge=!1,!(Ee+1>oe))for(var Ge=1;;Ge++){if(Ge===1){if(ae=P[Ee+Ge].charCodeAt(0),T(ae))if(Ee+Ge+1<=oe&&T(fe=P[Ee+Ge+1].charCodeAt(0))){G.push(String.fromCharCode(V(ae,fe))),Ee=oe;return}else{G.push(P[Ee+Ge]),Ee=oe;return}else if(!k(ae)){G.push(P[Ee+Ge]),Ee=oe;return}qe=P[Ee+Ge]}else if(Ge===2)if(fe=P[Ee+Ge].charCodeAt(0),k(fe)){ae=B(ae,fe),qe=String.fromCharCode(ae),G.push(qe),Ee=oe;return}else qe=String.fromCharCode((h[ae]*21+g[fe])*28+i);else Ge===3?(Te=P[Ee+Ge].charCodeAt(0),V(fe,Te)?fe=V(fe,Te):Se=Te,qe=String.fromCharCode((h[ae]*21+g[fe])*28+v[Se]+i)):Ge===4?(We=P[Ee+Ge].charCodeAt(0),B(Se,We)?Se=B(Se,We):Se=We,qe=String.fromCharCode((h[ae]*21+g[fe])*28+v[Se]+i)):Ge===5&&(We=P[Ee+Ge].charCodeAt(0),Se=B(Se,We),qe=String.fromCharCode((h[ae]*21+g[fe])*28+v[Se]+i));if(Ee+Ge>=oe){G.push(qe),Ee=oe;return}}}for(var te=0;te<K;te++){if(ee=P[te].charCodeAt(0),!k(ee)&&!T(ee)&&!S(ee)){J(te-1),J(te),de=0;continue}de===0?k(ee)?de=1:T(ee)&&(de=4):de==1?T(ee)?de=2:B(se,ee)?de=5:J(te-1):de==2?S(ee)?de=3:T(ee)?V(se,ee)||(J(te-1),de=4):(J(te-1),de=1):de==3?S(ee)?!ge&&B(se,ee)?ge=!0:(J(te-1),de=1):k(ee)?(J(te-1),de=1):T(ee)&&(J(te-2),de=2):de==4?T(ee)?V(se,ee)?(J(te),de=0):J(te-1):(J(te-1),de=1):de==5&&(T(ee)?(J(te-2),de=2):(J(te-1),de=1)),se=ee}return J(te-1),G.join("")},Y=function(P,G){var K=O(P).join(""),ee=O(G).join("");return K.indexOf(ee)},Q=function(P,G){var K=O(P).join(""),ee=O(G).join(""),de=O(P,!0),Ee=new RegExp(ee,"gi"),se=[],ge;if(!G.length)return[];for(;ge=Ee.exec(K);)se.push(ge.index);function J(oe){for(var ae=0,fe=0;ae<de.length;++ae)if(fe+=de[ae].length,oe<fe)return ae}function te(oe){for(var ae=0,fe=0;ae<de.length;++ae)if(fe+=de[ae].length,oe+ee.length<=fe)return ae}return se.map(function(oe){return[J(oe),te(oe)]})};function U(P){this.string=P,this.disassembled=O(P).join("")}U.prototype.search=function(P){return O(P).join("").indexOf(this.disassembled)};var D=function(P){typeof P=="object"&&(P=P.join(""));var G=P.charCodeAt(P.length-1);if(A(G)){G-=i;var K=G%28;if(K>0)return!0}else if(E(G))return!0;return!1},L=function(P,G){return O(P).pop()===G},j={disassemble:O,d:O,disassembleToString:F,ds:F,assemble:H,a:H,search:Y,rangeSearch:Q,Searcher:U,endsWithConsonant:D,endsWith:L,isHangul:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),A(P)},isComplete:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),A(P)},isConsonant:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),E(P)},isVowel:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),T(P)},isCho:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),k(P)},isJong:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),S(P)},isHangulAll:function(P){if(typeof P!="string")return!1;for(var G=0;G<P.length;G++)if(!A(P.charCodeAt(G)))return!1;return!0},isCompleteAll:function(P){if(typeof P!="string")return!1;for(var G=0;G<P.length;G++)if(!A(P.charCodeAt(G)))return!1;return!0},isConsonantAll:function(P){if(typeof P!="string")return!1;for(var G=0;G<P.length;G++)if(!E(P.charCodeAt(G)))return!1;return!0},isVowelAll:function(P){if(typeof P!="string")return!1;for(var G=0;G<P.length;G++)if(!T(P.charCodeAt(G)))return!1;return!0},isChoAll:function(P){if(typeof P!="string")return!1;for(var G=0;G<P.length;G++)if(!k(P.charCodeAt(G)))return!1;return!0},isJongAll:function(P){if(typeof P!="string")return!1;for(var G=0;G<P.length;G++)if(!S(P.charCodeAt(G)))return!1;return!0}};t.exports=j})()})(Lte);const Jl=new St("searchHighlight");function zh(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 h=p,g=p+i.length-1;if(n.wholeWord){const v=h>0?c[h-1]:"",b=g+1<c.length?c[g+1]:"";if(v&&a(v)||b&&a(b)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+h,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function Yb(t){return t.state.selection.from}function bS(t){if(t.state.plugins.find(r=>r.spec.key===Jl))return;const n=new it({key:Jl,state:{init(){return ut.empty},apply(r,i){const s=r.getMeta(Jl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Jl.getState(r)}}});t.registerPlugin(n)}function yS(t,e,n){bS(t);const r=e.map((a,l)=>jt.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(Jl,i);t.view.dispatch(s)}function Zl(t){bS(t);const e=t.state.tr.setMeta(Jl,ut.empty);t.view.dispatch(e)}function Rte(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){const h=t.value;if(!h||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,yS(h,n.value,e.value);const v=n.value[e.value];h.view.domAtPos(v.from).node?.scrollIntoView?.({block:"nearest",behavior:"smooth"}),h.chain().setTextSelection({from:v.from,to:v.to}).scrollIntoView().run()}function s(p){const h=t.value;if(!h)return;if(n.value=zh(h,p.find,p),n.value.length===0){e.value=-1,Zl(h);return}const g=Yb(h),v=n.value.findIndex(b=>b.from>g);i(v===-1?0:v)}function a(p){const h=t.value;if(!h)return;if(n.value=zh(h,p.find,p),n.value.length===0){e.value=-1,Zl(h);return}const g=Yb(h);let v=-1;for(let b=n.value.length-1;b>=0;b--)if(n.value[b].to<g){v=b;break}i(v===-1?n.value.length-1:v)}function l(p){const h=t.value;if(!h||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:v}=h,b=v.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?b===p.find:b.toLowerCase()===p.find.toLowerCase())){s(p);return}h.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const h=t.value;if(!h)return;const g=zh(h,p.find,p);if(g.length===0)return;const v=h.chain().focus();[...g].reverse().forEach(b=>{v.setTextSelection({from:b.from,to:b.to}).insertContent(p.replace)}),v.run(),n.value=[],e.value=-1,Zl(h)}function c(p){const h=t.value;if(!h)return;if(!p.find){n.value=[],e.value=-1,Zl(h);return}if(n.value=zh(h,p.find,p),n.value.length===0){e.value=-1,Zl(h);return}const g=Yb(h),v=n.value.findIndex(w=>w.from>=g),b=v===-1?0:v;e.value=b,i(b),yS(h,n.value,b)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Zl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const wS={black:[0,0,0],navy:[0,0,128],darkblue:[0,0,139],mediumblue:[0,0,205],darkgreen:[0,100,0],darkcyan:[0,139,139],darkred:[139,0,0],maroon:[128,0,0],purple:[128,0,128],olive:[128,128,0],darkmagenta:[139,0,139],darkviolet:[148,0,211],indigo:[75,0,130],midnightblue:[25,25,112],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkolivegreen:[85,107,47],dimgray:[105,105,105],dimgrey:[105,105,105],saddlebrown:[139,69,19],sienna:[160,82,45],brown:[165,42,42],teal:[0,128,128]},CS=.4,xS=.6;let Uh=null;const Kc=new Map;function Dte(){if(Uh)return Uh;if(typeof document>"u")return null;const t=document.createElement("canvas");return t.width=1,t.height=1,Uh=t.getContext("2d"),Uh}function Pte(t){if(Kc.has(t))return Kc.get(t)??null;const e=Dte();if(!e)return null;e.fillStyle="#000";try{e.fillStyle=t}catch{return Kc.set(t,null),null}const r=e.fillStyle.toLowerCase();if(r==="#000000"&&t.trim().toLowerCase()!=="#000"&&t.trim().toLowerCase()!=="#000000"&&t.trim().toLowerCase()!=="black")return Kc.set(t,null),null;let i=null;const s=r.match(/^#([0-9a-f]{6})$/);if(s)i={r:parseInt(s[1].slice(0,2),16),g:parseInt(s[1].slice(2,4),16),b:parseInt(s[1].slice(4,6),16),a:1};else{const a=r.match(/^rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)(?:\s*,\s*([\d.]+))?\s*\)$/);a&&(i={r:Math.round(parseFloat(a[1])),g:Math.round(parseFloat(a[2])),b:Math.round(parseFloat(a[3])),a:a[4]!==void 0?Math.max(0,Math.min(1,parseFloat(a[4]))):1})}return Kc.set(t,i),i}function Wh(t){if(!t)return null;const e=t.trim().toLowerCase();if(wS[e]){const[i,s,a]=wS[e];return{r:i,g:s,b:a,a:1}}const n=e.match(/^#([0-9a-f]{3,8})$/);if(n){const i=n[1];if(i.length===3)return{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:1};if(i.length===4)return{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:parseInt(i[3]+i[3],16)/255};if(i.length===6)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:1};if(i.length===8)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:parseInt(i.slice(6,8),16)/255}}const r=e.match(/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,\/]+([\d.]+))?/);return r?{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:r[4]!==void 0?Math.max(0,Math.min(1,parseFloat(r[4]))):1}:Pte(e)}function jh(t,e,n){const[r,i,s]=[t/255,e/255,n/255].map(a=>a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4));return .2126*r+.7152*i+.0722*s}function kS(t,e=CS){const n=Wh(t);return n?jh(n.r,n.g,n.b)<e:!1}function ES(t,e=xS){const n=Wh(t);return n?jh(n.r,n.g,n.b)>e:!1}function SS(t,e,n){const r=t/255,i=e/255,s=n/255,a=Math.max(r,i,s),l=Math.min(r,i,s),u=(a+l)/2;if(a===l)return[0,0,u];const c=a-l,f=u>.5?c/(2-a-l):c/(a+l);let p=0;return a===r?p=((i-s)/c+(i<s?6:0))/6:a===i?p=((s-r)/c+2)/6:p=((r-i)/c+4)/6,[p,f,u]}function _S(t,e,n){if(e===0){const a=Math.round(n*255);return[a,a,a]}const r=(a,l,u)=>(u<0&&(u+=1),u>1&&(u-=1),u<1/6?a+(l-a)*6*u:u<1/2?l:u<2/3?a+(l-a)*(2/3-u)*6:a),i=n<.5?n*(1+e):n+e-n*e,s=2*n-i;return[Math.round(r(s,i,t+1/3)*255),Math.round(r(s,i,t)*255),Math.round(r(s,i,t-1/3)*255)]}function TS(t,e,n,r){return r<1?`rgba(${t}, ${e}, ${n}, ${Number(r.toFixed(3))})`:`rgb(${t}, ${e}, ${n})`}function AS(t){const e=Wh(t);if(!e||jh(e.r,e.g,e.b)>=CS)return t;const[r,i,s]=SS(e.r,e.g,e.b),a=s<.5?1-s:s,[l,u,c]=_S(r,i,a);return TS(l,u,c,e.a)}const Vte=.4,Fte=.18;function MS(t){const e=Wh(t);if(!e||jh(e.r,e.g,e.b)<=xS)return t;const[r,i,s]=SS(e.r,e.g,e.b),a=s>.5?1-s:s,l=Math.min(a,Fte),u=i*Vte,[c,f,p]=_S(r,u,l);return TS(c,f,p,e.a)}function $te(t){if(!t)return t;const e=document.createElement("div");return e.innerHTML=t,e.querySelectorAll("[style]").forEach(r=>{const i=r.style.color;i&&kS(i)&&(r.style.color=AS(i));const s=r.style.backgroundColor;s&&ES(s)&&(r.style.backgroundColor=MS(s))}),e.innerHTML}function Hte(t,e,n,r){let i=null;const s=`dco-${Math.random().toString(36).slice(2,8)}`;let a=null,l=null,u=null,c=null;const f=o.ref(!1);function p(k){c===k&&u||(h(),u=new MutationObserver(()=>E()),u.observe(k,{attributes:!0,subtree:!0,attributeFilter:["style"],childList:!0}),c=k)}function h(){u&&(u.disconnect(),u=null),c&&(c.removeAttribute("data-dark-scope"),c=null)}function g(){return!!(e.value||r.value?.closest(".dark")||document.documentElement.classList.contains("dark"))}function v(){f.value=g()}function b(){const k=new Set;return t?.state?.doc&&t.state.doc.descendants(T=>{T.marks.forEach(S=>{S.type.name==="textStyle"&&S.attrs.color&&k.add(S.attrs.color)})}),k}function w(){const k=b(),T=[];return k.forEach(S=>{if(kS(S)){const A=AS(S),V=S.replace(/"/g,'\\"');T.push(`[data-dark-scope="${s}"] span[style*="color: ${V}"] { color: ${A} !important; }`)}}),T.join(`
348
348
  `)}function C(){const k=r.value;if(!k)return"";const T=k.querySelectorAll('[style*="background-color"]'),S=/background-color\s*:\s*([^;"]+?)(?=\s*(?:;|$))/gi,A=new Set,V=[];return T.forEach(B=>{const O=B.getAttribute("style");if(!O)return;let F;S.lastIndex=0;let H=null,Y=null;for(;(F=S.exec(O))!==null;)H=F[0],Y=F[1].trim();if(!H||!Y||!ES(Y))return;const Q=MS(Y);if(Q===Y||A.has(H))return;A.add(H);const U=H.replace(/\\/g,"\\\\").replace(/"/g,'\\"');V.push(`[data-dark-scope="${s}"] [style*="${U}"] { background-color: ${Q} !important; }`)}),V.join(`