vdc-editor 0.1.321 → 0.1.322
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BulkSpellChecker-66KkvZeb.mjs +5 -0
- package/lib/BulkSpellChecker-66KkvZeb.mjs.map +1 -0
- package/lib/{index-D8maE3UU.mjs → index-DqxdaR3T.mjs} +1916 -1931
- package/lib/{index-D8maE3UU.mjs.map → index-DqxdaR3T.mjs.map} +1 -1
- package/lib/src/extensions/Table/table.d.ts +0 -7
- package/lib/style.css +1 -1
- package/lib/vdc-editor.mjs +1 -1
- package/lib/vdc-editor.umd.js +2 -2
- package/lib/vdc-editor.umd.js.map +1 -1
- package/package.json +1 -1
- package/lib/BulkSpellChecker-BcmL5lTW.mjs +0 -5
- package/lib/BulkSpellChecker-BcmL5lTW.mjs.map +0 -1
package/lib/vdc-editor.umd.js
CHANGED
|
@@ -342,8 +342,8 @@ ${c}`:u)}else throw a},onCacheKey:a=>Sz(e,n,a)}}function mW(t){if(Be(t))return t
|
|
|
342
342
|
`});if(!(!T||!S))try{const{data:A}=await an.post(T,{value:S});if(!A.success&&A.code!==_L.NOTHING_TO_CHANGE){x=!0,t[k].wrongWords=[];continue}if(A.data?.wrongWordResponseDto){C=!0,t[k].wrongWords=A.data.wrongWordResponseDto;continue}t[k].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(k=>k.name==="spellchecker")?.options;return{mode:x?.spellcheckHighlightMode??Lo.ERROR_TYPE,color:x?.spellcheckHighlightColor??Ni}}function c(){for(const[C,{editor:x,wrongWords:k}]of Object.entries(t)){if(!x)continue;const{mode:E,color:T}=u(x);hv(x,k,E,T)}}function d(){for(const[C,{editor:x}]of Object.entries(t))x&&iY(x)}async function p(){await s(),c()}let h=!0;function g(C){if(h=C,!!C)for(const[x,{editor:k}]of Object.entries(t))k&&(k.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!1),k.view.dispatch(k.state.tr.setMeta(Rn.IS_ACTIVE_SPELLCHECK,!1)))}function b(){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 v(C,x,k=`
|
|
343
343
|
`){if(!C||!x.length)return;const E=BE(C,k);function T(F){if(F<0&&(F=0),F>=E.length)return C.state.doc.content.size;if(E[F]!=null)return E[F];for(let H=F;H<E.length;H++)if(E[H]!=null)return E[H];for(let H=F-1;H>=0;H--)if(E[H]!=null)return E[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))),hv(C,x)}function w(){for(const[C,{editor:x,wrongWords:k}]of Object.entries(t))x&&v(x,k)}return{editorsState:t,spellCheckStatus:n,countTotalWrongWords:a,allWrongWordsMissSuggestions:l,setEditor:e,resetAllEditorWrongWords:r,disableSpellCheckRealTime:g,resetEnableSpellCheckRealTime:b,applyAllEditorHighlightErrors:c,clearAllEditorHighlightErrors:d,reRunSpellCheckAndHighlight:p,handleRunSpellCheck:s,replaceAllEditorErrors:w}},fZ=o.defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(o.openBlock(),o.createBlock(o.unref(qD),o.normalizeProps(o.guardReactiveProps(e)),{default:o.withCtx(()=>[o.renderSlot(n.$slots,"default")]),_:3},16))}}),pZ={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"},Ek=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:d,applyAllEditorHighlightErrors:p,clearAllEditorHighlightErrors:h,reRunSpellCheckAndHighlight:g,replaceAllEditorErrors:b}=dZ(),v=o.ref(!1),w=o.reactive({x:0,y:0}),C=o.ref(!1),x={x:0,y:0},k=O=>{C.value=!0,x.x=O.clientX-w.x,x.y=O.clientY-w.y,document.addEventListener("mousemove",E),document.addEventListener("mouseup",T)},E=O=>{C.value&&(w.x=O.clientX-x.x,w.y=O.clientY-x.y)},T=()=>{C.value=!1,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",T)};o.onUnmounted(()=>{document.removeEventListener("mousemove",E),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(Io.EDITOR_COMMENT,e.editorComment),a(Io.EDITOR_CONTENT,e.editor)}),o.onUnmounted(()=>{a(Io.EDITOR_COMMENT,null),a(Io.EDITOR_CONTENT,null)}),o.watch(v,async O=>{O?(await o.nextTick(),V(),l(e.isEnableSpellCheckRealTime),await c(),p()):(d(),u(),h())});const B=e.editor?.extensionManager.extensions.find(O=>O.name==="spellchecker")?.options.bulkSpellCheckerButton;return(O,F)=>{const H=Bt,Y=gv,Q=gh,U=mh,D=hh,L=ph,j=AY,P=Vc,G=Pc;return o.openBlock(),o.createBlock(G,{open:o.unref(v)},{default:o.withCtx(()=>[o.createVNode(o.unref(fZ),{"as-child":"",ref_key:"triggerRef",ref:S,onClick:F[0]||(F[0]=K=>v.value=!o.unref(v))},{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",pZ,[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(k,["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=>v.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=>v.value=!1),onRunSpellcheck:o.unref(g),onReplaceAllEditorErrors:F[3]||(F[3]=K=>(o.unref(b)(),v.value=!1))},null,8,["editorsState","spellCheckStatus","allWrongWordsMissSuggestions","onRunSpellcheck"])],4)]),_:1})]),_:1},8,["open"])}}}),hZ=Object.freeze(Object.defineProperty({__proto__:null,default:Ek},Symbol.toStringTag,{value:"Module"})),kk=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}}}}),Ov=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=[nE,N5,tE,Q5,eE.configure({placeholder:"수퍼를 입력하세요"}),kk,oE],u=o.ref(r.spellcheckEnabled),c=o.computed(()=>r.parentEditor?.extensionManager.extensions.find(H=>H.name==="spellchecker")),d=o.computed(()=>xk.configure({proofreader:new kS({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 Oo({enablePasteRules:!1,enableInputRules:!1,content:r.modelValue,extensions:l.concat(d.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:b,measuredMinWidth:v,measure:w}=hf({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",""),k=o.inject("fontWeight",""),E=o.inject("letterSpacing",""),T=o.computed(()=>s?{fontSize:o.unref(C),fontFamily:o.unref(x),fontWeight:o.unref(k),letterSpacing:o.unref(E)}:{}),S=o.computed(()=>s?{paddingLeft:"7px",paddingRight:"7px"}:{width:`${v.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(!v.value||!(b.value instanceof Element)||!A)return;const H=A,Y=p.getText({blockSeparator:`
|
|
344
344
|
`}),Q=getComputedStyle(b.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,(v.value||0)-D);function j(ee,de){let ke=1,se=ee.length,ge=0;for(;ke<=se;){const J=Math.floor((ke+se)/2);U(ee.slice(0,J))<=de?(ge=J,ke=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:Jt(H)}}),{isScrolling:O,handleScroll:F}=Jl();return e({insertSpecialCharater:h,isChecked:u,toggleSpellCheck:g,wrapText:V,editor:p}),(H,Y)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:b,class:o.normalizeClass(o.unref(Ee)("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(Ee)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),mZ={class:"sr-only"},gZ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},bZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},vZ={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"},yZ=["checked"],wZ={for:"spellcheck",class:"select-none whitespace-nowrap"},CZ={class:"flex gap-x-1"},xZ={class:"ml-auto"},EZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},kZ={class:"text-right text-sm p-2"},SZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},Sk=5,Wc=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=ut.useLocalStorage("superInputModalPosition",null),d=o.reactive({x:0,y:0}),p=o.ref(!1),h={x:0,y:0},g=o.ref(!1),b=o.ref(!1),v=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&&(d.x=K.clientX-h.x,d.y=K.clientY-h.y)},x=()=>{p.value=!1,c.value={x:d.x,y:d.y},document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",x)};o.watch(()=>r.open,async K=>{if(!K)return;b.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,ke=window.innerHeight;c.value&&c.value.x!==void 0&&c.value.y!==void 0?(d.x=c.value.x,d.y=c.value.y):(d.x=Math.max((de-ee.offsetWidth)/2,0),d.y=Math.max((ke-ee.offsetHeight)/2,0))},{immediate:!0});const k=()=>{n("close"),s.value="",a.value="",u.value=!1},E=()=>{if(l.value?.editor.commands.hasInvalidChar()){v.value=!0;return}s.value=l.value.wrapText(),a.value="",b.value?g.value=!0:n("close"),n("save",s.value),s.value=""},T=()=>{g.value=!1,n("close")},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=ut.useLocalStorage("recentSpecialChars",[]),Q=ut.useLocalStorage("superInputSpellCheck",!0),U=K=>{if(!K)return;const ee=(Y.value??[]).filter(de=>de!==K);ee.unshift(K),Y.value=ee.slice(0,Sk)},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===""||(b.value=K!==(r.superTextInit??""))});const G=o.computed(()=>l.value?.editor);return(K,ee)=>{const de=gh,ke=mh,se=hh,ge=ph,J=Ek,te=XX,oe=fv,ae=Vc,fe=Pc,Te=qX;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(n1),null,{default:o.withCtx(()=>[o.createVNode(o.unref(l1),{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(${d.x}px, ${d.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(ke,{class:"absolute right-3 top-3 text-white",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(fc),{class:"w-5 h-5"}),o.createElementVNode("span",mZ,o.toDisplayString(K.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(ge),o.createElementVNode("div",gZ,[o.createElementVNode("div",bZ,[ee[5]||(ee[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(Ee)("flex gap-x-6",o.unref(Y).length===Sk&&"gap-x-4"))},[o.createVNode(bn,{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",vZ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref(j),onChange:P},null,40,yZ),o.createElementVNode("label",wZ,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(bn,{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",xZ,[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",EZ,[o.createElementVNode("label",kZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(te,{editor:o.unref(G)},{default:o.withCtx(()=>[o.createVNode(Ov,{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",SZ,[ee[6]||(ee[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(Cs,{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(bn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:E},{default:o.withCtx(()=>[o.createVNode(o.unref(I1),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(o.unref(i)("editor.check")),1)]),_:1}),o.createVNode(bn,{as:"button",variant:"destructive",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(fc),{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:v.value,onClose:ee[4]||(ee[4]=Se=>v.value=!1)},null,8,["open"])],64)}}}),Iv=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:k}=n.editor.state.selection,E=n.editor.state.doc.cut(x,k),S=hn.fromSchema(n.editor.schema).serializeFragment(E.content),A=document.createElement("div");return A.appendChild(S),A.innerHTML}const d=()=>{const{view:x}=n.editor,{from:k,to:E}=x.state.selection,T=c();s.text=T,s.from=k,s.to=E},p=()=>i.value=!i.value,h=()=>{u.value||(i.value=!0,d())},g=()=>i.value=!1,b=x=>{if(Uc(x.trim())){i.value=!1;return}const k=n?.superTextStore.addMoreSuperText(x);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":k,"data-text":x}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},v=o.ref(!1),w=async x=>{if(x){const k=await n.editor.hasClipboard?.();v.value=!!k}},C=()=>{if(u.value||!n.editor)return;const{view:x,state:k}=n.editor,{from:E,to:T}=k.selection;s.from=E,s.to=T,s.text="",x.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:h,closeDialog:g}),(x,k)=>{const E=Wc,T=fh,S=dh,A=ch,V=uh;return x.disabled?o.renderSlot(x.$slots,"default",{key:0}):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(E,{open:i.value,editor:x.editor,"super-text-init":s.text,onClose:p,onSave:b},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:k[0]||(k[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:k[1]||(k[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:!v.value,onSelect:k[2]||(k[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))}}}),_Z={id:"editor-panel",class:"flex relative w-full h-full"},TZ=Xr(o.defineComponent({__name:"PageNode",props:na,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"),d=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"),b=ut.useEventBus(cr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,v=>{b.emit(v.pageNumber)},{immediate:!0}),(v,w)=>{const C=Iv;return o.openBlock(),o.createBlock(o.unref(ta),{id:v.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":v.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":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:d.value?typeof o.unref(h)=="number"?`${o.unref(h)}px`:o.unref(h):"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",_Z,[o.createVNode(C,{mode:c.value?o.unref(Me).REPORT:o.unref(Me).EDITOR,editor:v.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(uC),{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 _k(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 AZ=({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,d=Ah(c,l.node().type.name,l.node().attrs);if(d.id=nv(),d.extend&&(d.extend=!1),s instanceof De&&s.node.isBlock)return!l.parentOffset||!gr(a,l.pos)?!1:(r&&(t&&_k(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:u4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&h?[{type:h,attrs:d}]:void 0,b=gr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&gr(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(b=!0,g=h?[{type:h,attrs:d}]:void 0),b&&(g||(g=[{type:l.node().type,attrs:d}]),e.split(e.mapping.map(l.pos),1,g),h&&!p&&!l.parentOffset&&l.parent.type!==h)){const v=e.mapping.map(l.before()),w=e.doc.resolve(v);l.node(-1).canReplaceWith(w.index(),w.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&_k(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},MZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{const s=vn(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 d=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 v=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)v=me.from(a.node(S).copy(v));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,x=Ah(d,a.node().type.name,a.node().attrs),k=s.contentMatch.defaultType?.createAndFill(x)??void 0;v=v.append(me.from(s.createAndFill(null,k)??void 0));const E=a.before(a.depth-(w-1));e.replace(E,a.after(-C),new _e(v,4-w,0));let T=-1;e.doc.nodesBetween(E,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=Ah(d,c.type.name,c.attrs),g=Ah(d,a.node().type.name,a.node().attrs);h.id=nv(),g.id=nv(),e.delete(a.pos,l.pos);const b=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:v,storedMarks:w}=n,{splittableMarks:C}=i.extensionManager,x=w??(v.$to.parentOffset&&v.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!x||!r)return!0;const k=x.filter(E=>C.includes(E.type.name));e.ensureMarks(k)}return!0},BZ=[th,eh,nh,rv,rh,_s,iv,Wl,av,uv,sv,Ta,jl,Ei,lv,cv,ov,Gr],OZ=Lt.create({priority:200,name:`${Gr}`,content:"block*",group:`${Gr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:ra(TZ),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",{...wt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:AZ,splitListItem:MZ,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:BZ.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:d}=u,p=Ue.atStart(a).from===c;return!l||!p||!d.type.isTextblock||d.textContent.length?!1:r.clearNodes()}),()=>Tk(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 d=li(p=>p.type.name===Gr)(a);if(d){if(!d.node.firstChild)return r.deleteNode(Gr);const p=d.node.firstChild.type;if(d.start+Ue.atStart(d.node).from===c){const g=Le.create(l,d.start-2,d.start-2),b=li(v=>v.type.name===Gr)(g);if(b){const v=Ue.atEnd(b.node).from+b.start,w=Le.create(l,v,v);if(p===b.node.lastChild.type){const{parent:C}=w.$anchor;return iX(C,i.schema)?s.setSelection(w):s.step(new gn(v,c,_e.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>Tk(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=li(d=>d.type.name===Wl)(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=li(d=>d.type.name===Gr)(s);if(c&&c.start+Ue.atEnd(c.node).from===u){const p=Le.create(a,u+2,u+2),h=li(g=>g.type.name===Gr)(p);if(h){const g=Ue.atStart(h.node).from+h.start,b=Le.create(a,g,g);if(li(w=>w.attrs.extend)(b))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 Ah(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 Tk=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=c4(r,{from:n.from,to:n.to},s=>s.type.name===Wl);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()}),Ak={"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"},Mk={"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":"확인"},Ia=QW({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:Ak,ko:Mk}}),IZ=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()}}}),LZ=["data-font"],RZ=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 d=e.editor.extensionManager.extensions.find(h=>h.name==="fontFamily").options;let p=[];return _t.isEmpty(d.fontFamilyList)?p=i:p=d.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 d={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?(q0(e.editor.state,"textStyle").fontFamily??e.editor.getAttributes("paragraph").fontFamily??e.editor.getAttributes("heading").fontFamily)||d.value:s.value||d.value});function u(d){d.value===l.value||d.value===r("editor.fontFamily.default")?(e.editor.chain().focus().unsetFontFamily().run(),s.value=null):(s.value=d.value,e.editor.chain().focus().setFontFamily(d.value).run()),e.editor.commands.setForceCloseBubble(!0)}e.editor.on("selectionUpdate",({editor:d})=>{d.state.selection.empty&&e.editor.commands.resetForceCloseBubble()});const c=o.computed(()=>{const d=a.value[0]?.label||r("editor.fontFamily.default");return a.value.find(p=>p.value===l.value)?.label||d});return(d,p)=>(o.openBlock(),o.createBlock(ba,{disabled:d.disabled,tooltip:d.tooltip,title:c.value,btn_class:`min-w-20 ${d.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(Il),{checked:l.value===h.value,onClick:b=>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,LZ)]),_:2},1032,["checked","onClick"]),h.label===o.unref(r)("editor.fontFamily.default")&&d.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(D1),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),Bk=IZ.extend({name:"fontFamily",addOptions(){return{...this.parent?.(),types:["textStyle"],fontFamilyList:[],button({editor:t,extension:e,t:n}){return{component:RZ,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})=>(f5(n,t),!0)).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().command(({tr:e})=>(f5(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}}),DZ=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}}),PZ={class:"flex gap-2"},VZ=["disabled"],FZ=Xr(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(yg[0])||parseInt(e.value)<parseInt(yg[0]):!1),r=ut.useEventBus(cr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=fa,u=da,c=pa;return o.openBlock(),o.createElementBlock("div",PZ,[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]=d=>i(!0))},[o.createVNode(o.unref(Bt),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(ss),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]=d=>i(!1)),disabled:o.unref(n)},[o.createVNode(o.unref(Bt),{name:"Minus",class:"w-6 h-6"})],8,VZ)]),_:1}),o.createVNode(o.unref(ss),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),$Z=Hn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:FZ,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})}}}),Lv=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 ot({key:new kt("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}}}})]}}),Rv=()=>$r(10),Ok=new kt("attrkey"),HZ=t=>new ot({key:Ok,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=Ok.getState(i);if(n.some(c=>c.getMeta("composition")))return null;if(l||n.some(c=>c.docChanged)){const c=[];i.doc.descendants((d,p,h,g)=>{const{attrs:b}=d,v=c.includes(b.id)?Rv():b.id||Rv();t.includes(d.type.name)&&(s.setNodeMarkup(p,void 0,{...b,id:v,"number-line":g+1}),a=!0),c.push(v)})}return a?s:null}}),Ik=[th,eh,nh,rv,rh,_s,iv,Wl,av,uv,sv,Ta,jl,Ei,lv,cv,ov,Gr],zZ=nt.create({name:"autoId",addGlobalAttributes(){return[{types:Ik.concat(this.options.types||[]),attributes:{id:{default:Rv()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[HZ(Ik.concat(this.options.types||[]))]}}),UZ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,WZ=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",wt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[v4({find:UZ,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),jZ=["src","alt"],qZ={key:0,class:"image-resizer"},KZ=["onMousedown","onTouchstart"],GZ=o.defineComponent({__name:"ImageView",props:{...na,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:pC,height:pC}),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:E,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:E||void 0,alt:T||void 0,style:{width:xg(S)?`${S}px`:S,height:xg(A)?`${A}px`:A,transform:F||"none"}}});o.computed(()=>({width:o.unref(u).style.width==="100%"?"100%":void 0}));const c=o.ref(null),d=new ResizeObserver(E=>{for(const T of E){const{width:S,height:A}=T.contentRect;s.value={width:S,height:A},e.updateAttributes({originWidth:S,originHeight:A})}});function p(){const{editor:E,getPos:T,extension:S,node:A}=e;if(E.isEditable)return E.commands.setNodeSelection(T());S.options.onImageClick?.(A.attrs.src)}const h=_t.throttle(()=>{const{editor:E}=e;i.value.width=parseInt(getComputedStyle(E.view.dom).width,10)},hC);function g(E,T){E.preventDefault(),E.stopPropagation();let S=0,A=0;const V=document.querySelector(".image-resizer");if(V&&(V.style.borderColor="#3b82f6"),"touches"in E&&E.touches.length>0)S=E.touches[0].clientX,A=E.touches[0].clientY;else if("clientX"in E)S=E.clientX,A=E.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 b=_t.throttle(E=>{if(!o.unref(a))return;let T=0;if("touches"in E&&E.touches.length>0)T=E.touches[0].clientX;else if("clientX"in E)T=E.clientX;else return;const{x:S,w:A,dir:V}=o.unref(l),B=(T-S)*(/l/.test(V)?-1:1),O=FL(A+B,AL,o.unref(i).width);e.updateAttributes({width:O})},hC),v=E=>{E.preventDefault(),E.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",b,!0),document.addEventListener("mouseup",v,!0),document.addEventListener("touchmove",b,!0),document.addEventListener("touchend",v,!0)}function C(){document.removeEventListener("mousemove",b,!0),document.removeEventListener("mouseup",v,!0),document.removeEventListener("touchmove",b,!0),document.removeEventListener("touchend",v,!0)}const x=new ResizeObserver(h),k=o.computed(()=>{const{textAlign:E}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[E]||""});return o.onMounted(()=>{c.value&&d.observe(c.value),x.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{C(),d.disconnect(),x.disconnect()}),(E,T)=>(o.openBlock(),o.createBlock(o.unref(ta),{class:"node-image",style:o.normalizeStyle({"pointer-events":o.unref(r)&&t.selected&&E.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},k.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(pf)&&o.unref(pf)(...S))},null,44,jZ),E.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",qZ,[(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(Ee)(`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,KZ))),128))],512)),[[o.vShow,t.selected||a.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1},8,["style"]))}}),XZ=Xr(GZ,[["__scopeId","data-v-7eba98b1"]]),Mh=WZ.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 ra(XZ)},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",wt(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 ot({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"}}})]}}),YZ=["paragraph","heading","list_item","todo_item"];function JZ(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!==mC?e:null;return r.nodesBetween(i,s,(u,c)=>{const d=u.type;return YZ.includes(d.name)?((u.attrs.lineHeight||null)!==l&&a.push({node:u,pos:c,nodeType:d}),d.name!=="list_item"&&d.name!=="todo_item"):!0}),a.length&&a.forEach(u=>{const{node:c,pos:d,nodeType:p}=u;let{attrs:h}=c;h={...h,lineHeight:l},t=t.setNodeMarkup(d,p,h,c.marks)}),t}function ZZ(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:i}=e;return i=i.setSelection(r),i=JZ(i,t),i.docChanged?(n&&n(i),!0):!1}}const QZ=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(d=>d.name==="lineHeight").options.lineHeights.map(d=>({label:n(d),value:d}));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(ba,{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,d)=>(o.openBlock(),o.createBlock(o.unref(Il),{key:d,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"]))}}),Lk=nt.create({name:"lineHeight",addOptions(){return{...this.parent?.(),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:mC,button({editor:t,t:e}){return{component:QZ,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=>ZZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),NZ=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",wt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var La=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(La||{});const Dv=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[NZ.configure(this.options.columnOptions)]}}),eQ={class:"flex gap-x-2 items-center"},tQ={class:"sr-only"},nQ={class:"flex justify-end gap-x-2.5 flex-1"},rQ=["disabled"],Rk=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 d=()=>{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,b)=>{const v=gh,w=mh,C=hh,x=ph,k=fv,E=Vc,T=Pc;return o.openBlock(),o.createBlock(T,{open:g.open},{default:o.withCtx(()=>[o.createVNode(E,{"is-overlay-transparent":"",class:"p-2.5 gap-0 gap-y-2.5 border-none w-[calc(100%-40px)] !shadow-ed rounded-[5px]"},{default:o.withCtx(()=>[o.createVNode(C,{class:"text-left flex-row justify-between"},{default:o.withCtx(()=>[o.createVNode(v,{class:"text-base font-normal"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(g.title?g.title:o.unref(i)("editor.superinput")),1)]),_:1}),o.createElementVNode("div",eQ,[o.withDirectives(o.createElementVNode("button",{onClick:h},[o.createVNode(o.unref(_1),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(w,{class:"outline-none",onClick:d},{default:o.withCtx(()=>[o.createVNode(o.unref(fc),{class:"w-5 h-5"}),o.createElementVNode("span",tQ,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(x,{class:"hidden"}),o.createVNode(Ov,{modelValue:s.value,"onUpdate:modelValue":b[0]||(b[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(k,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:b[1]||(b[1]=S=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",nQ,[o.createElementVNode("button",{onClick:d},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,rQ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-c6e8813c"]]),oQ=["innerHTML"],iQ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],sQ=o.defineComponent({__name:"ConfigPlan",props:na,setup(t){const e=t,n=o.ref(!1),r=o.ref(null),{selection:i,doc:s}=e.editor.state,a=o.inject("isMobile"),l=o.ref(!1),u=ut.useEventBus(cr.RENDER_SUPER_TEXT),c=o.computed(()=>{const x=s.resolve(i.from)?.node(-1),k=x?.attrs?.id,E=x?.attrs?.pageNumber;return{pageId:k,pageNumber:E}}),d=o.computed(()=>{const C=e.getPos(),x=e.editor.state.doc.resolve(C);for(let k=x.depth;k>0;k--){const E=x.node(k);if(E.type.name==="paragraph")return E}return null}),p=o.computed(()=>d.value?.attrs.id||"");function h(C){e.updateAttributes({"data-text":C}),n.value=!1}function g(C){const x=e.node.attrs[Qe.TEXT],k=e.node.attrs[Qe.ID],T={lineId:C.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:x};u.emit({action:"hover",payload:T})}function b(C){const x=e.node.attrs[Qe.ID],E={lineId:C.target.querySelector(`[node-id="${x}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:E})}function v(){const{getPos:C,node:x,editor:k}=e,E=C(),T=E+1;k.commands.deleteRange({from:E,to:T})}function w(){n.value=!0,a&&(l.value=!0)}return(C,x)=>{const k=bn,E=fh,T=dh,S=ch,A=uh,V=Wc;return o.openBlock(),o.createBlock(o.unref(ta),{as:"span",class:o.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":o.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:o.withCtx(()=>[o.createVNode(A,null,{default:o.withCtx(()=>[o.createVNode(E,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(k,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:w,onMouseenter:g,onMouseleave:b},{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,oQ),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,iQ)]),_: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:v},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(Rk,{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:v},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"])}}}),Dk=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",wt(t,{class:"config-plan"})]},addNodeView(){return ra(sQ)},addProseMirrorPlugins(){return[new ot({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 Pv,Vv;if(typeof WeakMap<"u"){let t=new WeakMap;Pv=e=>t.get(e),Vv=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Pv=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Vv=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var qt=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 Pv(t)||Vv(t,aQ(t))}};function aQ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=lQ(t),n=t.childCount,r=[];let i=0,s=null;const a=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const p=t.child(c);d++;for(let b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==p.childCount)break;const v=p.child(b),{colspan:w,rowspan:C,colwidth:x}=v.attrs;for(let k=0;k<C;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:C-k});break}const E=i+k*e;for(let T=0;T<w;T++){r[E+T]==0?r[E+T]=d:(s||(s=[])).push({type:"collision",row:c,pos:d,n:w-T});const S=x&&x[T];if(S){const A=(E+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,d+=v.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}),d++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new qt(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&&uQ(l,a,t),l}function lQ(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 uQ(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 d=(i+c)%t.width,p=e[d*2];p!=null&&(!u.colwidth||u.colwidth[c]!=p)&&((l||(l=cQ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function cQ(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 Ts=new kt("selectingCells");function Ra(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 dQ(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 yo(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 Bh(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=Ra(e.$head)||fQ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function fQ(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 Fv(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function pQ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function $v(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Pk(t,e,n){const r=t.node(-1),i=qt.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 Da(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 Vk(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 hQ(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 Ut=class Pi extends Ue{constructor(e,n=e){const r=e.node(-1),i=qt.get(r),s=e.start(-1),a=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=i.cellsInRect(a).filter(d=>d!=n.pos-s);u.unshift(n.pos-s);const c=u.map(d=>{const p=r.nodeAt(d);if(!p)throw RangeError(`No cell with offset ${d} found`);const h=s+d+1;return new m3(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(Fv(r)&&Fv(i)&&$v(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Pi.rowSelection(r,i):s&&this.isColSelection()?Pi.colSelection(r,i):new Pi(r,i)}return Le.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=qt.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 d=u*n.width+i.left,p=i.left;p<i.right;p++,d++){const h=n.map[d];if(s[h])continue;s[h]=!0;const g=n.findCell(h);let b=e.nodeAt(h);if(!b)throw RangeError(`No cell with offset ${h} found`);const v=i.left-g.left,w=g.right-i.right;if(v>0||w>0){let C=b.attrs;if(v>0&&(C=Da(C,0,v)),w>0&&(C=Da(C,C.colspan-w,w)),g.left<i.left){if(b=b.type.createAndFill(C),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else b=b.type.create(C,b.content)}if(g.top<i.top||g.bottom>i.bottom){const C={...b.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?b=b.type.createAndFill(C):b=b.type.create(C,b.content)}c.push(b)}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=qt.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=qt.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 Pi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=qt.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 Pi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=qt.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 Pi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Pi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Pi(e.resolve(n),e.resolve(r))}getBookmark(){return new mQ(this.$anchorCell.pos,this.$headCell.pos)}};Ut.prototype.visible=!1,Ue.jsonID("cell",Ut);var mQ=class MT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new MT(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&&$v(n,r)?new Ut(n,r):Ue.near(r,1)}};function gQ(t){if(!(t.selection instanceof Ut))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Ft.node(r,r+n.nodeSize,{class:"selectedCell"}))}),st.create(t.doc,e)}function bQ({$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 vQ({$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 yQ(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=Ut.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=Ut.rowSelection(l,l)}else if(!n){const l=qt.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=Ut.create(i,u+1,c)}}else r instanceof Le&&bQ(r)?s=Le.create(i,r.from):r instanceof Le&&vQ(r)&&(s=Le.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var wQ=new kt("fix-tables");function Fk(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,d=Math.min(i,a+3);c<d;c++)if(t.child(c)==u){l=c+1,n+=u.nodeSize;continue e}r(u,n),l<i&&t.child(l).sameMarkup(u)?Fk(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function $k(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&&Fk(e.doc,t.doc,0,r):t.doc.descendants(r),n}function CQ(t,e,n,r){const i=qt.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 d=e.nodeAt(c.pos);if(!d)continue;const p=d.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,Da(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+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 d=e.child(u),p=c+d.nodeSize,h=s[u];if(h>0){let g="cell";d.firstChild&&(g=d.firstChild.type.spec.tableRole);const b=[];for(let w=0;w<h;w++){const C=jn(t.schema)[g].createAndFill();C&&b.push(C)}const v=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(v),b)}c=p}return r.setMeta(wQ,{fixTables:!0})}function Go(t){const e=t.selection,n=Bh(t),r=n.node(-1),i=n.start(-1),s=qt.get(r);return{...e instanceof Ut?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function Hk(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;hQ(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,Vk(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 xQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(Hk(t.tr,n,n.left))}return!0}function EQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(Hk(t.tr,n,n.right))}return!0}function kQ(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),d=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,Da(d,i-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=d.rowspan}}function SQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;kQ(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=qt.get(s)}e(r)}return!0}function _Q(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 zk(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;_Q(e,r,i+u)&&(u=i==0||i==e.height?null:0);for(let c=0,d=e.width*i;c<e.width;c++,d++)if(i>0&&i<e.height&&e.map[d]==e.map[d-e.width]){const p=e.map[d],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[d+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 TQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(zk(t.tr,n,n.top))}return!0}function AQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(zk(t.tr,n,n.bottom))}return!0}function MQ(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,d=i*e.width;c<e.width;c++,d++){const p=e.map[d];if(!u.has(p)){if(u.add(p),i>0&&p==e.map[d-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[d+e.width]){const h=n.nodeAt(p),g=h.attrs,b=h.type.create({...g,rowspan:h.attrs.rowspan-1},h.content),v=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+v),b),c+=g.colspan-1}}}}function BQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;MQ(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=qt.get(n.table)}e(r)}return!0}function Uk(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function OQ({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 Wk(t,e){const n=t.selection;if(!(n instanceof Ut)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Go(t),{map:i}=r;if(OQ(i,r))return!1;if(e){const s=t.tr,a={};let l=me.empty,u,c;for(let d=r.top;d<r.bottom;d++)for(let p=r.left;p<r.right;p++){const h=i.map[d*i.width+p],g=r.table.nodeAt(h);if(!(a[h]||!g))if(a[h]=!0,u==null)u=h,c=g;else{Uk(g)||(l=l.append(g.content));const b=s.mapping.map(h+r.tableStart);s.delete(b,b+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...Vk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const d=u+1+c.content.size,p=Uk(c)?u+1:d;s.replaceWith(p+r.tableStart,d+r.tableStart,l)}s.setSelection(new Ut(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function jk(t,e){const n=jn(t.schema);return IQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function IQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof Ut){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=dQ(i.$from),!s)return!1;a=(r=Ra(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 d=Go(e),p=e.tr;for(let g=0;g<d.right-d.left;g++)u.push(c?{...l,colwidth:c&&c[g]?[c[g]]:null}:l);let h;for(let g=d.top;g<d.bottom;g++){let b=d.map.positionAt(g,d.left,d.table);g==d.top&&(b+=s.nodeSize);for(let v=d.left,w=0;v<d.right;v++,w++)v==d.left&&g==d.top||p.insert(h=p.mapping.map(b+d.tableStart,1),t({node:s,row:g,col:v}).createAndFill(u[w]))}p.setNodeMarkup(a,t({node:s,row:d.top,col:d.left}),u[0]),i instanceof Ut&&p.setSelection(new Ut(p.doc.resolve(i.$anchorCell.pos),h?p.doc.resolve(h):void 0)),n(p)}return!0}}function LQ(t,e){return function(n,r){if(!yo(n))return!1;const i=Bh(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Ut?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 RQ(t){return function(e,n){if(!yo(e))return!1;if(n){const r=jn(e.schema),i=Go(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 qk(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 jc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?RQ(t):function(n,r){if(!yo(n))return!1;if(r){const i=jn(n.schema),s=Go(n),a=n.tr,l=qk("row",s,i),u=qk("column",s,i),d=(t==="column"?l:t==="row"?u:!1)?1:0,p=t=="column"?{left:0,top:d,right:1,bottom:s.map.height}:t=="row"?{left:d,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 b=g+s.tableStart,v=a.doc.nodeAt(b);v&&a.setNodeMarkup(b,h,v.attrs)}),r(a)}return!0}}jc("row",{useDeprecatedLogic:!0}),jc("column",{useDeprecatedLogic:!0});var DQ=jc("cell",{useDeprecatedLogic:!0});function PQ(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 Kk(t){return function(e,n){if(!yo(e))return!1;const r=PQ(Bh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Le.between(i,pQ(i))).scrollIntoView())}return!0}}function VQ(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 Oh(t,e){const n=t.selection;if(!(n instanceof Ut))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 FQ(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 d=u?0:Math.max(0,n-1),p=u<e.childCount-1?0:Math.max(0,r-1);(d||p)&&(c=Hv(jn(a).row,new _e(c,d,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Hv(jn(a).row,new _e(e,n,r)).content:e);else return null;return $Q(a,l)}function $Q(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 Hv(t,e){const n=t.createAndFill();return new r0(n).replace(0,n.content.size,e).doc}function HQ({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 d=s[l]||0,p=0;d<r;p++){let h=u.child(p%u.childCount);d+h.attrs.colspan>r&&(h=h.type.createChecked(Da(h.attrs,h.attrs.colspan,d+h.attrs.colspan-r),h.content)),c.push(h),d+=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 d=0;d<c.childCount;d++){let p=c.child(d);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 zQ(t,e,n,r,i,s,a){const l=t.doc.type.schema,u=jn(l);let c,d;if(i>e.width)for(let p=0,h=0;p<e.height;p++){const g=n.child(p);h+=g.nodeSize;const b=[];let v;g.lastChild==null||g.lastChild.type==u.cell?v=c||(c=u.cell.createAndFill()):v=d||(d=u.header_cell.createAndFill());for(let w=e.width;w<i;w++)b.push(v);t.insert(t.mapping.slice(a).map(h-1+r),b)}if(s>e.height){const p=[];for(let b=0,v=(e.height-1)*e.width;b<Math.max(e.width,i);b++){const w=b>=e.width?!1:n.nodeAt(e.map[v+b]).type==u.header_cell;p.push(w?d||(d=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const h=u.row.create(null,me.from(p)),g=[];for(let b=e.height;b<s;b++)g.push(h);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||d)}function Gk(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 d=a*e.width+c,p=e.map[d];if(e.map[d-e.width]==p){u=!0;const h=n.nodeAt(p),{top:g,left:b}=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,b,n)),h.type.createAndFill({...h.attrs,rowspan:g+h.attrs.rowspan-a})),c+=h.attrs.colspan-1}}return u}function Xk(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 d=c*e.width+a,p=e.map[d];if(e.map[d-1]==p){u=!0;const h=n.nodeAt(p),g=e.colCount(p),b=t.mapping.slice(l).map(p+r);t.setNodeMarkup(b,null,Da(h.attrs,a-g,h.attrs.colspan-(a-g))),t.insert(b+h.nodeSize,h.type.createAndFill(Da(h.attrs,0,a-g))),c+=h.attrs.rowspan-1}}return u}function Yk(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=qt.get(s);const{top:l,left:u}=r,c=u+i.width,d=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=qt.get(s),h=p.mapping.maps.length}zQ(p,a,s,n,c,d,h)&&g(),Gk(p,a,s,n,u,c,l,h)&&g(),Gk(p,a,s,n,u,c,d,h)&&g(),Xk(p,a,s,n,l,d,u,h)&&g(),Xk(p,a,s,n,l,d,c,h)&&g();for(let b=l;b<d;b++){const v=a.positionAt(b,u,s),w=a.positionAt(b,c,s);p.replace(p.mapping.slice(h).map(v+n),p.mapping.slice(h).map(w+n),new _e(i.rows[b-l],0,0))}g(),p.setSelection(new Ut(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(d-1,c-1,s)))),e(p)}var UQ=R0({ArrowLeft:Lh("horiz",-1),ArrowRight:Lh("horiz",1),ArrowUp:Lh("vert",-1),ArrowDown:Lh("vert",1),"Shift-ArrowLeft":Rh("horiz",-1),"Shift-ArrowRight":Rh("horiz",1),"Shift-ArrowUp":Rh("vert",-1),"Shift-ArrowDown":Rh("vert",1),Backspace:Oh,"Mod-Backspace":Oh,Delete:Oh,"Mod-Delete":Oh});function Ih(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Lh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Ut)return Ih(n,r,Ue.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=Jk(i,t,e);if(a==null)return!1;if(t=="horiz")return Ih(n,r,Ue.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=Pk(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),Ih(n,r,c)}}}function Rh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof Ut)a=s;else{const u=Jk(i,t,e);if(u==null)return!1;a=new Ut(n.doc.resolve(u))}const l=Pk(a.$headCell,t,e);return l?Ih(n,r,new Ut(a.$anchorCell,l)):!1}}function WQ(t,e){const n=t.state.doc,r=Ra(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ut(r))),!0):!1}function jQ(t,e,n){if(!yo(t.state))return!1;let r=FQ(n);const i=t.state.selection;if(i instanceof Ut){r||(r={width:1,height:1,rows:[me.from(Hv(jn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=qt.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=HQ(r,l.right-l.left,l.bottom-l.top),Yk(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Bh(t.state),a=s.start(-1);return Yk(t.state,t.dispatch,a,qt.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function qQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=Zk(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Ut)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Ra(t.state.selection.$anchor))!=null&&((n=zv(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let d=zv(t,c);const p=Ts.getState(t.state)==null;if(!d||!$v(u,d))if(p)d=u;else return;const h=new Ut(u,d);if(p||!t.state.selection.eq(h)){const g=t.state.tr.setSelection(h);p&&g.setMeta(Ts,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),Ts.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ts,-1))}function l(u){const c=u,d=Ts.getState(t.state);let p;if(d!=null)p=t.state.doc.resolve(d);else if(Zk(t,c.target)!=r&&(p=zv(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 Jk(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 Zk(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function zv(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Ra(t.state.doc.resolve(n.pos)):null}var KQ=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")),Uv(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,Uv(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Uv(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const d=t.firstChild;if(d){for(let p=0,h=0;p<d.childCount;p++){const{colspan:g,colwidth:b}=d.child(p).attrs;for(let v=0;v<g;v++,h++){const w=i==h?s:b&&b[v],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 kt("tableColumnResizing");function Qk({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=KQ,lastColumnResizable:i=!0}={}){const s=new ot({key:Sr,state:{init(a,l){var u,c;const d=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=jn(l.schema).table.name;return r&&d&&(d[p]=(h,g)=>new r(h,n,g)),new GQ(-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)=>{XQ(a,l,t,i)},mouseleave:a=>{YQ(a)},mousedown:(a,l)=>{JQ(a,l,e,n)}},decorations:a=>{const l=Sr.getState(a);if(l&&l.activeHandle>-1)return tN(a,l.activeHandle)},nodeViews:{}}});return s}var GQ=class Hm{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 Hm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Hm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Fv(e.doc.resolve(i))||(i=-1),new Hm(i,n.dragging)}return n}};function XQ(t,e,n,r){if(!t.editable)return;const i=Sr.getState(t.state);if(i&&!i.dragging){const s=QQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=Nk(t,e,"left",n):u-e.clientX<=n&&(a=Nk(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=qt.get(u),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}tS(t,a)}}}function YQ(t){if(!t.editable)return;const e=Sr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&tS(t,-1)}function JQ(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",d);const h=Sr.getState(t.state);h?.dragging&&(NQ(t,h.activeHandle,eS(h.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Sr,{setDragging:null})))}function d(p){if(!p.which)return c(p);const h=Sr.getState(t.state);if(h&&h.dragging){const g=eS(h.dragging,p,n);nS(t,h.activeHandle,g,r)}}return nS(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",d),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 QQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Nk(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=Ra(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=qt.get(l.node(-1)),c=l.start(-1),d=u.map.indexOf(l.pos-c);return d%u.width==0?-1:c+u.map[d-1]}function eS(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function tS(t,e){t.dispatch(t.state.tr.setMeta(Sr,{setHandle:e}))}function NQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=qt.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 d=c*s.width+l;if(c&&s.map[d]==s.map[d-s.width])continue;const p=s.map[d],h=i.nodeAt(p).attrs,g=h.colspan==1?0:l-s.colCount(p);if(h.colwidth&&h.colwidth[g]==n)continue;const b=h.colwidth?h.colwidth.slice():eN(h.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...h,colwidth:b})}u.docChanged&&t.dispatch(u)}function nS(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=qt.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&&Uv(s,u.firstChild,u,r,l,n)}function eN(t){return Array(t).fill(0)}function tN(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return st.empty;const a=qt.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 d=u+c*a.width;if((u==a.width-1||a.map[d]!=a.map[d+1])&&(c==0||a.map[d]!=a.map[d-a.width])){const p=a.map[d],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(Ft.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(Ft.widget(h,g))}}return st.create(t.doc,r)}function rS({allowTableNodeSelection:t=!1}={}){return new ot({key:Ts,state:{init(){return null},apply(e,n){const r=e.getMeta(Ts);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:gQ,handleDOMEvents:{mousedown:qQ},createSelectionBetween(e){return Ts.getState(e.state)!=null?e.state.selection:null},handleTripleClick:WQ,handleKeyDown:UQ,handlePaste:jQ},appendTransaction(e,n,r){return yQ(r,$k(r,n),t)}})}const nN=(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)},rN=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof Ut)||i.forEachCell((s,a)=>{t=nN(t,a,n)}),t},oS=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=rN(n,e,t),n.docChanged?(i?.(n),!0):!1},oN=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=>oS(t,this.options),unsetTableCellBackground:()=>oS("",this.options)}}}),iN=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",wt(this.options.HTMLAttributes,t),0]}}),sN=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",wt(this.options.HTMLAttributes,t),0]}}).extend({addAttributes(){return{...this.parent?.(),height:{default:null,parseHTML:t=>{const n=t.style?.height||t.getAttribute("data-row-height");if(!n)return null;const r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:null},renderHTML:t=>t.height?{style:`height: ${t.height}px`}:{}}}},addNodeView(){return({node:t,HTMLAttributes:e})=>{const n=document.createElement("tr");for(const[r,i]of Object.entries(e))i!=null&&n.setAttribute(r,String(i));return{dom:n,contentDOM:n,update(r){if(r.type!==t.type)return!1;const i=r.attrs.height;return i&&i>0?n.style.height=`${i}px`:n.style.removeProperty("height"),!0},ignoreMutation(r){if(r.type!=="attributes")return!1;const i=r.target;if(!(r.attributeName==="style"||r.attributeName==="class"))return!1;if(i===n)return!0;if(i.parentNode===n){const a=i.tagName;return a==="TD"||a==="TH"}return!1}}}}}),aN=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",wt(this.options.HTMLAttributes,t),0]}});function Wv(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function iS(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const d=t.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:g,colwidth:b}=d.child(p).attrs;for(let v=0;v<g;v+=1,h+=1){const w=i===h?s:b&&b[v],C=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==C){const[x,k]=Wv(r,w);c.style.setProperty(x,k)}c=c.nextSibling}else{const x=document.createElement("col"),[k,E]=Wv(r,w);x.style.setProperty(k,E),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 lN{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")),iS(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,iS(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function jv(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:b}=l.child(p).attrs;for(let v=0;v<g;v+=1,h+=1){const w=n===h?r:b&&b[v];i+=w||e,w||(s=!1);const[C,x]=Wv(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 sS(t,e){return t.createAndFill()}function uN(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 cN(t,e,n,r,i){const s=uN(t),a=[],l=[];for(let c=0;c<n;c+=1){const d=sS(s.cell);if(d&&l.push(d),r){const p=sS(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 dN(t){return t instanceof Ut}const Dh=({editor:t})=>{const{selection:e}=t.state;if(!dN(e))return!1;let n=0;const r=d4(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},fN=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:lN,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}=jv(t,this.options.cellMinWidth);return["table",wt(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=cN(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})=>xQ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>EQ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>SQ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>TQ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>AQ(t,e),deleteRow:()=>({state:t,dispatch:e})=>BQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>VQ(t,e),mergeCells:()=>({state:t,dispatch:e})=>Wk(t,e),splitCell:()=>({state:t,dispatch:e})=>jk(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>jc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>jc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>DQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Wk(t,e)?!0:jk(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>LQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Kk(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Kk(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&$k(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Ut.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:Dh,"Mod-Backspace":Dh,Delete:Dh,"Mod-Delete":Dh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Qk({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],rS({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt($e(t,"tableRole",e))}}}),Yr=new kt("tableRowResizing");class qc{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=e.getMeta(Yr);if(n&&n.setHandle!=null)return new qc(n.setHandle,null);if(n&&n.setDragging!==void 0)return new qc(this.activeHandle,n.setDragging??null);if(this.activeHandle>-1&&e.docChanged){const r=e.mapping.map(this.activeHandle,-1);return new qc(r,this.dragging)}return this}}function pN({handleWidth:t=5,cellMinHeight:e=24}={}){return new ot({key:Yr,state:{init:()=>new qc(-1,null),apply:(n,r)=>r.apply(n)},props:{attributes(n){const r=Yr.getState(n);return r&&r.activeHandle>-1?{class:"row-resize-cursor"}:{}},handleDOMEvents:{mousemove:(n,r)=>(mN(n,r,t),!1),mouseleave:n=>(gN(n),!1),mousedown:(n,r)=>vN(n,r,e)},decorations(n){const r=Yr.getState(n);return r&&r.activeHandle>-1?xN(n,r.activeHandle):null}}})}function hN(t){let e=t;for(;e&&e.nodeName!=="TD"&&e.nodeName!=="TH";){if(e.nodeType===1&&e.classList?.contains("ProseMirror"))return null;e=e.parentNode}return e??null}function aS(t,e,n,r){const i=n==="bottom"?-r:r,s=t.posAtCoords({left:e.clientX,top:e.clientY+i});if(!s)return-1;const a=Ra(t.state.doc.resolve(s.pos));if(!a)return-1;if(n==="bottom")return a.pos;const l=qt.get(a.node(-1)),u=a.start(-1),c=l.map.indexOf(a.pos-u);return c<l.width?-1:u+l.map[c-l.width]}function mN(t,e,n){if(!t.editable)return;const r=Yr.getState(t.state);if(!r||r.dragging)return;const i=hN(e.target);let s=-1;if(i){const{top:a,bottom:l}=i.getBoundingClientRect();e.clientY-a<=n?s=aS(t,e,"top",n):l-e.clientY<=n&&(s=aS(t,e,"bottom",n))}s!==r.activeHandle&&lS(t,s)}function gN(t){if(!t.editable)return;const e=Yr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&lS(t,-1)}function lS(t,e){t.dispatch(t.state.tr.setMeta(Yr,{setHandle:e}))}function bN(t,e){const r=t.state.doc.resolve(e).parent.attrs.height;if(r&&r>0)return r;const i=t.domAtPos(e);return i.node.childNodes[i.offset]?.parentElement?.offsetHeight??24}function vN(t,e,n){if(!t.editable)return!1;const r=t.dom.ownerDocument.defaultView??window,i=Yr.getState(t.state);if(!i||i.activeHandle===-1||i.dragging)return!1;const s=i.activeHandle,a=bN(t,s),l=yN(t,s);t.dispatch(t.state.tr.setMeta(Yr,{setDragging:{startY:e.clientY,startHeight:a}}));function u(d){r.removeEventListener("mouseup",u),r.removeEventListener("mousemove",c);const p=Yr.getState(t.state);if(wN(l),p?.dragging){const h=uS(p.dragging,d,n);CN(t,p.activeHandle,h),t.dispatch(t.state.tr.setMeta(Yr,{setDragging:null}))}}function c(d){if(!d.buttons)return u(d);const p=Yr.getState(t.state);!p||!p.dragging||cS(l,uS(p.dragging,d,n))}return cS(l,a),r.addEventListener("mouseup",u),r.addEventListener("mousemove",c),e.preventDefault(),!0}function uS(t,e,n){return Math.max(n,t.startHeight+(e.clientY-t.startY))}function yN(t,e){const n=t.domAtPos(e),r=n.node.childNodes[n.offset];let i=null;if(r?.tagName==="TD"||r?.tagName==="TH")i=r.parentElement;else if(r?.tagName==="TR")i=r;else{let a=n.node;for(;a&&a.tagName!=="TR";)a=a.parentNode;i=a??null}const s=i?Array.from(i.children).filter(a=>a.tagName==="TD"||a.tagName==="TH"):[];return{tr:i,cells:s}}function cS({tr:t,cells:e},n){const r=`${n}px`;t&&(t.style.height=r);for(const i of e)i.style.height=r}function wN({tr:t,cells:e}){t&&(t.style.height="");for(const n of e)n.style.height=""}function CN(t,e,n){const r=t.state.doc.resolve(e),i=r.parent;if(i.attrs.height===n)return;const s=r.before(),a=t.state.tr.setNodeMarkup(s,null,{...i.attrs,height:n});t.dispatch(a)}function xN(t,e){const n=t.doc.resolve(e),r=n.node(-1);if(!r)return st.empty;const i=qt.get(r),s=n.start(-1),a=i.map.indexOf(n.pos-s)/i.width|0,l=[];for(let u=0;u<i.width;u++){const c=a*i.width+u;if(u>0&&i.map[c]===i.map[c-1])continue;const d=i.map[c],p=r.nodeAt(d);if(!p)continue;const h=s+d+p.nodeSize-1,g=document.createElement("div");g.className="row-resize-handle",l.push(Ft.widget(h,g))}return st.create(t.doc,l)}function EN(t){const{view:e,tableNode:n,tableEl:r,colgroupEl:i,tbodyEl:s,wrapperEl:a,axis:l,event:u}=t;if(!e.editable)return;u.preventDefault(),u.stopPropagation();const c=e.dom.ownerDocument.defaultView??window;if(a.classList.add("is-resizing"),l==="width"){const d=kN(n,i,t.cellMinWidth),p=u.clientX,h=b=>{if(!b.buttons)return g(b);const v=Ph(d,b.clientX-p,t.cellMinWidth);_N(i,r,v)},g=b=>{c.removeEventListener("mousemove",h),c.removeEventListener("mouseup",g);const v=Ph(d,b.clientX-p,t.cellMinWidth);a.classList.remove("is-resizing"),MN(e,n,v)};c.addEventListener("mousemove",h),c.addEventListener("mouseup",g)}else{const d=SN(n,s,t.cellMinHeight),p=u.clientY,h=b=>{if(!b.buttons)return g(b);const v=Ph(d,b.clientY-p,t.cellMinHeight);TN(s,v)},g=b=>{c.removeEventListener("mousemove",h),c.removeEventListener("mouseup",g);const v=Ph(d,b.clientY-p,t.cellMinHeight);AN(s),a.classList.remove("is-resizing"),BN(e,n,v)};c.addEventListener("mousemove",h),c.addEventListener("mouseup",g)}}function Ph(t,e,n){const r=t.length;if(r===0)return[];const i=e/r;return t.map(s=>Math.max(n,Math.round(s+i)))}function kN(t,e,n){const r=qt.get(t),i=[],s=Array.from(e.children),a=t.firstChild;if(!a)return[];let l=0;for(let u=0;u<a.childCount;u++){const{colspan:c,colwidth:d}=a.child(u).attrs;for(let p=0;p<c;p++,l++){const h=d?.[p];if(h&&h>0)i.push(h);else{const g=s[l]?.getBoundingClientRect().width??0;i.push(Math.max(n,Math.round(g)))}}}for(;i.length<r.width;)i.push(n);return i.slice(0,r.width)}function SN(t,e,n){const r=[],i=Array.from(e.children);for(let s=0;s<t.childCount;s++){const a=t.child(s);if(a.type.name!=="tableRow")continue;const l=a.attrs.height;if(l&&l>0)r.push(l);else{const u=i[s]?.getBoundingClientRect().height??0;r.push(Math.max(n,Math.round(u)))}}return r}function _N(t,e,n){const r=Array.from(t.children);let i=0;for(let s=0;s<n.length;s++){const a=n[s];i+=a;const l=r[s];l&&(l.style.width=`${a}px`,l.style.removeProperty("min-width"))}e.style.width=`${i}px`,e.style.minWidth=""}function TN(t,e){const n=Array.from(t.children);for(let r=0;r<e.length;r++){const i=n[r];i&&(i.style.height=`${e[r]}px`)}}function AN(t){const e=Array.from(t.children);for(const n of e)n.style.height=""}function dS(t,e){let n=-1;return t.state.doc.descendants((r,i)=>n>=0?!1:r===e?(n=i,!1):!0),n}function MN(t,e,n){const r=dS(t,e);if(r<0)return;const i=t.state.doc.nodeAt(r);if(!i)return;const s=qt.get(i),a=r+1,l=t.state.tr,u=new Set;for(let c=0;c<s.height;c++)for(let d=0;d<s.width;d++){const p=s.map[c*s.width+d];if(u.has(p))continue;u.add(p);const h=i.nodeAt(p);if(!h)continue;const g=h.attrs.colspan,b=s.colCount(p),v=[];for(let C=0;C<g;C++)v.push(n[b+C]);const w=h.attrs.colwidth;w&&w.length===v.length&&w.every((C,x)=>C===v[x])||l.setNodeMarkup(a+p,null,{...h.attrs,colwidth:v})}l.docChanged&&t.dispatch(l)}function BN(t,e,n){const r=dS(t,e);if(r<0)return;const i=t.state.doc.nodeAt(r);if(!i)return;const s=r+1,a=t.state.tr;let l=s,u=0;for(let c=0;c<i.childCount;c++){const d=i.child(c);if(d.type.name!=="tableRow"){l+=d.nodeSize;continue}const p=n[u++],h=d.attrs.height;p!=null&&h!==p&&a.setNodeMarkup(l,null,{...d.attrs,height:p}),l+=d.nodeSize}a.docChanged&&t.dispatch(a)}function ON(t){return class{node;cellMinWidth;view;dom;scrollEl;table;colgroup;contentDOM;rightHandle=null;bottomHandle=null;constructor(n,r,i){this.node=n,this.cellMinWidth=r,this.view=i,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.scrollEl=this.dom.appendChild(document.createElement("div")),this.scrollEl.className="tableScroll",this.table=this.scrollEl.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),this.contentDOM=this.table.appendChild(document.createElement("tbody")),this.syncColumns(n),t.allowTableResize&&(this.rightHandle=this.dom.appendChild(this.makeHandle("right")),this.bottomHandle=this.dom.appendChild(this.makeHandle("bottom")))}makeHandle(n){const r=document.createElement("div");return r.className=`table-resize-handle table-resize-handle--${n}`,r.contentEditable="false",r.addEventListener("mousedown",i=>{const s=n==="right"?"width":"height";EN({view:this.view,tableNode:this.node,tableEl:this.table,colgroupEl:this.colgroup,tbodyEl:this.contentDOM,wrapperEl:this.dom,axis:s,event:i,cellMinWidth:this.cellMinWidth,cellMinHeight:t.cellMinHeight})}),r}syncColumns(n){const r=jv(n,this.cellMinWidth);for(;this.colgroup.firstChild;)this.colgroup.removeChild(this.colgroup.firstChild);const i=r.colgroup?r.colgroup.slice(2):[];for(const s of i){const a=document.createElement("col"),l=Array.isArray(s)?s[1]:void 0;l?.style&&a.setAttribute("style",l.style),this.colgroup.appendChild(a)}r.tableWidth?(this.table.style.width=r.tableWidth,this.table.style.minWidth=""):r.tableMinWidth?(this.table.style.width="",this.table.style.minWidth=r.tableMinWidth):(this.table.style.width="",this.table.style.minWidth="")}update(n){return n.type!==this.node.type?!1:(this.node=n,this.syncColumns(n),!0)}ignoreMutation(n){if(n.type!=="attributes")return!1;const r=n.target;return r===this.table||this.colgroup.contains(r)||this.rightHandle?.contains(r)||this.bottomHandle?.contains(r)?!0:r===this.dom?n.attributeName==="class"||n.attributeName==="style":!1}}}const 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,LN=/CrOS/,RN=/android|ipad|playbook|silk/i;function fS(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)&&!LN.test(e)||t.tablet&&RN.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const DN=["disabled"],PN={"content-class":"table-grid-size-editor","content-style":"padding:0"},VN={class:"flex flex-col flex-wrap gap-1 justify-between"},FN=["onMouseover","onMousedown"],$N={class:"text-center text-sm text-zinc-600 mt-2"},HN=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:fS()?uf:lf,cols:fS()?uf:lf}),a=o.reactive({rows:cf,cols:cf});function l(g,b){g===s.rows&&(s.rows=Math.min(g+1,uf)),b===s.cols&&(s.cols=Math.min(b+1,uf)),a.rows=g,a.cols=b}function u(g,b){n("create-table",{rows:g,cols:b,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=lf,s.cols=lf,a.rows=cf,a.cols=cf}const d=o.inject("isMobile",!1),{isOpen:p}=ep({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),h=o.computed(()=>d?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,b)=>(o.openBlock(),o.createBlock(o.unref(gs),o.normalizeProps(o.guardReactiveProps(o.unref(h))),{default:o.withCtx(()=>[o.createVNode(o.unref(Ea),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,DN)]),_:3}),o.createVNode(o.unref(bs),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",PN,[o.createElementVNode("div",VN,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,v=>(o.openBlock(),o.createElementBlock("div",{key:"r"+v,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,w=>(o.openBlock(),o.createElementBlock("div",{key:"c"+w,class:o.normalizeClass([[w<=a.cols&&v<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:C=>l(v,w),onMousedown:C=>u(v,w)},b[0]||(b[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,FN))),128))]))),128))]),o.createElementVNode("div",$N,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),zN={style:{display:"flex"}},UN=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(HN,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",zN,[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"]))}}),qv=fN.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,allowRowResize:!0,cellMinHeight:24,rowHandleWidth:5,allowTableResize:!0,button:({editor:t,t:e})=>({component:UN,componentProps:{icon:"Table",tooltip:e("editor.table.tooltip"),action:()=>{const n=t.storage.table?.isTableEditorOpen??!1;t.commands.toggleTableEditor(!n)}}})}},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=jv(t,this.options.cellMinWidth);return["div",{class:"tableScroll"},["table",wt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]]},addExtensions(){return[sN.configure(this.options.tableRow),iN.configure(this.options.tableHeader),aN.configure(this.options.tableCell),oN.configure(this.options.tableCellBackground)]},addKeyboardShortcuts(){return{...this.parent?.(),Tab:()=>{const{editor:t}=this;return t.isActive("table")?t.commands.goToNextCell()?!0:t.can().addRowAfter()?t.chain().focus().addRowAfter().goToNextCell().run():!0:!1},"Shift-Tab":()=>{const{editor:t}=this;return t.isActive("table")?(t.commands.goToPreviousCell(),!0):!1}}},addProseMirrorPlugins(){const{onTableClick:t,resizable:e,handleWidth:n,cellMinWidth:r,lastColumnResizable:i,allowTableNodeSelection:s,allowRowResize:a,cellMinHeight:l,rowHandleWidth:u,allowTableResize:c}=this.options,d=this.editor.isEditable,p=ON({cellMinHeight:l,allowTableResize:c&&d}),h=[];return e&&d&&h.push(Qk({handleWidth:n,cellMinWidth:r,defaultCellMinWidth:r,View:p,lastColumnResizable:i})),a&&d&&h.push(pN({handleWidth:u,cellMinHeight:l})),h.push(rS({allowTableNodeSelection:s})),[...h,new ot({props:{handleClick:(g,b,v)=>{if(g.editable||!t)return!1;const{state:w}=g,C=w.doc.resolve(b);for(let x=C.depth;x>0;x--)if(C.node(x).type.name==="table"){const E=g.nodeDOM(C.before(x));if(E)return t(E.outerHTML),!0}return!1}}})]}}),WN={class:"flex items-center gap-2 px-2"},jN=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(ba,{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(Il),{key:u,class:"cursor-pointer",checked:l.isActive?.()||!1,onClick:l.action},{default:o.withCtx(()=>[o.createElementVNode("div",WN,[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"]))}}),qN=nt.create({name:"text-bubble",addOptions(){return{...this.parent?.(),toolbar:!1,button:()=>({component:jN,componentProps:{}})}}}),KN=[{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}년"}],pS=t=>{const e=[...t||[],...KN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},GN=nt.create({name:ah,addOptions(){return{additionalTimeWords:[],enabled:!0}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null,enabled:this.options.enabled}},addProseMirrorPlugins(){return[new ot({props:{decorations:t=>{if(!this.storage.enabled)return st.empty;const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=pS(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(Ft.inline(a,l,{class:"time-highlight"}))}}),st.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[ah];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Kv(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}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==="CLIPBOARD_STATE"&&t(!!r.data?.hasClipboard)},Kv({type:"REQUEST_CLIPBOARD_STATE"})})}function YN(){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)},Kv({type:"PASTE"})})}function JN(t,e){Kv({type:"COPY",data:{html:t,text:e}})}async function ZN(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 QN(){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 NN=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
|
-
`);t.storage.deviceEnv.isMobile?JN(u,c):await ZN(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 YN():await QN();if(!e)return;const n=new DataTransfer;if(tZ(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 XN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),eee=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)}}}),Vh=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(EF),o.normalizeProps(o.guardReactiveProps(o.unref(i))),{default:o.withCtx(()=>[o.renderSlot(s.$slots,"default")]),_:3},16))}}),tee={class:"truncate"},Xl=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(_F),o.mergeProps(o.unref(r),{class:o.unref(Ee)("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",tee,[o.renderSlot(i.$slots,"default")])]),_:3},16,["class"]))}}),Fh=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(kF),o.mergeProps(n.value,{class:o.unref(Ee)("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"]))}}),$h=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(SF),o.mergeProps({class:o.unref(Ee)("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"]))}}),nee={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"},ree={key:0,class:"flex justify-center items-center gap-3 text-s"},oee={key:1,class:"flex justify-between items-center w-full"},iee={class:"flex justify-center items-center gap-3"},see={class:"text-sm"},aee={class:"flex items-center gap-2"},lee=o.defineComponent({__name:"VideoUploader",props:{...na},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=Pt();function l(p){i.value=!0;const h=p.target,g=Array.from(h?.files||[]),b=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload")?.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof b?.upload!="function")return;const v=g[0];b.upload(v).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 d(){s.value?.click()}return(p,h)=>(o.openBlock(),o.createBlock(o.unref(ta),{as:"div","data-drag-handle":"",class:o.normalizeClass(o.unref(Ee)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(gs),{"default-open":o.unref(n)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ea),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",nee,[i.value?(o.openBlock(),o.createElementBlock("div",ree,[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",oee,[o.createElementVNode("div",iee,[o.createVNode(o.unref(Bt),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",see,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(bs),{"trap-focus":"",class:"w-full","on-open-auto-focus":g=>g.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Vh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Fh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Xl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Xl),{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($h),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(bn),{class:"w-full mt-1",size:"sm",disabled:i.value,onClick:d},{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($h),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",aee,[o.createVNode(o.unref(Cs),{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(bn),{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"]))}}),hS=Lt.create({name:Lc,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 ra(lee)},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 uee(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 cee(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 mS=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:df["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?uee(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:Jt(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: ${Jt(n)};`;return cee(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)}}}),Yl=new kt("upload-image"),dee=()=>new ot({key:Yl,state:{init(){return st.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Yl);if(n?.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=fee(a);return Ft.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 fee(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 pee(t,e){const r=Yl.getState(t).find(void 0,void 0,i=>i.id===e);return r.length?r[0]?.from:null}const gS=({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(Yl,{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),d=pee(r.state,l);if(d===null)return;const{schema:p}=r.state,h=typeof c=="object"?u:c,g=p.nodes.image?.create({src:h}),b=p.nodes.paragraph?.create();if(!g||!b)return;r.dispatch(r.state.tr.replaceWith(d,d,g).insert(d+g.nodeSize,b).setMeta(Yl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Yl,{remove:[l]}))}})))},hee=(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},mee=(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},gee={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"},bee={class:"flex items-center justify-between w-full"},vee={class:"flex items-center justify-center gap-3"},yee={class:"text-sm"},wee={class:"flex items-center gap-2"},Cee=o.defineComponent({__name:"ImageUploader",props:{...na},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Pt(),s=o.inject("isEditable",o.ref(!0));function a(d){const p=d?.target?.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const h=Array.from(p),g=e.editor.extensionManager.extensions.find(v=>v.name==="imageUpload")?.options;gS({validateFn:v=>!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(d,p)=>(o.openBlock(),o.createBlock(o.unref(ta),{id:d.node.attrs.id,"data-drag-handle":"",class:o.normalizeClass(o.unref(Ee)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(gs),{"default-open":o.unref(s)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ea),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",gee,[o.createElementVNode("div",bee,[o.createElementVNode("div",vee,[o.createVNode(o.unref(Bt),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",yee,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(bs),{"trap-focus":"",class:"w-full","on-open-auto-focus":h=>h.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Vh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Fh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Xl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Xl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref($h),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(bn),{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($h),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",wee,[o.createVNode(o.unref(Cs),{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(bn),{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"]))}}),xee=1,Eee=1e6,Si={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Gv=0;function kee(){return Gv=(Gv+1)%Number.MAX_VALUE,Gv.toString()}const Xv=new Map;function bS(t){if(Xv.has(t))return;const e=setTimeout(()=>{Xv.delete(t),Kc({type:Si.REMOVE_TOAST,toastId:t})},Eee);Xv.set(t,e)}const wo=o.ref({toasts:[]});function Kc(t){switch(t.type){case Si.ADD_TOAST:wo.value.toasts=[t.toast,...wo.value.toasts].slice(0,xee);break;case Si.UPDATE_TOAST:wo.value.toasts=wo.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Si.DISMISS_TOAST:{const{toastId:e}=t;e?bS(e):wo.value.toasts.forEach(n=>{bS(n.id)}),wo.value.toasts=wo.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Si.REMOVE_TOAST:t.toastId===void 0?wo.value.toasts=[]:wo.value.toasts=wo.value.toasts.filter(e=>e.id!==t.toastId);break}}function Yv(){return{toasts:o.computed(()=>wo.value.toasts),toast:See,dismiss:t=>Kc({type:Si.DISMISS_TOAST,toastId:t})}}function See(t){const e=kee(),n=i=>Kc({type:Si.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>Kc({type:Si.DISMISS_TOAST,toastId:e});return Kc({type:Si.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const _ee={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},Tee=t=>`${(t/1024/1024).toFixed(2)}MB`,vS=Lt.create({name:Ei,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 ra(Cee)},addOptions(){return{..._ee,...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}=Yv(),e=Ia.global.t,r=gS({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${Tee(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new ot({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:hee(i,s,r),handleDrop:(i,s,a,l)=>!(s instanceof DragEvent)||!s.dataTransfer||!Array.from(s.dataTransfer.files||[]).some(d=>this.options.acceptMimes.includes(d.type))?!1:mee(i,s,l,r)}}),dee()]}}),Aee=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}`}}}}}]}}),Mee=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:b4},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,b=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+h+p.value.slice(b);const v=g+h.length;p.setSelectionRange(v,v),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const d=(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:b}=g,{from:v}=b.state.selection;g.commands.insertContentAt(v,p),g.commands.focus()}}};return(p,h)=>{const g=fa,b=ss,v=da,w=pa;return o.openBlock(),o.createBlock(w,null,{default:o.withCtx(()=>[o.createVNode(v,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(g,null,{default:o.withCtx(()=>[o.createVNode(bn,{class:"text-[#65558F] hover:bg-[#ECE6F0]/90 text-xs rounded-none font-normal h-[26px] px-3 border border-gray-300 bg-ed-gray-50 dark:bg-black dark:text-white dark:hover:bg-gray-700 transition-all",onPointerdown:l,onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),o.createVNode(b,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.unref(s)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(i).component),o.mergeProps({key:0},o.unref(i).props,{"custom-class":"!z-[70] !pointer-events-auto",onClose:h[0]||(h[0]=C=>s.value=!1),onSelectedChar:d}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),Bee=nt.create({name:lh,addOptions(){return{button:({editor:t})=>({component:Mee,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),yS=nt.create({name:"base-kit",addOptions(){return{...this.parent?.(),timeHighlighter:{additionalTimeWords:[]},bubble:{list:OL,defaultBubbleList:yG,button:({editor:t,extension:e,t:n})=>{const{list:r={},defaultBubbleList:i}=e.options?.bubble??{},s=i?.(t)??[];return wG(r,s,{editor:t,extension:e,t:n})}}}},addExtensions(){const t=Ia.global.t,e=[];this.options.placeholder!==!1&&e.push(eE.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(aG.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(rE.configure().extend({content:"page+"})),e.push(OZ.configure({types:this.options.page?.nodesComputedOption?.types??[],slots:o.useSlots()}))):e.push(rE.configure())),this.options.dropcursor!==!1&&e.push(sG.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(rG.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(N5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(Q5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(gG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(bG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(vS.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(mS.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(hS.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(Wb.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(Bk.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(p5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(DZ.configure(this.options.fontWeight)),this.options.mode!==Me.EDITOR&&e.push(Bee.configure(this.options.specialCharacter)),this.options.mode!==Me.EDITOR&&e.push($Z),this.options.superText!==!1&&this.options.mode!==Me.PLAIN_TEXT&&this.options.mode!==Me.EDITOR&&(typeof this.options.superText=="boolean"?e.push(gk.configure()):e.push(gk.configure(this.options.superText))),this.options.mode===Me.EDITOR&&(this.options.image!==!1&&e.push(Mh.configure(typeof this.options.image=="object"?this.options.image:{})),e.push(n8.configure({spacer:!0}),S6,k6,_6,Hb,qv.configure(this.options.table!==!1?this.options.table:{}),T6,w5.configure({spacer:!0}),r8.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),Lk)),this.options.mode!==Me.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Me.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(Dk.configure()):e.push(Dk.configure({specialCharModal:this.options.configPlan?.specialCharModal}))),this.options.mode!==Me.EDITOR&&this.options.mode!==Me.PLAIN_TEXT&&e.push(zZ),(this.options.mode===Me.STRAIGHT||this.options.mode===Me.REPORT||this.options.mode===Me.EDITOR)&&this.options.timeHighlighter&&e.push(GN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(kk.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(Aee),e.push(oE,tE.configure(),qN.configure(),mG.configure(),Dv,Lv,gb,NN,eee.configure(this.options.deviceEnv),C5.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}}}),wS=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",wt(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",wt(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(wS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(CS.configure(this.options.superscript)),t}}),Iee={class:"ml-1"},Lee=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(ba,{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(Il),{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(e8),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(BC)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),Ree=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=kg(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:Lee,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(wS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(CS.configure(this.options.superscript)),t}});var Pa=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(Pa||{});function Dee(t,e,n){return t<e?e:t>n?n:t}function Pee(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 d=u.type;return n.includes(d.name)?(t=Vee(t,c,e),!1):!J0(u.type.name,r.extensionManager.extensions)}),t}function Vee(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=Dee((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 xS({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=Pee(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const Fee=nt.create({name:"indent",addOptions(){return{...this.parent?.(),types:["paragraph","heading","blockquote"],minIndent:Pa.min,maxIndent:Pa.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>=Pa.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<=Pa.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:()=>xS({delta:Pa.more,types:this.options.types}),outdent:()=>xS({delta:Pa.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function $ee(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=zO(n),d=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"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const v=l.pos-b.length,w=Array.from(b.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 k=v+w.index;let E=k+w[0].length;return u&&d.test(b.slice(E-1,E+1))&&(w[0]+=" ",E+=1),k<l.pos&&E>=l.pos?{range:{from:k,to:E},query:w[0].slice(n.length),text:w[0]}:null}const Hee=new kt("suggestion");function zee({pluginKey:t=Hee,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:d=()=>[],render:p=()=>({}),allow:h=()=>!0,findSuggestionMatch:g=$ee}){let b;const v=p?.(),w=new ot({key:t,view(){return{update:async(C,x)=>{var k,E,T,S,A,V,B;const O=(k=this.key)===null||k===void 0?void 0:k.getState(x),F=(E=this.key)===null||E===void 0?void 0:E.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}"]`);b={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=v?.onBeforeStart)===null||T===void 0||T.call(v,b)),L&&((S=v?.onBeforeUpdate)===null||S===void 0||S.call(v,b)),(L||D)&&(b.items=await d({editor:e,query:P.query})),j&&((A=v?.onExit)===null||A===void 0||A.call(v,b)),L&&((V=v?.onUpdate)===null||V===void 0||V.call(v,b)),D&&((B=v?.onStart)===null||B===void 0||B.call(v,b))},destroy:()=>{var C;b&&((C=v?.onExit)===null||C===void 0||C.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,x,k,E){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:E,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 k;const{active:E,range:T}=w.getState(C.state);return E&&((k=v?.onKeyDown)===null||k===void 0?void 0:k.call(v,{view:C,event:x,range:T}))||!1},decorations(C){const{active:x,range:k,decorationId:E}=w.getState(C);return x?st.create(C.doc,[Ft.inline(k.from,k.to,{nodeName:l,class:u,"data-decoration-id":E})]):null}}});return w}const Uee=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],Wee=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],jee=[{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"}],qee=[{label:"CodePen",value:"codepen",icon:"Codepen"}],Kee=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],Gee=[],Xee=[...Uee,...Wee,...jee,...qee,...Kee,...Gee];function Yee(t){const e=Ia.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(kg(t,"iframes")){const i=Xee;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 Jee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},Zee={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"},Qee=["onClick"],Nee=["src"],ete={key:1,class:"p-3"},tte={class:"text-xs text-gray-800 dark:text-gray-400"},nte=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 v=r.value*1e3+n.value,w=a.value[v];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:v}){return v.key==="ArrowUp"?(c(),!0):v.key==="ArrowDown"?(d(),!0):v.key==="Enter"?(p(),!0):!1}function c(){if(!l.items.length)return!1;let v=n.value-1,w=r.value;v<0&&(w=r.value-1,v=l.items[w]?.commands.length-1||0),w<0&&(w=l.items.length-1,v=l.items[w].commands.length-1),n.value=v,r.value=w}function d(){if(!l.items.length)return!1;const v=l.items[r.value].commands;let w=n.value+1,C=r.value;v.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(v,w){const C=l.items[v].commands[w];l.command(C)}function g(v,w){h(v,w)}function b(v,w,C){a.value[v*1e3+w]=C}return(v,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"},[v.items?.length?(o.openBlock(),o.createElementBlock("div",Jee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.items,(C,x)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:C.title},[o.createElementVNode("div",Zee,o.toDisplayString(C.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(C.commands,(k,E)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:T=>b(x,E,T),key:E,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===E?"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,E)},[k.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:k.iconUrl},null,8,Nee)):o.createCommentVNode("",!0),k.iconName?(o.openBlock(),o.createBlock(o.unref(Bt),{key:1,name:k.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(k.label),1)],10,Qee))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",ete,[o.createElementVNode("span",tte,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512))}}),Va="slashCommand";let Xo;const rte=nt.create({name:Va,priority:200,onCreate(){Xo=ea("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[zee({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new kt(Va),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})=>Yee(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()),d=l.match(u),p=c.some(h=>h.match(u));return d||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 cC(nte,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Va].rect;const s=n.clientRect();if(!s)return n.editor.storage[Va].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=()=>{Xo?.[0].setProps({getReferenceClientRect:i})},r.dom.parentElement?.addEventListener("scroll",e),t.element&&Xo?.[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element}),Xo?.[0].show()},onUpdate(n){t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Va].rect;const a=n.clientRect();return a?new DOMRect(a.x,a.y,a.width,a.height):n.editor.storage[Va].rect},s=()=>{Xo?.[0].setProps({getReferenceClientRect:i})};r.dom.parentElement?.addEventListener("scroll",s),n.editor.storage[Va].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Xo?.[0].setProps({getReferenceClientRect:i})},onKeyDown(n){return n.event.key==="Escape"?(Xo?.[0].hide(),!0):(Xo?.[0].state.isShown||Xo?.[0].show(),t.ref?.onKeyDown(n))},onExit(n){if(Xo?.[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}}}}),ote=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}=Yv();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"]))}}),ite=Lt.create({name:"AI",group:"block",addOptions(){return{...this.parent?.(),toolbar:!1,button:({editor:t,t:e})=>({component:ote,componentProps:{icon:"Sparkles",tooltip:e("editor.AI.ask")}})}}});function ste(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 ate(t,e){return new File([t],e,{type:t.type})}const lte=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}=Yv(),r=Ia.global.t;async function i(u){const d=new DOMParser().parseFromString(u,"text/html"),p=d.querySelectorAll("img");if(!p.length)return d.body.innerHTML;if(kg(e,"image")){const g=e.extensionManager.extensions.find(b=>b.name==="importWord")?.options;if(g&&typeof g.upload=="function"){const b=[];for(const w of p){const C=w.getAttribute("src"),x=ste(C,"image/jpeg"),k=ate(x,"image.jpeg");b.push(k)}const v=await g.upload(b);for(let w=0;w<p.length;w++){const C=p[w];C.setAttribute("src",v[w].src);const x=C.parentElement;x?.tagName==="P"&&(x.insertAdjacentElement("beforebegin",C),!x.hasChildNodes()&&x.textContent===""&&x.remove())}return d.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),d.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),d.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}=ut.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 d=await this.options.convert(c);s(d)}else{const d=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});d.append("config",p),d.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:d}).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}}}}),Jv=yn(),ute=nt.create({name:"preview",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ye,componentProps:{icon:"Eye",action:()=>{Jv.togglePreview()},tooltip:t("editor.preview.tooltip"),isActive:()=>Jv.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Jv.togglePreview(),!0)}}}),ES=yn(),cte=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function dte(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:st.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:d}=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:d+h.index,to:d+h.index+h[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],d=u===r?`${n} ${n}-current`:n,p=Ft.inline(c.from,c.to,{class:d});i.push(p)}return{decorationsToReturn:st.create(t,i),results:s}}const fte=(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))},pte=(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]},hte=(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=pte(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},mte=new kt("findAndReplacePlugin"),gte=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:()=>{ES.toggleFindAndReplace()},isActive:()=>ES.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 fte(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return hte(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 ot({key:mte,state:{init:()=>st.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:d,caseSensitive:p,lastCaseSensitive:h,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&d===c&&h===p&&b===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],st.empty;const{decorationsToReturn:v,results:w}=dte(a,cte(c,n,p),e,g);return t.storage.findAndReplace.results=w,v}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:bte,state:vte}=yn(),yte=nt.create({name:"printer",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ye,componentProps:{tooltip:t("editor.printer.tooltip"),action:()=>bte(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>vte.printer}})}}}),wte=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 an.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 kS{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(wte.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Cte=Object.freeze(Object.defineProperty({__proto__:null,AI:ite,BaseKit:yS,Blockquote:mK,Bold:k6,BulletList:sK,Clear:gb,Code:G$,CodeBlock:cz,Color:w5,Columns:Dv,FindAndReplace:gte,FontFamily:Bk,FontSize:p5,FormatPainter:Lv,Fullscreen:nG,Heading:n8,Highlight:tK,History:Wb,HorizontalRule:qK,Image:Mh,ImageUpload:vS,ImportWord:lte,Indent:Fee,Italic:S6,LineHeight:Lk,Link:Hb,MoreMark:Ree,OrderedList:cK,Preview:ute,Printer:yte,Proofreader:kS,SlashCommand:rte,SpellcheckerExtension:xk,Strike:T6,SubAndSuperScript:Oee,Table:qv,TaskList:pK,TextAlign:r8,Underline:_6,Video:mS,VideoUpload:hS},Symbol.toStringTag,{value:"Module"})),xte='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend=""false""><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend=""false"">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=""false""><strong>소개(국문)</strong></h1><p id="0qei01hl" extend=""false"">마이마이 에디터는 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 Ete(){const t=window.localStorage.getItem("content"),e=o.ref(t||xte),n=o.computed(()=>[yS.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),Wb,Dv,Lv,gb,Hb,Mh,qv]),r=ut.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 kte(){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,d=r.isEmpty;if(!t.value){if(d&&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 Jl(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 Ste(){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"),d=Array.from(document.querySelectorAll('[contenteditable="true"].tiptap:not(.simple-editor)'));return{popupInsideToolbars:l,toolBarFormat:u,toolBarImage:c,tiptapEditors:d}}function r(l){if(!l)return!1;const{popupInsideToolbars:u,toolBarFormat:c,toolBarImage:d,tiptapEditors:p}=n();return u.some(h=>h.contains(l))||(c?.contains(l)??!1)||(d?.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 ut.useEventListener(document,"mousedown",i,{capture:!0}),ut.useEventListener(document,"touchstart",i,{capture:!0}),ut.useEventListener(document,"focusin",s),ut.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}function Gc(){try{const{locale:t}=Pt();o.watch(t,e=>{const n=String(e);n&&Ia.global.locale.value!==n&&(Ia.global.locale.value=n)},{immediate:!0})}catch{}}const _te={key:0,class:"p-2.5 space-y-1.5"},Tte=["innerHTML"],Ate={key:1,class:"p-2.5 space-y-1.5"},Mte=["innerHTML"],Bte={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;Gc();const n=o.computed(()=>{const x=e.extensions?.filter(k=>k.name!=="spellchecker")||[];return x.some(k=>k.name==="image")||x.push(Mh.configure()),x}),r=o.computed(()=>oa(e.comment)),i=o.computed(()=>oa(e.commentCuesheet)),s=o.computed(()=>oa(e.content));function a(x){return wg(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):""),d=o.ref(),p=o.ref(),h=o.ref();o.onBeforeUnmount(()=>{d.value&&d.value.destroy(),p.value&&p.value.destroy(),h.value&&h.value.destroy()});function g(x){return new Oo({extensions:n.value,content:x,editable:!1,parseOptions:{preserveWhitespace:"full"}})}o.onMounted(async()=>{!r.value&&e.comment&&(d.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 b(x,k){if(!x)return;const E=cn(k,!0,e.mode);_t.isEqual(x.getHTML(),E)||x.commands.setContent(E,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,x=>{r.value||b(d.value,x)}),o.watch(()=>e.commentCuesheet,x=>{i.value||b(p.value,x)}),o.watch(()=>e.content,x=>{s.value||b(h.value,x)});const v=o.computed(()=>e.fontSize??""),{contentInner:w,measuredMinWidth:C}=hf({minChars:e.minChars,fontSize:v});return(x,k)=>{const E=l7;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",_te,[x.fieldNameComment?.label?(o.openBlock(),o.createBlock(E,{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,Tte)):o.unref(d)?(o.openBlock(),o.createBlock(o.unref(Jn),{key:2,editor:o.unref(d)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),x.commentCuesheet&&!x.hideComment?(o.openBlock(),o.createElementBlock("div",Ate,[x.fieldNameCommentCuesheet?.label?(o.openBlock(),o.createBlock(E,{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,Mte)):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",Bte,[x.fieldNameContent?.label?(o.openBlock(),o.createBlock(E,{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"]]),Co=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(mF),o.mergeProps(n.value,{class:o.unref(Ee)("shrink-0 bg-ed-separator",e.orientation==="vertical"?"w-px h-full":"h-px w-full",e.class)}),null,16,["class"]))}}),Lte={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-1.5"},Rte={class:"flex-1 flex justify-end items-center gap-x-3"},Dte=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(()=>hZ)),{t:n}=Pt(),r=t,i=o.inject("isEditable",o.ref(!0)),s=[oh,ih,lh,sh,ki,Dc],a=o.computed(()=>{const d=[...r.editor.extensionManager.extensions],p={[ki]:-1},h={[oh]:1,[ih]:2,[lh]:3,[sh]:4,[ki]:5,[Dc]:6},g=r.toolbarExtensionOrder??(r.mode===Me.EDITOR?p:h),b=yk(d,g);let v=[];for(const w of b){const{button:C,divider:x=!1,spacer:k=!1,toolbar:E=!0}=w.options;if(!C||!Eg(C)||!E)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?k:!1}));v=[...v,...S];continue}v.push({button:T,divider:x,spacer:k,id:`${w.name}`})}if(r.mode!==Me.EDITOR)return v.filter(w=>w.id&&s.includes(w.id));if(v=v.filter(w=>w.id!=="superText"),!i.value){v=v.map(C=>(C.button.componentProps.disabled=!0,C));const w=v.find(C=>C.id==="spellchecker");w&&(w.button.componentProps.disabled=!1)}return v}),l=d=>d.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]":d.button.componentProps.customClass,u=d=>d.id==="spellchecker"?"Spellchecker":d.button.componentProps.icon,c=o.computed(()=>r.editor?.extensionManager.extensions.find(d=>d.name==="spellchecker"));return(d,p)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(Ee)(r.class,d.customClassToolbar))},[o.createElementVNode("div",Lte,[(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(Co),{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:d.editor,disabled:d.disabled||h.button.componentProps?.disabled,"custom-class":l(h),icon:u(h)}),o.createSlots({_:2},[o.renderList(h.button.componentSlots,(b,v,w)=>({name:`${v}`,fn:o.withCtx(C=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(b),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(Co),{key:1,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64))),128)),o.createElementVNode("div",Rte,[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:d.editor,"editor-comment":d.editorComment,isEnableSpellCheckRealTime:d.editor?.extensionStorage.spellchecker.spellchecker.proofreader.enabled},null,8,["editor","editor-comment","isEnableSpellCheckRealTime"])):o.createCommentVNode("",!0)])])],2))}}),SS=(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},Pte={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"},Vte={class:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative gap-0.5"},Fte={class:"flex items-center gap-2"},$te={class:"mt-3"},_S=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 d(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),b=({editor:B})=>Y0(B.view.state,"image")||h.value;function v(){const B=SS(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 k(B){w(B)}function E(){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;al(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=Co,Y=Ea,Q=Oc,U=Cs,D=Xl,L=Fh,j=Vh,P=bs,G=gs;return o.openBlock(),o.createBlock(o.unref(qu),{editor:B.editor,"plugin-key":"image-menus-123","should-show":b,"update-delay":0,"tippy-options":{zIndex:9999,appendTo:c,getReferenceClientRect:()=>v()}},{default:o.withCtx(()=>[o.createElementVNode("div",Pte,[o.createElementVNode("div",Vte,[o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:E},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",Fte,[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(d,["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(d,["enter"])},null,8,["modelValue"])]),o.createElementVNode("div",$te,[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:()=>k(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"])}}}),Hte={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"},Hh=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 d(){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 b(w){e.editor.chain().focus().setTableCellBackground(w).run()}const v=()=>{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(qu),{editor:w.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:v,appendTo:n}},{default:o.withCtx(()=>[o.createElementVNode("div",Hte,[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(Co),{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:d,"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(Co),{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(Co),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(x5,{editor:w.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:b,"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"]))}}),zte={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},Ute={class:"flex items-center gap-1"},zh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>Y0(l.view.state,"columns"),r=()=>SS(e.editor,"columns")?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0),i=()=>{e.editor.chain().focus().setLayout(La.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(La.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(La.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(qu),{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",zte,[o.createElementVNode("div",Ute,[o.createVNode(Ye,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(La).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(La).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(La).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),Wte={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"},jte=["href"],qte={class:"flex flex-nowrap"},Kte=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",Wte,[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,jte),a.link?(o.openBlock(),o.createBlock(o.unref(Co),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",qte,[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"])])]))}}),Uh=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(qu),{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(gs),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref(xV),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Kte,{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(bs),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode(j5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),TS=(t,e,n,r,i)=>{const s=o.ref(0),a=ut.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(Uc(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},d=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> </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},b=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:d(A),status:0,lineId:Y,elementId:Q,hoverElementId:null,textOriginal:h(B)}});n.value=S},v=(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();v(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();v(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":b();break;default:console.log("There is no action")}},k=(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();v(V,F)&&B.classList.add("hidden")}}),g()},E=()=>{i.value.forEach(T=>T.classList.remove("hidden")),w()};return o.onBeforeMount(()=>{a.on(x),window.addEventListener("resize",b)}),o.onBeforeUnmount(()=>{a.off(x),window.removeEventListener("resize",b)}),o.watch(()=>n,async()=>{await o.nextTick(),w()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:w,eventListener:x,handleMouseOver:k,handleMouseLeave:E,wrapperMinHeight:s}},Gte=["index","book-mark-id","line-id","onMouseover"],Xte=["innerHTML"],Yte=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("")),d=o.computed(()=>n.fixedWidth&&o.unref(c)||"normal"),p=o.inject("canEditSuper",o.ref(!0)),{onUpdate:h,handleMouseOver:g,handleMouseLeave:b,wrapperMinHeight:v}=TS(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=>pd(S?n.superPreviewCustomClass?.completedSuper??"bg-black":n.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),x=o.computed(()=>n.fontSize??""),k=o.computed(()=>n.fixedWidth??!1),{contentInner:E,measuredMinWidth:T}=hf({minChars:n.minChars,fontSize:x,fixed:k});return e({measuredMinWidthComment:T}),(S,A)=>{const V=Bt;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:E,style:o.normalizeStyle({width:`${Number(o.unref(T))+25}px`,minHeight:`${o.unref(v)}px`}),class:o.normalizeClass(o.unref(Ee)("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(Ee)("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(b)&&o.unref(b)(...F))},[o.createVNode(o.unref(gv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("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:d.value}),innerHTML:B.text},null,12,Xte),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,Gte))),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(Wc,{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"]]),Jte=["index","book-mark-id","line-id","onMouseover"],Zte=["innerHTML"],Qte=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"),d=o.inject("isEditable",o.ref(!0)),{onUpdate:p,handleMouseOver:h,handleMouseLeave:g,wrapperMinHeight:b}=TS(e.editor,a,r,"editor-container-comment",n),v=(x,k)=>{d.value&&(a.value={id:x.id,text:x.text,elementId:x.elementId,index:k},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},w=x=>pd(x?e.superPreviewCustomClass?.completedSuper??"bg-black":e.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),C=o.inject("measuredMinWidthComment",0);return(x,k)=>{const E=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(b)}px`}),class:o.normalizeClass(o.unref(Ee)("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(Ee)("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:k[0]||(k[0]=(...A)=>o.unref(g)&&o.unref(g)(...A))},[o.createVNode(o.unref(gv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("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(d)})),onDblclick:A=>v(T,S)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:c.value}),innerHTML:T.text},null,12,Zte),o.createVNode(E,{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,Jte))),128)),!o.unref(l)&&a.value&&!x.disableSuperInput?(o.openBlock(),o.createBlock(Wc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:k[1]||(k[1]=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"]]),AS=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
|
|
345
|
+
`){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:Jt(H)}}),{isScrolling:O,handleScroll:F}=Jl();return e({insertSpecialCharater:h,isChecked:u,toggleSpellCheck:g,wrapText:V,editor:p}),(H,Y)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:b,class:o.normalizeClass(o.unref(Ee)("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(Ee)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),mZ={class:"sr-only"},gZ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},bZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},vZ={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"},yZ=["checked"],wZ={for:"spellcheck",class:"select-none whitespace-nowrap"},CZ={class:"flex gap-x-1"},xZ={class:"ml-auto"},EZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},kZ={class:"text-right text-sm p-2"},SZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},Sk=5,Wc=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=ut.useLocalStorage("superInputModalPosition",null),d=o.reactive({x:0,y:0}),p=o.ref(!1),h={x:0,y:0},g=o.ref(!1),b=o.ref(!1),v=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&&(d.x=K.clientX-h.x,d.y=K.clientY-h.y)},x=()=>{p.value=!1,c.value={x:d.x,y:d.y},document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",x)};o.watch(()=>r.open,async K=>{if(!K)return;b.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,ke=window.innerHeight;c.value&&c.value.x!==void 0&&c.value.y!==void 0?(d.x=c.value.x,d.y=c.value.y):(d.x=Math.max((de-ee.offsetWidth)/2,0),d.y=Math.max((ke-ee.offsetHeight)/2,0))},{immediate:!0});const k=()=>{n("close"),s.value="",a.value="",u.value=!1},E=()=>{if(l.value?.editor.commands.hasInvalidChar()){v.value=!0;return}s.value=l.value.wrapText(),a.value="",b.value?g.value=!0:n("close"),n("save",s.value),s.value=""},T=()=>{g.value=!1,n("close")},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=ut.useLocalStorage("recentSpecialChars",[]),Q=ut.useLocalStorage("superInputSpellCheck",!0),U=K=>{if(!K)return;const ee=(Y.value??[]).filter(de=>de!==K);ee.unshift(K),Y.value=ee.slice(0,Sk)},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===""||(b.value=K!==(r.superTextInit??""))});const G=o.computed(()=>l.value?.editor);return(K,ee)=>{const de=gh,ke=mh,se=hh,ge=ph,J=Ek,te=XX,oe=fv,ae=Vc,fe=Pc,Te=qX;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(n1),null,{default:o.withCtx(()=>[o.createVNode(o.unref(l1),{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(${d.x}px, ${d.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(ke,{class:"absolute right-3 top-3 text-white",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(fc),{class:"w-5 h-5"}),o.createElementVNode("span",mZ,o.toDisplayString(K.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(ge),o.createElementVNode("div",gZ,[o.createElementVNode("div",bZ,[ee[5]||(ee[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(Ee)("flex gap-x-6",o.unref(Y).length===Sk&&"gap-x-4"))},[o.createVNode(bn,{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",vZ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref(j),onChange:P},null,40,yZ),o.createElementVNode("label",wZ,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(bn,{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",xZ,[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",EZ,[o.createElementVNode("label",kZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(te,{editor:o.unref(G)},{default:o.withCtx(()=>[o.createVNode(Ov,{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",SZ,[ee[6]||(ee[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(Cs,{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(bn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:E},{default:o.withCtx(()=>[o.createVNode(o.unref(I1),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(o.unref(i)("editor.check")),1)]),_:1}),o.createVNode(bn,{as:"button",variant:"destructive",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(fc),{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:v.value,onClose:ee[4]||(ee[4]=Se=>v.value=!1)},null,8,["open"])],64)}}}),Iv=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:k}=n.editor.state.selection,E=n.editor.state.doc.cut(x,k),S=hn.fromSchema(n.editor.schema).serializeFragment(E.content),A=document.createElement("div");return A.appendChild(S),A.innerHTML}const d=()=>{const{view:x}=n.editor,{from:k,to:E}=x.state.selection,T=c();s.text=T,s.from=k,s.to=E},p=()=>i.value=!i.value,h=()=>{u.value||(i.value=!0,d())},g=()=>i.value=!1,b=x=>{if(Uc(x.trim())){i.value=!1;return}const k=n?.superTextStore.addMoreSuperText(x);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":k,"data-text":x}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},v=o.ref(!1),w=async x=>{if(x){const k=await n.editor.hasClipboard?.();v.value=!!k}},C=()=>{if(u.value||!n.editor)return;const{view:x,state:k}=n.editor,{from:E,to:T}=k.selection;s.from=E,s.to=T,s.text="",x.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:h,closeDialog:g}),(x,k)=>{const E=Wc,T=fh,S=dh,A=ch,V=uh;return x.disabled?o.renderSlot(x.$slots,"default",{key:0}):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(E,{open:i.value,editor:x.editor,"super-text-init":s.text,onClose:p,onSave:b},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:k[0]||(k[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:k[1]||(k[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:!v.value,onSelect:k[2]||(k[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))}}}),_Z={id:"editor-panel",class:"flex relative w-full h-full"},TZ=Xr(o.defineComponent({__name:"PageNode",props:na,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"),d=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"),b=ut.useEventBus(cr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,v=>{b.emit(v.pageNumber)},{immediate:!0}),(v,w)=>{const C=Iv;return o.openBlock(),o.createBlock(o.unref(ta),{id:v.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":v.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":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:d.value?typeof o.unref(h)=="number"?`${o.unref(h)}px`:o.unref(h):"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",_Z,[o.createVNode(C,{mode:c.value?o.unref(Me).REPORT:o.unref(Me).EDITOR,editor:v.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(uC),{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 _k(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 AZ=({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,d=Ah(c,l.node().type.name,l.node().attrs);if(d.id=nv(),d.extend&&(d.extend=!1),s instanceof De&&s.node.isBlock)return!l.parentOffset||!gr(a,l.pos)?!1:(r&&(t&&_k(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:u4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&h?[{type:h,attrs:d}]:void 0,b=gr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&gr(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(b=!0,g=h?[{type:h,attrs:d}]:void 0),b&&(g||(g=[{type:l.node().type,attrs:d}]),e.split(e.mapping.map(l.pos),1,g),h&&!p&&!l.parentOffset&&l.parent.type!==h)){const v=e.mapping.map(l.before()),w=e.doc.resolve(v);l.node(-1).canReplaceWith(w.index(),w.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&_k(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},MZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{const s=vn(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 d=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 v=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)v=me.from(a.node(S).copy(v));const C=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,x=Ah(d,a.node().type.name,a.node().attrs),k=s.contentMatch.defaultType?.createAndFill(x)??void 0;v=v.append(me.from(s.createAndFill(null,k)??void 0));const E=a.before(a.depth-(w-1));e.replace(E,a.after(-C),new _e(v,4-w,0));let T=-1;e.doc.nodesBetween(E,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=Ah(d,c.type.name,c.attrs),g=Ah(d,a.node().type.name,a.node().attrs);h.id=nv(),g.id=nv(),e.delete(a.pos,l.pos);const b=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:v,storedMarks:w}=n,{splittableMarks:C}=i.extensionManager,x=w??(v.$to.parentOffset&&v.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!x||!r)return!0;const k=x.filter(E=>C.includes(E.type.name));e.ensureMarks(k)}return!0},BZ=[th,eh,nh,rv,rh,_s,iv,Wl,av,uv,sv,Ta,jl,Ei,lv,cv,ov,Gr],OZ=Lt.create({priority:200,name:`${Gr}`,content:"block*",group:`${Gr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:ra(TZ),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",{...wt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:AZ,splitListItem:MZ,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:BZ.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:d}=u,p=Ue.atStart(a).from===c;return!l||!p||!d.type.isTextblock||d.textContent.length?!1:r.clearNodes()}),()=>Tk(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 d=li(p=>p.type.name===Gr)(a);if(d){if(!d.node.firstChild)return r.deleteNode(Gr);const p=d.node.firstChild.type;if(d.start+Ue.atStart(d.node).from===c){const g=Le.create(l,d.start-2,d.start-2),b=li(v=>v.type.name===Gr)(g);if(b){const v=Ue.atEnd(b.node).from+b.start,w=Le.create(l,v,v);if(p===b.node.lastChild.type){const{parent:C}=w.$anchor;return iX(C,i.schema)?s.setSelection(w):s.step(new gn(v,c,_e.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>Tk(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=li(d=>d.type.name===Wl)(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=li(d=>d.type.name===Gr)(s);if(c&&c.start+Ue.atEnd(c.node).from===u){const p=Le.create(a,u+2,u+2),h=li(g=>g.type.name===Gr)(p);if(h){const g=Ue.atStart(h.node).from+h.start,b=Le.create(a,g,g);if(li(w=>w.attrs.extend)(b))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 Ah(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 Tk=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=c4(r,{from:n.from,to:n.to},s=>s.type.name===Wl);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()}),Ak={"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"},Mk={"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":"확인"},Ia=QW({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:Ak,ko:Mk}}),IZ=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()}}}),LZ=["data-font"],RZ=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 d=e.editor.extensionManager.extensions.find(h=>h.name==="fontFamily").options;let p=[];return _t.isEmpty(d.fontFamilyList)?p=i:p=d.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 d={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?(q0(e.editor.state,"textStyle").fontFamily??e.editor.getAttributes("paragraph").fontFamily??e.editor.getAttributes("heading").fontFamily)||d.value:s.value||d.value});function u(d){d.value===l.value||d.value===r("editor.fontFamily.default")?(e.editor.chain().focus().unsetFontFamily().run(),s.value=null):(s.value=d.value,e.editor.chain().focus().setFontFamily(d.value).run()),e.editor.commands.setForceCloseBubble(!0)}e.editor.on("selectionUpdate",({editor:d})=>{d.state.selection.empty&&e.editor.commands.resetForceCloseBubble()});const c=o.computed(()=>{const d=a.value[0]?.label||r("editor.fontFamily.default");return a.value.find(p=>p.value===l.value)?.label||d});return(d,p)=>(o.openBlock(),o.createBlock(ba,{disabled:d.disabled,tooltip:d.tooltip,title:c.value,btn_class:`min-w-20 ${d.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(Il),{checked:l.value===h.value,onClick:b=>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,LZ)]),_:2},1032,["checked","onClick"]),h.label===o.unref(r)("editor.fontFamily.default")&&d.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(D1),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),Bk=IZ.extend({name:"fontFamily",addOptions(){return{...this.parent?.(),types:["textStyle"],fontFamilyList:[],button({editor:t,extension:e,t:n}){return{component:RZ,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})=>(f5(n,t),!0)).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().command(({tr:e})=>(f5(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}}),DZ=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}}),PZ={class:"flex gap-2"},VZ=["disabled"],FZ=Xr(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(yg[0])||parseInt(e.value)<parseInt(yg[0]):!1),r=ut.useEventBus(cr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=fa,u=da,c=pa;return o.openBlock(),o.createElementBlock("div",PZ,[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]=d=>i(!0))},[o.createVNode(o.unref(Bt),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(ss),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]=d=>i(!1)),disabled:o.unref(n)},[o.createVNode(o.unref(Bt),{name:"Minus",class:"w-6 h-6"})],8,VZ)]),_:1}),o.createVNode(o.unref(ss),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),$Z=Hn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:FZ,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})}}}),Lv=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 ot({key:new kt("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}}}})]}}),Rv=()=>$r(10),Ok=new kt("attrkey"),HZ=t=>new ot({key:Ok,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=Ok.getState(i);if(n.some(c=>c.getMeta("composition")))return null;if(l||n.some(c=>c.docChanged)){const c=[];i.doc.descendants((d,p,h,g)=>{const{attrs:b}=d,v=c.includes(b.id)?Rv():b.id||Rv();t.includes(d.type.name)&&(s.setNodeMarkup(p,void 0,{...b,id:v,"number-line":g+1}),a=!0),c.push(v)})}return a?s:null}}),Ik=[th,eh,nh,rv,rh,_s,iv,Wl,av,uv,sv,Ta,jl,Ei,lv,cv,ov,Gr],zZ=nt.create({name:"autoId",addGlobalAttributes(){return[{types:Ik.concat(this.options.types||[]),attributes:{id:{default:Rv()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[HZ(Ik.concat(this.options.types||[]))]}}),UZ=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,WZ=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",wt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[v4({find:UZ,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),jZ=["src","alt"],qZ={key:0,class:"image-resizer"},KZ=["onMousedown","onTouchstart"],GZ=o.defineComponent({__name:"ImageView",props:{...na,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:pC,height:pC}),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:E,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:E||void 0,alt:T||void 0,style:{width:xg(S)?`${S}px`:S,height:xg(A)?`${A}px`:A,transform:F||"none"}}});o.computed(()=>({width:o.unref(u).style.width==="100%"?"100%":void 0}));const c=o.ref(null),d=new ResizeObserver(E=>{for(const T of E){const{width:S,height:A}=T.contentRect;s.value={width:S,height:A},e.updateAttributes({originWidth:S,originHeight:A})}});function p(){const{editor:E,getPos:T,extension:S,node:A}=e;if(E.isEditable)return E.commands.setNodeSelection(T());S.options.onImageClick?.(A.attrs.src)}const h=_t.throttle(()=>{const{editor:E}=e;i.value.width=parseInt(getComputedStyle(E.view.dom).width,10)},hC);function g(E,T){E.preventDefault(),E.stopPropagation();let S=0,A=0;const V=document.querySelector(".image-resizer");if(V&&(V.style.borderColor="#3b82f6"),"touches"in E&&E.touches.length>0)S=E.touches[0].clientX,A=E.touches[0].clientY;else if("clientX"in E)S=E.clientX,A=E.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 b=_t.throttle(E=>{if(!o.unref(a))return;let T=0;if("touches"in E&&E.touches.length>0)T=E.touches[0].clientX;else if("clientX"in E)T=E.clientX;else return;const{x:S,w:A,dir:V}=o.unref(l),B=(T-S)*(/l/.test(V)?-1:1),O=FL(A+B,AL,o.unref(i).width);e.updateAttributes({width:O})},hC),v=E=>{E.preventDefault(),E.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",b,!0),document.addEventListener("mouseup",v,!0),document.addEventListener("touchmove",b,!0),document.addEventListener("touchend",v,!0)}function C(){document.removeEventListener("mousemove",b,!0),document.removeEventListener("mouseup",v,!0),document.removeEventListener("touchmove",b,!0),document.removeEventListener("touchend",v,!0)}const x=new ResizeObserver(h),k=o.computed(()=>{const{textAlign:E}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[E]||""});return o.onMounted(()=>{c.value&&d.observe(c.value),x.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{C(),d.disconnect(),x.disconnect()}),(E,T)=>(o.openBlock(),o.createBlock(o.unref(ta),{class:"node-image",style:o.normalizeStyle({"pointer-events":o.unref(r)&&t.selected&&E.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},k.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(pf)&&o.unref(pf)(...S))},null,44,jZ),E.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",qZ,[(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(Ee)(`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,KZ))),128))],512)),[[o.vShow,t.selected||a.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1},8,["style"]))}}),XZ=Xr(GZ,[["__scopeId","data-v-7eba98b1"]]),Mh=WZ.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 ra(XZ)},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",wt(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 ot({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"}}})]}}),YZ=["paragraph","heading","list_item","todo_item"];function JZ(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!==mC?e:null;return r.nodesBetween(i,s,(u,c)=>{const d=u.type;return YZ.includes(d.name)?((u.attrs.lineHeight||null)!==l&&a.push({node:u,pos:c,nodeType:d}),d.name!=="list_item"&&d.name!=="todo_item"):!0}),a.length&&a.forEach(u=>{const{node:c,pos:d,nodeType:p}=u;let{attrs:h}=c;h={...h,lineHeight:l},t=t.setNodeMarkup(d,p,h,c.marks)}),t}function ZZ(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:i}=e;return i=i.setSelection(r),i=JZ(i,t),i.docChanged?(n&&n(i),!0):!1}}const QZ=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(d=>d.name==="lineHeight").options.lineHeights.map(d=>({label:n(d),value:d}));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(ba,{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,d)=>(o.openBlock(),o.createBlock(o.unref(Il),{key:d,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"]))}}),Lk=nt.create({name:"lineHeight",addOptions(){return{...this.parent?.(),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:mC,button({editor:t,t:e}){return{component:QZ,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=>ZZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),NZ=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",wt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var La=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(La||{});const Dv=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[NZ.configure(this.options.columnOptions)]}}),eQ={class:"flex gap-x-2 items-center"},tQ={class:"sr-only"},nQ={class:"flex justify-end gap-x-2.5 flex-1"},rQ=["disabled"],Rk=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 d=()=>{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,b)=>{const v=gh,w=mh,C=hh,x=ph,k=fv,E=Vc,T=Pc;return o.openBlock(),o.createBlock(T,{open:g.open},{default:o.withCtx(()=>[o.createVNode(E,{"is-overlay-transparent":"",class:"p-2.5 gap-0 gap-y-2.5 border-none w-[calc(100%-40px)] !shadow-ed rounded-[5px]"},{default:o.withCtx(()=>[o.createVNode(C,{class:"text-left flex-row justify-between"},{default:o.withCtx(()=>[o.createVNode(v,{class:"text-base font-normal"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(g.title?g.title:o.unref(i)("editor.superinput")),1)]),_:1}),o.createElementVNode("div",eQ,[o.withDirectives(o.createElementVNode("button",{onClick:h},[o.createVNode(o.unref(_1),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(w,{class:"outline-none",onClick:d},{default:o.withCtx(()=>[o.createVNode(o.unref(fc),{class:"w-5 h-5"}),o.createElementVNode("span",tQ,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(x,{class:"hidden"}),o.createVNode(Ov,{modelValue:s.value,"onUpdate:modelValue":b[0]||(b[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(k,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:b[1]||(b[1]=S=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",nQ,[o.createElementVNode("button",{onClick:d},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,rQ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-c6e8813c"]]),oQ=["innerHTML"],iQ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],sQ=o.defineComponent({__name:"ConfigPlan",props:na,setup(t){const e=t,n=o.ref(!1),r=o.ref(null),{selection:i,doc:s}=e.editor.state,a=o.inject("isMobile"),l=o.ref(!1),u=ut.useEventBus(cr.RENDER_SUPER_TEXT),c=o.computed(()=>{const x=s.resolve(i.from)?.node(-1),k=x?.attrs?.id,E=x?.attrs?.pageNumber;return{pageId:k,pageNumber:E}}),d=o.computed(()=>{const C=e.getPos(),x=e.editor.state.doc.resolve(C);for(let k=x.depth;k>0;k--){const E=x.node(k);if(E.type.name==="paragraph")return E}return null}),p=o.computed(()=>d.value?.attrs.id||"");function h(C){e.updateAttributes({"data-text":C}),n.value=!1}function g(C){const x=e.node.attrs[Qe.TEXT],k=e.node.attrs[Qe.ID],T={lineId:C.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:x};u.emit({action:"hover",payload:T})}function b(C){const x=e.node.attrs[Qe.ID],E={lineId:C.target.querySelector(`[node-id="${x}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:E})}function v(){const{getPos:C,node:x,editor:k}=e,E=C(),T=E+1;k.commands.deleteRange({from:E,to:T})}function w(){n.value=!0,a&&(l.value=!0)}return(C,x)=>{const k=bn,E=fh,T=dh,S=ch,A=uh,V=Wc;return o.openBlock(),o.createBlock(o.unref(ta),{as:"span",class:o.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":o.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:o.withCtx(()=>[o.createVNode(A,null,{default:o.withCtx(()=>[o.createVNode(E,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(k,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:w,onMouseenter:g,onMouseleave:b},{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,oQ),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,iQ)]),_: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:v},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(Rk,{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:v},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"])}}}),Dk=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",wt(t,{class:"config-plan"})]},addNodeView(){return ra(sQ)},addProseMirrorPlugins(){return[new ot({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 Pv,Vv;if(typeof WeakMap<"u"){let t=new WeakMap;Pv=e=>t.get(e),Vv=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Pv=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Vv=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var qt=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 Pv(t)||Vv(t,aQ(t))}};function aQ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=lQ(t),n=t.childCount,r=[];let i=0,s=null;const a=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const p=t.child(c);d++;for(let b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==p.childCount)break;const v=p.child(b),{colspan:w,rowspan:C,colwidth:x}=v.attrs;for(let k=0;k<C;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:C-k});break}const E=i+k*e;for(let T=0;T<w;T++){r[E+T]==0?r[E+T]=d:(s||(s=[])).push({type:"collision",row:c,pos:d,n:w-T});const S=x&&x[T];if(S){const A=(E+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,d+=v.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}),d++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new qt(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&&uQ(l,a,t),l}function lQ(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 uQ(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 d=(i+c)%t.width,p=e[d*2];p!=null&&(!u.colwidth||u.colwidth[c]!=p)&&((l||(l=cQ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function cQ(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 Ts=new kt("selectingCells");function Ra(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 dQ(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 yo(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 Bh(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=Ra(e.$head)||fQ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function fQ(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 Fv(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function pQ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function $v(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Pk(t,e,n){const r=t.node(-1),i=qt.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 Da(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 Vk(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 hQ(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 Ut=class Pi extends Ue{constructor(e,n=e){const r=e.node(-1),i=qt.get(r),s=e.start(-1),a=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=i.cellsInRect(a).filter(d=>d!=n.pos-s);u.unshift(n.pos-s);const c=u.map(d=>{const p=r.nodeAt(d);if(!p)throw RangeError(`No cell with offset ${d} found`);const h=s+d+1;return new m3(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(Fv(r)&&Fv(i)&&$v(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Pi.rowSelection(r,i):s&&this.isColSelection()?Pi.colSelection(r,i):new Pi(r,i)}return Le.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=qt.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 d=u*n.width+i.left,p=i.left;p<i.right;p++,d++){const h=n.map[d];if(s[h])continue;s[h]=!0;const g=n.findCell(h);let b=e.nodeAt(h);if(!b)throw RangeError(`No cell with offset ${h} found`);const v=i.left-g.left,w=g.right-i.right;if(v>0||w>0){let C=b.attrs;if(v>0&&(C=Da(C,0,v)),w>0&&(C=Da(C,C.colspan-w,w)),g.left<i.left){if(b=b.type.createAndFill(C),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(C)}`)}else b=b.type.create(C,b.content)}if(g.top<i.top||g.bottom>i.bottom){const C={...b.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?b=b.type.createAndFill(C):b=b.type.create(C,b.content)}c.push(b)}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=qt.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=qt.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 Pi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=qt.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 Pi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=qt.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 Pi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Pi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Pi(e.resolve(n),e.resolve(r))}getBookmark(){return new mQ(this.$anchorCell.pos,this.$headCell.pos)}};Ut.prototype.visible=!1,Ue.jsonID("cell",Ut);var mQ=class MT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new MT(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&&$v(n,r)?new Ut(n,r):Ue.near(r,1)}};function gQ(t){if(!(t.selection instanceof Ut))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Ft.node(r,r+n.nodeSize,{class:"selectedCell"}))}),st.create(t.doc,e)}function bQ({$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 vQ({$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 yQ(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=Ut.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=Ut.rowSelection(l,l)}else if(!n){const l=qt.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=Ut.create(i,u+1,c)}}else r instanceof Le&&bQ(r)?s=Le.create(i,r.from):r instanceof Le&&vQ(r)&&(s=Le.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var wQ=new kt("fix-tables");function Fk(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,d=Math.min(i,a+3);c<d;c++)if(t.child(c)==u){l=c+1,n+=u.nodeSize;continue e}r(u,n),l<i&&t.child(l).sameMarkup(u)?Fk(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function $k(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&&Fk(e.doc,t.doc,0,r):t.doc.descendants(r),n}function CQ(t,e,n,r){const i=qt.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 d=e.nodeAt(c.pos);if(!d)continue;const p=d.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,Da(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+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 d=e.child(u),p=c+d.nodeSize,h=s[u];if(h>0){let g="cell";d.firstChild&&(g=d.firstChild.type.spec.tableRole);const b=[];for(let w=0;w<h;w++){const C=jn(t.schema)[g].createAndFill();C&&b.push(C)}const v=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(v),b)}c=p}return r.setMeta(wQ,{fixTables:!0})}function Go(t){const e=t.selection,n=Bh(t),r=n.node(-1),i=n.start(-1),s=qt.get(r);return{...e instanceof Ut?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function Hk(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;hQ(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,Vk(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 xQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(Hk(t.tr,n,n.left))}return!0}function EQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(Hk(t.tr,n,n.right))}return!0}function kQ(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),d=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,Da(d,i-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=d.rowspan}}function SQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;kQ(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=qt.get(s)}e(r)}return!0}function _Q(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 zk(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;_Q(e,r,i+u)&&(u=i==0||i==e.height?null:0);for(let c=0,d=e.width*i;c<e.width;c++,d++)if(i>0&&i<e.height&&e.map[d]==e.map[d-e.width]){const p=e.map[d],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[d+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 TQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(zk(t.tr,n,n.top))}return!0}function AQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t);e(zk(t.tr,n,n.bottom))}return!0}function MQ(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,d=i*e.width;c<e.width;c++,d++){const p=e.map[d];if(!u.has(p)){if(u.add(p),i>0&&p==e.map[d-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[d+e.width]){const h=n.nodeAt(p),g=h.attrs,b=h.type.create({...g,rowspan:h.attrs.rowspan-1},h.content),v=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+v),b),c+=g.colspan-1}}}}function BQ(t,e){if(!yo(t))return!1;if(e){const n=Go(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;MQ(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=qt.get(n.table)}e(r)}return!0}function Uk(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function OQ({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 Wk(t,e){const n=t.selection;if(!(n instanceof Ut)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Go(t),{map:i}=r;if(OQ(i,r))return!1;if(e){const s=t.tr,a={};let l=me.empty,u,c;for(let d=r.top;d<r.bottom;d++)for(let p=r.left;p<r.right;p++){const h=i.map[d*i.width+p],g=r.table.nodeAt(h);if(!(a[h]||!g))if(a[h]=!0,u==null)u=h,c=g;else{Uk(g)||(l=l.append(g.content));const b=s.mapping.map(h+r.tableStart);s.delete(b,b+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...Vk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const d=u+1+c.content.size,p=Uk(c)?u+1:d;s.replaceWith(p+r.tableStart,d+r.tableStart,l)}s.setSelection(new Ut(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function jk(t,e){const n=jn(t.schema);return IQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function IQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof Ut){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=dQ(i.$from),!s)return!1;a=(r=Ra(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 d=Go(e),p=e.tr;for(let g=0;g<d.right-d.left;g++)u.push(c?{...l,colwidth:c&&c[g]?[c[g]]:null}:l);let h;for(let g=d.top;g<d.bottom;g++){let b=d.map.positionAt(g,d.left,d.table);g==d.top&&(b+=s.nodeSize);for(let v=d.left,w=0;v<d.right;v++,w++)v==d.left&&g==d.top||p.insert(h=p.mapping.map(b+d.tableStart,1),t({node:s,row:g,col:v}).createAndFill(u[w]))}p.setNodeMarkup(a,t({node:s,row:d.top,col:d.left}),u[0]),i instanceof Ut&&p.setSelection(new Ut(p.doc.resolve(i.$anchorCell.pos),h?p.doc.resolve(h):void 0)),n(p)}return!0}}function LQ(t,e){return function(n,r){if(!yo(n))return!1;const i=Bh(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Ut?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 RQ(t){return function(e,n){if(!yo(e))return!1;if(n){const r=jn(e.schema),i=Go(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 qk(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 jc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?RQ(t):function(n,r){if(!yo(n))return!1;if(r){const i=jn(n.schema),s=Go(n),a=n.tr,l=qk("row",s,i),u=qk("column",s,i),d=(t==="column"?l:t==="row"?u:!1)?1:0,p=t=="column"?{left:0,top:d,right:1,bottom:s.map.height}:t=="row"?{left:d,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 b=g+s.tableStart,v=a.doc.nodeAt(b);v&&a.setNodeMarkup(b,h,v.attrs)}),r(a)}return!0}}jc("row",{useDeprecatedLogic:!0}),jc("column",{useDeprecatedLogic:!0});var DQ=jc("cell",{useDeprecatedLogic:!0});function PQ(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 Kk(t){return function(e,n){if(!yo(e))return!1;const r=PQ(Bh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Le.between(i,pQ(i))).scrollIntoView())}return!0}}function VQ(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 Oh(t,e){const n=t.selection;if(!(n instanceof Ut))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 FQ(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 d=u?0:Math.max(0,n-1),p=u<e.childCount-1?0:Math.max(0,r-1);(d||p)&&(c=Hv(jn(a).row,new _e(c,d,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Hv(jn(a).row,new _e(e,n,r)).content:e);else return null;return $Q(a,l)}function $Q(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 Hv(t,e){const n=t.createAndFill();return new r0(n).replace(0,n.content.size,e).doc}function HQ({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 d=s[l]||0,p=0;d<r;p++){let h=u.child(p%u.childCount);d+h.attrs.colspan>r&&(h=h.type.createChecked(Da(h.attrs,h.attrs.colspan,d+h.attrs.colspan-r),h.content)),c.push(h),d+=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 d=0;d<c.childCount;d++){let p=c.child(d);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 zQ(t,e,n,r,i,s,a){const l=t.doc.type.schema,u=jn(l);let c,d;if(i>e.width)for(let p=0,h=0;p<e.height;p++){const g=n.child(p);h+=g.nodeSize;const b=[];let v;g.lastChild==null||g.lastChild.type==u.cell?v=c||(c=u.cell.createAndFill()):v=d||(d=u.header_cell.createAndFill());for(let w=e.width;w<i;w++)b.push(v);t.insert(t.mapping.slice(a).map(h-1+r),b)}if(s>e.height){const p=[];for(let b=0,v=(e.height-1)*e.width;b<Math.max(e.width,i);b++){const w=b>=e.width?!1:n.nodeAt(e.map[v+b]).type==u.header_cell;p.push(w?d||(d=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const h=u.row.create(null,me.from(p)),g=[];for(let b=e.height;b<s;b++)g.push(h);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||d)}function Gk(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 d=a*e.width+c,p=e.map[d];if(e.map[d-e.width]==p){u=!0;const h=n.nodeAt(p),{top:g,left:b}=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,b,n)),h.type.createAndFill({...h.attrs,rowspan:g+h.attrs.rowspan-a})),c+=h.attrs.colspan-1}}return u}function Xk(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 d=c*e.width+a,p=e.map[d];if(e.map[d-1]==p){u=!0;const h=n.nodeAt(p),g=e.colCount(p),b=t.mapping.slice(l).map(p+r);t.setNodeMarkup(b,null,Da(h.attrs,a-g,h.attrs.colspan-(a-g))),t.insert(b+h.nodeSize,h.type.createAndFill(Da(h.attrs,0,a-g))),c+=h.attrs.rowspan-1}}return u}function Yk(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=qt.get(s);const{top:l,left:u}=r,c=u+i.width,d=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=qt.get(s),h=p.mapping.maps.length}zQ(p,a,s,n,c,d,h)&&g(),Gk(p,a,s,n,u,c,l,h)&&g(),Gk(p,a,s,n,u,c,d,h)&&g(),Xk(p,a,s,n,l,d,u,h)&&g(),Xk(p,a,s,n,l,d,c,h)&&g();for(let b=l;b<d;b++){const v=a.positionAt(b,u,s),w=a.positionAt(b,c,s);p.replace(p.mapping.slice(h).map(v+n),p.mapping.slice(h).map(w+n),new _e(i.rows[b-l],0,0))}g(),p.setSelection(new Ut(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(d-1,c-1,s)))),e(p)}var UQ=R0({ArrowLeft:Lh("horiz",-1),ArrowRight:Lh("horiz",1),ArrowUp:Lh("vert",-1),ArrowDown:Lh("vert",1),"Shift-ArrowLeft":Rh("horiz",-1),"Shift-ArrowRight":Rh("horiz",1),"Shift-ArrowUp":Rh("vert",-1),"Shift-ArrowDown":Rh("vert",1),Backspace:Oh,"Mod-Backspace":Oh,Delete:Oh,"Mod-Delete":Oh});function Ih(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Lh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Ut)return Ih(n,r,Ue.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=Jk(i,t,e);if(a==null)return!1;if(t=="horiz")return Ih(n,r,Ue.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=Pk(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),Ih(n,r,c)}}}function Rh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof Ut)a=s;else{const u=Jk(i,t,e);if(u==null)return!1;a=new Ut(n.doc.resolve(u))}const l=Pk(a.$headCell,t,e);return l?Ih(n,r,new Ut(a.$anchorCell,l)):!1}}function WQ(t,e){const n=t.state.doc,r=Ra(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ut(r))),!0):!1}function jQ(t,e,n){if(!yo(t.state))return!1;let r=FQ(n);const i=t.state.selection;if(i instanceof Ut){r||(r={width:1,height:1,rows:[me.from(Hv(jn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=qt.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=HQ(r,l.right-l.left,l.bottom-l.top),Yk(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Bh(t.state),a=s.start(-1);return Yk(t.state,t.dispatch,a,qt.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function qQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=Zk(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Ut)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Ra(t.state.selection.$anchor))!=null&&((n=zv(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let d=zv(t,c);const p=Ts.getState(t.state)==null;if(!d||!$v(u,d))if(p)d=u;else return;const h=new Ut(u,d);if(p||!t.state.selection.eq(h)){const g=t.state.tr.setSelection(h);p&&g.setMeta(Ts,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),Ts.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ts,-1))}function l(u){const c=u,d=Ts.getState(t.state);let p;if(d!=null)p=t.state.doc.resolve(d);else if(Zk(t,c.target)!=r&&(p=zv(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 Jk(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 Zk(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function zv(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Ra(t.state.doc.resolve(n.pos)):null}var KQ=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")),Uv(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,Uv(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Uv(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const d=t.firstChild;if(d){for(let p=0,h=0;p<d.childCount;p++){const{colspan:g,colwidth:b}=d.child(p).attrs;for(let v=0;v<g;v++,h++){const w=i==h?s:b&&b[v],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 kt("tableColumnResizing");function Qk({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=KQ,lastColumnResizable:i=!0}={}){const s=new ot({key:Sr,state:{init(a,l){var u,c;const d=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=jn(l.schema).table.name;return r&&d&&(d[p]=(h,g)=>new r(h,n,g)),new GQ(-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)=>{XQ(a,l,t,i)},mouseleave:a=>{YQ(a)},mousedown:(a,l)=>{JQ(a,l,e,n)}},decorations:a=>{const l=Sr.getState(a);if(l&&l.activeHandle>-1)return tN(a,l.activeHandle)},nodeViews:{}}});return s}var GQ=class Hm{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 Hm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Hm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Fv(e.doc.resolve(i))||(i=-1),new Hm(i,n.dragging)}return n}};function XQ(t,e,n,r){if(!t.editable)return;const i=Sr.getState(t.state);if(i&&!i.dragging){const s=QQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=Nk(t,e,"left",n):u-e.clientX<=n&&(a=Nk(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=qt.get(u),d=l.start(-1);if(c.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==c.width-1)return}tS(t,a)}}}function YQ(t){if(!t.editable)return;const e=Sr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&tS(t,-1)}function JQ(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",d);const h=Sr.getState(t.state);h?.dragging&&(NQ(t,h.activeHandle,eS(h.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Sr,{setDragging:null})))}function d(p){if(!p.which)return c(p);const h=Sr.getState(t.state);if(h&&h.dragging){const g=eS(h.dragging,p,n);nS(t,h.activeHandle,g,r)}}return nS(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",d),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 QQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Nk(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=Ra(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=qt.get(l.node(-1)),c=l.start(-1),d=u.map.indexOf(l.pos-c);return d%u.width==0?-1:c+u.map[d-1]}function eS(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function tS(t,e){t.dispatch(t.state.tr.setMeta(Sr,{setHandle:e}))}function NQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=qt.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 d=c*s.width+l;if(c&&s.map[d]==s.map[d-s.width])continue;const p=s.map[d],h=i.nodeAt(p).attrs,g=h.colspan==1?0:l-s.colCount(p);if(h.colwidth&&h.colwidth[g]==n)continue;const b=h.colwidth?h.colwidth.slice():eN(h.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...h,colwidth:b})}u.docChanged&&t.dispatch(u)}function nS(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=qt.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&&Uv(s,u.firstChild,u,r,l,n)}function eN(t){return Array(t).fill(0)}function tN(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return st.empty;const a=qt.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 d=u+c*a.width;if((u==a.width-1||a.map[d]!=a.map[d+1])&&(c==0||a.map[d]!=a.map[d-a.width])){const p=a.map[d],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(Ft.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(Ft.widget(h,g))}}return st.create(t.doc,r)}function rS({allowTableNodeSelection:t=!1}={}){return new ot({key:Ts,state:{init(){return null},apply(e,n){const r=e.getMeta(Ts);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:gQ,handleDOMEvents:{mousedown:qQ},createSelectionBetween(e){return Ts.getState(e.state)!=null?e.state.selection:null},handleTripleClick:WQ,handleKeyDown:UQ,handlePaste:jQ},appendTransaction(e,n,r){return yQ(r,$k(r,n),t)}})}const nN=(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)},rN=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof Ut)||i.forEachCell((s,a)=>{t=nN(t,a,n)}),t},oS=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=rN(n,e,t),n.docChanged?(i?.(n),!0):!1},oN=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=>oS(t,this.options),unsetTableCellBackground:()=>oS("",this.options)}}}),iN=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",wt(this.options.HTMLAttributes,t),0]}}),sN=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",wt(this.options.HTMLAttributes,t),0]}}).extend({addAttributes(){return{...this.parent?.(),height:{default:null,parseHTML:t=>{const n=t.style?.height||t.getAttribute("data-row-height");if(!n)return null;const r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:null},renderHTML:t=>t.height?{style:`height: ${t.height}px`}:{}}}},addNodeView(){return({node:t,HTMLAttributes:e})=>{const n=document.createElement("tr");for(const[r,i]of Object.entries(e))i!=null&&n.setAttribute(r,String(i));return{dom:n,contentDOM:n,update(r){if(r.type!==t.type)return!1;const i=r.attrs.height;return i&&i>0?n.style.height=`${i}px`:n.style.removeProperty("height"),!0},ignoreMutation(r){if(r.type!=="attributes")return!1;const i=r.target;if(!(r.attributeName==="style"||r.attributeName==="class"))return!1;if(i===n)return!0;if(i.parentNode===n){const a=i.tagName;return a==="TD"||a==="TH"}return!1}}}}}),aN=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",wt(this.options.HTMLAttributes,t),0]}});function Wv(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function iS(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const d=t.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:g,colwidth:b}=d.child(p).attrs;for(let v=0;v<g;v+=1,h+=1){const w=i===h?s:b&&b[v],C=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==C){const[x,k]=Wv(r,w);c.style.setProperty(x,k)}c=c.nextSibling}else{const x=document.createElement("col"),[k,E]=Wv(r,w);x.style.setProperty(k,E),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 lN{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")),iS(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,iS(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function jv(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:b}=l.child(p).attrs;for(let v=0;v<g;v+=1,h+=1){const w=n===h?r:b&&b[v];i+=w||e,w||(s=!1);const[C,x]=Wv(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 sS(t,e){return t.createAndFill()}function uN(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 cN(t,e,n,r,i){const s=uN(t),a=[],l=[];for(let c=0;c<n;c+=1){const d=sS(s.cell);if(d&&l.push(d),r){const p=sS(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 dN(t){return t instanceof Ut}const Dh=({editor:t})=>{const{selection:e}=t.state;if(!dN(e))return!1;let n=0;const r=d4(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},fN=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:lN,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}=jv(t,this.options.cellMinWidth);return["table",wt(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=cN(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})=>xQ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>EQ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>SQ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>TQ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>AQ(t,e),deleteRow:()=>({state:t,dispatch:e})=>BQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>VQ(t,e),mergeCells:()=>({state:t,dispatch:e})=>Wk(t,e),splitCell:()=>({state:t,dispatch:e})=>jk(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>jc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>jc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>DQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Wk(t,e)?!0:jk(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>LQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Kk(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Kk(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&$k(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Ut.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:Dh,"Mod-Backspace":Dh,Delete:Dh,"Mod-Delete":Dh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Qk({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],rS({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt($e(t,"tableRole",e))}}}),Yr=new kt("tableRowResizing");class qc{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=e.getMeta(Yr);if(n&&n.setHandle!=null)return new qc(n.setHandle,null);if(n&&n.setDragging!==void 0)return new qc(this.activeHandle,n.setDragging??null);if(this.activeHandle>-1&&e.docChanged){const r=e.mapping.map(this.activeHandle,-1);return new qc(r,this.dragging)}return this}}function pN({handleWidth:t=5,cellMinHeight:e=24}={}){return new ot({key:Yr,state:{init:()=>new qc(-1,null),apply:(n,r)=>r.apply(n)},props:{attributes(n){const r=Yr.getState(n);return r&&r.activeHandle>-1?{class:"row-resize-cursor"}:{}},handleDOMEvents:{mousemove:(n,r)=>(mN(n,r,t),!1),mouseleave:n=>(gN(n),!1),mousedown:(n,r)=>vN(n,r,e)},decorations(n){const r=Yr.getState(n);return r&&r.activeHandle>-1?xN(n,r.activeHandle):null}}})}function hN(t){let e=t;for(;e&&e.nodeName!=="TD"&&e.nodeName!=="TH";){if(e.nodeType===1&&e.classList?.contains("ProseMirror"))return null;e=e.parentNode}return e??null}function aS(t,e,n,r){const i=n==="bottom"?-r:r,s=t.posAtCoords({left:e.clientX,top:e.clientY+i});if(!s)return-1;const a=Ra(t.state.doc.resolve(s.pos));if(!a)return-1;if(n==="bottom")return a.pos;const l=qt.get(a.node(-1)),u=a.start(-1),c=l.map.indexOf(a.pos-u);return c<l.width?-1:u+l.map[c-l.width]}function mN(t,e,n){if(!t.editable)return;const r=Yr.getState(t.state);if(!r||r.dragging)return;const i=hN(e.target);let s=-1;if(i){const{top:a,bottom:l}=i.getBoundingClientRect();e.clientY-a<=n?s=aS(t,e,"top",n):l-e.clientY<=n&&(s=aS(t,e,"bottom",n))}s!==r.activeHandle&&lS(t,s)}function gN(t){if(!t.editable)return;const e=Yr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&lS(t,-1)}function lS(t,e){t.dispatch(t.state.tr.setMeta(Yr,{setHandle:e}))}function bN(t,e){const r=t.state.doc.resolve(e).parent.attrs.height;if(r&&r>0)return r;const i=t.domAtPos(e);return i.node.childNodes[i.offset]?.parentElement?.offsetHeight??24}function vN(t,e,n){if(!t.editable)return!1;const r=t.dom.ownerDocument.defaultView??window,i=Yr.getState(t.state);if(!i||i.activeHandle===-1||i.dragging)return!1;const s=i.activeHandle,a=bN(t,s),l=yN(t,s);t.dispatch(t.state.tr.setMeta(Yr,{setDragging:{startY:e.clientY,startHeight:a}}));function u(d){r.removeEventListener("mouseup",u),r.removeEventListener("mousemove",c);const p=Yr.getState(t.state);if(wN(l),p?.dragging){const h=uS(p.dragging,d,n);CN(t,p.activeHandle,h),t.dispatch(t.state.tr.setMeta(Yr,{setDragging:null}))}}function c(d){if(!d.buttons)return u(d);const p=Yr.getState(t.state);!p||!p.dragging||cS(l,uS(p.dragging,d,n))}return cS(l,a),r.addEventListener("mouseup",u),r.addEventListener("mousemove",c),e.preventDefault(),!0}function uS(t,e,n){return Math.max(n,t.startHeight+(e.clientY-t.startY))}function yN(t,e){const n=t.domAtPos(e),r=n.node.childNodes[n.offset];let i=null;if(r?.tagName==="TD"||r?.tagName==="TH")i=r.parentElement;else if(r?.tagName==="TR")i=r;else{let a=n.node;for(;a&&a.tagName!=="TR";)a=a.parentNode;i=a??null}const s=i?Array.from(i.children).filter(a=>a.tagName==="TD"||a.tagName==="TH"):[];return{tr:i,cells:s}}function cS({tr:t,cells:e},n){const r=`${n}px`;t&&(t.style.height=r);for(const i of e)i.style.height=r}function wN({tr:t,cells:e}){t&&(t.style.height="");for(const n of e)n.style.height=""}function CN(t,e,n){const r=t.state.doc.resolve(e),i=r.parent;if(i.attrs.height===n)return;const s=r.before(),a=t.state.tr.setNodeMarkup(s,null,{...i.attrs,height:n});t.dispatch(a)}function xN(t,e){const n=t.doc.resolve(e),r=n.node(-1);if(!r)return st.empty;const i=qt.get(r),s=n.start(-1),a=i.map.indexOf(n.pos-s)/i.width|0,l=[];for(let u=0;u<i.width;u++){const c=a*i.width+u;if(u>0&&i.map[c]===i.map[c-1])continue;const d=i.map[c],p=r.nodeAt(d);if(!p)continue;const h=s+d+p.nodeSize-1,g=document.createElement("div");g.className="row-resize-handle",l.push(Ft.widget(h,g))}return st.create(t.doc,l)}function EN(t){const{view:e,tableNode:n,tableEl:r,colgroupEl:i,tbodyEl:s,wrapperEl:a,axis:l,event:u}=t;if(!e.editable)return;u.preventDefault(),u.stopPropagation();const c=e.dom.ownerDocument.defaultView??window;if(a.classList.add("is-resizing"),l==="width"){const d=kN(n,i,t.cellMinWidth),p=u.clientX,h=b=>{if(!b.buttons)return g(b);const v=Ph(d,b.clientX-p,t.cellMinWidth);_N(i,r,v)},g=b=>{c.removeEventListener("mousemove",h),c.removeEventListener("mouseup",g);const v=Ph(d,b.clientX-p,t.cellMinWidth);a.classList.remove("is-resizing"),MN(e,n,v)};c.addEventListener("mousemove",h),c.addEventListener("mouseup",g)}else{const d=SN(n,s,t.cellMinHeight),p=u.clientY,h=b=>{if(!b.buttons)return g(b);const v=Ph(d,b.clientY-p,t.cellMinHeight);TN(s,v)},g=b=>{c.removeEventListener("mousemove",h),c.removeEventListener("mouseup",g);const v=Ph(d,b.clientY-p,t.cellMinHeight);AN(s),a.classList.remove("is-resizing"),BN(e,n,v)};c.addEventListener("mousemove",h),c.addEventListener("mouseup",g)}}function Ph(t,e,n){const r=t.length;if(r===0)return[];const i=e/r;return t.map(s=>Math.max(n,Math.round(s+i)))}function kN(t,e,n){const r=qt.get(t),i=[],s=Array.from(e.children),a=t.firstChild;if(!a)return[];let l=0;for(let u=0;u<a.childCount;u++){const{colspan:c,colwidth:d}=a.child(u).attrs;for(let p=0;p<c;p++,l++){const h=d?.[p];if(h&&h>0)i.push(h);else{const g=s[l]?.getBoundingClientRect().width??0;i.push(Math.max(n,Math.round(g)))}}}for(;i.length<r.width;)i.push(n);return i.slice(0,r.width)}function SN(t,e,n){const r=[],i=Array.from(e.children);for(let s=0;s<t.childCount;s++){const a=t.child(s);if(a.type.name!=="tableRow")continue;const l=a.attrs.height;if(l&&l>0)r.push(l);else{const u=i[s]?.getBoundingClientRect().height??0;r.push(Math.max(n,Math.round(u)))}}return r}function _N(t,e,n){const r=Array.from(t.children);let i=0;for(let s=0;s<n.length;s++){const a=n[s];i+=a;const l=r[s];l&&(l.style.width=`${a}px`,l.style.removeProperty("min-width"))}e.style.width=`${i}px`,e.style.minWidth=""}function TN(t,e){const n=Array.from(t.children);for(let r=0;r<e.length;r++){const i=n[r];i&&(i.style.height=`${e[r]}px`)}}function AN(t){const e=Array.from(t.children);for(const n of e)n.style.height=""}function dS(t,e){let n=-1;return t.state.doc.descendants((r,i)=>n>=0?!1:r===e?(n=i,!1):!0),n}function MN(t,e,n){const r=dS(t,e);if(r<0)return;const i=t.state.doc.nodeAt(r);if(!i)return;const s=qt.get(i),a=r+1,l=t.state.tr,u=new Set;for(let c=0;c<s.height;c++)for(let d=0;d<s.width;d++){const p=s.map[c*s.width+d];if(u.has(p))continue;u.add(p);const h=i.nodeAt(p);if(!h)continue;const g=h.attrs.colspan,b=s.colCount(p),v=[];for(let C=0;C<g;C++)v.push(n[b+C]);const w=h.attrs.colwidth;w&&w.length===v.length&&w.every((C,x)=>C===v[x])||l.setNodeMarkup(a+p,null,{...h.attrs,colwidth:v})}l.docChanged&&t.dispatch(l)}function BN(t,e,n){const r=dS(t,e);if(r<0)return;const i=t.state.doc.nodeAt(r);if(!i)return;const s=r+1,a=t.state.tr;let l=s,u=0;for(let c=0;c<i.childCount;c++){const d=i.child(c);if(d.type.name!=="tableRow"){l+=d.nodeSize;continue}const p=n[u++],h=d.attrs.height;p!=null&&h!==p&&a.setNodeMarkup(l,null,{...d.attrs,height:p}),l+=d.nodeSize}a.docChanged&&t.dispatch(a)}function ON(t){return class{node;cellMinWidth;view;dom;scrollEl;table;colgroup;contentDOM;rightHandle=null;bottomHandle=null;constructor(n,r,i){this.node=n,this.cellMinWidth=r,this.view=i,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.scrollEl=this.dom.appendChild(document.createElement("div")),this.scrollEl.className="tableScroll",this.table=this.scrollEl.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),this.contentDOM=this.table.appendChild(document.createElement("tbody")),this.syncColumns(n),t.allowTableResize&&(this.rightHandle=this.dom.appendChild(this.makeHandle("right")),this.bottomHandle=this.dom.appendChild(this.makeHandle("bottom")))}makeHandle(n){const r=document.createElement("div");return r.className=`table-resize-handle table-resize-handle--${n}`,r.contentEditable="false",r.addEventListener("mousedown",i=>{const s=n==="right"?"width":"height";EN({view:this.view,tableNode:this.node,tableEl:this.table,colgroupEl:this.colgroup,tbodyEl:this.contentDOM,wrapperEl:this.dom,axis:s,event:i,cellMinWidth:this.cellMinWidth,cellMinHeight:t.cellMinHeight})}),r}syncColumns(n){const r=jv(n,this.cellMinWidth);for(;this.colgroup.firstChild;)this.colgroup.removeChild(this.colgroup.firstChild);const i=r.colgroup?r.colgroup.slice(2):[];for(const s of i){const a=document.createElement("col"),l=Array.isArray(s)?s[1]:void 0;l?.style&&a.setAttribute("style",l.style),this.colgroup.appendChild(a)}r.tableWidth?(this.table.style.width=r.tableWidth,this.table.style.minWidth=""):r.tableMinWidth?(this.table.style.width="",this.table.style.minWidth=r.tableMinWidth):(this.table.style.width="",this.table.style.minWidth="")}update(n){return n.type!==this.node.type?!1:(this.node=n,this.syncColumns(n),!0)}ignoreMutation(n){if(n.type!=="attributes")return!1;const r=n.target;return r===this.table||this.colgroup.contains(r)||this.rightHandle?.contains(r)||this.bottomHandle?.contains(r)?!0:r===this.dom?n.attributeName==="class"||n.attributeName==="style":!1}}}const 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,LN=/CrOS/,RN=/android|ipad|playbook|silk/i;function fS(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)&&!LN.test(e)||t.tablet&&RN.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const DN=["disabled"],PN={"content-class":"table-grid-size-editor","content-style":"padding:0"},VN={class:"flex flex-col flex-wrap gap-1 justify-between"},FN=["onMouseover","onMousedown"],$N={class:"text-center text-sm text-zinc-600 mt-2"},HN=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:fS()?uf:lf,cols:fS()?uf:lf}),a=o.reactive({rows:cf,cols:cf});function l(g,b){g===s.rows&&(s.rows=Math.min(g+1,uf)),b===s.cols&&(s.cols=Math.min(b+1,uf)),a.rows=g,a.cols=b}function u(g,b){n("create-table",{rows:g,cols:b,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=lf,s.cols=lf,a.rows=cf,a.cols=cf}const d=o.inject("isMobile",!1),{isOpen:p}=ep({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),h=o.computed(()=>d?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,b)=>(o.openBlock(),o.createBlock(o.unref(gs),o.normalizeProps(o.guardReactiveProps(o.unref(h))),{default:o.withCtx(()=>[o.createVNode(o.unref(Ea),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,DN)]),_:3}),o.createVNode(o.unref(bs),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",PN,[o.createElementVNode("div",VN,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,v=>(o.openBlock(),o.createElementBlock("div",{key:"r"+v,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,w=>(o.openBlock(),o.createElementBlock("div",{key:"c"+w,class:o.normalizeClass([[w<=a.cols&&v<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:C=>l(v,w),onMousedown:C=>u(v,w)},b[0]||(b[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,FN))),128))]))),128))]),o.createElementVNode("div",$N,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),zN={style:{display:"flex"}},UN=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(HN,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",zN,[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"]))}}),qv=fN.extend({addOptions(){return{...this.parent?.(),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,allowRowResize:!0,cellMinHeight:24,rowHandleWidth:5,allowTableResize:!0,button:({t})=>({component:UN,componentProps:{icon:"Table",tooltip:t("editor.table.tooltip")}})}},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=jv(t,this.options.cellMinWidth);return["div",{class:"tableScroll"},["table",wt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]]},addExtensions(){return[sN.configure(this.options.tableRow),iN.configure(this.options.tableHeader),aN.configure(this.options.tableCell),oN.configure(this.options.tableCellBackground)]},addKeyboardShortcuts(){return{...this.parent?.(),Tab:()=>{const{editor:t}=this;return t.isActive("table")?t.commands.goToNextCell()?!0:t.can().addRowAfter()?t.chain().focus().addRowAfter().goToNextCell().run():!0:!1},"Shift-Tab":()=>{const{editor:t}=this;return t.isActive("table")?(t.commands.goToPreviousCell(),!0):!1}}},addProseMirrorPlugins(){const{onTableClick:t,resizable:e,handleWidth:n,cellMinWidth:r,lastColumnResizable:i,allowTableNodeSelection:s,allowRowResize:a,cellMinHeight:l,rowHandleWidth:u,allowTableResize:c}=this.options,d=this.editor.isEditable,p=ON({cellMinHeight:l,allowTableResize:c&&d}),h=[];return e&&d&&h.push(Qk({handleWidth:n,cellMinWidth:r,defaultCellMinWidth:r,View:p,lastColumnResizable:i})),a&&d&&h.push(pN({handleWidth:u,cellMinHeight:l})),h.push(rS({allowTableNodeSelection:s})),[...h,new ot({props:{handleClick:(g,b,v)=>{if(g.editable||!t)return!1;const{state:w}=g,C=w.doc.resolve(b);for(let x=C.depth;x>0;x--)if(C.node(x).type.name==="table"){const E=g.nodeDOM(C.before(x));if(E)return t(E.outerHTML),!0}return!1}}})]}}),WN={class:"flex items-center gap-2 px-2"},jN=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(ba,{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(Il),{key:u,class:"cursor-pointer",checked:l.isActive?.()||!1,onClick:l.action},{default:o.withCtx(()=>[o.createElementVNode("div",WN,[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"]))}}),qN=nt.create({name:"text-bubble",addOptions(){return{...this.parent?.(),toolbar:!1,button:()=>({component:jN,componentProps:{}})}}}),KN=[{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}년"}],pS=t=>{const e=[...t||[],...KN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},GN=nt.create({name:ah,addOptions(){return{additionalTimeWords:[],enabled:!0}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null,enabled:this.options.enabled}},addProseMirrorPlugins(){return[new ot({props:{decorations:t=>{if(!this.storage.enabled)return st.empty;const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=pS(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(Ft.inline(a,l,{class:"time-highlight"}))}}),st.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[ah];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Kv(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}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==="CLIPBOARD_STATE"&&t(!!r.data?.hasClipboard)},Kv({type:"REQUEST_CLIPBOARD_STATE"})})}function YN(){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)},Kv({type:"PASTE"})})}function JN(t,e){Kv({type:"COPY",data:{html:t,text:e}})}async function ZN(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 QN(){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 NN=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
|
+
`);t.storage.deviceEnv.isMobile?JN(u,c):await ZN(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 YN():await QN();if(!e)return;const n=new DataTransfer;if(tZ(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 XN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),eee=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)}}}),Vh=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(EF),o.normalizeProps(o.guardReactiveProps(o.unref(i))),{default:o.withCtx(()=>[o.renderSlot(s.$slots,"default")]),_:3},16))}}),tee={class:"truncate"},Xl=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(_F),o.mergeProps(o.unref(r),{class:o.unref(Ee)("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",tee,[o.renderSlot(i.$slots,"default")])]),_:3},16,["class"]))}}),Fh=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(kF),o.mergeProps(n.value,{class:o.unref(Ee)("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"]))}}),$h=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(SF),o.mergeProps({class:o.unref(Ee)("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"]))}}),nee={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"},ree={key:0,class:"flex justify-center items-center gap-3 text-s"},oee={key:1,class:"flex justify-between items-center w-full"},iee={class:"flex justify-center items-center gap-3"},see={class:"text-sm"},aee={class:"flex items-center gap-2"},lee=o.defineComponent({__name:"VideoUploader",props:{...na},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=Pt();function l(p){i.value=!0;const h=p.target,g=Array.from(h?.files||[]),b=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload")?.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof b?.upload!="function")return;const v=g[0];b.upload(v).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 d(){s.value?.click()}return(p,h)=>(o.openBlock(),o.createBlock(o.unref(ta),{as:"div","data-drag-handle":"",class:o.normalizeClass(o.unref(Ee)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(gs),{"default-open":o.unref(n)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ea),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",nee,[i.value?(o.openBlock(),o.createElementBlock("div",ree,[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",oee,[o.createElementVNode("div",iee,[o.createVNode(o.unref(Bt),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",see,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(bs),{"trap-focus":"",class:"w-full","on-open-auto-focus":g=>g.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Vh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Fh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Xl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Xl),{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($h),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(bn),{class:"w-full mt-1",size:"sm",disabled:i.value,onClick:d},{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($h),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",aee,[o.createVNode(o.unref(Cs),{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(bn),{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"]))}}),hS=Lt.create({name:Lc,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 ra(lee)},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 uee(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 cee(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 mS=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:df["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?uee(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:Jt(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: ${Jt(n)};`;return cee(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)}}}),Yl=new kt("upload-image"),dee=()=>new ot({key:Yl,state:{init(){return st.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Yl);if(n?.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=fee(a);return Ft.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 fee(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 pee(t,e){const r=Yl.getState(t).find(void 0,void 0,i=>i.id===e);return r.length?r[0]?.from:null}const gS=({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(Yl,{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),d=pee(r.state,l);if(d===null)return;const{schema:p}=r.state,h=typeof c=="object"?u:c,g=p.nodes.image?.create({src:h}),b=p.nodes.paragraph?.create();if(!g||!b)return;r.dispatch(r.state.tr.replaceWith(d,d,g).insert(d+g.nodeSize,b).setMeta(Yl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Yl,{remove:[l]}))}})))},hee=(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},mee=(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},gee={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"},bee={class:"flex items-center justify-between w-full"},vee={class:"flex items-center justify-center gap-3"},yee={class:"text-sm"},wee={class:"flex items-center gap-2"},Cee=o.defineComponent({__name:"ImageUploader",props:{...na},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Pt(),s=o.inject("isEditable",o.ref(!0));function a(d){const p=d?.target?.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const h=Array.from(p),g=e.editor.extensionManager.extensions.find(v=>v.name==="imageUpload")?.options;gS({validateFn:v=>!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(d,p)=>(o.openBlock(),o.createBlock(o.unref(ta),{id:d.node.attrs.id,"data-drag-handle":"",class:o.normalizeClass(o.unref(Ee)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(gs),{"default-open":o.unref(s)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ea),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",gee,[o.createElementVNode("div",bee,[o.createElementVNode("div",vee,[o.createVNode(o.unref(Bt),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",yee,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(bs),{"trap-focus":"",class:"w-full","on-open-auto-focus":h=>h.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Vh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Fh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Xl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Xl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref($h),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(bn),{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($h),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",wee,[o.createVNode(o.unref(Cs),{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(bn),{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"]))}}),xee=1,Eee=1e6,Si={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Gv=0;function kee(){return Gv=(Gv+1)%Number.MAX_VALUE,Gv.toString()}const Xv=new Map;function bS(t){if(Xv.has(t))return;const e=setTimeout(()=>{Xv.delete(t),Kc({type:Si.REMOVE_TOAST,toastId:t})},Eee);Xv.set(t,e)}const wo=o.ref({toasts:[]});function Kc(t){switch(t.type){case Si.ADD_TOAST:wo.value.toasts=[t.toast,...wo.value.toasts].slice(0,xee);break;case Si.UPDATE_TOAST:wo.value.toasts=wo.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Si.DISMISS_TOAST:{const{toastId:e}=t;e?bS(e):wo.value.toasts.forEach(n=>{bS(n.id)}),wo.value.toasts=wo.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Si.REMOVE_TOAST:t.toastId===void 0?wo.value.toasts=[]:wo.value.toasts=wo.value.toasts.filter(e=>e.id!==t.toastId);break}}function Yv(){return{toasts:o.computed(()=>wo.value.toasts),toast:See,dismiss:t=>Kc({type:Si.DISMISS_TOAST,toastId:t})}}function See(t){const e=kee(),n=i=>Kc({type:Si.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>Kc({type:Si.DISMISS_TOAST,toastId:e});return Kc({type:Si.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const _ee={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},Tee=t=>`${(t/1024/1024).toFixed(2)}MB`,vS=Lt.create({name:Ei,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 ra(Cee)},addOptions(){return{..._ee,...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}=Yv(),e=Ia.global.t,r=gS({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${Tee(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new ot({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:hee(i,s,r),handleDrop:(i,s,a,l)=>!(s instanceof DragEvent)||!s.dataTransfer||!Array.from(s.dataTransfer.files||[]).some(d=>this.options.acceptMimes.includes(d.type))?!1:mee(i,s,l,r)}}),dee()]}}),Aee=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}`}}}}}]}}),Mee=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:b4},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,b=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+h+p.value.slice(b);const v=g+h.length;p.setSelectionRange(v,v),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const d=(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:b}=g,{from:v}=b.state.selection;g.commands.insertContentAt(v,p),g.commands.focus()}}};return(p,h)=>{const g=fa,b=ss,v=da,w=pa;return o.openBlock(),o.createBlock(w,null,{default:o.withCtx(()=>[o.createVNode(v,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(g,null,{default:o.withCtx(()=>[o.createVNode(bn,{class:"text-[#65558F] hover:bg-[#ECE6F0]/90 text-xs rounded-none font-normal h-[26px] px-3 border border-gray-300 bg-ed-gray-50 dark:bg-black dark:text-white dark:hover:bg-gray-700 transition-all",onPointerdown:l,onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),o.createVNode(b,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.unref(s)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(i).component),o.mergeProps({key:0},o.unref(i).props,{"custom-class":"!z-[70] !pointer-events-auto",onClose:h[0]||(h[0]=C=>s.value=!1),onSelectedChar:d}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),Bee=nt.create({name:lh,addOptions(){return{button:({editor:t})=>({component:Mee,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),yS=nt.create({name:"base-kit",addOptions(){return{...this.parent?.(),timeHighlighter:{additionalTimeWords:[]},bubble:{list:OL,defaultBubbleList:yG,button:({editor:t,extension:e,t:n})=>{const{list:r={},defaultBubbleList:i}=e.options?.bubble??{},s=i?.(t)??[];return wG(r,s,{editor:t,extension:e,t:n})}}}},addExtensions(){const t=Ia.global.t,e=[];this.options.placeholder!==!1&&e.push(eE.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(aG.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(rE.configure().extend({content:"page+"})),e.push(OZ.configure({types:this.options.page?.nodesComputedOption?.types??[],slots:o.useSlots()}))):e.push(rE.configure())),this.options.dropcursor!==!1&&e.push(sG.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(rG.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(N5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(Q5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(gG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(bG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(vS.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(mS.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(hS.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(Wb.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(Bk.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(p5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(DZ.configure(this.options.fontWeight)),this.options.mode!==Me.EDITOR&&e.push(Bee.configure(this.options.specialCharacter)),this.options.mode!==Me.EDITOR&&e.push($Z),this.options.superText!==!1&&this.options.mode!==Me.PLAIN_TEXT&&this.options.mode!==Me.EDITOR&&(typeof this.options.superText=="boolean"?e.push(gk.configure()):e.push(gk.configure(this.options.superText))),this.options.mode===Me.EDITOR&&(this.options.image!==!1&&e.push(Mh.configure(typeof this.options.image=="object"?this.options.image:{})),e.push(n8.configure({spacer:!0}),S6,k6,_6,Hb,qv.configure(this.options.table!==!1?this.options.table:{}),T6,w5.configure({spacer:!0}),r8.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),Lk)),this.options.mode!==Me.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Me.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(Dk.configure()):e.push(Dk.configure({specialCharModal:this.options.configPlan?.specialCharModal}))),this.options.mode!==Me.EDITOR&&this.options.mode!==Me.PLAIN_TEXT&&e.push(zZ),(this.options.mode===Me.STRAIGHT||this.options.mode===Me.REPORT||this.options.mode===Me.EDITOR)&&this.options.timeHighlighter&&e.push(GN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(kk.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(Aee),e.push(oE,tE.configure(),qN.configure(),mG.configure(),Dv,Lv,gb,NN,eee.configure(this.options.deviceEnv),C5.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}}}),wS=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",wt(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",wt(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(wS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(CS.configure(this.options.superscript)),t}}),Iee={class:"ml-1"},Lee=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(ba,{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(Il),{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(e8),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(BC)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),Ree=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=kg(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:Lee,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(wS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(CS.configure(this.options.superscript)),t}});var Pa=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(Pa||{});function Dee(t,e,n){return t<e?e:t>n?n:t}function Pee(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 d=u.type;return n.includes(d.name)?(t=Vee(t,c,e),!1):!J0(u.type.name,r.extensionManager.extensions)}),t}function Vee(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=Dee((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 xS({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=Pee(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const Fee=nt.create({name:"indent",addOptions(){return{...this.parent?.(),types:["paragraph","heading","blockquote"],minIndent:Pa.min,maxIndent:Pa.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>=Pa.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<=Pa.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:()=>xS({delta:Pa.more,types:this.options.types}),outdent:()=>xS({delta:Pa.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function $ee(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=zO(n),d=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"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const v=l.pos-b.length,w=Array.from(b.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 k=v+w.index;let E=k+w[0].length;return u&&d.test(b.slice(E-1,E+1))&&(w[0]+=" ",E+=1),k<l.pos&&E>=l.pos?{range:{from:k,to:E},query:w[0].slice(n.length),text:w[0]}:null}const Hee=new kt("suggestion");function zee({pluginKey:t=Hee,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:d=()=>[],render:p=()=>({}),allow:h=()=>!0,findSuggestionMatch:g=$ee}){let b;const v=p?.(),w=new ot({key:t,view(){return{update:async(C,x)=>{var k,E,T,S,A,V,B;const O=(k=this.key)===null||k===void 0?void 0:k.getState(x),F=(E=this.key)===null||E===void 0?void 0:E.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}"]`);b={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=v?.onBeforeStart)===null||T===void 0||T.call(v,b)),L&&((S=v?.onBeforeUpdate)===null||S===void 0||S.call(v,b)),(L||D)&&(b.items=await d({editor:e,query:P.query})),j&&((A=v?.onExit)===null||A===void 0||A.call(v,b)),L&&((V=v?.onUpdate)===null||V===void 0||V.call(v,b)),D&&((B=v?.onStart)===null||B===void 0||B.call(v,b))},destroy:()=>{var C;b&&((C=v?.onExit)===null||C===void 0||C.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,x,k,E){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:E,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 k;const{active:E,range:T}=w.getState(C.state);return E&&((k=v?.onKeyDown)===null||k===void 0?void 0:k.call(v,{view:C,event:x,range:T}))||!1},decorations(C){const{active:x,range:k,decorationId:E}=w.getState(C);return x?st.create(C.doc,[Ft.inline(k.from,k.to,{nodeName:l,class:u,"data-decoration-id":E})]):null}}});return w}const Uee=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],Wee=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],jee=[{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"}],qee=[{label:"CodePen",value:"codepen",icon:"Codepen"}],Kee=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],Gee=[],Xee=[...Uee,...Wee,...jee,...qee,...Kee,...Gee];function Yee(t){const e=Ia.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(kg(t,"iframes")){const i=Xee;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 Jee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},Zee={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"},Qee=["onClick"],Nee=["src"],ete={key:1,class:"p-3"},tte={class:"text-xs text-gray-800 dark:text-gray-400"},nte=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 v=r.value*1e3+n.value,w=a.value[v];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:v}){return v.key==="ArrowUp"?(c(),!0):v.key==="ArrowDown"?(d(),!0):v.key==="Enter"?(p(),!0):!1}function c(){if(!l.items.length)return!1;let v=n.value-1,w=r.value;v<0&&(w=r.value-1,v=l.items[w]?.commands.length-1||0),w<0&&(w=l.items.length-1,v=l.items[w].commands.length-1),n.value=v,r.value=w}function d(){if(!l.items.length)return!1;const v=l.items[r.value].commands;let w=n.value+1,C=r.value;v.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(v,w){const C=l.items[v].commands[w];l.command(C)}function g(v,w){h(v,w)}function b(v,w,C){a.value[v*1e3+w]=C}return(v,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"},[v.items?.length?(o.openBlock(),o.createElementBlock("div",Jee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.items,(C,x)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:C.title},[o.createElementVNode("div",Zee,o.toDisplayString(C.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(C.commands,(k,E)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:T=>b(x,E,T),key:E,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===E?"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,E)},[k.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:k.iconUrl},null,8,Nee)):o.createCommentVNode("",!0),k.iconName?(o.openBlock(),o.createBlock(o.unref(Bt),{key:1,name:k.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(k.label),1)],10,Qee))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",ete,[o.createElementVNode("span",tte,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512))}}),Va="slashCommand";let Xo;const rte=nt.create({name:Va,priority:200,onCreate(){Xo=ea("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[zee({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new kt(Va),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})=>Yee(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()),d=l.match(u),p=c.some(h=>h.match(u));return d||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 cC(nte,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Va].rect;const s=n.clientRect();if(!s)return n.editor.storage[Va].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=()=>{Xo?.[0].setProps({getReferenceClientRect:i})},r.dom.parentElement?.addEventListener("scroll",e),t.element&&Xo?.[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element}),Xo?.[0].show()},onUpdate(n){t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Va].rect;const a=n.clientRect();return a?new DOMRect(a.x,a.y,a.width,a.height):n.editor.storage[Va].rect},s=()=>{Xo?.[0].setProps({getReferenceClientRect:i})};r.dom.parentElement?.addEventListener("scroll",s),n.editor.storage[Va].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Xo?.[0].setProps({getReferenceClientRect:i})},onKeyDown(n){return n.event.key==="Escape"?(Xo?.[0].hide(),!0):(Xo?.[0].state.isShown||Xo?.[0].show(),t.ref?.onKeyDown(n))},onExit(n){if(Xo?.[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}}}}),ote=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}=Yv();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"]))}}),ite=Lt.create({name:"AI",group:"block",addOptions(){return{...this.parent?.(),toolbar:!1,button:({editor:t,t:e})=>({component:ote,componentProps:{icon:"Sparkles",tooltip:e("editor.AI.ask")}})}}});function ste(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 ate(t,e){return new File([t],e,{type:t.type})}const lte=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}=Yv(),r=Ia.global.t;async function i(u){const d=new DOMParser().parseFromString(u,"text/html"),p=d.querySelectorAll("img");if(!p.length)return d.body.innerHTML;if(kg(e,"image")){const g=e.extensionManager.extensions.find(b=>b.name==="importWord")?.options;if(g&&typeof g.upload=="function"){const b=[];for(const w of p){const C=w.getAttribute("src"),x=ste(C,"image/jpeg"),k=ate(x,"image.jpeg");b.push(k)}const v=await g.upload(b);for(let w=0;w<p.length;w++){const C=p[w];C.setAttribute("src",v[w].src);const x=C.parentElement;x?.tagName==="P"&&(x.insertAdjacentElement("beforebegin",C),!x.hasChildNodes()&&x.textContent===""&&x.remove())}return d.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),d.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),d.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}=ut.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 d=await this.options.convert(c);s(d)}else{const d=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});d.append("config",p),d.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:d}).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}}}}),Jv=yn(),ute=nt.create({name:"preview",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ye,componentProps:{icon:"Eye",action:()=>{Jv.togglePreview()},tooltip:t("editor.preview.tooltip"),isActive:()=>Jv.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Jv.togglePreview(),!0)}}}),ES=yn(),cte=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function dte(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:st.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:d}=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:d+h.index,to:d+h.index+h[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],d=u===r?`${n} ${n}-current`:n,p=Ft.inline(c.from,c.to,{class:d});i.push(p)}return{decorationsToReturn:st.create(t,i),results:s}}const fte=(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))},pte=(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]},hte=(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=pte(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},mte=new kt("findAndReplacePlugin"),gte=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:()=>{ES.toggleFindAndReplace()},isActive:()=>ES.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 fte(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return hte(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 ot({key:mte,state:{init:()=>st.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:d,caseSensitive:p,lastCaseSensitive:h,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&d===c&&h===p&&b===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],st.empty;const{decorationsToReturn:v,results:w}=dte(a,cte(c,n,p),e,g);return t.storage.findAndReplace.results=w,v}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:bte,state:vte}=yn(),yte=nt.create({name:"printer",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ye,componentProps:{tooltip:t("editor.printer.tooltip"),action:()=>bte(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>vte.printer}})}}}),wte=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 an.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 kS{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(wte.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Cte=Object.freeze(Object.defineProperty({__proto__:null,AI:ite,BaseKit:yS,Blockquote:mK,Bold:k6,BulletList:sK,Clear:gb,Code:G$,CodeBlock:cz,Color:w5,Columns:Dv,FindAndReplace:gte,FontFamily:Bk,FontSize:p5,FormatPainter:Lv,Fullscreen:nG,Heading:n8,Highlight:tK,History:Wb,HorizontalRule:qK,Image:Mh,ImageUpload:vS,ImportWord:lte,Indent:Fee,Italic:S6,LineHeight:Lk,Link:Hb,MoreMark:Ree,OrderedList:cK,Preview:ute,Printer:yte,Proofreader:kS,SlashCommand:rte,SpellcheckerExtension:xk,Strike:T6,SubAndSuperScript:Oee,Table:qv,TaskList:pK,TextAlign:r8,Underline:_6,Video:mS,VideoUpload:hS},Symbol.toStringTag,{value:"Module"})),xte='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend=""false""><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend=""false"">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=""false""><strong>소개(국문)</strong></h1><p id="0qei01hl" extend=""false"">마이마이 에디터는 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 Ete(){const t=window.localStorage.getItem("content"),e=o.ref(t||xte),n=o.computed(()=>[yS.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),Wb,Dv,Lv,gb,Hb,Mh,qv]),r=ut.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 kte(){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,d=r.isEmpty;if(!t.value){if(d&&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 Jl(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 Ste(){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"),d=Array.from(document.querySelectorAll('[contenteditable="true"].tiptap:not(.simple-editor)'));return{popupInsideToolbars:l,toolBarFormat:u,toolBarImage:c,tiptapEditors:d}}function r(l){if(!l)return!1;const{popupInsideToolbars:u,toolBarFormat:c,toolBarImage:d,tiptapEditors:p}=n();return u.some(h=>h.contains(l))||(c?.contains(l)??!1)||(d?.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 ut.useEventListener(document,"mousedown",i,{capture:!0}),ut.useEventListener(document,"touchstart",i,{capture:!0}),ut.useEventListener(document,"focusin",s),ut.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}function Gc(){try{const{locale:t}=Pt();o.watch(t,e=>{const n=String(e);n&&Ia.global.locale.value!==n&&(Ia.global.locale.value=n)},{immediate:!0})}catch{}}const _te={key:0,class:"p-2.5 space-y-1.5"},Tte=["innerHTML"],Ate={key:1,class:"p-2.5 space-y-1.5"},Mte=["innerHTML"],Bte={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;Gc();const n=o.computed(()=>{const x=e.extensions?.filter(k=>k.name!=="spellchecker")||[];return x.some(k=>k.name==="image")||x.push(Mh.configure()),x}),r=o.computed(()=>oa(e.comment)),i=o.computed(()=>oa(e.commentCuesheet)),s=o.computed(()=>oa(e.content));function a(x){return wg(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):""),d=o.ref(),p=o.ref(),h=o.ref();o.onBeforeUnmount(()=>{d.value&&d.value.destroy(),p.value&&p.value.destroy(),h.value&&h.value.destroy()});function g(x){return new Oo({extensions:n.value,content:x,editable:!1,parseOptions:{preserveWhitespace:"full"}})}o.onMounted(async()=>{!r.value&&e.comment&&(d.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 b(x,k){if(!x)return;const E=cn(k,!0,e.mode);_t.isEqual(x.getHTML(),E)||x.commands.setContent(E,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,x=>{r.value||b(d.value,x)}),o.watch(()=>e.commentCuesheet,x=>{i.value||b(p.value,x)}),o.watch(()=>e.content,x=>{s.value||b(h.value,x)});const v=o.computed(()=>e.fontSize??""),{contentInner:w,measuredMinWidth:C}=hf({minChars:e.minChars,fontSize:v});return(x,k)=>{const E=l7;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",_te,[x.fieldNameComment?.label?(o.openBlock(),o.createBlock(E,{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,Tte)):o.unref(d)?(o.openBlock(),o.createBlock(o.unref(Jn),{key:2,editor:o.unref(d)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),x.commentCuesheet&&!x.hideComment?(o.openBlock(),o.createElementBlock("div",Ate,[x.fieldNameCommentCuesheet?.label?(o.openBlock(),o.createBlock(E,{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,Mte)):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",Bte,[x.fieldNameContent?.label?(o.openBlock(),o.createBlock(E,{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"]]),Co=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(mF),o.mergeProps(n.value,{class:o.unref(Ee)("shrink-0 bg-ed-separator",e.orientation==="vertical"?"w-px h-full":"h-px w-full",e.class)}),null,16,["class"]))}}),Lte={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-1.5"},Rte={class:"flex-1 flex justify-end items-center gap-x-3"},Dte=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(()=>hZ)),{t:n}=Pt(),r=t,i=o.inject("isEditable",o.ref(!0)),s=[oh,ih,lh,sh,ki,Dc],a=o.computed(()=>{const d=[...r.editor.extensionManager.extensions],p={[ki]:-1},h={[oh]:1,[ih]:2,[lh]:3,[sh]:4,[ki]:5,[Dc]:6},g=r.toolbarExtensionOrder??(r.mode===Me.EDITOR?p:h),b=yk(d,g);let v=[];for(const w of b){const{button:C,divider:x=!1,spacer:k=!1,toolbar:E=!0}=w.options;if(!C||!Eg(C)||!E)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?k:!1}));v=[...v,...S];continue}v.push({button:T,divider:x,spacer:k,id:`${w.name}`})}if(r.mode!==Me.EDITOR)return v.filter(w=>w.id&&s.includes(w.id));if(v=v.filter(w=>w.id!=="superText"),!i.value){v=v.map(C=>(C.button.componentProps.disabled=!0,C));const w=v.find(C=>C.id==="spellchecker");w&&(w.button.componentProps.disabled=!1)}return v}),l=d=>d.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]":d.button.componentProps.customClass,u=d=>d.id==="spellchecker"?"Spellchecker":d.button.componentProps.icon,c=o.computed(()=>r.editor?.extensionManager.extensions.find(d=>d.name==="spellchecker"));return(d,p)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(Ee)(r.class,d.customClassToolbar))},[o.createElementVNode("div",Lte,[(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(Co),{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:d.editor,disabled:d.disabled||h.button.componentProps?.disabled,"custom-class":l(h),icon:u(h)}),o.createSlots({_:2},[o.renderList(h.button.componentSlots,(b,v,w)=>({name:`${v}`,fn:o.withCtx(C=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(b),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(Co),{key:1,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64))),128)),o.createElementVNode("div",Rte,[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:d.editor,"editor-comment":d.editorComment,isEnableSpellCheckRealTime:d.editor?.extensionStorage.spellchecker.spellchecker.proofreader.enabled},null,8,["editor","editor-comment","isEnableSpellCheckRealTime"])):o.createCommentVNode("",!0)])])],2))}}),SS=(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},Pte={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"},Vte={class:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative gap-0.5"},Fte={class:"flex items-center gap-2"},$te={class:"mt-3"},_S=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 d(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),b=({editor:B})=>Y0(B.view.state,"image")||h.value;function v(){const B=SS(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 k(B){w(B)}function E(){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;al(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=Co,Y=Ea,Q=Oc,U=Cs,D=Xl,L=Fh,j=Vh,P=bs,G=gs;return o.openBlock(),o.createBlock(o.unref(qu),{editor:B.editor,"plugin-key":"image-menus-123","should-show":b,"update-delay":0,"tippy-options":{zIndex:9999,appendTo:c,getReferenceClientRect:()=>v()}},{default:o.withCtx(()=>[o.createElementVNode("div",Pte,[o.createElementVNode("div",Vte,[o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:E},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",Fte,[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(d,["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(d,["enter"])},null,8,["modelValue"])]),o.createElementVNode("div",$te,[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:()=>k(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"])}}}),Hte={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"},Hh=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:w})=>w.isActive("table"),{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 d(){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 b(w){e.editor.chain().focus().setTableCellBackground(w).run()}const v=()=>{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(qu),{editor:w.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:v,appendTo:n}},{default:o.withCtx(()=>[o.createElementVNode("div",Hte,[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(Co),{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:d,"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(Co),{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(Co),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(x5,{editor:w.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:b,"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"]))}}),zte={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},Ute={class:"flex items-center gap-1"},zh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>Y0(l.view.state,"columns"),r=()=>SS(e.editor,"columns")?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0),i=()=>{e.editor.chain().focus().setLayout(La.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(La.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(La.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(qu),{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",zte,[o.createElementVNode("div",Ute,[o.createVNode(Ye,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(La).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(La).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(La).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),Wte={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"},jte=["href"],qte={class:"flex flex-nowrap"},Kte=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",Wte,[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,jte),a.link?(o.openBlock(),o.createBlock(o.unref(Co),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",qte,[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"])])]))}}),Uh=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(qu),{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(gs),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref(xV),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Kte,{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(bs),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode(j5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),TS=(t,e,n,r,i)=>{const s=o.ref(0),a=ut.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(Uc(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},d=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> </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},b=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:d(A),status:0,lineId:Y,elementId:Q,hoverElementId:null,textOriginal:h(B)}});n.value=S},v=(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();v(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();v(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":b();break;default:console.log("There is no action")}},k=(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();v(V,F)&&B.classList.add("hidden")}}),g()},E=()=>{i.value.forEach(T=>T.classList.remove("hidden")),w()};return o.onBeforeMount(()=>{a.on(x),window.addEventListener("resize",b)}),o.onBeforeUnmount(()=>{a.off(x),window.removeEventListener("resize",b)}),o.watch(()=>n,async()=>{await o.nextTick(),w()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:w,eventListener:x,handleMouseOver:k,handleMouseLeave:E,wrapperMinHeight:s}},Gte=["index","book-mark-id","line-id","onMouseover"],Xte=["innerHTML"],Yte=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("")),d=o.computed(()=>n.fixedWidth&&o.unref(c)||"normal"),p=o.inject("canEditSuper",o.ref(!0)),{onUpdate:h,handleMouseOver:g,handleMouseLeave:b,wrapperMinHeight:v}=TS(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=>pd(S?n.superPreviewCustomClass?.completedSuper??"bg-black":n.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),x=o.computed(()=>n.fontSize??""),k=o.computed(()=>n.fixedWidth??!1),{contentInner:E,measuredMinWidth:T}=hf({minChars:n.minChars,fontSize:x,fixed:k});return e({measuredMinWidthComment:T}),(S,A)=>{const V=Bt;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:E,style:o.normalizeStyle({width:`${Number(o.unref(T))+25}px`,minHeight:`${o.unref(v)}px`}),class:o.normalizeClass(o.unref(Ee)("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(Ee)("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(b)&&o.unref(b)(...F))},[o.createVNode(o.unref(gv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("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:d.value}),innerHTML:B.text},null,12,Xte),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,Gte))),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(Wc,{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"]]),Jte=["index","book-mark-id","line-id","onMouseover"],Zte=["innerHTML"],Qte=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"),d=o.inject("isEditable",o.ref(!0)),{onUpdate:p,handleMouseOver:h,handleMouseLeave:g,wrapperMinHeight:b}=TS(e.editor,a,r,"editor-container-comment",n),v=(x,k)=>{d.value&&(a.value={id:x.id,text:x.text,elementId:x.elementId,index:k},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},w=x=>pd(x?e.superPreviewCustomClass?.completedSuper??"bg-black":e.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),C=o.inject("measuredMinWidthComment",0);return(x,k)=>{const E=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(b)}px`}),class:o.normalizeClass(o.unref(Ee)("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(Ee)("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:k[0]||(k[0]=(...A)=>o.unref(g)&&o.unref(g)(...A))},[o.createVNode(o.unref(gv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("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(d)})),onDblclick:A=>v(T,S)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:c.value}),innerHTML:T.text},null,12,Zte),o.createVNode(E,{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,Jte))),128)),!o.unref(l)&&a.value&&!x.disableSuperInput?(o.openBlock(),o.createBlock(Wc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:k[1]||(k[1]=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"]]),AS=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
|
|
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},Zv=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Qv=(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)},Nte=(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 d=Ir.fromJSON(r,c);s.push(d)}),s.length===0)return!1;const a=me.fromArray(s),l=_e.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ene=yn(),Wh=t=>{const e=o.computed(()=>ene.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Rn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),vk(t)&&t.commands.focus()},{immediate:!0})},tne={id:"editor-container-comment",class:"flex flex-col"},nne={class:"flex flex-1"},rne={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},one=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=ut.useEventBus(cr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=yn(),{isReady:u,editor:c,updateEditorState:d,superTextStore:p,checkSpellStore:h,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),w=new Oo({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,Ro),transformPastedHTML:S=>{const A=AS(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})=>{d(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}),d(S),C()},Ro),extensions:r.extensions,editable:v.value,onFocus:S=>{g(k.value),b(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(()=>v.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()),Qu(Ku.SAVE,()=>{localStorage.setItem("comment",x(w,"html"))});const k=o.ref(null);function E(S){S===Me.REPORT&&g(k.value)}function T(S){S===Me.REPORT&&b(w)}return o.onMounted(()=>{E(r.mode),T(r.mode)}),o.watch(()=>r.mode,S=>{E(S),T(S)}),o.watch(()=>r.editorContentInstance?.storage[ah]?.enabled,()=>{w.commands.toggleTimeHighlight()}),Wh(w),e({editor:w}),(S,A)=>(o.openBlock(),o.createElementBlock("div",tne,[o.createElementVNode("div",nne,[S.isOpenSuperView?(o.openBlock(),o.createBlock(Qte,{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",rne,[o.createVNode(Iv,{ref_key:"selectContextMenuRef",ref:k,"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 ine(t,e,n=!1,r=200){const{height:i}=ut.useElementSize(t),s=o.ref(0),a=o.ref(0),l=o.ref(r),u=o.ref(0),c=async()=>{await o.nextTick();const d=i.value-8;e.value===Me.REPORT?(s.value=d/3,a.value=n?"auto":d-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 sne={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],d=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,h,g,b,v,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),b=C(u);function x(P){for(var G=P.length,K={},ee,de,ke=0;ke<G;ke++)ee=P[ke][0].charCodeAt(0),de=P[ke][1].charCodeAt(0),typeof K[ee]>"u"&&(K[ee]={}),K[ee][de]=P[ke][2].charCodeAt(0);return K}v=x(c),w=x(d);function k(P){return typeof p[P]<"u"}function E(P){return typeof h[P]<"u"}function T(P){return typeof g[P]<"u"}function S(P){return typeof b[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 v[P]&&v[P][G]?v[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,ke,se,ge,J,te=0;te<ee;te++){var oe=[];ge=P.charCodeAt(te),A(ge)?(ge-=i,se=ge%28,ke=(ge-se)/28%21,de=parseInt((ge-se)/28/21),oe.push(e[de]),typeof n[ke]=="object"?oe=oe.concat(n[ke]):oe.push(n[ke]),se>0&&(typeof r[se]=="object"?oe=oe.concat(r[se]):oe.push(r[se]))):k(ge)?(E(ge)?J=e[h[ge]]:J=r[b[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,ke=-1,se,ge=!1;function J(oe){var ae,fe,Te,Se=0,We,qe="";if(ge=!1,!(ke+1>oe))for(var Ge=1;;Ge++){if(Ge===1){if(ae=P[ke+Ge].charCodeAt(0),T(ae))if(ke+Ge+1<=oe&&T(fe=P[ke+Ge+1].charCodeAt(0))){G.push(String.fromCharCode(V(ae,fe))),ke=oe;return}else{G.push(P[ke+Ge]),ke=oe;return}else if(!E(ae)){G.push(P[ke+Ge]),ke=oe;return}qe=P[ke+Ge]}else if(Ge===2)if(fe=P[ke+Ge].charCodeAt(0),E(fe)){ae=B(ae,fe),qe=String.fromCharCode(ae),G.push(qe),ke=oe;return}else qe=String.fromCharCode((h[ae]*21+g[fe])*28+i);else Ge===3?(Te=P[ke+Ge].charCodeAt(0),V(fe,Te)?fe=V(fe,Te):Se=Te,qe=String.fromCharCode((h[ae]*21+g[fe])*28+b[Se]+i)):Ge===4?(We=P[ke+Ge].charCodeAt(0),B(Se,We)?Se=B(Se,We):Se=We,qe=String.fromCharCode((h[ae]*21+g[fe])*28+b[Se]+i)):Ge===5&&(We=P[ke+Ge].charCodeAt(0),Se=B(Se,We),qe=String.fromCharCode((h[ae]*21+g[fe])*28+b[Se]+i));if(ke+Ge>=oe){G.push(qe),ke=oe;return}}}for(var te=0;te<K;te++){if(ee=P[te].charCodeAt(0),!E(ee)&&!T(ee)&&!S(ee)){J(te-1),J(te),de=0;continue}de===0?E(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):E(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),ke=new RegExp(ee,"gi"),se=[],ge;if(!G.length)return[];for(;ge=ke.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(k(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)),k(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)),E(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(!k(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(!E(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})()})(sne);const Zl=new kt("searchHighlight");function jh(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 d=0,p=c.indexOf(i,d);for(;p!==-1;){const h=p,g=p+i.length-1;if(n.wholeWord){const b=h>0?c[h-1]:"",v=g+1<c.length?c[g+1]:"";if(b&&a(b)||v&&a(v)){d=p+1,p=c.indexOf(i,d);continue}}r.push({from:u+h,to:u+g+1}),d=p+i.length,p=c.indexOf(i,d)}}),r}function Nv(t){return t.state.selection.from}function MS(t){if(t.state.plugins.find(r=>r.spec.key===Zl))return;const n=new ot({key:Zl,state:{init(){return st.empty},apply(r,i){const s=r.getMeta(Zl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Zl.getState(r)}}});t.registerPlugin(n)}function BS(t,e,n){MS(t);const r=e.map((a,l)=>Ft.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=st.create(t.state.doc,r),s=t.state.tr.setMeta(Zl,i);t.view.dispatch(s)}function Ql(t){MS(t);const e=t.state.tr.setMeta(Zl,st.empty);t.view.dispatch(e)}function ane(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,BS(h,n.value,e.value);const b=n.value[e.value];h.view.domAtPos(b.from).node?.scrollIntoView?.({block:"nearest",behavior:"smooth"}),h.chain().setTextSelection({from:b.from,to:b.to}).scrollIntoView().run()}function s(p){const h=t.value;if(!h)return;if(n.value=jh(h,p.find,p),n.value.length===0){e.value=-1,Ql(h);return}const g=Nv(h),b=n.value.findIndex(v=>v.from>g);i(b===-1?0:b)}function a(p){const h=t.value;if(!h)return;if(n.value=jh(h,p.find,p),n.value.length===0){e.value=-1,Ql(h);return}const g=Nv(h);let b=-1;for(let v=n.value.length-1;v>=0;v--)if(n.value[v].to<g){b=v;break}i(b===-1?n.value.length-1:b)}function l(p){const h=t.value;if(!h||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:b}=h,v=b.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?v===p.find:v.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=jh(h,p.find,p);if(g.length===0)return;const b=h.chain().focus();[...g].reverse().forEach(v=>{b.setTextSelection({from:v.from,to:v.to}).insertContent(p.replace)}),b.run(),n.value=[],e.value=-1,Ql(h)}function c(p){const h=t.value;if(!h)return;if(!p.find){n.value=[],e.value=-1,Ql(h);return}if(n.value=jh(h,p.find,p),n.value.length===0){e.value=-1,Ql(h);return}const g=Nv(h),b=n.value.findIndex(w=>w.from>=g),v=b===-1?0:b;e.value=v,i(v),BS(h,n.value,v)}function d(){const p=t.value;p&&(n.value=[],e.value=-1,Ql(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:d}}const OS={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]},IS=.4,LS=.6;let qh=null;const Xc=new Map;function lne(){if(qh)return qh;if(typeof document>"u")return null;const t=document.createElement("canvas");return t.width=1,t.height=1,qh=t.getContext("2d"),qh}function une(t){if(Xc.has(t))return Xc.get(t)??null;const e=lne();if(!e)return null;e.fillStyle="#000";try{e.fillStyle=t}catch{return Xc.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 Xc.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 Xc.set(t,i),i}function Kh(t){if(!t)return null;const e=t.trim().toLowerCase();if(OS[e]){const[i,s,a]=OS[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}:une(e)}function Gh(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 RS(t,e=IS){const n=Kh(t);return n?Gh(n.r,n.g,n.b)<e:!1}function DS(t,e=LS){const n=Kh(t);return n?Gh(n.r,n.g,n.b)>e:!1}function PS(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,d=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,d,u]}function VS(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 FS(t,e,n,r){return r<1?`rgba(${t}, ${e}, ${n}, ${Number(r.toFixed(3))})`:`rgb(${t}, ${e}, ${n})`}function $S(t){const e=Kh(t);if(!e||Gh(e.r,e.g,e.b)>=IS)return t;const[r,i,s]=PS(e.r,e.g,e.b),a=s<.5?1-s:s,[l,u,c]=VS(r,i,a);return FS(l,u,c,e.a)}const cne=.4,dne=.18;function HS(t){const e=Kh(t);if(!e||Gh(e.r,e.g,e.b)<=LS)return t;const[r,i,s]=PS(e.r,e.g,e.b),a=s>.5?1-s:s,l=Math.min(a,dne),u=i*cne,[c,d,p]=VS(r,u,l);return FS(c,d,p,e.a)}function fne(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&&RS(i)&&(r.style.color=$S(i));const s=r.style.backgroundColor;s&&DS(s)&&(r.style.backgroundColor=HS(s))}),e.innerHTML}function pne(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 d=o.ref(!1);function p(E){c===E&&u||(h(),u=new MutationObserver(()=>k()),u.observe(E,{attributes:!0,subtree:!0,attributeFilter:["style"],childList:!0}),c=E)}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 b(){d.value=g()}function v(){const E=new Set;return t?.state?.doc&&t.state.doc.descendants(T=>{T.marks.forEach(S=>{S.type.name==="textStyle"&&S.attrs.color&&E.add(S.attrs.color)})}),E}function w(){const E=v(),T=[];return E.forEach(S=>{if(RS(S)){const A=$S(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 E=r.value;if(!E)return"";const T=E.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||!DS(Y))return;const Q=HS(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(`
|
|
349
349
|
`)}function x(){if(!i)return;if(b(),!d.value||n.value){i.textContent="";return}const E=w(),T=C();i.textContent=[E,T].filter(Boolean).join(`
|