/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../core/dist/index.js");var e=Object.defineProperty,s="textStyle",n=/^\s*([-+*])\s$/,r=t.Node.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",t.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>"list"!==t.type||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(s)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=t.wrappingInputRule({find:n,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=t.wrappingInputRule({find:n,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(s),editor:this.editor})),[e]}}),i=t.Node.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",t.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if("list_item"!==t.type)return[];let s=[];if(t.tokens&&t.tokens.length>0){if(t.tokens.some(t=>"paragraph"===t.type))s=e.parseChildren(t.tokens);else{const n=t.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(n.tokens)}],t.tokens.length>1){const n=t.tokens.slice(1),r=e.parseChildren(n);s.push(...r)}}else s=e.parseChildren(t.tokens)}}return 0===s.length&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(e,s,n)=>t.renderNestedMarkdownContent(e,s,t=>{var e,s;if("bulletList"===t.parentType)return"- ";if("orderedList"===t.parentType){return`${((null==(s=null==(e=t.meta)?void 0:e.parentAttrs)?void 0:s.start)||1)+t.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),o={};((t,s)=>{for(var n in s)e(t,n,{get:s[n],enumerable:!0})})(o,{findListItemPos:()=>a,getNextListDepth:()=>d,handleBackspace:()=>u,handleDelete:()=>k,hasListBefore:()=>p,hasListItemAfter:()=>b,hasListItemBefore:()=>c,listItemHasSubList:()=>l,nextListIsDeeper:()=>h,nextListIsHigher:()=>m});var a=(e,s)=>{const{$from:n}=s.selection,r=t.getNodeType(e,s.schema);let i=null,o=n.depth,a=n.pos,d=null;for(;o>0&&null===d;)i=n.node(o),i.type===r?d=o:(o-=1,a-=1);return null===d?null:{$pos:s.doc.resolve(a),depth:d}},d=(e,s)=>{const n=a(e,s);if(!n)return!1;const[,r]=t.getNodeAtPosition(s,e,n.$pos.pos+4);return r},p=(t,e,s)=>{const{$anchor:n}=t.selection,r=Math.max(0,n.pos-2),i=t.doc.resolve(r).node();return!(!i||!s.includes(i.type.name))},c=(t,e)=>{var s;const{$anchor:n}=e.selection,r=e.doc.resolve(n.pos-2);return 0!==r.index()&&(null==(s=r.nodeBefore)?void 0:s.type.name)===t},l=(e,s,n)=>{if(!n)return!1;const r=t.getNodeType(e,s.schema);let i=!1;return n.descendants(t=>{t.type===r&&(i=!0)}),i},u=(e,s,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!t.isNodeActive(e.state,s)&&p(e.state,s,n)){const{$anchor:t}=e.state.selection,n=e.state.doc.resolve(t.before()-1),r=[];n.node().descendants((t,e)=>{t.type.name===s&&r.push({node:t,pos:e})});const i=r.at(-1);if(!i)return!1;const o=e.state.doc.resolve(n.start()+i.pos+1);return e.chain().cut({from:t.start()-1,to:t.end()+1},o.end()).joinForward().run()}if(!t.isNodeActive(e.state,s))return!1;if(!t.isAtStartOfNode(e.state))return!1;const r=a(s,e.state);if(!r)return!1;const i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=l(s,e.state,i);return c(s,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(s).run()},h=(t,e)=>{const s=d(t,e),n=a(t,e);return!(!n||!s)&&s>n.depth},m=(t,e)=>{const s=d(t,e),n=a(t,e);return!(!n||!s)&&s<n.depth},k=(e,s)=>{if(!t.isNodeActive(e.state,s))return!1;if(!t.isAtEndOfNode(e.state,s))return!1;const{selection:n}=e.state,{$from:r,$to:i}=n;return!(!n.empty&&r.sameParent(i))&&(h(s,e.state)?e.chain().focus(e.state.selection.from+4).lift(s).joinBackward().run():m(s,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},b=(t,e)=>{var s;const{$anchor:n}=e.selection,r=e.doc.resolve(n.pos-n.parentOffset-2);return r.index()!==r.parent.childCount-1&&(null==(s=r.nodeAfter)?void 0:s.type.name)===t},g=t.Extension.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s})=>{void 0!==t.state.schema.nodes[s]&&k(t,s)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s})=>{void 0!==t.state.schema.nodes[s]&&k(t,s)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s,wrapperNames:n})=>{void 0!==t.state.schema.nodes[s]&&u(t,s,n)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s,wrapperNames:n})=>{void 0!==t.state.schema.nodes[s]&&u(t,s,n)&&(e=!0)}),e}}}}),L=/^(\s*)(\d+)\.\s+(.*)$/,f=/^\s/;function y(t,e,s){var n;const r=[];let i=0;for(;i<t.length;){const o=t[i];if(o.indent===e){const a=o.content.split("\n"),d=(null==(n=a[0])?void 0:n.trim())||"",p=[];d&&p.push({type:"paragraph",raw:d,tokens:s.inlineTokens(d)});const c=a.slice(1).join("\n").trim();if(c){const t=s.blockTokens(c);p.push(...t)}let l=i+1;const u=[];for(;l<t.length&&t[l].indent>e;)u.push(t[l]),l+=1;if(u.length>0){const t=Math.min(...u.map(t=>t.indent)),e=y(u,t,s);p.push({type:"list",ordered:!0,start:u[0].number,items:e,raw:u.map(t=>t.raw).join("\n")})}r.push({type:"list_item",raw:o.raw,tokens:p}),i=l}else i+=1}return r}var T="textStyle",A=/^(\d+)\.\s$/,M=t.Node.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:s,...n}=e;return 1===s?["ol",t.mergeAttributes(this.options.HTMLAttributes,n),0]:["ol",t.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if("list"!==t.type||!t.ordered)return[];const s=t.start||1,n=t.items?function(t,e){return t.map(t=>{if("list_item"!==t.type)return e.parseChildren([t])[0];const s=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(t=>{if("paragraph"===t.type||"list"===t.type||"blockquote"===t.type||"code"===t.type)s.push(...e.parseChildren([t]));else if("text"===t.type&&t.tokens){const n=e.parseChildren([t]);s.push({type:"paragraph",content:n})}else{const n=e.parseChildren([t]);n.length>0&&s.push(...n)}}),{type:"listItem",content:s}})}(t.items,e):[];return 1!==s?{type:"orderedList",attrs:{start:s},content:n}:{type:"orderedList",content:n}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),s=null==e?void 0:e.index;return void 0!==s?s:-1},tokenize:(t,e,s)=>{var n;const r=t.split("\n"),[i,o]=function(t){const e=[];let s=0,n=0;for(;s<t.length;){const r=t[s],i=r.match(L);if(!i)break;const[,o,a,d]=i,p=o.length;let c=d,l=s+1;const u=[r];for(;l<t.length;){const e=t[l];if(e.match(L))break;if(""===e.trim())u.push(e),c+="\n",l+=1;else{if(!e.match(f))break;u.push(e),c+=`\n${e.slice(p+2)}`,l+=1}}e.push({indent:p,number:parseInt(a,10),content:c.trim(),raw:u.join("\n")}),n=l,s=l}return[e,n]}(r);if(0===i.length)return;const a=y(i,0,s);if(0===a.length)return;return{type:"list",ordered:!0,start:(null==(n=i[0])?void 0:n.number)||1,items:a,raw:r.slice(0,o).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(T)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=t.wrappingInputRule({find:A,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=t.wrappingInputRule({find:A,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(T)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[e]}}),v=/^\s*(\[([( |x])?\])\s$/,w=t.Node.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return""===e||"true"===e},renderHTML:t=>({"data-checked":t.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:s}){return["li",t.mergeAttributes(this.options.HTMLAttributes,s,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const s=[];if(t.tokens&&t.tokens.length>0?s.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?s.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):s.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const n=e.parseChildren(t.nestedTokens);s.push(...n)}return e.createNode("taskItem",{checked:t.checked||!1},s)},renderMarkdown:(e,s)=>{var n;const r=`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `;return t.renderNestedMarkdownContent(e,s,r)},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:e,HTMLAttributes:s,getPos:n,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),a=document.createElement("span"),d=document.createElement("input"),p=document.createElement("div"),c=t=>{var e,s;d.ariaLabel=(null==(s=null==(e=this.options.a11y)?void 0:e.checkboxLabel)?void 0:s.call(e,t,d.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};c(e),o.contentEditable="false",d.type="checkbox",d.addEventListener("mousedown",t=>t.preventDefault()),d.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(d.checked=!d.checked);const{checked:s}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:t})=>{const e=n();if("number"!=typeof e)return!1;const r=t.doc.nodeAt(e);return t.setNodeMarkup(e,void 0,{...null==r?void 0:r.attrs,checked:s}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,s)||(d.checked=!d.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([t,e])=>{i.setAttribute(t,e)}),i.dataset.checked=e.attrs.checked,d.checked=e.attrs.checked,o.append(d,a),i.append(o,p),Object.entries(s).forEach(([t,e])=>{i.setAttribute(t,e)});let l=new Set(Object.keys(s));return{dom:i,contentDOM:p,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,d.checked=e.attrs.checked,c(e);const s=r.extensionManager.attributes,n=t.getRenderedAttributes(e,s),o=new Set(Object.keys(n)),a=this.options.HTMLAttributes;return l.forEach(t=>{o.has(t)||(t in a?i.setAttribute(t,a[t]):i.removeAttribute(t))}),Object.entries(n).forEach(([t,e])=>{null==e?t in a?i.setAttribute(t,a[t]):i.removeAttribute(t):i.setAttribute(t,e)}),l=o,!0}}}},addInputRules(){return[t.wrappingInputRule({find:v,type:this.type,getAttributes:t=>({checked:"x"===t[t.length-1]})})]}}),I=t.Node.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",t.mergeAttributes(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const s=null==(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:e.index;return void 0!==s?s:-1},tokenize(e,s,n){const r=e=>{const s=t.parseIndentedBlocks(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:t=>({indentLevel:t[1].length,mainContent:t[4],checked:"x"===t[3].toLowerCase()}),createToken:(t,e)=>({type:"taskItem",raw:"",mainContent:t.mainContent,indentLevel:t.indentLevel,checked:t.checked,text:t.mainContent,tokens:n.inlineTokens(t.mainContent),nestedTokens:e}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(e)},i=t.parseIndentedBlocks(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:t=>({indentLevel:t[1].length,mainContent:t[4],checked:"x"===t[3].toLowerCase()}),createToken:(t,e)=>({type:"taskItem",raw:"",mainContent:t.mainContent,indentLevel:t.indentLevel,checked:t.checked,text:t.mainContent,tokens:n.inlineTokens(t.mainContent),nestedTokens:e}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});t.Extension.create({name:"listKit",addExtensions(){const t=[];return!1!==this.options.bulletList&&t.push(r.configure(this.options.bulletList)),!1!==this.options.listItem&&t.push(i.configure(this.options.listItem)),!1!==this.options.listKeymap&&t.push(g.configure(this.options.listKeymap)),!1!==this.options.orderedList&&t.push(M.configure(this.options.orderedList)),!1!==this.options.taskItem&&t.push(w.configure(this.options.taskItem)),!1!==this.options.taskList&&t.push(I.configure(this.options.taskList)),t}}),exports.BulletList=r,exports.ListItem=i,exports.ListKeymap=g,exports.OrderedList=M,exports.TaskItem=w,exports.TaskList=I,exports.bulletListInputRegex=n,exports.inputRegex=v,exports.listHelpers=o,exports.orderedListInputRegex=A;