@cyberskill/cyber-editor 3.8.2 → 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cyber-editor.cjs.js +4 -4
- package/dist/cyber-editor.css +1 -1
- package/dist/cyber-editor.es.js +292 -191
- package/package.json +1 -1
package/dist/cyber-editor.cjs.js
CHANGED
|
@@ -657,12 +657,12 @@ html body {
|
|
|
657
657
|
*
|
|
658
658
|
* This source code is licensed under the ISC license.
|
|
659
659
|
* See the LICENSE file in the root directory of this source tree.
|
|
660
|
-
*/const T5=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],P5=Vt("x",T5);function Oc({value:t,onChange:e}){return ve.jsxDEV(bu,{value:t,onChange:e,presets:[{label:"Recommended",colors:["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2","#ffffff","#000000"]}]},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/color-picker/color-picker.component.tsx",lineNumber:7,columnNumber:9},this)}function A5({editor:t}){const[e,n]=N.useState("#1677ff"),[r,o]=N.useState("#ffffff"),i=l=>{const c=l.toHexString();n(c),t.chain().focus().setColor(c).run()},a=l=>{const c=l.toHexString();o(c),t.chain().focus().setHighlight({color:c}).run()},s=l=>{l.preventDefault()};return ve.jsxDEV("div",{className:"flex items-center gap-4",children:[ve.jsxDEV(Uo,{title:"Text Color",children:ve.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:s,children:[ve.jsxDEV(O5,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:36,columnNumber:21},this),ve.jsxDEV(Oc,{value:e,onChange:i},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:37,columnNumber:21},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:35,columnNumber:17},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:34,columnNumber:13},this),ve.jsxDEV(Uo,{title:"Highlight Color",children:ve.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:s,children:[ve.jsxDEV(l5,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:44,columnNumber:21},this),ve.jsxDEV(Oc,{value:r,onChange:a},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:45,columnNumber:21},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:43,columnNumber:17},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:42,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:32,columnNumber:9},this)}function k5({editor:t}){if(!t)return null;const e=()=>{for(let r=1;r<=6;r++)if(t.isActive("heading",{level:r}))switch(r){case 1:return ve.jsxDEV(Pd,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:
|
|
660
|
+
*/const T5=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],P5=Vt("x",T5);function Oc({value:t,onChange:e}){return ve.jsxDEV(bu,{value:t,onChange:e,presets:[{label:"Recommended",colors:["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2","#ffffff","#000000"]}]},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/color-picker/color-picker.component.tsx",lineNumber:7,columnNumber:9},this)}function A5({editor:t}){const[e,n]=N.useState("#1677ff"),[r,o]=N.useState("#ffffff"),i=l=>{const c=l.toHexString();n(c),t.chain().focus().setColor(c).run()},a=l=>{const c=l.toHexString();o(c),t.chain().focus().setHighlight({color:c}).run()},s=l=>{l.preventDefault()};return ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-4",children:[ve.jsxDEV(Uo,{title:"Text Color",children:ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-2",onMouseDown:s,children:[ve.jsxDEV(O5,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:36,columnNumber:21},this),ve.jsxDEV(Oc,{value:e,onChange:i},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:37,columnNumber:21},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:35,columnNumber:17},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:34,columnNumber:13},this),ve.jsxDEV(Uo,{title:"Highlight Color",children:ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-2",onMouseDown:s,children:[ve.jsxDEV(l5,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:44,columnNumber:21},this),ve.jsxDEV(Oc,{value:r,onChange:a},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:45,columnNumber:21},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:43,columnNumber:17},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:42,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/color-picker/color-picker.component.tsx",lineNumber:32,columnNumber:9},this)}function k5({editor:t}){if(!t)return null;const e=()=>{for(let r=1;r<=6;r++)if(t.isActive("heading",{level:r}))switch(r){case 1:return ve.jsxDEV(Pd,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:27,columnNumber:32},this);case 2:return ve.jsxDEV(t0,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:29,columnNumber:32},this);case 3:return ve.jsxDEV(n0,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:31,columnNumber:32},this);case 4:return ve.jsxDEV(r0,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:33,columnNumber:32},this);case 5:return ve.jsxDEV(o0,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:35,columnNumber:32},this);case 6:return ve.jsxDEV(i0,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:37,columnNumber:32},this)}return ve.jsxDEV(Pd,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:41,columnNumber:16},this)},n=[...Array.from({length:6},(r,o)=>({key:`${o+1}`,label:ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-2",onClick:()=>t.chain().focus().toggleHeading({level:o+1}).run(),children:[N.createElement([Pd,t0,n0,r0,o0,i0][o],{size:16}),ve.jsxDEV("span",{children:["Heading",o+1]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:69,columnNumber:21},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:48,columnNumber:17},this),className:t.isActive("heading",{level:o+1})?"ant-dropdown-menu-item-active":""}))];return ve.jsxDEV(yu,{menu:{items:n},trigger:["hover"],placement:"bottomLeft",children:ve.jsxDEV("button",{className:"ce:flex ce:items-center ce:gap-1 ce:p-2 ce:rounded-md ce:hover:bg-blue-100 ce:hover:text-blue-600",type:"button",children:e()},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:87,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/heading/heading.component.tsx",lineNumber:82,columnNumber:9},this)}const D5=8,_5=8;function B5({editor:t,buttonClass:e,activeClass:n}){const[r,o]=N.useState({rows:0,cols:0}),[i,a]=N.useState(!1),s=N.useCallback((l,c)=>{t&&(t.chain().focus().insertTable({rows:l,cols:c,withHeaderRow:!0}).run(),a(!1))},[t]);return ve.jsxDEV(yu,{open:i,onOpenChange:l=>a(l),trigger:["hover"],dropdownRender:()=>ve.jsxDEV("div",{className:"ce:w-56 ce:p-4 ce:bg-white ce:border ce:border-gray-300 ce:rounded-lg ce:shadow-xl",children:[ve.jsxDEV("div",{className:"ce:grid ce:grid-cols-8 ce:gap-1",children:Array.from({length:D5}).map((l,c)=>Array.from({length:_5}).map((u,d)=>{const f=c<r.rows&&d<r.cols;return ve.jsxDEV("div",{className:`ce:w-5 ce:h-5 ce:border ce:rounded-sm ce:cursor-pointer ce:transition-all ce:duration-200 ${f?"ce:bg-blue-400 ce:border-white ce:scale-110":"ce:bg-gray-200 ce:hover:bg-gray-300"}`,onMouseEnter:()=>o({rows:c+1,cols:d+1}),onClick:p=>{p.stopPropagation(),s(c+1,d+1)}},`${c}-${d}`,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/table/table.component.tsx",lineNumber:47,columnNumber:41},this)}))},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/table/table.component.tsx",lineNumber:39,columnNumber:21},this),ve.jsxDEV("div",{className:"ce:mt-3 ce:text-sm ce:font-medium ce:text-center ce:text-gray-700",children:r.rows>0&&r.cols>0?`${r.rows} × ${r.cols} Table`:"Insert Table"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/table/table.component.tsx",lineNumber:73,columnNumber:21},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/table/table.component.tsx",lineNumber:38,columnNumber:17},this),children:ve.jsxDEV("button",{type:"button",className:`${e} ${i?n:""} ce:transition-all`,onClick:l=>{l.preventDefault(),a(!i)},children:ve.jsxDEV(E5,{className:"ce:w-5 ce:h-5"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/table/table.component.tsx",lineNumber:91,columnNumber:17},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/table/table.component.tsx",lineNumber:81,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/table/table.component.tsx",lineNumber:33,columnNumber:9},this)}function j5({editor:t}){const[e,n]=N.useState(!1);return ve.jsxDEV("div",{className:"ce:relative",children:[ve.jsxDEV("button",{type:"button",className:`ce:p-1 ce:text-black ce:transition-all ce:duration-300 ce:rounded-md ce:shadow-lg ce:hover:bg-blue-100 ce:hover:text-blue-600 ${e?"ce:bg-blue-100 ce:text-blue-600":""}`,onClick:r=>{r.preventDefault(),r.stopPropagation(),n(!e)},children:e?ve.jsxDEV(P5,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:20,columnNumber:25},this):ve.jsxDEV(e5,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:20,columnNumber:43},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:9,columnNumber:13},this),e&&ve.jsxDEV("div",{className:"ce:fixed ce:z-40 ce:w-64 ce:p-4 ce:bg-white ce:border ce:border-gray-200 ce:rounded-lg ce:shadow-xl ce:bottom-20 ce:right-4 ce:animate-slide-up",children:ve.jsxDEV("div",{className:"ce:space-y-2",children:[ve.jsxDEV("h3",{className:"ce:mb-3 ce:font-bold ce:text-center ce:text-gray-700",children:"Custom Extensions"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:26,columnNumber:25},this),ve.jsxDEV("button",{type:"button",onClick:()=>{t.chain().focus().insertContent({type:"accordion",content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()},className:"ce:flex ce:items-center ce:justify-center ce:w-full ce:gap-2 ce:px-3 ce:py-1 ce:text-blue-600 ce:duration-300 ce:rounded-md ce:bg-blue-50 ce:hover:bg-blue-100 ce:hover:text-blue-700",children:[ve.jsxDEV(u5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:54,columnNumber:29},this)," Accordion"]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:30,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:25,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:24,columnNumber:17},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/custom.tsx",lineNumber:8,columnNumber:9},this)}function z5({editor:t}){if(!t)return null;const e="ce:p-2 ce:rounded-md ce:transition-all ce:duration-200 ce:hover:bg-blue-100 ce:hover:text-blue-600",n="ce:bg-blue-100 ce:text-blue-600",r=(o,i,a,s,l)=>ve.jsxDEV(Uo,{title:l,children:ve.jsxDEV("button",{type:"button",onClick:i,disabled:s,className:`
|
|
661
661
|
${e}
|
|
662
662
|
${a?n:""}
|
|
663
|
-
${s?"opacity-50 cursor-not-allowed":""}
|
|
664
|
-
`,children:o},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:46,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:45,columnNumber:9},this);return ve.jsxDEV("div",{className:"flex flex-wrap items-center gap-2 p-2 border-b border-gray-200 rounded-t-lg bg-gray-50",children:[ve.jsxDEV("div",{className:"flex items-center gap-1",children:[r(ve.jsxDEV(_H,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:66,columnNumber:21},this),()=>t.chain().focus().toggleBold().run(),t.isActive("bold"),!1,"Bold"),r(ve.jsxDEV(QH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:73,columnNumber:21},this),()=>t.chain().focus().toggleItalic().run(),t.isActive("italic"),!1,"Italic"),r(ve.jsxDEV(M5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:80,columnNumber:21},this),()=>t.chain().focus().toggleUnderline().run(),t.isActive("underline"),!1,"Underline"),r(ve.jsxDEV(b5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:87,columnNumber:21},this),()=>t.chain().focus().toggleStrike().run(),t.isActive("strike"),!1,"Strikethrough"),r(ve.jsxDEV(LH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:94,columnNumber:21},this),()=>t.chain().focus().toggleCode().run(),t.isActive("code"),!1,"Code"),r(ve.jsxDEV(C5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:101,columnNumber:21},this),()=>t.chain().focus().toggleSubscript().run(),t.isActive("subscript"),!1,"Subscript"),r(ve.jsxDEV(x5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:108,columnNumber:21},this),()=>t.chain().focus().toggleSuperscript().run(),t.isActive("superscript"),!1,"Superscript")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:64,columnNumber:13},this),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:116,columnNumber:13},this),ve.jsxDEV(k5,{editor:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:119,columnNumber:13},this),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:121,columnNumber:13},this),ve.jsxDEV("div",{className:"flex items-center gap-1",children:[r(ve.jsxDEV(PH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:126,columnNumber:21},this),()=>t.chain().focus().setTextAlign("left").run(),t.isActive({textAlign:"left"}),!1,"Align Left"),r(ve.jsxDEV(MH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:133,columnNumber:21},this),()=>t.chain().focus().setTextAlign("center").run(),t.isActive({textAlign:"center"}),!1,"Align Center"),r(ve.jsxDEV(kH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:140,columnNumber:21},this),()=>t.chain().focus().setTextAlign("right").run(),t.isActive({textAlign:"right"}),!1,"Align Right"),r(ve.jsxDEV(IH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:147,columnNumber:21},this),()=>t.chain().focus().setTextAlign("justify").run(),t.isActive({textAlign:"justify"}),!1,"Align Justify")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:124,columnNumber:13},this),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:155,columnNumber:13},this),ve.jsxDEV("div",{className:"flex items-center gap-1",children:[r(ve.jsxDEV(o5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:160,columnNumber:21},this),()=>t.chain().focus().toggleBulletList().run(),t.isActive("bulletList"),!1,"Bullet List"),r(ve.jsxDEV(n5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:167,columnNumber:21},this),()=>t.chain().focus().toggleOrderedList().run(),t.isActive("orderedList"),!1,"Ordered List"),r(ve.jsxDEV(g5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:174,columnNumber:21},this),()=>t.chain().focus().toggleTaskList().run(),t.isActive("taskList"),!1,"Task List")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:158,columnNumber:13},this),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:182,columnNumber:13},this),ve.jsxDEV("div",{className:"flex items-center gap-1",children:[r(ve.jsxDEV(f5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:187,columnNumber:21},this),()=>t.chain().focus().toggleBlockquote().run(),t.isActive("blockquote"),!1,"Blockquote"),ve.jsxDEV(B5,{editor:t,buttonClass:e,activeClass:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:193,columnNumber:17},this),r(ve.jsxDEV(a5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:195,columnNumber:21},this),()=>t.chain().focus().setHorizontalRule().run(),!1,!1,"Horizontal Rule"),r(ve.jsxDEV(FH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:202,columnNumber:21},this),()=>t.chain().focus().setHardBreak().run(),!1,!1,"Line Break")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:185,columnNumber:13},this),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:210,columnNumber:13},this),ve.jsxDEV("div",{className:"flex items-center gap-1",children:[r(ve.jsxDEV(I5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:215,columnNumber:21},this),()=>t.chain().focus().undo().run(),!1,!t.can().chain().focus().undo().run()),r(ve.jsxDEV(p5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:221,columnNumber:21},this),()=>t.chain().focus().redo().run(),!1,!t.can().chain().focus().redo().run())]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:213,columnNumber:13},this),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:228,columnNumber:13},this),r(ve.jsxDEV(YH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:231,columnNumber:17},this),()=>{const o=prompt("Enter the image URL");o&&t.chain().focus().insertContent({type:"image",attrs:{src:o,width:50,height:50,marginLeft:0,marginRight:0}}).run()},!1,!1,"Insert Image"),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:252,columnNumber:13},this),ve.jsxDEV(A5,{editor:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:255,columnNumber:13},this),ve.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:257,columnNumber:13},this),ve.jsxDEV(j5,{editor:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:258,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:62,columnNumber:9},this)}const L5=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,o;const i=n.getAttribute("style"),a=(o=(r=n.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||o===void 0?void 0:o.getAttribute("style");n.setAttribute("style",`${a};${i}`)})},a0=to.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&L5(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),V5=Hn.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),F5=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,H5=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,W5=to.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Ei({find:F5,type:this.type})]},addPasteRules(){return[Ni({find:H5,type:this.type})]}}),zw=Sn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Zt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),q5=to.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",Zt(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()}}}),K5=to.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",Zt(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()}}});var bh,yh;if(typeof WeakMap<"u"){let t=new WeakMap;bh=e=>t.get(e),yh=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;bh=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},yh=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var Cn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,a=o+1;for(let s=1;i<this.width&&this.map[e+s]==n;s++)i++;for(let s=1;a<this.height&&this.map[e+this.width*s]==n;s++)a++;return{left:r,top:o,right:i,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:o,top:i,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:a==this.height)?null:this.map[r+this.width*(n<0?i-1:a)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:a,right:s,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(o,l),right:Math.max(r,s),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const i=r*this.width+o,a=this.map[i];n[a]||(n[a]=!0,!(o==t.left&&o&&this.map[i-1]==a||r==t.top&&r&&this.map[i-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const s=(t+1)*this.width;for(;a<s&&this.map[a]<o;)a++;return a==s?i-1:this.map[a]}o=i}}static get(t){return bh(t)||yh(t,U5(t))}};function U5(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=G5(t),n=t.childCount,r=[];let o=0,i=null;const a=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==d.childCount)break;const v=d.child(m),{colspan:g,rowspan:y,colwidth:b}=v.attrs;for(let C=0;C<y;C++){if(C+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-C});break}const x=o+C*e;for(let S=0;S<g;S++){r[x+S]==0?r[x+S]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:g-S});const w=b&&b[S];if(w){const E=(x+S)%e*2,M=a[E];M==null||M!=w&&a[E+1]==1?(a[E]=w,a[E+1]=1):M==w&&a[E+1]++}}}o+=g,u+=v.nodeSize}const f=(c+1)*e;let p=0;for(;o<f;)r[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const s=new Cn(e,n,r,i);let l=!1;for(let c=0;!l&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(l=!0);return l&&X5(s,a,t),s}function G5(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let i=0;if(n)for(let a=0;a<r;a++){const s=t.child(a);for(let l=0;l<s.childCount;l++){const c=s.child(l);a+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let a=0;a<o.childCount;a++){const s=o.child(a);i+=s.attrs.colspan,s.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function X5(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(r[i])continue;r[i]=!0;const a=n.nodeAt(i);if(!a)throw new RangeError(`No cell with offset ${i} found`);let s=null;const l=a.attrs;for(let c=0;c<l.colspan;c++){const u=(o+c)%t.width,d=e[u*2];d!=null&&(!l.colwidth||l.colwidth[c]!=d)&&((s||(s=Y5(l)))[c]=d)}s&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}function Y5(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Yn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var Ao=new vr("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 J5(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 Fr(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 Cu(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)||Q5(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Q5(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 Ch(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Z5(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function em(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Lw(t,e,n){const r=t.node(-1),o=Cn.get(r),i=t.start(-1),a=o.nextCell(t.pos-i,e,n);return a==null?null:t.node(0).resolve(i+a)}function Ri(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(o=>o>0)||(r.colwidth=null)),r}function Vw(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function e3(t,e,n){const r=Yn(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var un=class so extends vt{constructor(e,n=e){const r=e.node(-1),o=Cn.get(r),i=e.start(-1),a=o.rectBetween(e.pos-i,n.pos-i),s=e.node(0),l=o.cellsInRect(a).filter(u=>u!=n.pos-i);l.unshift(n.pos-i);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new sy(s.resolve(f),s.resolve(f+d.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)),o=e.resolve(n.map(this.$headCell.pos));if(Ch(r)&&Ch(o)&&em(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?so.rowSelection(r,o):i&&this.isColSelection()?so.colSelection(r,o):new so(r,o)}return gt.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=Cn.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},a=[];for(let l=o.top;l<o.bottom;l++){const c=[];for(let u=l*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const v=o.left-p.left,g=p.right-o.right;if(v>0||g>0){let y=m.attrs;if(v>0&&(y=Ri(y,0,v)),g>0&&(y=Ri(y,y.colspan-g,g)),p.left<o.left){if(m=m.type.createAndFill(y),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(p.top<o.top||p.bottom>o.bottom){const y={...m.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}c.push(m)}a.push(e.child(l).copy(Re.from(c)))}const s=this.isColSelection()&&this.isRowSelection()?e:a;return new Ge(Re.from(s),1,1)}replace(e,n=Ge.empty){const r=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){const{$from:s,$to:l}=o[a],c=e.mapping.slice(r);e.replace(c.map(s.pos),c.map(l.pos),a?Ge.empty:n)}const i=vt.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new Ge(Re.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Cn.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let a=0;a<i.length;a++)e(n.nodeAt(i[a]),o+i[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,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=Cn.get(r),i=e.start(-1),a=o.findCell(e.pos-i),s=o.findCell(n.pos-i),l=e.node(0);return a.top<=s.top?(a.top>0&&(e=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))):(s.top>0&&(n=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(e=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))),new so(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Cn.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const a=o+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,s)==n.width}eq(e){return e instanceof so&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=Cn.get(r),i=e.start(-1),a=o.findCell(e.pos-i),s=o.findCell(n.pos-i),l=e.node(0);return a.left<=s.left?(a.left>0&&(e=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(n=l.resolve(i+o.map[o.width*(s.top+1)-1]))):(s.left>0&&(n=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(e=l.resolve(i+o.map[o.width*(a.top+1)-1]))),new so(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new so(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new so(e.resolve(n),e.resolve(r))}getBookmark(){return new t3(this.$anchorCell.pos,this.$headCell.pos)}};un.prototype.visible=!1;vt.jsonID("cell",un);var t3=class Fw{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Fw(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&&em(n,r)?new un(n,r):vt.near(r,1)}};function n3(t){if(!(t.selection instanceof un))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Zn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),bn.create(t.doc,e)}function r3({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function o3({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function i3(t,e,n){const r=(e||t).selection,o=(e||t).doc;let i,a;if(r instanceof mt&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")i=un.create(o,r.from);else if(a=="row"){const s=o.resolve(r.from+1);i=un.rowSelection(s,s)}else if(!n){const s=Cn.get(r.node),l=r.from+1,c=l+s.map[s.width*s.height-1];i=un.create(o,l+1,c)}}else r instanceof gt&&r3(r)?i=gt.create(o,r.from):r instanceof gt&&o3(r)&&(i=gt.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var a3=new vr("fix-tables");function Hw(t,e,n,r){const o=t.childCount,i=e.childCount;e:for(let a=0,s=0;a<i;a++){const l=e.child(a);for(let c=s,u=Math.min(o,a+3);c<u;c++)if(t.child(c)==l){s=c+1,n+=l.nodeSize;continue e}r(l,n),s<o&&t.child(s).sameMarkup(l)?Hw(t.child(s),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function Ww(t,e){let n;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=s3(t,o,i,n))};return e?e.doc!=t.doc&&Hw(e.doc,t.doc,0,r):t.doc.descendants(r),n}function s3(t,e,n,r){const o=Cn.get(e);if(!o.problems)return r;r||(r=t.tr);const i=[];for(let l=0;l<o.height;l++)i.push(0);for(let l=0;l<o.problems.length;l++){const c=o.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ri(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let a,s;for(let l=0;l<i.length;l++)i[l]&&(a==null&&(a=l),s=l);for(let l=0,c=n+1;l<o.height;l++){const u=e.child(l),d=c+u.nodeSize,f=i[l];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const m=[];for(let g=0;g<f;g++){const y=Yn(t.schema)[p].createAndFill();y&&m.push(y)}const v=(l==0||a==l-1)&&s==l?c+1:d-1;r.insert(r.mapping.map(v),m)}c=d}return r.setMeta(a3,{fixTables:!0})}function oo(t){const e=t.selection,n=Cu(t),r=n.node(-1),o=n.start(-1),i=Cn.get(r);return{...e instanceof un?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function qw(t,{map:e,tableStart:n,table:r},o){let i=o>0?-1:0;e3(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let a=0;a<e.height;a++){const s=a*e.width+o;if(o>0&&o<e.width&&e.map[s-1]==e.map[s]){const l=e.map[s],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,Vw(c.attrs,o-e.colCount(l))),a+=c.attrs.rowspan-1}else{const l=i==null?Yn(r.type.schema).cell:r.nodeAt(e.map[s+i]).type,c=e.positionAt(a,o,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function l3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(qw(t.tr,n,n.left))}return!0}function c3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(qw(t.tr,n,n.right))}return!0}function u3(t,{map:e,table:n,tableStart:r},o){const i=t.mapping.maps.length;for(let a=0;a<e.height;){const s=a*e.width+o,l=e.map[s],c=n.nodeAt(l),u=c.attrs;if(o>0&&e.map[s-1]==l||o<e.width-1&&e.map[s+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(r+l),null,Ri(u,o-e.colCount(l)));else{const d=t.mapping.slice(i).map(r+l);t.delete(d,d+c.nodeSize)}a+=u.rowspan}}function d3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;u3(r,n,o),o!=n.left;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Cn.get(i)}e(r)}return!0}function f3(t,e,n){var r;const o=Yn(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))==null?void 0:r.type)!=o)return!1;return!0}function Kw(t,{map:e,tableStart:n,table:r},o){var i;let a=n;for(let c=0;c<o;c++)a+=r.child(c).nodeSize;const s=[];let l=o>0?-1:0;f3(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=l==null?Yn(r.type.schema).cell:(i=r.nodeAt(e.map[u+l*e.width]))==null?void 0:i.type,f=d==null?void 0:d.createAndFill();f&&s.push(f)}return t.insert(a,Yn(r.type.schema).row.create(null,s)),t}function h3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(Kw(t.tr,n,n.top))}return!0}function p3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(Kw(t.tr,n,n.bottom))}return!0}function m3(t,{map:e,table:n,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=n.child(c).nodeSize;const a=i+n.child(o).nodeSize,s=t.mapping.maps.length;t.delete(i+r,a+r);const l=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),o>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(s).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),v=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(s).map(r+v),m),c+=p.colspan-1}}}}function g3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;m3(r,n,o),o!=n.top;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Cn.get(n.table)}e(r)}return!0}function s0(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function v3({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,a=(r.bottom-1)*t+r.left,s=o+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[s]==n[s+1])return!0;i+=t,s+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[a]==n[a+t])return!0;o++,a++}return!1}function l0(t,e){const n=t.selection;if(!(n instanceof un)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=oo(t),{map:o}=r;if(v3(o,r))return!1;if(e){const i=t.tr,a={};let s=Re.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=o.map[u*o.width+d],p=r.table.nodeAt(f);if(!(a[f]||!p))if(a[f]=!0,l==null)l=f,c=p;else{s0(p)||(s=s.append(p.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+p.nodeSize)}}if(l==null||c==null)return!0;if(i.setNodeMarkup(l+r.tableStart,null,{...Vw(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),s.size){const u=l+1+c.content.size,d=s0(c)?l+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,s)}i.setSelection(new un(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function c0(t,e){const n=Yn(t.schema);return b3(({node:r})=>n[r.type.spec.tableRole])(t,e)}function b3(t){return(e,n)=>{var r;const o=e.selection;let i,a;if(o instanceof un){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,a=o.$anchorCell.pos}else{if(i=J5(o.$from),!i)return!1;a=(r=Ra(o.$from))==null?void 0:r.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let s=i.attrs;const l=[],c=s.colwidth;s.rowspan>1&&(s={...s,rowspan:1}),s.colspan>1&&(s={...s,colspan:1});const u=oo(e),d=e.tr;for(let p=0;p<u.right-u.left;p++)l.push(c?{...s,colwidth:c&&c[p]?[c[p]]:null}:s);let f;for(let p=u.top;p<u.bottom;p++){let m=u.map.positionAt(p,u.left,u.table);p==u.top&&(m+=i.nodeSize);for(let v=u.left,g=0;v<u.right;v++,g++)v==u.left&&p==u.top||d.insert(f=d.mapping.map(m+u.tableStart,1),t({node:i,row:p,col:v}).createAndFill(l[g]))}d.setNodeMarkup(a,t({node:i,row:u.top,col:u.left}),l[0]),o instanceof un&&d.setSelection(new un(d.doc.resolve(o.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function y3(t,e){return function(n,r){if(!Fr(n))return!1;const o=Cu(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof un?n.selection.forEachCell((a,s)=>{a.attrs[t]!==e&&i.setNodeMarkup(s,null,{...a.attrs,[t]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function C3(t){return function(e,n){if(!Fr(e))return!1;if(n){const r=Yn(e.schema),o=oo(e),i=e.tr,a=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),s=a.map(l=>o.table.nodeAt(l));for(let l=0;l<a.length;l++)s[l].type==r.header_cell&&i.setNodeMarkup(o.tableStart+a[l],r.cell,s[l].attrs);if(i.steps.length==0)for(let l=0;l<a.length;l++)i.setNodeMarkup(o.tableStart+a[l],r.header_cell,s[l].attrs);n(i)}return!0}}function u0(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 o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ns(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?C3(t):function(n,r){if(!Fr(n))return!1;if(r){const o=Yn(n.schema),i=oo(n),a=n.tr,s=u0("row",i,o),l=u0("column",i,o),u=(t==="column"?s:t==="row"?l:!1)?1:0,d=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?l?o.cell:o.header_cell:t=="row"?s?o.cell:o.header_cell:o.cell;i.map.cellsInRect(d).forEach(p=>{const m=p+i.tableStart,v=a.doc.nodeAt(m);v&&a.setNodeMarkup(m,f,v.attrs)}),r(a)}return!0}}Ns("row",{useDeprecatedLogic:!0});Ns("column",{useDeprecatedLogic:!0});var S3=Ns("cell",{useDeprecatedLogic:!0});function x3(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const i=t.node(-1).child(r),a=i.lastChild;if(a)return o-1-a.nodeSize;o-=i.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),o=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function d0(t){return function(e,n){if(!Fr(e))return!1;const r=x3(Cu(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(gt.between(o,Z5(o))).scrollIntoView())}return!0}}function w3(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 Sl(t,e){const n=t.selection;if(!(n instanceof un))return!1;if(e){const r=t.tr,o=Yn(t.schema).cell.createAndFill().content;n.forEachCell((i,a)=>{i.content.eq(o)||r.replace(r.mapping.map(a+1),r.mapping.map(a+i.nodeSize-1),new Ge(o,0,0))}),r.docChanged&&e(r)}return!0}function E3(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 o=e.child(0),i=o.type.spec.tableRole,a=o.type.schema,s=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Sh(Yn(a).row,new Ge(c,u,d)).content),s.push(c)}else if(i=="cell"||i=="header_cell")s.push(n||r?Sh(Yn(a).row,new Ge(e,n,r)).content:e);else return null;return N3(a,s)}function N3(t,e){const n=[];for(let o=0;o<e.length;o++){const i=e[o];for(let a=i.childCount-1;a>=0;a--){const{rowspan:s,colspan:l}=i.child(a).attrs;for(let c=o;c<o+s;c++)n[c]=(n[c]||0)+l}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(Re.empty),n[o]<r){const i=Yn(t).cell.createAndFill(),a=[];for(let s=n[o];s<r;s++)a.push(i);e[o]=e[o].append(Re.from(a))}return{height:e.length,width:r,rows:e}}function Sh(t,e){const n=t.createAndFill();return new ay(n).replace(0,n.content.size,e).doc}function O3({width:t,height:e,rows:n},r,o){if(t!=r){const i=[],a=[];for(let s=0;s<n.length;s++){const l=n[s],c=[];for(let u=i[s]||0,d=0;u<r;d++){let f=l.child(d%l.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Ri(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[s+p]=(i[s+p]||0)+f.attrs.colspan}a.push(Re.from(c))}n=a,t=r}if(e!=o){const i=[];for(let a=0,s=0;a<o;a++,s++){const l=[],c=n[s%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);a+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),l.push(d)}i.push(Re.from(l))}n=i,e=o}return{width:t,height:e,rows:n}}function $3(t,e,n,r,o,i,a){const s=t.doc.type.schema,l=Yn(s);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const p=n.child(d);f+=p.nodeSize;const m=[];let v;p.lastChild==null||p.lastChild.type==l.cell?v=c||(c=l.cell.createAndFill()):v=u||(u=l.header_cell.createAndFill());for(let g=e.width;g<o;g++)m.push(v);t.insert(t.mapping.slice(a).map(f-1+r),m)}if(i>e.height){const d=[];for(let m=0,v=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const g=m>=e.width?!1:n.nodeAt(e.map[v+m]).type==l.header_cell;d.push(g?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const f=l.row.create(null,Re.from(d)),p=[];for(let m=e.height;m<i;m++)p.push(f);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),p)}return!!(c||u)}function f0(t,e,n,r,o,i,a,s){if(a==0||a==e.height)return!1;let l=!1;for(let c=o;c<i;c++){const u=a*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const f=n.nodeAt(d),{top:p,left:m}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(s).map(d+r),null,{...f.attrs,rowspan:a-p}),t.insert(t.mapping.slice(s).map(e.positionAt(a,m,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-a})),c+=f.attrs.colspan-1}}return l}function h0(t,e,n,r,o,i,a,s){if(a==0||a==e.width)return!1;let l=!1;for(let c=o;c<i;c++){const u=c*e.width+a,d=e.map[u];if(e.map[u-1]==d){l=!0;const f=n.nodeAt(d),p=e.colCount(d),m=t.mapping.slice(s).map(d+r);t.setNodeMarkup(m,null,Ri(f.attrs,a-p,f.attrs.colspan-(a-p))),t.insert(m+f.nodeSize,f.type.createAndFill(Ri(f.attrs,0,a-p))),c+=f.attrs.rowspan-1}}return l}function p0(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let a=Cn.get(i);const{top:s,left:l}=r,c=l+o.width,u=s+o.height,d=t.tr;let f=0;function p(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");a=Cn.get(i),f=d.mapping.maps.length}$3(d,a,i,n,c,u,f)&&p(),f0(d,a,i,n,l,c,s,f)&&p(),f0(d,a,i,n,l,c,u,f)&&p(),h0(d,a,i,n,s,u,l,f)&&p(),h0(d,a,i,n,s,u,c,f)&&p();for(let m=s;m<u;m++){const v=a.positionAt(m,l,i),g=a.positionAt(m,c,i);d.replace(d.mapping.slice(f).map(v+n),d.mapping.slice(f).map(g+n),new Ge(o.rows[m-s],0,0))}p(),d.setSelection(new un(d.doc.resolve(n+a.positionAt(s,l,i)),d.doc.resolve(n+a.positionAt(u-1,c-1,i)))),e(d)}var M3=Bh({ArrowLeft:xl("horiz",-1),ArrowRight:xl("horiz",1),ArrowUp:xl("vert",-1),ArrowDown:xl("vert",1),"Shift-ArrowLeft":wl("horiz",-1),"Shift-ArrowRight":wl("horiz",1),"Shift-ArrowUp":wl("vert",-1),"Shift-ArrowDown":wl("vert",1),Backspace:Sl,"Mod-Backspace":Sl,Delete:Sl,"Mod-Delete":Sl});function ql(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function xl(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof un)return ql(n,r,vt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const a=Uw(o,t,e);if(a==null)return!1;if(t=="horiz")return ql(n,r,vt.near(n.doc.resolve(i.head+e),e));{const s=n.doc.resolve(a),l=Lw(s,t,e);let c;return l?c=vt.near(l,1):e<0?c=vt.near(n.doc.resolve(s.before(-1)),-1):c=vt.near(n.doc.resolve(s.after(-1)),1),ql(n,r,c)}}}function wl(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let a;if(i instanceof un)a=i;else{const l=Uw(o,t,e);if(l==null)return!1;a=new un(n.doc.resolve(l))}const s=Lw(a.$headCell,t,e);return s?ql(n,r,new un(a.$anchorCell,s)):!1}}function R3(t,e){const n=t.state.doc,r=Ra(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new un(r))),!0):!1}function I3(t,e,n){if(!Fr(t.state))return!1;let r=E3(n);const o=t.state.selection;if(o instanceof un){r||(r={width:1,height:1,rows:[Re.from(Sh(Yn(t.state.schema).cell,n))]});const i=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),s=Cn.get(i).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=O3(r,s.right-s.left,s.bottom-s.top),p0(t.state,t.dispatch,a,s,r),!0}else if(r){const i=Cu(t.state),a=i.start(-1);return p0(t.state,t.dispatch,a,Cn.get(i.node(-1)).findCell(i.pos-a),r),!0}else return!1}function T3(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=m0(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof un)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Ra(t.state.selection.$anchor))!=null&&((n=Ad(t,e))==null?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(l,c){let u=Ad(t,c);const d=Ao.getState(t.state)==null;if(!u||!em(l,u))if(d)u=l;else return;const f=new un(l,u);if(d||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);d&&p.setMeta(Ao,l.pos),t.dispatch(p)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",s),Ao.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ao,-1))}function s(l){const c=l,u=Ao.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(m0(t,c.target)!=r&&(d=Ad(t,e),!d))return a();d&&i(d,c)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",s)}function Uw(t,e,n){if(!(t.state.selection instanceof gt))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=r.before(o),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?s:null}}return null}function m0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ad(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Ra(t.state.doc.resolve(n.pos)):null}var P3=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")),xh(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,xh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function xh(t,e,n,r,o,i){var a;let s=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let v=0;v<p;v++,f++){const g=o==f?i:m&&m[v],y=g?g+"px":"";if(s+=g||r,g||(l=!1),c)c.style.width!=y&&(c.style.width=y),c=c.nextSibling;else{const b=document.createElement("col");b.style.width=y,e.appendChild(b)}}}for(;c;){const d=c.nextSibling;(a=c.parentNode)==null||a.removeChild(c),c=d}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var fr=new vr("tableColumnResizing");function A3({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=P3,lastColumnResizable:o=!0}={}){const i=new Qn({key:fr,state:{init(a,s){var l,c;const u=(c=(l=i.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,d=Yn(s.schema).table.name;return r&&u&&(u[d]=(f,p)=>new r(f,n,p)),new k3(-1,!1)},apply(a,s){return s.apply(a)}},props:{attributes:a=>{const s=fr.getState(a);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,s)=>{D3(a,s,t,o)},mouseleave:a=>{_3(a)},mousedown:(a,s)=>{B3(a,s,e,n)}},decorations:a=>{const s=fr.getState(a);if(s&&s.activeHandle>-1)return F3(a,s.activeHandle)},nodeViews:{}}});return i}var k3=class Kl{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(fr);if(r&&r.setHandle!=null)return new Kl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Kl(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Ch(e.doc.resolve(o))||(o=-1),new Kl(o,n.dragging)}return n}};function D3(t,e,n,r){if(!t.editable)return;const o=fr.getState(t.state);if(o&&!o.dragging){const i=z3(e.target);let a=-1;if(i){const{left:s,right:l}=i.getBoundingClientRect();e.clientX-s<=n?a=g0(t,e,"left",n):l-e.clientX<=n&&(a=g0(t,e,"right",n))}if(a!=o.activeHandle){if(!r&&a!==-1){const s=t.state.doc.resolve(a),l=s.node(-1),c=Cn.get(l),u=s.start(-1);if(c.colCount(s.pos-u)+s.nodeAfter.attrs.colspan-1==c.width-1)return}Gw(t,a)}}}function _3(t){if(!t.editable)return;const e=fr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Gw(t,-1)}function B3(t,e,n,r){var o;if(!t.editable)return!1;const i=(o=t.dom.ownerDocument.defaultView)!=null?o:window,a=fr.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const s=t.state.doc.nodeAt(a.activeHandle),l=j3(t,a.activeHandle,s.attrs);t.dispatch(t.state.tr.setMeta(fr,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=fr.getState(t.state);f!=null&&f.dragging&&(L3(t,f.activeHandle,v0(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(fr,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=fr.getState(t.state);if(f&&f.dragging){const p=v0(f.dragging,d,n);b0(t,f.activeHandle,p,r)}}return b0(t,a.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function j3(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=t.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(s-=r[c],l--);return s/l}function z3(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function g0(t,e,n,r){const o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:a}=i,s=Ra(t.state.doc.resolve(a));if(!s)return-1;if(n=="right")return s.pos;const l=Cn.get(s.node(-1)),c=s.start(-1),u=l.map.indexOf(s.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function v0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Gw(t,e){t.dispatch(t.state.tr.setMeta(fr,{setHandle:e}))}function L3(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),i=Cn.get(o),a=r.start(-1),s=i.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+s;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=o.nodeAt(d).attrs,p=f.colspan==1?0:s-i.colCount(d);if(f.colwidth&&f.colwidth[p]==n)continue;const m=f.colwidth?f.colwidth.slice():V3(f.colspan);m[p]=n,l.setNodeMarkup(a+d,null,{...f,colwidth:m})}l.docChanged&&t.dispatch(l)}function b0(t,e,n,r){const o=t.state.doc.resolve(e),i=o.node(-1),a=o.start(-1),s=Cn.get(i).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let l=t.domAtPos(o.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&xh(i,l.firstChild,l,r,s,n)}function V3(t){return Array(t).fill(0)}function F3(t,e){var n;const r=[],o=t.doc.resolve(e),i=o.node(-1);if(!i)return bn.empty;const a=Cn.get(i),s=o.start(-1),l=a.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<a.height;c++){const u=l+c*a.width;if((l==a.width-1||a.map[u]!=a.map[u+1])&&(c==0||a.map[u]!=a.map[u-a.width])){const d=a.map[u],f=s+d+i.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=fr.getState(t))!=null&&n.dragging&&r.push(Zn.node(s+d,s+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Zn.widget(f,p))}}return bn.create(t.doc,r)}function H3({allowTableNodeSelection:t=!1}={}){return new Qn({key:Ao,state:{init(){return null},apply(e,n){const r=e.getMeta(Ao);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:n3,handleDOMEvents:{mousedown:T3},createSelectionBetween(e){return Ao.getState(e.state)!=null?e.state.selection:null},handleTripleClick:R3,handleKeyDown:M3,handlePaste:I3},appendTransaction(e,n,r){return i3(r,Ww(r,n),t)}})}function wh(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function y0(t,e,n,r,o,i){var a;let s=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let v=0;v<p;v+=1,f+=1){const g=o===f?i:m&&m[v],y=g?`${g}px`:"";if(s+=g||r,g||(l=!1),c){if(c.style.width!==y){const[b,C]=wh(r,g);c.style.setProperty(b,C)}c=c.nextSibling}else{const b=document.createElement("col"),[C,x]=wh(r,g);b.style.setProperty(C,x),e.appendChild(b)}}}for(;c;){const d=c.nextSibling;(a=c.parentNode)===null||a===void 0||a.removeChild(c),c=d}l?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class W3{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")),y0(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,y0(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function q3(t,e,n,r){let o=0,i=!0;const a=[],s=t.firstChild;if(!s)return{};for(let d=0,f=0;d<s.childCount;d+=1){const{colspan:p,colwidth:m}=s.child(d).attrs;for(let v=0;v<p;v+=1,f+=1){const g=n===f?r:m&&m[v];o+=g||e,g||(i=!1);const[y,b]=wh(e,g);a.push(["col",{style:`${y}: ${b}`}])}}const l=i?`${o}px`:"",c=i?"":`${o}px`;return{colgroup:["colgroup",{},...a],tableWidth:l,tableMinWidth:c}}function C0(t,e){return t.createAndFill()}function K3(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 U3(t,e,n,r,o){const i=K3(t),a=[],s=[];for(let c=0;c<n;c+=1){const u=C0(i.cell);if(u&&s.push(u),r){const d=C0(i.header_cell);d&&a.push(d)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?a:s));return i.table.createChecked(null,l)}function G3(t){return t instanceof un}const El=({editor:t})=>{const{selection:e}=t.state;if(!G3(e))return!1;let n=0;const r=fC(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},X3=Sn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:W3,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:o}=q3(t,this.options.cellMinWidth);return["table",Zt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{const a=U3(i.schema,t,e,n);if(o){const s=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(gt.near(r.doc.resolve(s)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>l3(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>c3(t,e),deleteColumn:()=>({state:t,dispatch:e})=>d3(t,e),addRowBefore:()=>({state:t,dispatch:e})=>h3(t,e),addRowAfter:()=>({state:t,dispatch:e})=>p3(t,e),deleteRow:()=>({state:t,dispatch:e})=>g3(t,e),deleteTable:()=>({state:t,dispatch:e})=>w3(t,e),mergeCells:()=>({state:t,dispatch:e})=>l0(t,e),splitCell:()=>({state:t,dispatch:e})=>c0(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Ns("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Ns("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>S3(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>l0(t,e)?!0:c0(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>y3(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>d0(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>d0(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Ww(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=un.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:El,"Mod-Backspace":El,Delete:El,"Mod-Delete":El}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[A3({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],H3({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Mt(ut(t,"tableRole",e))}}}),Y3=Sn.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",Zt(this.options.HTMLAttributes,t),0]}}),J3=Sn.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",Zt(this.options.HTMLAttributes,t),0]}}),Q3=Sn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Zt(this.options.HTMLAttributes,t),0]}}),Z3=/^\s*(\[([( |x])?\])\s$/,e4=Sn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Zt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),a=document.createElement("span"),s=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",s.type="checkbox",s.addEventListener("mousedown",c=>c.preventDefault()),s.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}const{checked:u}=c.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const f=n();if(typeof f!="number")return!1;const p=d.doc.nodeAt(f);return d.setNodeMarkup(f,void 0,{...p==null?void 0:p.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{o.setAttribute(c,u)}),o.dataset.checked=t.attrs.checked,s.checked=t.attrs.checked,i.append(s,a),o.append(i,l),Object.entries(e).forEach(([c,u])=>{o.setAttribute(c,u)}),{dom:o,contentDOM:l,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,s.checked=c.attrs.checked,!0)}}},addInputRules(){return[fa({find:Z3,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),t4=Sn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Zt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),n4=Hn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),r4=to.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),o4=/^\s*>\s$/,i4=Sn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[fa({find:o4,type:this.type})]}}),a4=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,s4=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,l4=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,c4=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,u4=to.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ei({find:a4,type:this.type}),Ei({find:l4,type:this.type})]},addPasteRules(){return[Ni({find:s4,type:this.type}),Ni({find:c4,type:this.type})]}}),d4="listItem",S0="textStyle",x0=/^\s*([-+*])\s$/,f4=Sn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(d4,this.editor.getAttributes(S0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fa({find:x0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fa({find:x0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(S0),editor:this.editor})),[t]}}),h4=/(^|[^`])`([^`]+)`(?!`)/,p4=/(^|[^`])`([^`]+)`(?!`)/g,m4=to.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ei({find:h4,type:this.type})]},addPasteRules(){return[Ni({find:p4,type:this.type})]}}),g4=/^```([a-z]+)?[\s\n]$/,v4=/^~~~([a-z]+)?[\s\n]$/,b4=Sn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,i=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Zt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
|
|
663
|
+
${s?"ce:opacity-50 ce:cursor-not-allowed":""}
|
|
664
|
+
`,children:o},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:47,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:46,columnNumber:9},this);return ve.jsxDEV("div",{className:"ce:flex ce:flex-wrap ce:items-center ce:gap-2 ce:p-2 ce:border-b ce:border-gray-200 ce:rounded-t-lg ce:bg-gray-50",children:[ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-1",children:[r(ve.jsxDEV(_H,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:67,columnNumber:21},this),()=>t.chain().focus().toggleBold().run(),t.isActive("bold"),!1,"Bold"),r(ve.jsxDEV(QH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:74,columnNumber:21},this),()=>t.chain().focus().toggleItalic().run(),t.isActive("italic"),!1,"Italic"),r(ve.jsxDEV(M5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:81,columnNumber:21},this),()=>t.chain().focus().toggleUnderline().run(),t.isActive("underline"),!1,"Underline"),r(ve.jsxDEV(b5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:88,columnNumber:21},this),()=>t.chain().focus().toggleStrike().run(),t.isActive("strike"),!1,"Strikethrough"),r(ve.jsxDEV(LH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:95,columnNumber:21},this),()=>t.chain().focus().toggleCode().run(),t.isActive("code"),!1,"Code"),r(ve.jsxDEV(C5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:102,columnNumber:21},this),()=>t.chain().focus().toggleSubscript().run(),t.isActive("subscript"),!1,"Subscript"),r(ve.jsxDEV(x5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:109,columnNumber:21},this),()=>t.chain().focus().toggleSuperscript().run(),t.isActive("superscript"),!1,"Superscript")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:65,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:117,columnNumber:13},this),ve.jsxDEV(k5,{editor:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:120,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:122,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-1",children:[r(ve.jsxDEV(PH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:127,columnNumber:21},this),()=>t.chain().focus().setTextAlign("left").run(),t.isActive({textAlign:"left"}),!1,"Align Left"),r(ve.jsxDEV(MH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:134,columnNumber:21},this),()=>t.chain().focus().setTextAlign("center").run(),t.isActive({textAlign:"center"}),!1,"Align Center"),r(ve.jsxDEV(kH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:141,columnNumber:21},this),()=>t.chain().focus().setTextAlign("right").run(),t.isActive({textAlign:"right"}),!1,"Align Right"),r(ve.jsxDEV(IH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:148,columnNumber:21},this),()=>t.chain().focus().setTextAlign("justify").run(),t.isActive({textAlign:"justify"}),!1,"Align Justify")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:125,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:156,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-1",children:[r(ve.jsxDEV(o5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:161,columnNumber:21},this),()=>t.chain().focus().toggleBulletList().run(),t.isActive("bulletList"),!1,"Bullet List"),r(ve.jsxDEV(n5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:168,columnNumber:21},this),()=>t.chain().focus().toggleOrderedList().run(),t.isActive("orderedList"),!1,"Ordered List"),r(ve.jsxDEV(g5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:175,columnNumber:21},this),()=>t.chain().focus().toggleTaskList().run(),t.isActive("taskList"),!1,"Task List")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:159,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:183,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-1",children:[r(ve.jsxDEV(f5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:188,columnNumber:21},this),()=>t.chain().focus().toggleBlockquote().run(),t.isActive("blockquote"),!1,"Blockquote"),ve.jsxDEV(B5,{editor:t,buttonClass:e,activeClass:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:194,columnNumber:17},this),r(ve.jsxDEV(a5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:200,columnNumber:21},this),()=>t.chain().focus().setHorizontalRule().run(),!1,!1,"Horizontal Rule"),r(ve.jsxDEV(FH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:207,columnNumber:21},this),()=>t.chain().focus().setHardBreak().run(),!1,!1,"Line Break")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:186,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:215,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:gap-1",children:[r(ve.jsxDEV(I5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:220,columnNumber:21},this),()=>t.chain().focus().undo().run(),!1,!t.can().chain().focus().undo().run()),r(ve.jsxDEV(p5,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:226,columnNumber:21},this),()=>t.chain().focus().redo().run(),!1,!t.can().chain().focus().redo().run())]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:218,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:233,columnNumber:13},this),r(ve.jsxDEV(YH,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:236,columnNumber:17},this),()=>{const o=prompt("Enter the image URL");o&&t.chain().focus().insertContent({type:"image",attrs:{src:o,width:50,height:50,marginLeft:0,marginRight:0}}).run()},!1,!1,"Insert Image"),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:261,columnNumber:13},this),ve.jsxDEV(A5,{editor:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:264,columnNumber:13},this),ve.jsxDEV("div",{className:"ce:h-5 ce:w-[1px] ce:bg-gray-300 ce:mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:266,columnNumber:13},this),ve.jsxDEV(j5,{editor:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:267,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/toolbar/index.tsx",lineNumber:63,columnNumber:9},this)}const L5=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,o;const i=n.getAttribute("style"),a=(o=(r=n.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||o===void 0?void 0:o.getAttribute("style");n.setAttribute("style",`${a};${i}`)})},a0=to.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&L5(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(i=>!!i))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),V5=Hn.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),F5=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,H5=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,W5=to.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Ei({find:F5,type:this.type})]},addPasteRules(){return[Ni({find:H5,type:this.type})]}}),zw=Sn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Zt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),q5=to.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",Zt(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()}}}),K5=to.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",Zt(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()}}});var bh,yh;if(typeof WeakMap<"u"){let t=new WeakMap;bh=e=>t.get(e),yh=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;bh=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},yh=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var Cn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,a=o+1;for(let s=1;i<this.width&&this.map[e+s]==n;s++)i++;for(let s=1;a<this.height&&this.map[e+this.width*s]==n;s++)a++;return{left:r,top:o,right:i,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:o,top:i,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:a==this.height)?null:this.map[r+this.width*(n<0?i-1:a)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:a,right:s,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(o,l),right:Math.max(r,s),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const i=r*this.width+o,a=this.map[i];n[a]||(n[a]=!0,!(o==t.left&&o&&this.map[i-1]==a||r==t.top&&r&&this.map[i-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const s=(t+1)*this.width;for(;a<s&&this.map[a]<o;)a++;return a==s?i-1:this.map[a]}o=i}}static get(t){return bh(t)||yh(t,U5(t))}};function U5(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=G5(t),n=t.childCount,r=[];let o=0,i=null;const a=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==d.childCount)break;const v=d.child(m),{colspan:g,rowspan:y,colwidth:b}=v.attrs;for(let C=0;C<y;C++){if(C+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-C});break}const x=o+C*e;for(let S=0;S<g;S++){r[x+S]==0?r[x+S]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:g-S});const w=b&&b[S];if(w){const E=(x+S)%e*2,M=a[E];M==null||M!=w&&a[E+1]==1?(a[E]=w,a[E+1]=1):M==w&&a[E+1]++}}}o+=g,u+=v.nodeSize}const f=(c+1)*e;let p=0;for(;o<f;)r[o++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const s=new Cn(e,n,r,i);let l=!1;for(let c=0;!l&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(l=!0);return l&&X5(s,a,t),s}function G5(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let i=0;if(n)for(let a=0;a<r;a++){const s=t.child(a);for(let l=0;l<s.childCount;l++){const c=s.child(l);a+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let a=0;a<o.childCount;a++){const s=o.child(a);i+=s.attrs.colspan,s.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function X5(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(r[i])continue;r[i]=!0;const a=n.nodeAt(i);if(!a)throw new RangeError(`No cell with offset ${i} found`);let s=null;const l=a.attrs;for(let c=0;c<l.colspan;c++){const u=(o+c)%t.width,d=e[u*2];d!=null&&(!l.colwidth||l.colwidth[c]!=d)&&((s||(s=Y5(l)))[c]=d)}s&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}function Y5(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Yn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var Ao=new vr("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 J5(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 Fr(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 Cu(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)||Q5(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Q5(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 Ch(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Z5(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function em(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Lw(t,e,n){const r=t.node(-1),o=Cn.get(r),i=t.start(-1),a=o.nextCell(t.pos-i,e,n);return a==null?null:t.node(0).resolve(i+a)}function Ri(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(o=>o>0)||(r.colwidth=null)),r}function Vw(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function e3(t,e,n){const r=Yn(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var un=class so extends vt{constructor(e,n=e){const r=e.node(-1),o=Cn.get(r),i=e.start(-1),a=o.rectBetween(e.pos-i,n.pos-i),s=e.node(0),l=o.cellsInRect(a).filter(u=>u!=n.pos-i);l.unshift(n.pos-i);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new sy(s.resolve(f),s.resolve(f+d.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)),o=e.resolve(n.map(this.$headCell.pos));if(Ch(r)&&Ch(o)&&em(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?so.rowSelection(r,o):i&&this.isColSelection()?so.colSelection(r,o):new so(r,o)}return gt.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=Cn.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},a=[];for(let l=o.top;l<o.bottom;l++){const c=[];for(let u=l*n.width+o.left,d=o.left;d<o.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const v=o.left-p.left,g=p.right-o.right;if(v>0||g>0){let y=m.attrs;if(v>0&&(y=Ri(y,0,v)),g>0&&(y=Ri(y,y.colspan-g,g)),p.left<o.left){if(m=m.type.createAndFill(y),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(p.top<o.top||p.bottom>o.bottom){const y={...m.attrs,rowspan:Math.min(p.bottom,o.bottom)-Math.max(p.top,o.top)};p.top<o.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}c.push(m)}a.push(e.child(l).copy(Re.from(c)))}const s=this.isColSelection()&&this.isRowSelection()?e:a;return new Ge(Re.from(s),1,1)}replace(e,n=Ge.empty){const r=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){const{$from:s,$to:l}=o[a],c=e.mapping.slice(r);e.replace(c.map(s.pos),c.map(l.pos),a?Ge.empty:n)}const i=vt.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new Ge(Re.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Cn.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let a=0;a<i.length;a++)e(n.nodeAt(i[a]),o+i[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,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=Cn.get(r),i=e.start(-1),a=o.findCell(e.pos-i),s=o.findCell(n.pos-i),l=e.node(0);return a.top<=s.top?(a.top>0&&(e=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))):(s.top>0&&(n=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(e=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))),new so(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Cn.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const a=o+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,s)==n.width}eq(e){return e instanceof so&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=Cn.get(r),i=e.start(-1),a=o.findCell(e.pos-i),s=o.findCell(n.pos-i),l=e.node(0);return a.left<=s.left?(a.left>0&&(e=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(n=l.resolve(i+o.map[o.width*(s.top+1)-1]))):(s.left>0&&(n=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(e=l.resolve(i+o.map[o.width*(a.top+1)-1]))),new so(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new so(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new so(e.resolve(n),e.resolve(r))}getBookmark(){return new t3(this.$anchorCell.pos,this.$headCell.pos)}};un.prototype.visible=!1;vt.jsonID("cell",un);var t3=class Fw{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Fw(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&&em(n,r)?new un(n,r):vt.near(r,1)}};function n3(t){if(!(t.selection instanceof un))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Zn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),bn.create(t.doc,e)}function r3({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function o3({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function i3(t,e,n){const r=(e||t).selection,o=(e||t).doc;let i,a;if(r instanceof mt&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")i=un.create(o,r.from);else if(a=="row"){const s=o.resolve(r.from+1);i=un.rowSelection(s,s)}else if(!n){const s=Cn.get(r.node),l=r.from+1,c=l+s.map[s.width*s.height-1];i=un.create(o,l+1,c)}}else r instanceof gt&&r3(r)?i=gt.create(o,r.from):r instanceof gt&&o3(r)&&(i=gt.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var a3=new vr("fix-tables");function Hw(t,e,n,r){const o=t.childCount,i=e.childCount;e:for(let a=0,s=0;a<i;a++){const l=e.child(a);for(let c=s,u=Math.min(o,a+3);c<u;c++)if(t.child(c)==l){s=c+1,n+=l.nodeSize;continue e}r(l,n),s<o&&t.child(s).sameMarkup(l)?Hw(t.child(s),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function Ww(t,e){let n;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=s3(t,o,i,n))};return e?e.doc!=t.doc&&Hw(e.doc,t.doc,0,r):t.doc.descendants(r),n}function s3(t,e,n,r){const o=Cn.get(e);if(!o.problems)return r;r||(r=t.tr);const i=[];for(let l=0;l<o.height;l++)i.push(0);for(let l=0;l<o.problems.length;l++){const c=o.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ri(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let a,s;for(let l=0;l<i.length;l++)i[l]&&(a==null&&(a=l),s=l);for(let l=0,c=n+1;l<o.height;l++){const u=e.child(l),d=c+u.nodeSize,f=i[l];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const m=[];for(let g=0;g<f;g++){const y=Yn(t.schema)[p].createAndFill();y&&m.push(y)}const v=(l==0||a==l-1)&&s==l?c+1:d-1;r.insert(r.mapping.map(v),m)}c=d}return r.setMeta(a3,{fixTables:!0})}function oo(t){const e=t.selection,n=Cu(t),r=n.node(-1),o=n.start(-1),i=Cn.get(r);return{...e instanceof un?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function qw(t,{map:e,tableStart:n,table:r},o){let i=o>0?-1:0;e3(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let a=0;a<e.height;a++){const s=a*e.width+o;if(o>0&&o<e.width&&e.map[s-1]==e.map[s]){const l=e.map[s],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,Vw(c.attrs,o-e.colCount(l))),a+=c.attrs.rowspan-1}else{const l=i==null?Yn(r.type.schema).cell:r.nodeAt(e.map[s+i]).type,c=e.positionAt(a,o,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function l3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(qw(t.tr,n,n.left))}return!0}function c3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(qw(t.tr,n,n.right))}return!0}function u3(t,{map:e,table:n,tableStart:r},o){const i=t.mapping.maps.length;for(let a=0;a<e.height;){const s=a*e.width+o,l=e.map[s],c=n.nodeAt(l),u=c.attrs;if(o>0&&e.map[s-1]==l||o<e.width-1&&e.map[s+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(r+l),null,Ri(u,o-e.colCount(l)));else{const d=t.mapping.slice(i).map(r+l);t.delete(d,d+c.nodeSize)}a+=u.rowspan}}function d3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;u3(r,n,o),o!=n.left;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Cn.get(i)}e(r)}return!0}function f3(t,e,n){var r;const o=Yn(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))==null?void 0:r.type)!=o)return!1;return!0}function Kw(t,{map:e,tableStart:n,table:r},o){var i;let a=n;for(let c=0;c<o;c++)a+=r.child(c).nodeSize;const s=[];let l=o>0?-1:0;f3(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=l==null?Yn(r.type.schema).cell:(i=r.nodeAt(e.map[u+l*e.width]))==null?void 0:i.type,f=d==null?void 0:d.createAndFill();f&&s.push(f)}return t.insert(a,Yn(r.type.schema).row.create(null,s)),t}function h3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(Kw(t.tr,n,n.top))}return!0}function p3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t);e(Kw(t.tr,n,n.bottom))}return!0}function m3(t,{map:e,table:n,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=n.child(c).nodeSize;const a=i+n.child(o).nodeSize,s=t.mapping.maps.length;t.delete(i+r,a+r);const l=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),o>0&&d==e.map[u-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(s).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const f=n.nodeAt(d),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),v=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(s).map(r+v),m),c+=p.colspan-1}}}}function g3(t,e){if(!Fr(t))return!1;if(e){const n=oo(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;m3(r,n,o),o!=n.top;o--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Cn.get(n.table)}e(r)}return!0}function s0(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function v3({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,a=(r.bottom-1)*t+r.left,s=o+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[s]==n[s+1])return!0;i+=t,s+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[a]==n[a+t])return!0;o++,a++}return!1}function l0(t,e){const n=t.selection;if(!(n instanceof un)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=oo(t),{map:o}=r;if(v3(o,r))return!1;if(e){const i=t.tr,a={};let s=Re.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=o.map[u*o.width+d],p=r.table.nodeAt(f);if(!(a[f]||!p))if(a[f]=!0,l==null)l=f,c=p;else{s0(p)||(s=s.append(p.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+p.nodeSize)}}if(l==null||c==null)return!0;if(i.setNodeMarkup(l+r.tableStart,null,{...Vw(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),s.size){const u=l+1+c.content.size,d=s0(c)?l+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,s)}i.setSelection(new un(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function c0(t,e){const n=Yn(t.schema);return b3(({node:r})=>n[r.type.spec.tableRole])(t,e)}function b3(t){return(e,n)=>{var r;const o=e.selection;let i,a;if(o instanceof un){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,a=o.$anchorCell.pos}else{if(i=J5(o.$from),!i)return!1;a=(r=Ra(o.$from))==null?void 0:r.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let s=i.attrs;const l=[],c=s.colwidth;s.rowspan>1&&(s={...s,rowspan:1}),s.colspan>1&&(s={...s,colspan:1});const u=oo(e),d=e.tr;for(let p=0;p<u.right-u.left;p++)l.push(c?{...s,colwidth:c&&c[p]?[c[p]]:null}:s);let f;for(let p=u.top;p<u.bottom;p++){let m=u.map.positionAt(p,u.left,u.table);p==u.top&&(m+=i.nodeSize);for(let v=u.left,g=0;v<u.right;v++,g++)v==u.left&&p==u.top||d.insert(f=d.mapping.map(m+u.tableStart,1),t({node:i,row:p,col:v}).createAndFill(l[g]))}d.setNodeMarkup(a,t({node:i,row:u.top,col:u.left}),l[0]),o instanceof un&&d.setSelection(new un(d.doc.resolve(o.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function y3(t,e){return function(n,r){if(!Fr(n))return!1;const o=Cu(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof un?n.selection.forEachCell((a,s)=>{a.attrs[t]!==e&&i.setNodeMarkup(s,null,{...a.attrs,[t]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function C3(t){return function(e,n){if(!Fr(e))return!1;if(n){const r=Yn(e.schema),o=oo(e),i=e.tr,a=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),s=a.map(l=>o.table.nodeAt(l));for(let l=0;l<a.length;l++)s[l].type==r.header_cell&&i.setNodeMarkup(o.tableStart+a[l],r.cell,s[l].attrs);if(i.steps.length==0)for(let l=0;l<a.length;l++)i.setNodeMarkup(o.tableStart+a[l],r.header_cell,s[l].attrs);n(i)}return!0}}function u0(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 o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ns(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?C3(t):function(n,r){if(!Fr(n))return!1;if(r){const o=Yn(n.schema),i=oo(n),a=n.tr,s=u0("row",i,o),l=u0("column",i,o),u=(t==="column"?s:t==="row"?l:!1)?1:0,d=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=t=="column"?l?o.cell:o.header_cell:t=="row"?s?o.cell:o.header_cell:o.cell;i.map.cellsInRect(d).forEach(p=>{const m=p+i.tableStart,v=a.doc.nodeAt(m);v&&a.setNodeMarkup(m,f,v.attrs)}),r(a)}return!0}}Ns("row",{useDeprecatedLogic:!0});Ns("column",{useDeprecatedLogic:!0});var S3=Ns("cell",{useDeprecatedLogic:!0});function x3(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const i=t.node(-1).child(r),a=i.lastChild;if(a)return o-1-a.nodeSize;o-=i.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),o=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function d0(t){return function(e,n){if(!Fr(e))return!1;const r=x3(Cu(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(gt.between(o,Z5(o))).scrollIntoView())}return!0}}function w3(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 Sl(t,e){const n=t.selection;if(!(n instanceof un))return!1;if(e){const r=t.tr,o=Yn(t.schema).cell.createAndFill().content;n.forEachCell((i,a)=>{i.content.eq(o)||r.replace(r.mapping.map(a+1),r.mapping.map(a+i.nodeSize-1),new Ge(o,0,0))}),r.docChanged&&e(r)}return!0}function E3(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 o=e.child(0),i=o.type.spec.tableRole,a=o.type.schema,s=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Sh(Yn(a).row,new Ge(c,u,d)).content),s.push(c)}else if(i=="cell"||i=="header_cell")s.push(n||r?Sh(Yn(a).row,new Ge(e,n,r)).content:e);else return null;return N3(a,s)}function N3(t,e){const n=[];for(let o=0;o<e.length;o++){const i=e[o];for(let a=i.childCount-1;a>=0;a--){const{rowspan:s,colspan:l}=i.child(a).attrs;for(let c=o;c<o+s;c++)n[c]=(n[c]||0)+l}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(Re.empty),n[o]<r){const i=Yn(t).cell.createAndFill(),a=[];for(let s=n[o];s<r;s++)a.push(i);e[o]=e[o].append(Re.from(a))}return{height:e.length,width:r,rows:e}}function Sh(t,e){const n=t.createAndFill();return new ay(n).replace(0,n.content.size,e).doc}function O3({width:t,height:e,rows:n},r,o){if(t!=r){const i=[],a=[];for(let s=0;s<n.length;s++){const l=n[s],c=[];for(let u=i[s]||0,d=0;u<r;d++){let f=l.child(d%l.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Ri(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[s+p]=(i[s+p]||0)+f.attrs.colspan}a.push(Re.from(c))}n=a,t=r}if(e!=o){const i=[];for(let a=0,s=0;a<o;a++,s++){const l=[],c=n[s%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);a+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),l.push(d)}i.push(Re.from(l))}n=i,e=o}return{width:t,height:e,rows:n}}function $3(t,e,n,r,o,i,a){const s=t.doc.type.schema,l=Yn(s);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const p=n.child(d);f+=p.nodeSize;const m=[];let v;p.lastChild==null||p.lastChild.type==l.cell?v=c||(c=l.cell.createAndFill()):v=u||(u=l.header_cell.createAndFill());for(let g=e.width;g<o;g++)m.push(v);t.insert(t.mapping.slice(a).map(f-1+r),m)}if(i>e.height){const d=[];for(let m=0,v=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const g=m>=e.width?!1:n.nodeAt(e.map[v+m]).type==l.header_cell;d.push(g?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const f=l.row.create(null,Re.from(d)),p=[];for(let m=e.height;m<i;m++)p.push(f);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),p)}return!!(c||u)}function f0(t,e,n,r,o,i,a,s){if(a==0||a==e.height)return!1;let l=!1;for(let c=o;c<i;c++){const u=a*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const f=n.nodeAt(d),{top:p,left:m}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(s).map(d+r),null,{...f.attrs,rowspan:a-p}),t.insert(t.mapping.slice(s).map(e.positionAt(a,m,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-a})),c+=f.attrs.colspan-1}}return l}function h0(t,e,n,r,o,i,a,s){if(a==0||a==e.width)return!1;let l=!1;for(let c=o;c<i;c++){const u=c*e.width+a,d=e.map[u];if(e.map[u-1]==d){l=!0;const f=n.nodeAt(d),p=e.colCount(d),m=t.mapping.slice(s).map(d+r);t.setNodeMarkup(m,null,Ri(f.attrs,a-p,f.attrs.colspan-(a-p))),t.insert(m+f.nodeSize,f.type.createAndFill(Ri(f.attrs,0,a-p))),c+=f.attrs.rowspan-1}}return l}function p0(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let a=Cn.get(i);const{top:s,left:l}=r,c=l+o.width,u=s+o.height,d=t.tr;let f=0;function p(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");a=Cn.get(i),f=d.mapping.maps.length}$3(d,a,i,n,c,u,f)&&p(),f0(d,a,i,n,l,c,s,f)&&p(),f0(d,a,i,n,l,c,u,f)&&p(),h0(d,a,i,n,s,u,l,f)&&p(),h0(d,a,i,n,s,u,c,f)&&p();for(let m=s;m<u;m++){const v=a.positionAt(m,l,i),g=a.positionAt(m,c,i);d.replace(d.mapping.slice(f).map(v+n),d.mapping.slice(f).map(g+n),new Ge(o.rows[m-s],0,0))}p(),d.setSelection(new un(d.doc.resolve(n+a.positionAt(s,l,i)),d.doc.resolve(n+a.positionAt(u-1,c-1,i)))),e(d)}var M3=Bh({ArrowLeft:xl("horiz",-1),ArrowRight:xl("horiz",1),ArrowUp:xl("vert",-1),ArrowDown:xl("vert",1),"Shift-ArrowLeft":wl("horiz",-1),"Shift-ArrowRight":wl("horiz",1),"Shift-ArrowUp":wl("vert",-1),"Shift-ArrowDown":wl("vert",1),Backspace:Sl,"Mod-Backspace":Sl,Delete:Sl,"Mod-Delete":Sl});function ql(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function xl(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof un)return ql(n,r,vt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const a=Uw(o,t,e);if(a==null)return!1;if(t=="horiz")return ql(n,r,vt.near(n.doc.resolve(i.head+e),e));{const s=n.doc.resolve(a),l=Lw(s,t,e);let c;return l?c=vt.near(l,1):e<0?c=vt.near(n.doc.resolve(s.before(-1)),-1):c=vt.near(n.doc.resolve(s.after(-1)),1),ql(n,r,c)}}}function wl(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let a;if(i instanceof un)a=i;else{const l=Uw(o,t,e);if(l==null)return!1;a=new un(n.doc.resolve(l))}const s=Lw(a.$headCell,t,e);return s?ql(n,r,new un(a.$anchorCell,s)):!1}}function R3(t,e){const n=t.state.doc,r=Ra(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new un(r))),!0):!1}function I3(t,e,n){if(!Fr(t.state))return!1;let r=E3(n);const o=t.state.selection;if(o instanceof un){r||(r={width:1,height:1,rows:[Re.from(Sh(Yn(t.state.schema).cell,n))]});const i=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),s=Cn.get(i).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=O3(r,s.right-s.left,s.bottom-s.top),p0(t.state,t.dispatch,a,s,r),!0}else if(r){const i=Cu(t.state),a=i.start(-1);return p0(t.state,t.dispatch,a,Cn.get(i.node(-1)).findCell(i.pos-a),r),!0}else return!1}function T3(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=m0(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof un)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Ra(t.state.selection.$anchor))!=null&&((n=Ad(t,e))==null?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(l,c){let u=Ad(t,c);const d=Ao.getState(t.state)==null;if(!u||!em(l,u))if(d)u=l;else return;const f=new un(l,u);if(d||!t.state.selection.eq(f)){const p=t.state.tr.setSelection(f);d&&p.setMeta(Ao,l.pos),t.dispatch(p)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",s),Ao.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Ao,-1))}function s(l){const c=l,u=Ao.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(m0(t,c.target)!=r&&(d=Ad(t,e),!d))return a();d&&i(d,c)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",s)}function Uw(t,e,n){if(!(t.state.selection instanceof gt))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=r.before(o),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?s:null}}return null}function m0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ad(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Ra(t.state.doc.resolve(n.pos)):null}var P3=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")),xh(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,xh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function xh(t,e,n,r,o,i){var a;let s=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let v=0;v<p;v++,f++){const g=o==f?i:m&&m[v],y=g?g+"px":"";if(s+=g||r,g||(l=!1),c)c.style.width!=y&&(c.style.width=y),c=c.nextSibling;else{const b=document.createElement("col");b.style.width=y,e.appendChild(b)}}}for(;c;){const d=c.nextSibling;(a=c.parentNode)==null||a.removeChild(c),c=d}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var fr=new vr("tableColumnResizing");function A3({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=P3,lastColumnResizable:o=!0}={}){const i=new Qn({key:fr,state:{init(a,s){var l,c;const u=(c=(l=i.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,d=Yn(s.schema).table.name;return r&&u&&(u[d]=(f,p)=>new r(f,n,p)),new k3(-1,!1)},apply(a,s){return s.apply(a)}},props:{attributes:a=>{const s=fr.getState(a);return s&&s.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,s)=>{D3(a,s,t,o)},mouseleave:a=>{_3(a)},mousedown:(a,s)=>{B3(a,s,e,n)}},decorations:a=>{const s=fr.getState(a);if(s&&s.activeHandle>-1)return F3(a,s.activeHandle)},nodeViews:{}}});return i}var k3=class Kl{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(fr);if(r&&r.setHandle!=null)return new Kl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Kl(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Ch(e.doc.resolve(o))||(o=-1),new Kl(o,n.dragging)}return n}};function D3(t,e,n,r){if(!t.editable)return;const o=fr.getState(t.state);if(o&&!o.dragging){const i=z3(e.target);let a=-1;if(i){const{left:s,right:l}=i.getBoundingClientRect();e.clientX-s<=n?a=g0(t,e,"left",n):l-e.clientX<=n&&(a=g0(t,e,"right",n))}if(a!=o.activeHandle){if(!r&&a!==-1){const s=t.state.doc.resolve(a),l=s.node(-1),c=Cn.get(l),u=s.start(-1);if(c.colCount(s.pos-u)+s.nodeAfter.attrs.colspan-1==c.width-1)return}Gw(t,a)}}}function _3(t){if(!t.editable)return;const e=fr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Gw(t,-1)}function B3(t,e,n,r){var o;if(!t.editable)return!1;const i=(o=t.dom.ownerDocument.defaultView)!=null?o:window,a=fr.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const s=t.state.doc.nodeAt(a.activeHandle),l=j3(t,a.activeHandle,s.attrs);t.dispatch(t.state.tr.setMeta(fr,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=fr.getState(t.state);f!=null&&f.dragging&&(L3(t,f.activeHandle,v0(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(fr,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=fr.getState(t.state);if(f&&f.dragging){const p=v0(f.dragging,d,n);b0(t,f.activeHandle,p,r)}}return b0(t,a.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function j3(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=t.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(s-=r[c],l--);return s/l}function z3(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function g0(t,e,n,r){const o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:a}=i,s=Ra(t.state.doc.resolve(a));if(!s)return-1;if(n=="right")return s.pos;const l=Cn.get(s.node(-1)),c=s.start(-1),u=l.map.indexOf(s.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function v0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Gw(t,e){t.dispatch(t.state.tr.setMeta(fr,{setHandle:e}))}function L3(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),i=Cn.get(o),a=r.start(-1),s=i.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+s;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=o.nodeAt(d).attrs,p=f.colspan==1?0:s-i.colCount(d);if(f.colwidth&&f.colwidth[p]==n)continue;const m=f.colwidth?f.colwidth.slice():V3(f.colspan);m[p]=n,l.setNodeMarkup(a+d,null,{...f,colwidth:m})}l.docChanged&&t.dispatch(l)}function b0(t,e,n,r){const o=t.state.doc.resolve(e),i=o.node(-1),a=o.start(-1),s=Cn.get(i).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let l=t.domAtPos(o.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&xh(i,l.firstChild,l,r,s,n)}function V3(t){return Array(t).fill(0)}function F3(t,e){var n;const r=[],o=t.doc.resolve(e),i=o.node(-1);if(!i)return bn.empty;const a=Cn.get(i),s=o.start(-1),l=a.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<a.height;c++){const u=l+c*a.width;if((l==a.width-1||a.map[u]!=a.map[u+1])&&(c==0||a.map[u]!=a.map[u-a.width])){const d=a.map[u],f=s+d+i.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=fr.getState(t))!=null&&n.dragging&&r.push(Zn.node(s+d,s+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Zn.widget(f,p))}}return bn.create(t.doc,r)}function H3({allowTableNodeSelection:t=!1}={}){return new Qn({key:Ao,state:{init(){return null},apply(e,n){const r=e.getMeta(Ao);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:n3,handleDOMEvents:{mousedown:T3},createSelectionBetween(e){return Ao.getState(e.state)!=null?e.state.selection:null},handleTripleClick:R3,handleKeyDown:M3,handlePaste:I3},appendTransaction(e,n,r){return i3(r,Ww(r,n),t)}})}function wh(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function y0(t,e,n,r,o,i){var a;let s=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let v=0;v<p;v+=1,f+=1){const g=o===f?i:m&&m[v],y=g?`${g}px`:"";if(s+=g||r,g||(l=!1),c){if(c.style.width!==y){const[b,C]=wh(r,g);c.style.setProperty(b,C)}c=c.nextSibling}else{const b=document.createElement("col"),[C,x]=wh(r,g);b.style.setProperty(C,x),e.appendChild(b)}}}for(;c;){const d=c.nextSibling;(a=c.parentNode)===null||a===void 0||a.removeChild(c),c=d}l?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}class W3{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")),y0(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,y0(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function q3(t,e,n,r){let o=0,i=!0;const a=[],s=t.firstChild;if(!s)return{};for(let d=0,f=0;d<s.childCount;d+=1){const{colspan:p,colwidth:m}=s.child(d).attrs;for(let v=0;v<p;v+=1,f+=1){const g=n===f?r:m&&m[v];o+=g||e,g||(i=!1);const[y,b]=wh(e,g);a.push(["col",{style:`${y}: ${b}`}])}}const l=i?`${o}px`:"",c=i?"":`${o}px`;return{colgroup:["colgroup",{},...a],tableWidth:l,tableMinWidth:c}}function C0(t,e){return t.createAndFill()}function K3(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 U3(t,e,n,r,o){const i=K3(t),a=[],s=[];for(let c=0;c<n;c+=1){const u=C0(i.cell);if(u&&s.push(u),r){const d=C0(i.header_cell);d&&a.push(d)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?a:s));return i.table.createChecked(null,l)}function G3(t){return t instanceof un}const El=({editor:t})=>{const{selection:e}=t.state;if(!G3(e))return!1;let n=0;const r=fC(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},X3=Sn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:W3,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:o}=q3(t,this.options.cellMinWidth);return["table",Zt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{const a=U3(i.schema,t,e,n);if(o){const s=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(gt.near(r.doc.resolve(s)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>l3(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>c3(t,e),deleteColumn:()=>({state:t,dispatch:e})=>d3(t,e),addRowBefore:()=>({state:t,dispatch:e})=>h3(t,e),addRowAfter:()=>({state:t,dispatch:e})=>p3(t,e),deleteRow:()=>({state:t,dispatch:e})=>g3(t,e),deleteTable:()=>({state:t,dispatch:e})=>w3(t,e),mergeCells:()=>({state:t,dispatch:e})=>l0(t,e),splitCell:()=>({state:t,dispatch:e})=>c0(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Ns("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Ns("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>S3(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>l0(t,e)?!0:c0(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>y3(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>d0(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>d0(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Ww(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=un.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:El,"Mod-Backspace":El,Delete:El,"Mod-Delete":El}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[A3({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],H3({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Mt(ut(t,"tableRole",e))}}}),Y3=Sn.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",Zt(this.options.HTMLAttributes,t),0]}}),J3=Sn.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",Zt(this.options.HTMLAttributes,t),0]}}),Q3=Sn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Zt(this.options.HTMLAttributes,t),0]}}),Z3=/^\s*(\[([( |x])?\])\s$/,e4=Sn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Zt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),a=document.createElement("span"),s=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",s.type="checkbox",s.addEventListener("mousedown",c=>c.preventDefault()),s.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}const{checked:u}=c.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const f=n();if(typeof f!="number")return!1;const p=d.doc.nodeAt(f);return d.setNodeMarkup(f,void 0,{...p==null?void 0:p.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{o.setAttribute(c,u)}),o.dataset.checked=t.attrs.checked,s.checked=t.attrs.checked,i.append(s,a),o.append(i,l),Object.entries(e).forEach(([c,u])=>{o.setAttribute(c,u)}),{dom:o,contentDOM:l,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,s.checked=c.attrs.checked,!0)}}},addInputRules(){return[fa({find:Z3,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),t4=Sn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Zt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),n4=Hn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),r4=to.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),o4=/^\s*>\s$/,i4=Sn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[fa({find:o4,type:this.type})]}}),a4=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,s4=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,l4=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,c4=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,u4=to.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ei({find:a4,type:this.type}),Ei({find:l4,type:this.type})]},addPasteRules(){return[Ni({find:s4,type:this.type}),Ni({find:c4,type:this.type})]}}),d4="listItem",S0="textStyle",x0=/^\s*([-+*])\s$/,f4=Sn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(d4,this.editor.getAttributes(S0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=fa({find:x0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fa({find:x0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(S0),editor:this.editor})),[t]}}),h4=/(^|[^`])`([^`]+)`(?!`)/,p4=/(^|[^`])`([^`]+)`(?!`)/g,m4=to.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ei({find:h4,type:this.type})]},addPasteRules(){return[Ni({find:p4,type:this.type})]}}),g4=/^```([a-z]+)?[\s\n]$/,v4=/^~~~([a-z]+)?[\s\n]$/,b4=Sn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,i=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Zt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
|
|
665
665
|
|
|
666
666
|
`);return!i||!a?!1:t.chain().command(({tr:s})=>(s.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:c})=>(c.setSelection(vt.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[tf({find:g4,type:this.type,getAttributes:t=>({language:t[1]})}),tf({find:v4,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Qn({key:new vr("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o==null?void 0:o.mode;if(!n||!i)return!1;const{tr:a,schema:s}=t.state,l=s.text(n.replace(/\r\n?/g,`
|
|
667
667
|
`));return a.replaceSelectionWith(this.type.create({language:i},l)),a.selection.$from.parent.type!==this.type&&a.setSelection(gt.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),t.dispatch(a),!0}}})]}}),y4=Sn.create({name:"doc",topNode:!0,content:"block+"});function C4(t={}){return new Qn({view(e){return new S4(e,t)}})}class S4{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=a=>{this[o](a)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let s=e.nodeBefore,l=e.nodeAfter;if(s||l){let c=this.editorView.nodeDOM(this.cursorPos-(s?s.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=s?u.bottom:u.top;s&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let s=this.editorView.coordsAtPos(this.cursorPos);r={left:s.left-this.width/2,right:s.left+this.width/2,top:s.top,bottom:s.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,a;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,a=-pageYOffset;else{let s=o.getBoundingClientRect();i=s.left-o.scrollLeft,a=s.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-a+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let s=ty(this.editorView.state.doc,a,this.editorView.dragging.slice);s!=null&&(a=s)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const x4=Hn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[C4(this.options)]}});class yn extends vt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return yn.valid(r)?new yn(r):vt.near(r)}content(){return Ge.empty}eq(e){return e instanceof yn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new yn(e.resolve(n.pos))}getBookmark(){return new tm(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!w4(e)||!E4(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&yn.valid(e))return e;let o=e.pos,i=null;for(let a=e.depth;;a--){let s=e.node(a);if(n>0?e.indexAfter(a)<s.childCount:e.index(a)>0){i=s.child(n>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;o+=n;let l=e.doc.resolve(o);if(yn.valid(l))return l}for(;;){let a=n>0?i.firstChild:i.lastChild;if(!a){if(i.isAtom&&!i.isText&&!mt.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=a,o+=n;let s=e.doc.resolve(o);if(yn.valid(s))return s}return null}}}yn.prototype.visible=!1;yn.findFrom=yn.findGapCursorFrom;vt.jsonID("gapcursor",yn);class tm{constructor(e){this.pos=e}map(e){return new tm(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return yn.valid(n)?new yn(n):vt.near(n)}}function w4(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function E4(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function N4(){return new Qn({props:{decorations:R4,createSelectionBetween(t,e,n){return e.pos==n.pos&&yn.valid(n)?new yn(n):null},handleClick:$4,handleKeyDown:O4,handleDOMEvents:{beforeinput:M4}}})}const O4=Bh({ArrowLeft:Nl("horiz",-1),ArrowRight:Nl("horiz",1),ArrowUp:Nl("vert",-1),ArrowDown:Nl("vert",1)});function Nl(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let a=r.selection,s=e>0?a.$to:a.$from,l=a.empty;if(a instanceof gt){if(!i.endOfTextblock(n)||s.depth==0)return!1;l=!1,s=r.doc.resolve(e>0?s.after():s.before())}let c=yn.findGapCursorFrom(s,e,l);return c?(o&&o(r.tr.setSelection(new yn(c))),!0):!1}}function $4(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!yn.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&mt.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new yn(r))),!0)}function M4(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof yn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=Re.empty;for(let a=r.length-1;a>=0;a--)o=Re.from(r[a].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new Ge(o,0,0));return i.setSelection(gt.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function R4(t){if(!(t.selection instanceof yn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",bn.create(t.doc,[Zn.widget(t.selection.head,e,{key:"gapcursor"})])}const I4=Hn.create({name:"gapCursor",addProseMirrorPlugins(){return[N4()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Mt(ut(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),T4=Sn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Zt(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
668
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:s}=r.extensionManager,l=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&a){const d=l.filter(f=>s.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),P4=Sn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Zt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>tf({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var $c=200,Bn=function(){};Bn.prototype.append=function(e){return e.length?(e=Bn.from(e),!this.length&&e||e.length<$c&&this.leafAppend(e)||this.length<$c&&e.leafPrepend(this)||this.appendInner(e)):this};Bn.prototype.prepend=function(e){return e.length?Bn.from(e).append(this):this};Bn.prototype.appendInner=function(e){return new A4(this,e)};Bn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Bn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Bn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Bn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Bn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,a){return o.push(e(i,a))},n,r),o};Bn.from=function(e){return e instanceof Bn?e:e&&e.length?new Xw(e):Bn.empty};var Xw=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,a,s){for(var l=i;l<a;l++)if(o(this.values[l],s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,a,s){for(var l=i-1;l>=a;l--)if(o(this.values[l],s+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=$c)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=$c)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Bn);Bn.empty=new Xw([]);var A4=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,a){var s=this.left.length;if(o<s&&this.left.forEachInner(r,o,Math.min(i,s),a)===!1||i>s&&this.right.forEachInner(r,Math.max(o-s,0),Math.min(this.length,i)-s,a+s)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,a){var s=this.left.length;if(o>s&&this.right.forEachInvertedInner(r,o-s,Math.max(i,s)-s,a+s)===!1||i<s&&this.left.forEachInvertedInner(r,Math.min(o,s),i,a)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Bn);const k4=500;class Ar{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let a=e.tr,s,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new qr(d.map));let p=d.step.map(o.slice(i)),m;p&&a.maybeStep(p).doc&&(m=a.mapping.maps[a.mapping.maps.length-1],c.push(new qr(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else a.maybeStep(d.step);if(d.selection)return s=o?d.selection.map(o.slice(i)):d.selection,l=new Ar(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:a,selection:s}}addTransform(e,n,r,o){let i=[],a=this.eventCount,s=this.items,l=!o&&s.length?s.get(s.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new qr(e.mapping.maps[u],d,n),p;(p=l&&l.merge(f))&&(f=p,u?i.pop():s=s.slice(0,s.length-1)),i.push(f),n&&(a++,n=void 0),o||(l=f)}let c=a-r.depth;return c>_4&&(s=D4(s,c),a-=c),new Ar(s.append(i),a)}remapping(e,n){let r=new as;return this.items.forEach((o,i)=>{let a=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,a)},e,n),r}addMaps(e){return this.eventCount==0?this:new Ar(this.items.append(e.map(n=>new qr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,a=e.steps.length,s=this.eventCount;this.items.forEach(f=>{f.selection&&s--},o);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;a=Math.min(a,p);let m=i.maps[p];if(f.step){let v=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(i.slice(l+1,p));g&&s++,r.push(new qr(m,v,g))}else r.push(new qr(m))},o);let c=[];for(let f=n;f<a;f++)c.push(new qr(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Ar(u,s);return d.emptyItemCount()>k4&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((a,s)=>{if(s>=e)o.push(a),a.selection&&i++;else if(a.step){let l=a.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=a.selection&&a.selection.map(n.slice(r));u&&i++;let d=new qr(c.invert(),l,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else a.map&&r--},this.items.length,0),new Ar(Bn.from(o.reverse()),i)}}Ar.empty=new Ar(Bn.empty,0);function D4(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class qr{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new qr(n.getMap().invert(),n,this.selection)}}}class Io{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const _4=20;function B4(t,e,n,r){let o=n.getMeta(Ci),i;if(o)return o.historyState;n.getMeta(L4)&&(t=new Io(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(Ci))return a.getMeta(Ci).redo?new Io(t.done.addTransform(n,void 0,r,Ul(e)),t.undone,w0(n.mapping.maps),t.prevTime,t.prevComposition):new Io(t.done,t.undone.addTransform(n,void 0,r,Ul(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let s=n.getMeta("composition"),l=t.prevTime==0||!a&&t.prevComposition!=s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!j4(n,t.prevRanges)),c=a?kd(t.prevRanges,n.mapping):w0(n.mapping.maps);return new Io(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Ul(e)),Ar.empty,c,n.time,s??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Io(t.done.rebased(n,i),t.undone.rebased(n,i),kd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Io(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),kd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function j4(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function w0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,a)=>e.push(i,a));return e}function kd(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function z4(t,e,n){let r=Ul(e),o=Ci.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let a=i.selection.resolve(i.transform.doc),s=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),l=new Io(n?s:i.remaining,n?i.remaining:s,null,0,-1);return i.transform.setSelection(a).setMeta(Ci,{redo:n,historyState:l})}let Dd=!1,E0=null;function Ul(t){let e=t.plugins;if(E0!=e){Dd=!1,E0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Dd=!0;break}}return Dd}const Ci=new vr("history"),L4=new vr("closeHistory");function V4(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Qn({key:Ci,state:{init(){return new Io(Ar.empty,Ar.empty,null,0,-1)},apply(e,n,r){return B4(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Jw:r=="historyRedo"?Qw:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Yw(t,e){return(n,r)=>{let o=Ci.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=z4(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Jw=Yw(!1,!0),Qw=Yw(!0,!0),F4=Hn.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Jw(t,e),redo:()=>({state:t,dispatch:e})=>Qw(t,e)}},addProseMirrorPlugins(){return[V4(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),H4=Sn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Zt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:o}=n,i=t();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):kM(n)?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:a,dispatch:s})=>{var l;if(s){const{$to:c}=a.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?a.setSelection(gt.create(a.doc,c.pos+1)):c.nodeAfter.isBlock?a.setSelection(mt.create(a.doc,c.pos)):a.setSelection(gt.create(a.doc,c.pos));else{const d=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(a.insert(u,d),a.setSelection(gt.create(a.doc,u+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[dR({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),W4=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,q4=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,K4=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,U4=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,G4=to.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ei({find:W4,type:this.type}),Ei({find:K4,type:this.type})]},addPasteRules(){return[Ni({find:q4,type:this.type}),Ni({find:U4,type:this.type})]}}),X4="listItem",N0="textStyle",O0=/^(\d+)\.\s$/,Y4=Sn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Zt(this.options.HTMLAttributes,n),0]:["ol",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(X4,this.editor.getAttributes(N0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=fa({find:O0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fa({find:O0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(N0)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),J4=Sn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Q4=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Z4=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,e6=to.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ei({find:Q4,type:this.type})]},addPasteRules(){return[Ni({find:Z4,type:this.type})]}}),t6=Sn.create({name:"text",group:"inline"}),n6=Hn.create({name:"starterKit",addExtensions(){var t,e,n,r,o,i,a,s,l,c,u,d,f,p,m,v,g,y;const b=[];return this.options.bold!==!1&&b.push(u4.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&b.push(i4.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&b.push(f4.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&b.push(m4.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&b.push(b4.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&b.push(y4.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&b.push(x4.configure((a=this.options)===null||a===void 0?void 0:a.dropcursor)),this.options.gapcursor!==!1&&b.push(I4.configure((s=this.options)===null||s===void 0?void 0:s.gapcursor)),this.options.hardBreak!==!1&&b.push(T4.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&b.push(P4.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&b.push(F4.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&b.push(H4.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&b.push(G4.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&b.push(zw.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&b.push(Y4.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&b.push(J4.configure((v=this.options)===null||v===void 0?void 0:v.paragraph)),this.options.strike!==!1&&b.push(e6.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&b.push(t6.configure((y=this.options)===null||y===void 0?void 0:y.text)),b}});function Zw({title:t,childrenContent:e,editable:n,childrenEdit:r}){const[o,i]=N.useState(!1),a=n?ve.jsxDEV(Go,{children:ve.jsxDEV(Go.Item,{onClick:()=>i(!0),children:"Edit"},"edit",!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:17,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:16,columnNumber:17},this):null;return ve.jsxDEV("div",{children:[n&&a?ve.jsxDEV(yu,{dropdownRender:()=>a,trigger:["contextMenu"],children:e},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:28,columnNumber:25},this):e,ve.jsxDEV(Mr,{title:`Edit ${t}`,open:o,onOk:()=>i(!1),onCancel:()=>i(!1),children:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:36,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:25,columnNumber:9},this)}function r6({node:t,editor:e}){const[n,r]=N.useState(!1),[o,i]=N.useState(t.attrs.bgColor||"#f3f4f6"),[a,s]=N.useState(t.attrs.titleColor||"#000000"),l=d=>{d.preventDefault()},c=d=>{i(d.toHexString())},u=d=>{s(d.toHexString())};return ve.jsxDEV(gC,{className:"accordion-wrapper",children:ve.jsxDEV(Zw,{title:"Accordion",childrenContent:ve.jsxDEV("div",{className:"my-4 transition-all duration-300 border rounded-lg shadow-sm",onContextMenu:l,children:[ve.jsxDEV("div",{className:"flex items-center justify-between p-4 transition-colors accordion-header",style:{backgroundColor:o},onClick:()=>r(!n),children:[ve.jsxDEV("input",{className:"w-full text-lg font-medium bg-transparent border-none outline-none",style:{color:a},defaultValue:t.attrs.title||"Accordion Title",disabled:!e.isEditable,suppressContentEditableWarning:!0,contentEditable:!0,placeholder:"Accordion title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:41,columnNumber:29},this),ve.jsxDEV(jH,{className:`transition-transform duration-300 ${n?"rotate-180":""}`,size:20},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:50,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:36,columnNumber:25},this),ve.jsxDEV("div",{className:`overflow-hidden duration-300 ease-in-out ${n?"max-h-96 opacity-100":"max-h-0 opacity-0"} `,children:ve.jsxDEV("div",{className:"p-4 border-t",children:ve.jsxDEV(AR,{contentEditable:e.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:60,columnNumber:33},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:59,columnNumber:29},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:56,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:32,columnNumber:21},this),editable:e.isEditable,childrenEdit:ve.jsxDEV("div",{className:"px-6 py-4 space-y-6 rounded-lg bg-gray-50",children:[ve.jsxDEV("div",{className:"grid grid-cols-1 gap-6",children:[ve.jsxDEV("div",{className:"flex flex-col space-y-2",children:[ve.jsxDEV("label",{className:"font-medium text-gray-700",children:"Background Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:72,columnNumber:33},this),ve.jsxDEV("div",{className:"flex items-center space-x-3",children:[ve.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:o}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:74,columnNumber:37},this),ve.jsxDEV(Oc,{value:o,onChange:c},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:78,columnNumber:37},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:73,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:71,columnNumber:29},this),ve.jsxDEV("div",{className:"flex flex-col space-y-2",children:[ve.jsxDEV("label",{className:"font-medium text-gray-700",children:"Title Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:83,columnNumber:33},this),ve.jsxDEV("div",{className:"flex items-center space-x-3",children:[ve.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:a}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:85,columnNumber:37},this),ve.jsxDEV(Oc,{value:a,onChange:u},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:89,columnNumber:37},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:84,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:82,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:70,columnNumber:25},this),ve.jsxDEV("div",{className:"pt-4 border-t border-gray-200",children:ve.jsxDEV("div",{className:"p-3 bg-white border rounded-md",children:[ve.jsxDEV("div",{className:"text-sm text-gray-600",children:"Preview"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:96,columnNumber:33},this),ve.jsxDEV("div",{className:"p-2 mt-2 rounded",style:{backgroundColor:o},children:ve.jsxDEV("span",{style:{color:a,fontWeight:500},children:"Accordion Title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:98,columnNumber:37},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:97,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:95,columnNumber:29},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:94,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:69,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:29,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:28,columnNumber:9},this)}const o6=Sn.create({name:"accordion",group:"block",content:"block+",atom:!1,draggable:!0,selectable:!0,inline:!1,defining:!0,addAttributes(){return{title:{default:"Accordion Title"},bgColor:{default:"#f3f4f6"},titleColor:{default:"#000000"}}},parseHTML(){return[{tag:"accordion"}]},renderHTML({HTMLAttributes:t}){return["accordion",Zt(t)]},addNodeView(){return vC(r6)},addCommands(){return{setAccordion:t=>({chain:e})=>e().insertContent({type:"accordion",attrs:t,content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()}}});function i6({node:t,updateAttributes:e,editor:n}){const[r,o]=N.useState({width:t.attrs.width??50,height:t.attrs.height??"auto"}),[i,a]=N.useState({left:t.attrs.marginLeft??"0%",right:t.attrs.marginRight??"0%"}),[s,l]=N.useState(t.attrs.src||""),c=N.useRef(null);N.useEffect(()=>{if(t.attrs.src&&c.current){const f=new Image;f.onload=()=>{t.attrs.width===void 0&&o({width:100,height:"auto"})},f.src=t.attrs.src}},[t.attrs.src,t.attrs.width,t.attrs.height]);const u=()=>{e({src:s,width:r.width,height:r.height,marginLeft:i.left,marginRight:i.right})},d=f=>{f.preventDefault()};return ve.jsxDEV(gC,{className:"image-wrapper w-full",children:ve.jsxDEV(Zw,{title:"Image",childrenContent:ve.jsxDEV("div",{className:"relative w-full max-w-full overflow-hidden",style:{marginLeft:i.left+"%",marginRight:i.right+"%"},onContextMenu:d,children:ve.jsxDEV("img",{ref:c,src:t.attrs.src,alt:"Uploaded",className:"w-full h-auto object-contain inline-block",style:{width:r.width+"%",height:r.height==="auto"?"auto":r.height+"%",maxWidth:"100%"},draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:68,columnNumber:25},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:60,columnNumber:21},this),editable:n.isEditable,childrenEdit:ve.jsxDEV("div",{className:"space-y-4",children:[ve.jsxDEV("div",{children:[ve.jsxDEV("label",{className:"block text-sm font-medium text-gray-700",children:"Image URL"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:89,columnNumber:29},this),ve.jsxDEV(ho,{type:"text",value:s,onChange:f=>l(f.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:92,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:88,columnNumber:25},this),ve.jsxDEV("div",{className:"flex gap-4",children:[ve.jsxDEV("div",{className:"flex-1",children:[ve.jsxDEV("label",{className:"block text-sm font-medium text-gray-700",children:"Width (%)"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:103,columnNumber:33},this),ve.jsxDEV(ho,{type:"number",value:r.width,onChange:f=>o({...r,width:Number(f.target.value)}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:106,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:102,columnNumber:29},this),ve.jsxDEV("div",{className:"flex-1",children:[ve.jsxDEV("label",{className:"block text-sm font-medium text-gray-700",children:"Height"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:120,columnNumber:33},this),ve.jsxDEV(ur,{value:r.height,onChange:f=>o({...r,height:f}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50",disabled:!n.isEditable,children:[ve.jsxDEV(ur.Option,{value:"auto",children:"Auto"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:134,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"25",children:"25%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:137,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"50",children:"50%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:140,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"75",children:"75%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:143,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"100",children:"100%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:146,columnNumber:37},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:123,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:119,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:101,columnNumber:25},this),ve.jsxDEV("div",{className:"flex gap-4",children:[ve.jsxDEV("div",{className:"flex-1",children:[ve.jsxDEV("label",{className:"block text-sm font-medium text-gray-700",children:"Margin Left (%)"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:155,columnNumber:33},this),ve.jsxDEV(ho,{type:"number",value:i.left,onChange:f=>a({...i,left:String(Number(f.target.value))}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:158,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:154,columnNumber:29},this),ve.jsxDEV("div",{className:"flex-1",children:[ve.jsxDEV("label",{className:"block text-sm font-medium text-gray-700",children:"Margin Right (%)"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:174,columnNumber:33},this),ve.jsxDEV(ho,{type:"number",value:i.right,onChange:f=>a({...i,right:String(Number(f.target.value))}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:177,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:173,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:153,columnNumber:25},this),ve.jsxDEV("button",{type:"button",onClick:u,className:"w-full py-2 px-4 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",disabled:!n.isEditable,children:"Update Image"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:194,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:87,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:57,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:56,columnNumber:9},this)}const a6=Sn.create({name:"image",group:"block",content:"inline*",atom:!0,draggable:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:50},height:{default:"auto"},marginLeft:{default:0},marginRight:{default:0}}},parseHTML(){return[{tag:"img",getAttrs:t=>t instanceof HTMLElement?{src:t.getAttribute("src"),width:t.getAttribute("width")?Number(t.getAttribute("width")):50,height:t.getAttribute("height")||"auto",marginLeft:t.getAttribute("marginleft")?Number(t.getAttribute("marginleft")):0,marginRight:t.getAttribute("marginright")?Number(t.getAttribute("marginright")):0}:null}]},renderHTML({HTMLAttributes:t}){return["img",Zt(t)]},addNodeView(){return vC(i6)},addCommands(){return{setImage:t=>({chain:e})=>e().insertContent({type:"image",attrs:{...t,width:(t==null?void 0:t.width)??50,height:(t==null?void 0:t.height)??"auto"}}).run()}}}),s6=[V5.configure({types:[a0.name,zw.name]}),a0,W5.configure({multicolor:!0}),n6.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1}}),r4,q5,K5,n4.configure({types:["heading","paragraph"]}),t4,e4,X3.configure({resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"table-wrapper"}}),Q3,J3,Y3.configure({HTMLAttributes:{class:"table-cell"}}),a6,o6];function l6({content:t="",slotBefore:e=!1,className:n="",editorClassName:r="",editable:o=!0,onChange:i}){const a=TR({extensions:s6,content:t,editable:o,onUpdate:({editor:s})=>{i==null||i(s.getHTML())}});return N.useEffect(()=>{a&&t!==a.getHTML()&&a.commands.setContent(t,!1)},[a,t]),a?ve.jsxDEV("div",{className:re(eE["cyber-editor"],n),children:[e&&ve.jsxDEV(z5,{editor:a},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:43,columnNumber:28},this),ve.jsxDEV(SR,{editor:a,className:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:44,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:42,columnNumber:9},this):ve.jsxDEV(xE,{full:!0},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:38,columnNumber:16},this)}exports.EditorProvider=l6;
|
|
668
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:s}=r.extensionManager,l=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&a){const d=l.filter(f=>s.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),P4=Sn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Zt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>tf({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var $c=200,Bn=function(){};Bn.prototype.append=function(e){return e.length?(e=Bn.from(e),!this.length&&e||e.length<$c&&this.leafAppend(e)||this.length<$c&&e.leafPrepend(this)||this.appendInner(e)):this};Bn.prototype.prepend=function(e){return e.length?Bn.from(e).append(this):this};Bn.prototype.appendInner=function(e){return new A4(this,e)};Bn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Bn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Bn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Bn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Bn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,a){return o.push(e(i,a))},n,r),o};Bn.from=function(e){return e instanceof Bn?e:e&&e.length?new Xw(e):Bn.empty};var Xw=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,a,s){for(var l=i;l<a;l++)if(o(this.values[l],s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,a,s){for(var l=i-1;l>=a;l--)if(o(this.values[l],s+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=$c)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=$c)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Bn);Bn.empty=new Xw([]);var A4=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,a){var s=this.left.length;if(o<s&&this.left.forEachInner(r,o,Math.min(i,s),a)===!1||i>s&&this.right.forEachInner(r,Math.max(o-s,0),Math.min(this.length,i)-s,a+s)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,a){var s=this.left.length;if(o>s&&this.right.forEachInvertedInner(r,o-s,Math.max(i,s)-s,a+s)===!1||i<s&&this.left.forEachInvertedInner(r,Math.min(o,s),i,a)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Bn);const k4=500;class Ar{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let a=e.tr,s,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new qr(d.map));let p=d.step.map(o.slice(i)),m;p&&a.maybeStep(p).doc&&(m=a.mapping.maps[a.mapping.maps.length-1],c.push(new qr(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else a.maybeStep(d.step);if(d.selection)return s=o?d.selection.map(o.slice(i)):d.selection,l=new Ar(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:a,selection:s}}addTransform(e,n,r,o){let i=[],a=this.eventCount,s=this.items,l=!o&&s.length?s.get(s.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new qr(e.mapping.maps[u],d,n),p;(p=l&&l.merge(f))&&(f=p,u?i.pop():s=s.slice(0,s.length-1)),i.push(f),n&&(a++,n=void 0),o||(l=f)}let c=a-r.depth;return c>_4&&(s=D4(s,c),a-=c),new Ar(s.append(i),a)}remapping(e,n){let r=new as;return this.items.forEach((o,i)=>{let a=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,a)},e,n),r}addMaps(e){return this.eventCount==0?this:new Ar(this.items.append(e.map(n=>new qr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,a=e.steps.length,s=this.eventCount;this.items.forEach(f=>{f.selection&&s--},o);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;a=Math.min(a,p);let m=i.maps[p];if(f.step){let v=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(i.slice(l+1,p));g&&s++,r.push(new qr(m,v,g))}else r.push(new qr(m))},o);let c=[];for(let f=n;f<a;f++)c.push(new qr(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Ar(u,s);return d.emptyItemCount()>k4&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((a,s)=>{if(s>=e)o.push(a),a.selection&&i++;else if(a.step){let l=a.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=a.selection&&a.selection.map(n.slice(r));u&&i++;let d=new qr(c.invert(),l,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else a.map&&r--},this.items.length,0),new Ar(Bn.from(o.reverse()),i)}}Ar.empty=new Ar(Bn.empty,0);function D4(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class qr{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new qr(n.getMap().invert(),n,this.selection)}}}class Io{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const _4=20;function B4(t,e,n,r){let o=n.getMeta(Ci),i;if(o)return o.historyState;n.getMeta(L4)&&(t=new Io(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(Ci))return a.getMeta(Ci).redo?new Io(t.done.addTransform(n,void 0,r,Ul(e)),t.undone,w0(n.mapping.maps),t.prevTime,t.prevComposition):new Io(t.done,t.undone.addTransform(n,void 0,r,Ul(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let s=n.getMeta("composition"),l=t.prevTime==0||!a&&t.prevComposition!=s&&(t.prevTime<(n.time||0)-r.newGroupDelay||!j4(n,t.prevRanges)),c=a?kd(t.prevRanges,n.mapping):w0(n.mapping.maps);return new Io(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Ul(e)),Ar.empty,c,n.time,s??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Io(t.done.rebased(n,i),t.undone.rebased(n,i),kd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Io(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),kd(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function j4(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function w0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,a)=>e.push(i,a));return e}function kd(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function z4(t,e,n){let r=Ul(e),o=Ci.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let a=i.selection.resolve(i.transform.doc),s=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),l=new Io(n?s:i.remaining,n?i.remaining:s,null,0,-1);return i.transform.setSelection(a).setMeta(Ci,{redo:n,historyState:l})}let Dd=!1,E0=null;function Ul(t){let e=t.plugins;if(E0!=e){Dd=!1,E0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Dd=!0;break}}return Dd}const Ci=new vr("history"),L4=new vr("closeHistory");function V4(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Qn({key:Ci,state:{init(){return new Io(Ar.empty,Ar.empty,null,0,-1)},apply(e,n,r){return B4(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Jw:r=="historyRedo"?Qw:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Yw(t,e){return(n,r)=>{let o=Ci.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=z4(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Jw=Yw(!1,!0),Qw=Yw(!0,!0),F4=Hn.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Jw(t,e),redo:()=>({state:t,dispatch:e})=>Qw(t,e)}},addProseMirrorPlugins(){return[V4(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),H4=Sn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Zt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:o}=n,i=t();return r.parentOffset===0?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):kM(n)?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:a,dispatch:s})=>{var l;if(s){const{$to:c}=a.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?a.setSelection(gt.create(a.doc,c.pos+1)):c.nodeAfter.isBlock?a.setSelection(mt.create(a.doc,c.pos)):a.setSelection(gt.create(a.doc,c.pos));else{const d=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(a.insert(u,d),a.setSelection(gt.create(a.doc,u+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[dR({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),W4=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,q4=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,K4=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,U4=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,G4=to.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ei({find:W4,type:this.type}),Ei({find:K4,type:this.type})]},addPasteRules(){return[Ni({find:q4,type:this.type}),Ni({find:U4,type:this.type})]}}),X4="listItem",N0="textStyle",O0=/^(\d+)\.\s$/,Y4=Sn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Zt(this.options.HTMLAttributes,n),0]:["ol",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(X4,this.editor.getAttributes(N0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=fa({find:O0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=fa({find:O0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(N0)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),J4=Sn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Q4=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Z4=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,e6=to.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Zt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ei({find:Q4,type:this.type})]},addPasteRules(){return[Ni({find:Z4,type:this.type})]}}),t6=Sn.create({name:"text",group:"inline"}),n6=Hn.create({name:"starterKit",addExtensions(){var t,e,n,r,o,i,a,s,l,c,u,d,f,p,m,v,g,y;const b=[];return this.options.bold!==!1&&b.push(u4.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&b.push(i4.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&b.push(f4.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&b.push(m4.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&b.push(b4.configure((o=this.options)===null||o===void 0?void 0:o.codeBlock)),this.options.document!==!1&&b.push(y4.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&b.push(x4.configure((a=this.options)===null||a===void 0?void 0:a.dropcursor)),this.options.gapcursor!==!1&&b.push(I4.configure((s=this.options)===null||s===void 0?void 0:s.gapcursor)),this.options.hardBreak!==!1&&b.push(T4.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&b.push(P4.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&b.push(F4.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&b.push(H4.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&b.push(G4.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&b.push(zw.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&b.push(Y4.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&b.push(J4.configure((v=this.options)===null||v===void 0?void 0:v.paragraph)),this.options.strike!==!1&&b.push(e6.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&b.push(t6.configure((y=this.options)===null||y===void 0?void 0:y.text)),b}});function Zw({title:t,childrenContent:e,editable:n,childrenEdit:r}){const[o,i]=N.useState(!1),a=n?ve.jsxDEV(Go,{children:ve.jsxDEV(Go.Item,{onClick:()=>i(!0),children:"Edit"},"edit",!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:17,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:16,columnNumber:17},this):null;return ve.jsxDEV("div",{children:[n&&a?ve.jsxDEV(yu,{dropdownRender:()=>a,trigger:["contextMenu"],children:e},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:28,columnNumber:25},this):e,ve.jsxDEV(Mr,{title:`Edit ${t}`,open:o,onOk:()=>i(!1),onCancel:()=>i(!1),children:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:36,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/shared/components/modal-edit/modal-edit.component.tsx",lineNumber:25,columnNumber:9},this)}function r6({node:t,editor:e}){const[n,r]=N.useState(!1),[o,i]=N.useState(t.attrs.bgColor||"#f3f4f6"),[a,s]=N.useState(t.attrs.titleColor||"#000000"),l=d=>{d.preventDefault()},c=d=>{i(d.toHexString())},u=d=>{s(d.toHexString())};return ve.jsxDEV(gC,{className:"accordion-wrapper",children:ve.jsxDEV(Zw,{title:"Accordion",childrenContent:ve.jsxDEV("div",{className:"ce:my-4 ce:transition-all ce:duration-300 ce:border ce:rounded-lg ce:shadow-sm",onContextMenu:l,children:[ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:justify-between ce:p-4 ce:transition-colors ce:accordion-header",style:{backgroundColor:o},onClick:()=>r(!n),children:[ve.jsxDEV("input",{className:"ce:w-full ce:text-lg ce:font-medium ce:bg-transparent ce:border-none ce:outline-none",style:{color:a},defaultValue:t.attrs.title||"Accordion Title",disabled:!e.isEditable,suppressContentEditableWarning:!0,contentEditable:!0,placeholder:"Accordion title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:43,columnNumber:29},this),ve.jsxDEV(jH,{className:`ce:transition-transform ce:duration-300 ${n?"ce:rotate-180":""}`,size:20},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:54,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:38,columnNumber:25},this),ve.jsxDEV("div",{className:`ce:overflow-hidden ce:duration-300 ce:ease-in-out ${n?"ce:max-h-96 ce:opacity-100":"ce:max-h-0 ce:opacity-0"} `,children:ve.jsxDEV("div",{className:"ce:p-4 ce:border-t",children:ve.jsxDEV(AR,{contentEditable:e.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:70,columnNumber:33},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:69,columnNumber:29},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:62,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:34,columnNumber:21},this),editable:e.isEditable,childrenEdit:ve.jsxDEV("div",{className:"ce:px-6 ce:py-4 ce:space-y-6 ce:rounded-lg ce:bg-gray-50",children:[ve.jsxDEV("div",{className:"ce:grid ce:grid-cols-1 ce:gap-6",children:[ve.jsxDEV("div",{className:"ce:flex ce:flex-col ce:space-y-2",children:[ve.jsxDEV("label",{className:"ce:font-medium ce:text-gray-700",children:"Background Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:82,columnNumber:33},this),ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:space-x-3",children:[ve.jsxDEV("div",{className:"ce:w-8 ce:h-8 ce:border ce:rounded ce:shadow",style:{backgroundColor:o}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:86,columnNumber:37},this),ve.jsxDEV(Oc,{value:o,onChange:c},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:90,columnNumber:37},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:85,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:81,columnNumber:29},this),ve.jsxDEV("div",{className:"ce:flex ce:flex-col ce:space-y-2",children:[ve.jsxDEV("label",{className:"ce:font-medium ce:text-gray-700",children:"Title Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:98,columnNumber:33},this),ve.jsxDEV("div",{className:"ce:flex ce:items-center ce:space-x-3",children:[ve.jsxDEV("div",{className:"ce:w-8 ce:h-8 ce:border ce:rounded ce:shadow",style:{backgroundColor:a}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:102,columnNumber:37},this),ve.jsxDEV(Oc,{value:a,onChange:u},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:106,columnNumber:37},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:101,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:97,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:80,columnNumber:25},this),ve.jsxDEV("div",{className:"ce:pt-4 ce:border-t ce:border-gray-200",children:ve.jsxDEV("div",{className:"ce:p-3 ce:bg-white ce:border ce:rounded-md",children:[ve.jsxDEV("div",{className:"ce:text-sm ce:text-gray-600",children:"Preview"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:116,columnNumber:33},this),ve.jsxDEV("div",{className:"ce:p-2 ce:mt-2 ce:rounded",style:{backgroundColor:o},children:ve.jsxDEV("span",{style:{color:a,fontWeight:500},children:"Accordion Title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:123,columnNumber:37},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:119,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:115,columnNumber:29},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:114,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:79,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:31,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/accordion/accordion-view.component.tsx",lineNumber:30,columnNumber:9},this)}const o6=Sn.create({name:"accordion",group:"block",content:"block+",atom:!1,draggable:!0,selectable:!0,inline:!1,defining:!0,addAttributes(){return{title:{default:"Accordion Title"},bgColor:{default:"#f3f4f6"},titleColor:{default:"#000000"}}},parseHTML(){return[{tag:"accordion"}]},renderHTML({HTMLAttributes:t}){return["accordion",Zt(t)]},addNodeView(){return vC(r6)},addCommands(){return{setAccordion:t=>({chain:e})=>e().insertContent({type:"accordion",attrs:t,content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()}}});function i6({node:t,updateAttributes:e,editor:n}){const[r,o]=N.useState({width:t.attrs.width??50,height:t.attrs.height??"auto"}),[i,a]=N.useState({left:t.attrs.marginLeft??"0%",right:t.attrs.marginRight??"0%"}),[s,l]=N.useState(t.attrs.src||""),c=N.useRef(null);N.useEffect(()=>{if(t.attrs.src&&c.current){const f=new Image;f.onload=()=>{t.attrs.width===void 0&&o({width:100,height:"auto"})},f.src=t.attrs.src}},[t.attrs.src,t.attrs.width,t.attrs.height]);const u=()=>{e({src:s,width:r.width,height:r.height,marginLeft:i.left,marginRight:i.right})},d=f=>{f.preventDefault()};return ve.jsxDEV(gC,{className:"image-wrapper ce:w-full",children:ve.jsxDEV(Zw,{title:"Image",childrenContent:ve.jsxDEV("div",{className:"ce:relative ce:w-full ce:max-w-full ce:overflow-hidden",style:{marginLeft:i.left+"%",marginRight:i.right+"%"},onContextMenu:d,children:ve.jsxDEV("img",{ref:c,src:t.attrs.src,alt:"Uploaded",className:"ce:w-full ce:h-auto ce:object-contain ce:inline-block",style:{width:r.width+"%",height:r.height==="auto"?"auto":r.height+"%",maxWidth:"100%"},draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:68,columnNumber:25},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:60,columnNumber:21},this),editable:n.isEditable,childrenEdit:ve.jsxDEV("div",{className:"ce:space-y-4",children:[ve.jsxDEV("div",{children:[ve.jsxDEV("label",{className:"ce:block ce:text-sm ce:font-medium ce:text-gray-700",children:"Image URL"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:89,columnNumber:29},this),ve.jsxDEV(ho,{type:"text",value:s,onChange:f=>l(f.target.value),className:"ce:mt-1 ce:block ce:w-full ce:rounded-md ce:border-gray-300 ce:shadow-sm ce:focus:border-indigo-300 ce:focus:ring ce:focus:ring-indigo-200 focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:92,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:88,columnNumber:25},this),ve.jsxDEV("div",{className:"ce:flex ce:gap-4",children:[ve.jsxDEV("div",{className:"ce:flex-1",children:[ve.jsxDEV("label",{className:"ce:block ce:text-sm ce:font-medium ce:text-gray-700",children:"Width (%)"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:103,columnNumber:33},this),ve.jsxDEV(ho,{type:"number",value:r.width,onChange:f=>o({...r,width:Number(f.target.value)}),className:"ce:mt-1 ce:block ce:w-full ce:rounded-md ce:border-gray-300 ce:shadow-sm ce:focus:border-indigo-300 ce:focus:ring ce:focus:ring-indigo-200 ce:focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:106,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:102,columnNumber:29},this),ve.jsxDEV("div",{className:"ce:flex-1",children:[ve.jsxDEV("label",{className:"ce:block ce:text-sm ce:font-medium ce:text-gray-700",children:"Height"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:120,columnNumber:33},this),ve.jsxDEV(ur,{value:r.height,onChange:f=>o({...r,height:f}),className:"ce:mt-1 ce:block ce:w-full ce:rounded-md ce:border-gray-300 ce:shadow-sm ce:focus:border-indigo-300 ce:focus:ring ce:focus:ring-indigo-200 ce:focus:ring-opacity-50",disabled:!n.isEditable,children:[ve.jsxDEV(ur.Option,{value:"auto",children:"Auto"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:134,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"25",children:"25%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:137,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"50",children:"50%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:140,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"75",children:"75%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:143,columnNumber:37},this),ve.jsxDEV(ur.Option,{value:"100",children:"100%"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:146,columnNumber:37},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:123,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:119,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:101,columnNumber:25},this),ve.jsxDEV("div",{className:"ce:flex ce:gap-4",children:[ve.jsxDEV("div",{className:"ce:flex-1",children:[ve.jsxDEV("label",{className:"ce:block ce:text-sm ce:font-medium ce:text-gray-700",children:"Margin Left (%)"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:155,columnNumber:33},this),ve.jsxDEV(ho,{type:"number",value:i.left,onChange:f=>a({...i,left:String(Number(f.target.value))}),className:"ce:mt-1 ce:block ce:w-full ce:rounded-md ce:border-gray-300 ce:shadow-sm ce:focus:border-indigo-300 ce:focus:ring focus:ring-indigo-200 ce:focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:158,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:154,columnNumber:29},this),ve.jsxDEV("div",{className:"ce:flex-1",children:[ve.jsxDEV("label",{className:"ce:block ce:text-sm ce:font-medium ce:text-gray-700",children:"Margin Right (%)"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:174,columnNumber:33},this),ve.jsxDEV(ho,{type:"number",value:i.right,onChange:f=>a({...i,right:String(Number(f.target.value))}),className:"ce:mt-1 ce:block ce:w-full ce:rounded-md ce:border-gray-300 ce:shadow-sm ce:focus:border-indigo-300 ce:focus:ring ce:focus:ring-indigo-200 ce:focus:ring-opacity-50",disabled:!n.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:177,columnNumber:33},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:173,columnNumber:29},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:153,columnNumber:25},this),ve.jsxDEV("button",{type:"button",onClick:u,className:"ce:w-full ce:py-2 ce:px-4 ce:bg-indigo-600 ce:text-white ce:rounded-md ce:hover:bg-indigo-700 ce:focus:outline-none ce:focus:ring-2 ce:focus:ring-indigo-500 ce:focus:ring-offset-2",disabled:!n.isEditable,children:"Update Image"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:194,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:87,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:57,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/modules/image/image-view.component.tsx",lineNumber:56,columnNumber:9},this)}const a6=Sn.create({name:"image",group:"block",content:"inline*",atom:!0,draggable:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:50},height:{default:"auto"},marginLeft:{default:0},marginRight:{default:0}}},parseHTML(){return[{tag:"img",getAttrs:t=>t instanceof HTMLElement?{src:t.getAttribute("src"),width:t.getAttribute("width")?Number(t.getAttribute("width")):50,height:t.getAttribute("height")||"auto",marginLeft:t.getAttribute("marginleft")?Number(t.getAttribute("marginleft")):0,marginRight:t.getAttribute("marginright")?Number(t.getAttribute("marginright")):0}:null}]},renderHTML({HTMLAttributes:t}){return["img",Zt(t)]},addNodeView(){return vC(i6)},addCommands(){return{setImage:t=>({chain:e})=>e().insertContent({type:"image",attrs:{...t,width:(t==null?void 0:t.width)??50,height:(t==null?void 0:t.height)??"auto"}}).run()}}}),s6=[V5.configure({types:[a0.name,zw.name]}),a0,W5.configure({multicolor:!0}),n6.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1}}),r4,q5,K5,n4.configure({types:["heading","paragraph"]}),t4,e4,X3.configure({resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"table-wrapper"}}),Q3,J3,Y3.configure({HTMLAttributes:{class:"table-cell"}}),a6,o6];function l6({content:t="",slotBefore:e=!1,className:n="",editorClassName:r="",editable:o=!0,onChange:i}){const a=TR({extensions:s6,content:t,editable:o,onUpdate:({editor:s})=>{i==null||i(s.getHTML())}});return N.useEffect(()=>{a&&t!==a.getHTML()&&a.commands.setContent(t,!1)},[a,t]),a?ve.jsxDEV("div",{className:re(eE["cyber-editor"],n),children:[e&&ve.jsxDEV(z5,{editor:a},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:43,columnNumber:28},this),ve.jsxDEV(SR,{editor:a,className:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:44,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:42,columnNumber:9},this):ve.jsxDEV(xE,{full:!0},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/shared/providers/editor.tsx",lineNumber:38,columnNumber:16},this)}exports.EditorProvider=l6;
|