PageSourceSearch

https://pika.page/assets/@tiptap--extension-list-5f7e63ad9de2ff59f…5441e10a8306ba3768bccf8d5eefdb4e18e51281.js

js pika.page collected 2026-10-03 21:41:59 UTC 22,892 bytes, 15 lines download raw bytes

vendor: 7,388 bytes, lines 1-4
1// @tiptap/[email protected] downloaded from https://ga.jspm.io/npm:@tiptap/[email protected]/dist/index.js
2
3import{Node as e,wrappingInputRule as t,mergeAttributes as n,Extension as r,renderNestedMarkdownContent as i,getNodeType as a,getNodeAtPosition as o,isNodeActive as s,isAtStartOfNode as c,isAtEndOfNode as l,getPreviousBlockSibling as u,getRenderedAttributes as d,parseIndentedBlocks as f}from"@tiptap/core";import{Fragment as p}from"@tiptap/pm/model";import{TextSelection as m,Plugin as h}from"@tiptap/pm/state";var g=Object.defineProperty,_=(e,t)=>{let n={};for(var r in e)g(n,r,{get:e[r],enumerable:!0});return t||g(n,Symbol.toStringTag,{value:`Module`}),n};const ee=`listItem`,v=`textStyle`,y=/^\s*([-+*])\s$/,b=e.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:e}){return[`ul`,n(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
4`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(`listItem`,this.editor.getAttributes(v)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=t({find:y,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=t({find:y,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(v),editor:this.editor})),[e]}}),te=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},ne=(e,t,n,r)=>{let i=te(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,p.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},re=(e,t,n)=>ne(e.state,e.view.dispatch,t,n),x=(e,t)=>r.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>re(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),S=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],C=`abcdefghijklmnopqrstuvwxyz`,w=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function T(e){let t=e,n=``;for(let[e,r]of S)for(;t>=e;)n+=r,t-=e;return n}function E(e){return T(e).toUpperCase()}function D(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of S)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function ie(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=D(e);return t<=0?!1:(e===e.toLowerCase()?T(t):E(t))===e}function ae(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function O(e){if(e<=26)return C[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?C[n]:C[t]+C[n]}function k(e){if(!(!e||/^\d+$/.test(e))){if(ie(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function A(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=k(e);if(t===`i`||t===`I`)return D(e);if(t===`a`||t===`A`){let t=ae(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function oe(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return O(t);case`A`:return O(t).toUpperCase();case`i`:return T(t);case`I`:return E(t);default:return String(t)}}function j(e){var t;if(e.length===0)return!1;let n=(t=k(e[0]))==null?`numeric`:t,r=A(e[0]);if(r<1)return!1;for(let t=0;t<e.length;t++){let i=oe(n,r+t);if(e[t]!==i)return!1}return!0}function M(e){return{type:k(e),start:A(e)}}function N(e){let{type:t,start:n}=M(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function P(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${O(r)}${n}`;case`A`:return`${O(r).toUpperCase()}${n}`;case`i`:return`${T(r)}${n}`;case`I`:return`${E(r)}${n}`;default:return`${r}${n}`}}function se(e){var t,n;let r=(t=e.tokens)==null?void 0:t[0];return!!(e.text&&((n=e.tokens)==null?void 0:n.length)===1&&(r==null?void 0:r.type)===`list`&&r.ordered&&r.raw===e.text)}function ce(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}const F=e.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,n(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{var n;if(e.type!==`list_item`)return[];let r=(n=t.parseBlockChildren)==null?t.parseChildren:n,i=[];if(e.tokens&&e.tokens.length>0){if(se(e))return{type:`listItem`,content:[{type:`paragraph`,content:ce(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))i=r(e.tokens);else{let n=e.tokens[0];if(n&&n.type===`text`&&n.tokens&&n.tokens.length>0){if(i=[{type:`paragraph`,content:t.parseInline(n.tokens)}],e.tokens.length>1){let t=r(e.tokens.slice(1));i.push(...t)}}else i=r(e.tokens)}}return i.length===0&&(i=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:i}},renderMarkdown:(e,t,n)=>i(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return P((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n,{alignNestedToPrefix:(n==null?void 0:n.parentType)===`orderedList`}),addExtensions(){return[x(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),I=(e,t)=>{let{$from:n}=t.selection,r=a(e,t.schema),i=null,o=n.depth,s=n.pos,c=null;for(;o>0&&c===null;)i=n.node(o),i.type===r?c=o:(--o,--s);return c===null?null:{$pos:t.doc.resolve(s),depth:c}},L=(e,t)=>{let n=I(e,t);if(!n)return!1;let[,r]=o(t,e,n.$pos.pos+4);return r},R=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},z=(e,t,n)=>{if(e.commands.undoInputRule())return!0;
4if(e.state.selection.from!==e.state.selection.to)return!1;if(!s(e.state,t)&&R(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!s(e.state,t)||!c(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},B=(e,t)=>{let n=L(e,t),r=I(e,t);return!r||!n?!1:n>r.depth},V=(e,t)=>{let n=L(e,t),r=I(e,t);return!r||!n?!1:n<r.depth},H=(e,t)=>{if(!s(e.state,t)||!l(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:B(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():V(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},U=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||s(r,t))return!1;let o=u(a);if(!o||!n.includes(o.type.name))return!1;let c=o.lastChild;if(!c||c.type.name!==t)return!1;let l=a.parent;if(!c.canReplace(c.childCount,c.childCount,p.from(l)))return!1;let d=a.before(),f=a.after(),h=d-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(d,f).insert(h,p.from(l)),e.setSelection(m.create(e.doc,h+1)),e.scrollIntoView()),!0))},le=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==e)},ue=(e,t)=>{var n;let{$anchor:r}=t.selection,i=t.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==e)},de=(e,t,n)=>{if(!n)return!1;let r=a(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i};var fe=/* @__PURE__ */ _({findListItemPos:()=>I,getNextListDepth:()=>L,handleBackspace:()=>z,handleDelete:()=>H,handleTab:()=>U,hasListBefore:()=>R,hasListItemAfter:()=>le,hasListItemBefore:()=>ue,listItemHasSubList:()=>de,nextListIsDeeper:()=>B,nextListIsHigher:()=>V});const W=r.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&H(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&H(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&z(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&z(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&U(e,t,n))return!0;return!1}}}}),G=RegExp(`^(\\s*)(${w})([.)])\\s+(.*)$`),pe=/^\s/,K={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function me(e){return G.test(e.trimStart())}function he(e){let t=e.trimStart();return K.bulletItem.test(t)||me(t)||K.heading.test(t)||K.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||K.codeFence.test(t)||K.blockMath.test(t)}function ge(e){return Object.values(K).some(t=>t.test(e))}function _e(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&he(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function ve(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(G);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?k(s):void 0,p=isNaN(d)?A(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(G))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(pe)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||ge(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
5`).trim(),contentLines:m,raw:g.join(`
6`)}),r=h,n=h}return[t,r]}const ye=RegExp(`^(${w})([.)])\\s+(.+)$`);function q(e){let t=e.split(`
7`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(ye);if(!t)return null;n.push({marker:t[1],content:t[3]})}return j(n.map(e=>e.marker))?{type:`orderedList`,attrs:N(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function J(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=_e(a.contentLines),c=o.join(`
8`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
9`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=J(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
10`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function be(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>
100&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}const xe=`listItem`,Y=`textStyle`,X=/^(\d+)\.\s$/;function Z(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}const Q=e.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:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=Z(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=Z(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:r,...i}=e,a=n(this.options.HTMLAttributes,i);return t!==1&&(a.start=t),r&&r!==`1`&&(a.type=r),[`ol`,a,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?be(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
11`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{var r,i;let a=e.split(`
12`),[o,s]=ve(a);if(o.length===0)return;let c=J(o,o[0].indent,n);if(c.length!==0)return{type:`list`,ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,typeMarker:(i=o[0])==null?void 0:i.type,items:c,raw:a.slice(0,s).join(`
13`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(`listItem`,this.editor.getAttributes(Y)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new h({props:{handlePaste:(e,t)=>
13{var n,r;let i=(n=t.clipboardData)==null?void 0:n.getData(`text/html`);if(i!=null&&i.trim())return!1;let a=(r=t.clipboardData)==null?void 0:r.getData(`text/plain`);if(!a)return!1;let o=q(a);if(!o)return!1;try{let t=e.state.schema.nodeFromJSON(o),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],n=t({find:X,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(n=t({find:X,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Y)}),joinPredicate:e,editor:this.editor})),[n]}}),Se=/^\s*(\[([( |x])?\])\s$/,Ce=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,we=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},Te=e.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>{var t;return(t=e.querySelector(`div`))==null?e:t}}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,n(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;return i(e,t,`- [${(n=e.attrs)!=null&&n.checked?`x`:` `}] `)},addExtensions(){return this.options.nested?[x(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`;let l=e=>{let t=we(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r==null?void 0:r.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=d(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;
13return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[t({find:Se,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),$=e.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:e}){return[`ul`,n(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
14`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){var t;let n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n===void 0?-1:n},tokenize(e,t,n){let r=e=>{let t=f(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=f(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Ee=r.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(b.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(F.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(W.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Q.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Te.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push($.configure(this.options.taskList)),e}});export{b as BulletList,F as ListItem,W as ListKeymap,Ee as ListKit,w as ORDERED_LIST_MARKER_PATTERN,Q as OrderedList,Te as TaskItem,$ as TaskList,j as areOrderedListMarkersSequential,N as buildOrderedListAttrsFromMarker,y as bulletListInputRegex,k as detectMarkerType,P as getListMarker,Se as inputRegex,fe as listHelpers,A as markerToStart,X as orderedListInputRegex,M as parseListMarker,q as parsePlainTextOrderedListPaste,T as toRoman,E as toRomanUpper};
15

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.