@burdenoff/microfe-support 2026.1115.1 → 2026.1118.1
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/support/components/careers/RichTextEditor.js +31 -31
- package/dist/support/components/careers/RichTextEditor.js.map +1 -1
- package/package.json +1 -1
- package/dist/_virtual/_rolldown/runtime.js +0 -6
- package/dist/node_modules/@tiptap/core/dist/index.js +0 -3491
- package/dist/node_modules/@tiptap/core/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -44
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +0 -12
- package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -75
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -73
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -78
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -157
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -11
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -50
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -70
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -49
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -70
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -389
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -967
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -46
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -6
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -55
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -14
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +0 -72
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -457
- package/dist/node_modules/@tiptap/extensions/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +0 -332
- package/dist/node_modules/@tiptap/react/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -28
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +0 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +0 -298
- package/dist/node_modules/fast-equals/dist/es/index.js.map +0 -1
- package/dist/node_modules/linkifyjs/dist/linkify.js +0 -527
- package/dist/node_modules/linkifyjs/dist/linkify.js.map +0 -1
- package/dist/node_modules/orderedmap/dist/index.js +0 -68
- package/dist/node_modules/orderedmap/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +0 -334
- package/dist/node_modules/prosemirror-commands/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -112
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -168
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +0 -219
- package/dist/node_modules/prosemirror-history/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -51
- package/dist/node_modules/prosemirror-keymap/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +0 -1775
- package/dist/node_modules/prosemirror-model/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -77
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-state/dist/index.js +0 -526
- package/dist/node_modules/prosemirror-state/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1204
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +0 -3355
- package/dist/node_modules/prosemirror-view/dist/index.js.map +0 -1
- package/dist/node_modules/rope-sequence/dist/index.js +0 -84
- package/dist/node_modules/rope-sequence/dist/index.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +0 -55
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +0 -53
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -53
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -45
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +0 -11
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +0 -11
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +0 -1
- package/dist/node_modules/w3c-keyname/index.js +0 -89
- package/dist/node_modules/w3c-keyname/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Fragment$1","__exportAll","createChainableState","config","transaction","state","storedMarks","selection","doc","CommandManager","props","editor","tr","rawCommands","name","command","args","callback","view","callbacks","hasStartTransaction","startTr","run","shouldDispatch","chain","property","target","blur","_window","clearContent","commands","clearNodes","dispatch","startMapsLength","ranges","from","$from","to","$to","depthMapping","maxSweeps","pos","sweep","docBefore","sweepMapsLength","rangeMapping","cachedMapsLength","sweepMapping","mappedFrom","mappedTo","node","$mappedFrom","$mappedTo","nodeRange","targetLiftDepth","liftTarget","defaultType","fn","createParagraphNear$1","createParagraphNear","cut","contentSlice","originRange","newPos","targetPos","TextSelection","deleteCurrentNode","currentNode","$pos","depth","getNodeType","nameOrType","schema","deleteNode","type","typeOrName","deleteRange","range","hasTextContent","nodeSpec","expandSelectionForSide","side","parentContent","expandSelectionForInlineText","deleteSelection","marks","mapFrom","mapping","enter","exitCode$1","exitCode","isRegExp","value","objectIncludes","keys","object2","options","key","object1","findMarkInSet","item","attributes","k","isMarkInSet","getMarkRange","start","mark","firstMark","startIndex","startPos","endIndex","endPos","getMarkType","extendMarkRange","newSelection","first","items","i","isTextSelection","minMax","min","max","resolveFocusPosition","position","selectionAtStart","Selection","selectionAtEnd","minPos","maxPos","isAndroid","isiOS","isSafari","focus","delayedFocus","isSameSelection","forEach","insertContent","removeWhitespaces","children","child","elementFromString","wrappedValue","html","isProseMirrorContent","createNodeFromContent","content","isJSONContent","isTextContent","Fragment","error","hasInvalidContent","invalidContent","contentCheckSchema","Schema","DOMParser","parser","isFragment","nodeOrFragment","selectionToInsertionEnd","last","startLen","step","ReplaceStep","ReplaceAroundStep","map","end","newTo","bias","insertContentAt","emitContentError","parseOptions","isOnlyTextContent","isOnlyBlockContent","nodes","parent","newContent","$fromNode","fromSelectionAtStart","hasContent","defaultBlockAt","match","insertDefaultBlock","validAttrKeys","filteredAttrs","attrs","parsed","updateSelection","joinUp$1","joinUp","joinDown$1","joinDown","joinBackward$1","joinBackward","joinForward$1","joinForward","canJoinItemsAt","before","after","joinItemBackward","point","joinPoint","joinItemForward","joinTextblockBackward$1","joinTextblockBackward","joinTextblockForward$1","joinTextblockForward","isMacOS","normalizeKeyName","parts","result","alt","ctrl","shift","meta","mod","keyboardShortcut","event","f","newStep","isNodeActive","nodeRanges","relativeFrom","relativeTo","selectionRange","matchedNodeRanges","empty","sum","lift$1","lift","liftEmptyBlock$1","liftEmptyBlock","liftListItem$1","liftListItem","newlineInCode$1","newlineInCode","getSchemaTypeNameByName","deleteProps","propOrProps","obj","prop","newObj","resetAttributes","nodeType","markType","schemaType","canReset","scrollIntoView","selectAll","AllSelection","selectNodeBackward$1","selectNodeBackward","selectNodeForward$1","selectNodeForward","selectParentNode$1","selectParentNode","selectTextblockEnd$1","selectTextblockEnd","selectTextblockStart$1","selectTextblockStart","createDocument","setContent","document","errorOnInvalidContent","emitUpdate","getMarkAttributes","markItem","combineTransactionSteps","transform","Transform","oldDoc","transactions","findChildrenInRange","nodesWithPos","predicate","findParentNodeClosestToPos","findParentNode","getExtensionField","extension","field","context","flattenExtensions","extensions","addExtensions","getHTMLFromFragment","documentFragment","DOMSerializer","fragment","container","getSchemaAttributes","attributesByType","attribute","typeAttributes","spec","local","hasDefault","nodeSchemaFields","markSchemaFields","structuralFields","fields","expected","path","mergeType","external","checkTypes","kind","mergeSchemaSpec","findDuplicates","filtered","el","index","splitExtensions","getAttributesFromExtensions","extensionAttributes","nodeAndMarkExtensions","nodeExtensions","markExtensions","defaultAttribute","nodeExtensionTypes","ext","markExtensionTypes","allExtensionTypes","addGlobalAttributes","resolvedTypes","globalAttribute","addAttributes","mergedAttr","isFunction","callOrReturn","isEmptyObject","splitStyleDeclarations","current","inSingleQuote","inDoubleQuote","parenDepth","length","styles","char","parseStyleEntries","pairs","declarations","numDeclarations","declaration","firstColonIndex","mergeAttributes","objects","mergedAttributes","valueClasses","existingClasses","insertClasses","valueClass","styleMap","val","getRenderedAttributes","nodeOrMark","fromString","injectExtensionAttributesToParseRule","parseRule","oldAttributes","newAttributes","cleanUpSchemaItem","data","buildAttributeSpec","_extensionAttribute$a","_extensionAttribute$a2","extensionAttribute","getSchemaSpecByResolvedExtensions","allAttributes","extendNodeSchema","e","parseHTML","renderHTML","renderText","extendMarkSchema","getSchemaByResolvedExtensions","schemaSpec","duplicates","sortExtensions","priorityA","a","priorityB","b","resolveExtensions","resolvedExtensions","duplicatedNames","getTextBetween","text","startNode","blockSeparator","textSerializer","textSerializers","_node$text","getText","getTextSerializersFromSchema","getNodeAttributes","nodeItem","getAttributes","removeDuplicates","seen","array","by","simplifyChangedRanges","uniqueChanges","changes","change","otherChange","getChangedRanges","inverted","stepMap","steps","rest","newStart","newEnd","oldStart","oldEnd","getMarksBetween","getNodeAtPosition","currentDepth","maxDepth","getPreviousBlockSibling","parentDepth","getSchemaTypeByName","getSplittedAttributes","typeName","getTextContentFromNodes","textBefore","sliceEndPos","maxMatch","_node$type$spec","chunk","isMarkActive","markRanges","matchedRange","markRange","excludedRange","isActive","isAtEndOfNode","parentNode","$parentPos","$anchor","isAtStartOfNode","isExtensionRulesEnabled","enabled","enabledExtension","isList","group","isNodeEmpty","ignoreWhitespace","checkChildren","isContentEmpty","childNode","isNodeSelection","NodeSelection","isProseMirrorStep","isProseMirrorReplaceStep","json","MappablePosition","getUpdatedPosition","mapResult","createMappablePosition","canSetMark","cursor","currentMarks","newMarkType","someNodeSupportsMark","parentAllowsMarkType","currentMarksAllowMarkType","otherMark","setMark","trimmedFrom","trimmedTo","setMeta","setNode","attributesToCopy","setBlockType","updatedState","setNodeSelection","setTextDirection","direction","setTextSelection","resolvedFrom","resolvedEnd","sinkListItem$1","sinkListItem","ensureMarks","filteredMarks","splittableMarks","splitBlock","canSplit","keepMarks","atEnd","deflt","types","deletedTr","EditorState","splitDoc","splitPos","can","$first","splitListItem","grandParent","wrap","depthBefore","d","depthAfter","newNextTypeAttributes","overrideAttrs","nextType","Slice","sel","n","newTypeAttributes","splitsAtStartOfItem","itemStart","trailingTypeAttributes","createNode","flushPendingContent","itemType","appendContentNode","appendNestedList","nestedItems","convertListItems","sourceList","nestedList","convertListItem","sourceItem","convertedItems","findNodePosition","root","normalizeListType","areListTypesCompatible","typeA","typeB","joinListBackwards","list","listType","nodeBefore","canJoin","joinListForwards","nodeAfter","createInnerSelectionForWholeDocList","$start","$end","toggleList","listTypeOrName","itemTypeOrName","parentList","isAllSelection","topLevelNodes","soleTopLevelNode","allSelectionList","currentList","isInsideExistingList","hasWholeDocSelectedList","trx","disp","nextSelection","currentItemType","convertedContent","anchorParent","headParent","$head","anchorOffset","headOffset","newList","anchorParentPos","headParentPos","anchor","head","canWrapInList","toggleMark","toggleNode","toggleType","toggleTypeOrName","toggleWrap","undoInputRule","plugins","plugin","undoable","toUndo","j","unsetAllMarks","clearableMarkTypes","ignoreClearable","nonClearableMarks","unsetMark","extendEmptyMarkRange","unsetTextDirection","newAttrs","updateAttributes","canUpdate","lastPos","lastNode","trimmedFrom2","trimmedTo2","DECORATION_MANAGER_PLUGIN_KEY","PluginKey","updateDecorations","extensionName","wrapIn$1","wrapIn","wrapInList$1","wrapInList","commands_exports","depthByEditor","runInDecorationApplyScope","remaining","isInDecorationApplyScope","EventEmitter","onceFn","isDev","isWidgetDecoration","decoration","decorationsToPMDecorations","pmDecorations","widgetKeys","decorations","buildDecorationSet","DecorationSet","rangeOwnsPosition","docSize","filterOutOfRangeDecorations","warnedExtensions","widgetKeyOf","findDuplicateWidgetKeys","extensionsByKey","counts","decorationSet","isAttrStep","hasResolvableChangedRange","hasMappedRange","positionalStep","blockRangeFor","nodeStart","changed","nodeEnd","getRebuildRanges","newRanges","newRange","blockRange","merged","mapDecorationSet","set","removedSpec","mapDecorations","previousSet","previous","mergeDecorationSets","allDecorations","decorationSetsByExtension","unionWidgetKeys","widgetKeysByExtension","validateDecorationSpec","shouldRecomputeDecoration","forced","EMPTY_KEYS","DecorationManager","nextState","resolved","entries","addDecorations","Plugin","managerState","forceAll","forceName","recomputedNames","newState","resolution","stale","addedKeys","create","method","duplicateKeys","nextWarningKeys","names","canInsertNode","createStyleTag","tiptapStyleTag","suffix","styleNode","nonce","style","isNumber","getType","isPlainObject","dedentLine","line","columns","character","whitespace","indentSize","continuesParagraph","source","token","blockTokens","parseContinuation","lines","nestedContent","isContinuation","lexer","continuationLength","mainContent","parseIndentedBlocks","src","totalRaw","baseIndentSize","currentLine","itemMatch","itemData","itemContent","_nextLine$match","nextLine","_nextNonEmpty$match","nextNonEmptyIndex","l","indentLevel","nestedTokens","continuation","nestedLine","dedentedNested","TAB_STOP","columnWidth","width","renderNestedMarkdownContent","prefix","prefixOrGenerator","ctx","h","output","childContent","indentLine","configured","prefixWidth","indentedChild","mergeDeep","updateMarkViewAttributes","thisMark","checkMark","foundMark","needsUpdate","updatedMark","InputRule","inputRuleMatcherHandler","find","inputRuleMatch","createRuleTransaction","insertText","inputTransaction","applyRule","inputEnd","rule","closeHistory","matchesDocument","matchedDocLength","matchStartOffset","run$1","rules","inputRulesPlugin","stored","simulatedInputMeta","prev","$cursor","Extendable","extendedConfig","Mark","_args","resolvedConfig","currentPos","m","removeMark","PasteRule","pasteRuleMatcherHandler","matches","pasteRuleMatch","handlers","_node$type","contentSize","resolvedTo","pasteEvent","handler","tiptapDragFromOtherEditor","createClipboardPasteEvent","_event$clipboardData","pasteRulesPlugin","dragSourceElement","isPastedFromProseMirror","isDroppedFromProseMirror","dropEvent","processEvent","chainableState","pasteEvt","handleDragstart","handleDragend","dragFromOtherEditor","isPaste","isDrop","simulatedPasteMeta","isSimulatedPaste","oldState","ExtensionManager","addCommands","allPlugins","addKeyboardShortcuts","defaultBindings","bindings","shortcut","keyMapPlugin","keymap","addInputRules","inputResult","inputPlugins","addPasteRules","pasteRules","addProseMirrorPlugins","proseMirrorPlugins","decorationPlugin","_this$decorationManag","addNodeView","nodeViewResult","HTMLAttributes","dispatchTransaction","next","baseDispatch","extensionTransform","transformedHtml","baseTransform","addMarkView","_this$decorationManag2","onBeforeCreate","onCreate","onUpdate","onSelectionUpdate","onTransaction","onFocus","onBlur","onDestroy","Extension","ClipboardTextSerializer","Commands","Delete","_this$editor$options$5","_this$editor$options$2","_this$editor$options$3","nextTransaction","appendedTransactions","isFullyWithinRange","RemoveMarkStep","foundBeforeMark","foundAfterMark","Drop","Editable","focusEventsPluginKey","FocusEvents","Keymap","handleBackspace","parentIsIsolating","parentPos","isAtStart","handleDelete","baseKeymap","pcKeymap","macKeymap","docChanges","ignoreTr","allFrom","allEnd","Paste","Tabindex","TextDirection","dir","element","hasChecked","warnOnDuplicatedProseMirrorModel","NodePos","isBlock","isNonTextAtom","isInline","offset","childNodePos","selector","nodeAttributes","attrKeys","firstItemOnly","childPos","Editor","slice","moved","initialDoc","dom","handlePlugins","prevPlugins","nameOrPluginKeyToRemove","nameOrPluginKey","_this$options$coreExt","_this$options$coreExt2","allExtensions","fallbackDoc","editorProps","enableExtensionDispatchTransaction","baseTransformPastedHTML","transformPastedHTML","EditorView","selectionHasChanged","rootTrWasApplied","prevState","mostRecentFocusTr","nameOrAttributes","attributesOrUndefined","markInputRule","captureGroup","fullMatch","startSpaces","textStart","textEnd","markEnd","nodeInputRule","newNode","matchStart","lastChar","insertionStart","textblockTypeInputRule","wrappingInputRule","wrapping","findWrapping","Node","markPasteRule"],"sources":["../../../../../node_modules/@tiptap/core/dist/index.js"],"sourcesContent":["import { t as __exportAll } from \"./rolldown-runtime-D7D4PA-g.js\";\nimport { RemoveMarkStep, ReplaceAroundStep, ReplaceStep, Transform, canJoin, canSplit, findWrapping, joinPoint, liftTarget } from \"@tiptap/pm/transform\";\nimport { createParagraphNear, exitCode, joinBackward, joinDown, joinForward, joinTextblockBackward, joinTextblockForward, joinUp, lift, liftEmptyBlock, newlineInCode, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, setBlockType, wrapIn } from \"@tiptap/pm/commands\";\nimport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, TextSelection } from \"@tiptap/pm/state\";\nimport { DOMParser, DOMSerializer, Fragment as Fragment$1, Node as Node$1, Schema, Slice } from \"@tiptap/pm/model\";\nimport { liftListItem, sinkListItem, wrapInList } from \"@tiptap/pm/schema-list\";\nimport { Decoration as Decoration$1, DecorationSet, EditorView } from \"@tiptap/pm/view\";\nimport { keymap } from \"@tiptap/pm/keymap\";\nimport { closeHistory } from \"@tiptap/pm/history\";\n//#region src/helpers/createChainableState.ts\n/**\n* Takes a Transaction & Editor State and turns it into a chainable state object\n* @param config The transaction and state to create the chainable state from\n* @returns A chainable Editor state object\n*/\nfunction createChainableState(config) {\n\tconst { state, transaction } = config;\n\tlet { selection } = transaction;\n\tlet { doc } = transaction;\n\tlet { storedMarks } = transaction;\n\treturn {\n\t\t...state,\n\t\tapply: state.apply.bind(state),\n\t\tapplyTransaction: state.applyTransaction.bind(state),\n\t\tplugins: state.plugins,\n\t\tschema: state.schema,\n\t\treconfigure: state.reconfigure.bind(state),\n\t\ttoJSON: state.toJSON.bind(state),\n\t\tget storedMarks() {\n\t\t\treturn storedMarks;\n\t\t},\n\t\tget selection() {\n\t\t\treturn selection;\n\t\t},\n\t\tget doc() {\n\t\t\treturn doc;\n\t\t},\n\t\tget tr() {\n\t\t\tselection = transaction.selection;\n\t\t\tdoc = transaction.doc;\n\t\t\tstoredMarks = transaction.storedMarks;\n\t\t\treturn transaction;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/CommandManager.ts\nvar CommandManager = class CommandManager {\n\tconstructor(props) {\n\t\tthis.editor = props.editor;\n\t\tthis.rawCommands = this.editor.extensionManager.commands;\n\t\tthis.customState = props.state;\n\t}\n\tget hasCustomState() {\n\t\treturn !!this.customState;\n\t}\n\tget state() {\n\t\treturn this.customState || this.editor.state;\n\t}\n\tget commands() {\n\t\tconst { rawCommands, editor, state } = this;\n\t\tconst { view } = editor;\n\t\tconst { tr } = state;\n\t\tconst props = this.buildProps(tr);\n\t\treturn Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\tconst method = (...args) => {\n\t\t\t\tconst callback = command(...args)(props);\n\t\t\t\tif (!tr.getMeta(\"preventDispatch\") && !this.hasCustomState) view.dispatch(tr);\n\t\t\t\treturn callback;\n\t\t\t};\n\t\t\treturn [name, method];\n\t\t}));\n\t}\n\tget chain() {\n\t\treturn () => this.createChain();\n\t}\n\tget can() {\n\t\treturn () => this.createCan();\n\t}\n\tcreateChain(startTr, shouldDispatch = true) {\n\t\tconst { rawCommands, editor, state } = this;\n\t\tconst { view } = editor;\n\t\tconst callbacks = [];\n\t\tconst hasStartTransaction = !!startTr;\n\t\tconst tr = startTr || state.tr;\n\t\tconst run = () => {\n\t\t\tif (!hasStartTransaction && shouldDispatch && !tr.getMeta(\"preventDispatch\") && !this.hasCustomState) view.dispatch(tr);\n\t\t\treturn callbacks.every((callback) => callback === true);\n\t\t};\n\t\tconst chain = {\n\t\t\t...Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\t\tconst chainedCommand = (...args) => {\n\t\t\t\t\tconst props = this.buildProps(tr, shouldDispatch);\n\t\t\t\t\tconst callback = command(...args)(props);\n\t\t\t\t\tcallbacks.push(callback);\n\t\t\t\t\treturn chain;\n\t\t\t\t};\n\t\t\t\treturn [name, chainedCommand];\n\t\t\t})),\n\t\t\trun\n\t\t};\n\t\treturn chain;\n\t}\n\t/**\n\t* Creates a chain that safely returns `false` when run.\n\t* @returns A non-dispatching command chain.\n\t* @example\n\t* const chain = CommandManager.createFakeChain()\n\t* chain.focus().run() // false\n\t*/\n\tstatic createFakeChain() {\n\t\tconst chain = new Proxy({}, { get: (_target, property) => {\n\t\t\tif (property === \"then\") return;\n\t\t\tif (property === \"run\") return () => false;\n\t\t\treturn () => chain;\n\t\t} });\n\t\treturn chain;\n\t}\n\tcreateCan(startTr) {\n\t\tconst { rawCommands, state } = this;\n\t\tconst dispatch = false;\n\t\tconst tr = startTr || state.tr;\n\t\tconst props = this.buildProps(tr, dispatch);\n\t\treturn {\n\t\t\t...Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\t\treturn [name, (...args) => command(...args)({\n\t\t\t\t\t...props,\n\t\t\t\t\tdispatch: void 0\n\t\t\t\t})];\n\t\t\t})),\n\t\t\tchain: () => this.createChain(tr, dispatch)\n\t\t};\n\t}\n\t/**\n\t* Creates capability checks that safely return `false`.\n\t* @returns A non-dispatching capability checker.\n\t* @example\n\t* const can = CommandManager.createFallbackCan()\n\t* can.focus() // false\n\t*/\n\tstatic createFallbackCan() {\n\t\tconst chain = CommandManager.createFakeChain();\n\t\treturn new Proxy({ chain: () => chain }, { get: (target, property) => {\n\t\t\tif (property === \"then\") return;\n\t\t\tif (property === \"chain\") return target.chain;\n\t\t\treturn () => false;\n\t\t} });\n\t}\n\tbuildProps(tr, shouldDispatch = true) {\n\t\tconst { rawCommands, editor, state } = this;\n\t\tconst { view } = editor;\n\t\tconst props = {\n\t\t\ttr,\n\t\t\teditor,\n\t\t\tview,\n\t\t\tstate: createChainableState({\n\t\t\t\tstate,\n\t\t\t\ttransaction: tr\n\t\t\t}),\n\t\t\tdispatch: shouldDispatch ? () => void 0 : void 0,\n\t\t\tchain: () => this.createChain(tr, shouldDispatch),\n\t\t\tcan: () => this.createCan(tr),\n\t\t\tget commands() {\n\t\t\t\treturn Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\t\t\treturn [name, (...args) => command(...args)(props)];\n\t\t\t\t}));\n\t\t\t}\n\t\t};\n\t\treturn props;\n\t}\n};\n//#endregion\n//#region src/commands/blur.ts\nconst blur = () => ({ editor, view }) => {\n\trequestAnimationFrame(() => {\n\t\tif (!editor.isDestroyed) {\n\t\t\tvar _window;\n\t\t\tview.dom.blur();\n\t\t\t(_window = window) === null || _window === void 0 || (_window = _window.getSelection()) === null || _window === void 0 || _window.removeAllRanges();\n\t\t}\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/clearContent.ts\nconst clearContent = (emitUpdate = true) => ({ commands }) => {\n\treturn commands.setContent(\"\", { emitUpdate });\n};\n//#endregion\n//#region src/commands/clearNodes.ts\nconst clearNodes = () => ({ tr, dispatch }) => {\n\tconst { selection } = tr;\n\tconst { ranges } = selection;\n\tif (!dispatch) return true;\n\tconst startMapsLength = tr.mapping.maps.length;\n\tranges.forEach(({ $from, $to }) => {\n\t\tconst from = $from.pos;\n\t\tconst to = $to.pos;\n\t\tconst depthMapping = tr.mapping.slice(startMapsLength);\n\t\tlet maxSweeps = 1;\n\t\ttr.doc.nodesBetween(depthMapping.map(from), depthMapping.map(to), (_node, pos) => {\n\t\t\tmaxSweeps = Math.max(maxSweeps, tr.doc.resolve(pos).depth + 1);\n\t\t});\n\t\tfor (let sweep = 0; sweep < maxSweeps; sweep += 1) {\n\t\t\tconst docBefore = tr.doc;\n\t\t\tconst sweepMapsLength = tr.mapping.maps.length;\n\t\t\tconst rangeMapping = tr.mapping.slice(startMapsLength);\n\t\t\tlet cachedMapsLength = sweepMapsLength;\n\t\t\tlet sweepMapping = tr.mapping.slice(sweepMapsLength);\n\t\t\tconst mappedFrom = rangeMapping.map(from);\n\t\t\tconst mappedTo = rangeMapping.map(to);\n\t\t\tdocBefore.nodesBetween(mappedFrom, mappedTo, (node, pos) => {\n\t\t\t\tif (node.type.isText) return;\n\t\t\t\tif (tr.mapping.maps.length !== cachedMapsLength) {\n\t\t\t\t\tcachedMapsLength = tr.mapping.maps.length;\n\t\t\t\t\tsweepMapping = tr.mapping.slice(sweepMapsLength);\n\t\t\t\t}\n\t\t\t\tconst $mappedFrom = tr.doc.resolve(sweepMapping.map(pos));\n\t\t\t\tconst $mappedTo = tr.doc.resolve(sweepMapping.map(pos + node.nodeSize));\n\t\t\t\tconst nodeRange = $mappedFrom.blockRange($mappedTo);\n\t\t\t\tif (!nodeRange) return;\n\t\t\t\tconst targetLiftDepth = liftTarget(nodeRange);\n\t\t\t\tif (node.type.isTextblock) {\n\t\t\t\t\tconst { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());\n\t\t\t\t\tconst target = tr.doc.nodeAt(nodeRange.start);\n\t\t\t\t\tif (defaultType && target && !target.hasMarkup(defaultType) && defaultType.validContent(target.content)) tr.setNodeMarkup(nodeRange.start, defaultType);\n\t\t\t\t}\n\t\t\t\tif (targetLiftDepth || targetLiftDepth === 0) tr.lift(nodeRange, targetLiftDepth);\n\t\t\t});\n\t\t\tif (tr.doc.eq(docBefore)) break;\n\t\t}\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/command.ts\nconst command = (fn) => (props) => {\n\treturn fn(props);\n};\n//#endregion\n//#region src/commands/createParagraphNear.ts\nconst createParagraphNear$1 = () => ({ state, dispatch }) => {\n\treturn createParagraphNear(state, dispatch);\n};\n//#endregion\n//#region src/commands/cut.ts\nconst cut = (originRange, targetPos) => ({ editor, tr }) => {\n\tconst { state } = editor;\n\tconst contentSlice = state.doc.slice(originRange.from, originRange.to);\n\ttr.deleteRange(originRange.from, originRange.to);\n\tconst newPos = tr.mapping.map(targetPos);\n\ttr.insert(newPos, contentSlice.content);\n\ttr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));\n\treturn true;\n};\n//#endregion\n//#region src/commands/deleteCurrentNode.ts\nconst deleteCurrentNode = () => ({ tr, dispatch }) => {\n\tconst { selection } = tr;\n\tconst currentNode = selection.$anchor.node();\n\tif (currentNode.content.size > 0) return false;\n\tconst $pos = tr.selection.$anchor;\n\tfor (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === currentNode.type) {\n\t\tif (dispatch) {\n\t\t\tconst from = $pos.before(depth);\n\t\t\tconst to = $pos.after(depth);\n\t\t\ttr.delete(from, to).scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/helpers/getNodeType.ts\nfunction getNodeType(nameOrType, schema) {\n\tif (typeof nameOrType === \"string\") {\n\t\tif (!schema.nodes[nameOrType]) throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n\t\treturn schema.nodes[nameOrType];\n\t}\n\treturn nameOrType;\n}\n//#endregion\n//#region src/commands/deleteNode.ts\nconst deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst $pos = tr.selection.$anchor;\n\tfor (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === type) {\n\t\tif (dispatch) {\n\t\t\tconst from = $pos.before(depth);\n\t\t\tconst to = $pos.after(depth);\n\t\t\ttr.delete(from, to).scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/commands/deleteRange.ts\nconst deleteRange = (range) => ({ tr, dispatch }) => {\n\tconst { from, to } = range;\n\tif (dispatch) tr.delete(from, to);\n\treturn true;\n};\n//#endregion\n//#region src/commands/deleteSelection.ts\n/**\n* Check if a node has text content based on its content specification.\n* Returns true if the node's content spec matches text* or text+ patterns.\n*/\nconst hasTextContent = (nodeSpec) => {\n\tif (!nodeSpec.content) return false;\n\treturn /^text(\\*|\\+)/.test(nodeSpec.content);\n};\n/**\n* Expand selection position for a specific side (left or right) to handle inline text nodes.\n* This function checks if the position is within an inline node with text content and\n* expands it to include the entire node boundaries for proper deletion.\n* @param $pos - The resolved position to expand\n* @param schema - The ProseMirror schema\n* @param side - Which side to expand ('left' or 'right')\n* @returns The expanded position for deletion\n*/\nconst expandSelectionForSide = ($pos, schema, side) => {\n\tif (!$pos.parent.isInline) return $pos.pos;\n\tif (side === \"left\" && $pos.pos > $pos.start() || side === \"right\" && $pos.pos < $pos.end()) return $pos.pos;\n\tconst parentContent = schema.nodes[$pos.parent.type.name].spec;\n\tif (!hasTextContent(parentContent)) return $pos.pos;\n\treturn side === \"left\" ? $pos.start() - 1 : $pos.end() + 1;\n};\n/**\n* Expand selection range to properly handle deletion of inline text nodes.\n* Inline text nodes don't collapse correctly when text inside is deleted,\n* so we need to expand the selection to include the entire node.\n* See: https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1365\n*/\nconst expandSelectionForInlineText = ($from, $to, schema) => {\n\treturn {\n\t\tfrom: expandSelectionForSide($from, schema, \"left\"),\n\t\tto: expandSelectionForSide($to, schema, \"right\")\n\t};\n};\nconst deleteSelection = () => ({ state, dispatch }) => {\n\tif (state.selection.empty) return false;\n\tif (dispatch) {\n\t\tconst tr = state.tr;\n\t\tconst { ranges } = state.selection;\n\t\tconst marks = state.selection instanceof TextSelection ? state.selection.$from.marksAcross(state.selection.$to) : null;\n\t\tconst mapFrom = tr.steps.length;\n\t\tranges.forEach((range) => {\n\t\t\tconst mapping = tr.mapping.slice(mapFrom);\n\t\t\tconst $from = tr.doc.resolve(mapping.map(range.$from.pos));\n\t\t\tconst $to = tr.doc.resolve(mapping.map(range.$to.pos));\n\t\t\tconst { from, to } = expandSelectionForInlineText($from, $to, state.schema);\n\t\t\ttr.deleteRange(from, to);\n\t\t});\n\t\tif (!tr.selection.empty) tr.setSelection(TextSelection.near(tr.doc.resolve(tr.selection.from)));\n\t\tif (marks) tr.ensureMarks(marks);\n\t\ttr.scrollIntoView();\n\t\tdispatch(tr);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/enter.ts\nconst enter = () => ({ commands }) => {\n\treturn commands.keyboardShortcut(\"Enter\");\n};\n//#endregion\n//#region src/commands/exitCode.ts\nconst exitCode$1 = () => ({ state, dispatch }) => {\n\treturn exitCode(state, dispatch);\n};\n//#endregion\n//#region src/utilities/isRegExp.ts\nfunction isRegExp(value) {\n\treturn Object.prototype.toString.call(value) === \"[object RegExp]\";\n}\n//#endregion\n//#region src/utilities/objectIncludes.ts\n/**\n* Check if object1 includes object2\n* @param object1 Object\n* @param object2 Object\n*/\nfunction objectIncludes(object1, object2, options = { strict: true }) {\n\tconst keys = Object.keys(object2);\n\tif (!keys.length) return true;\n\treturn keys.every((key) => {\n\t\tif (options.strict) return object2[key] === object1[key];\n\t\tif (isRegExp(object2[key])) return object2[key].test(object1[key]);\n\t\treturn object2[key] === object1[key];\n\t});\n}\n//#endregion\n//#region src/helpers/getMarkRange.ts\nfunction findMarkInSet(marks, type, attributes = {}) {\n\treturn marks.find((item) => {\n\t\treturn item.type === type && objectIncludes(Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])), attributes);\n\t});\n}\nfunction isMarkInSet(marks, type, attributes = {}) {\n\treturn !!findMarkInSet(marks, type, attributes);\n}\n/**\n* Get the range of a mark at a resolved position.\n*/\nfunction getMarkRange($pos, type, attributes) {\n\tif (!$pos || !type) return;\n\tlet start = $pos.parent.childAfter($pos.parentOffset);\n\tif (!start.node || !start.node.marks.some((mark) => mark.type === type)) start = $pos.parent.childBefore($pos.parentOffset);\n\tif (!start.node || !start.node.marks.some((mark) => mark.type === type)) return;\n\tif (!attributes) {\n\t\tconst firstMark = start.node.marks.find((mark) => mark.type === type);\n\t\tif (firstMark) attributes = firstMark.attrs;\n\t}\n\tif (!findMarkInSet([...start.node.marks], type, attributes)) return;\n\tlet startIndex = start.index;\n\tlet startPos = $pos.start() + start.offset;\n\tlet endIndex = startIndex + 1;\n\tlet endPos = startPos + start.node.nodeSize;\n\twhile (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {\n\t\tstartIndex -= 1;\n\t\tstartPos -= $pos.parent.child(startIndex).nodeSize;\n\t}\n\twhile (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {\n\t\tendPos += $pos.parent.child(endIndex).nodeSize;\n\t\tendIndex += 1;\n\t}\n\treturn {\n\t\tfrom: startPos,\n\t\tto: endPos\n\t};\n}\n//#endregion\n//#region src/helpers/getMarkType.ts\nfunction getMarkType(nameOrType, schema) {\n\tif (typeof nameOrType === \"string\") {\n\t\tif (!schema.marks[nameOrType]) throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n\t\treturn schema.marks[nameOrType];\n\t}\n\treturn nameOrType;\n}\n//#endregion\n//#region src/commands/extendMarkRange.ts\nconst extendMarkRange = (typeOrName, attributes) => ({ tr, state, dispatch }) => {\n\tconst type = getMarkType(typeOrName, state.schema);\n\tconst { doc, selection } = tr;\n\tconst { $from, from, to } = selection;\n\tif (dispatch) {\n\t\tconst range = getMarkRange($from, type, attributes);\n\t\tif (range && range.from <= from && range.to >= to) {\n\t\t\tconst newSelection = TextSelection.create(doc, range.from, range.to);\n\t\t\ttr.setSelection(newSelection);\n\t\t}\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/first.ts\nconst first = (commands) => (props) => {\n\tconst items = typeof commands === \"function\" ? commands(props) : commands;\n\tfor (let i = 0; i < items.length; i += 1) if (items[i](props)) return true;\n\treturn false;\n};\n//#endregion\n//#region src/helpers/isTextSelection.ts\nfunction isTextSelection(value) {\n\treturn value instanceof TextSelection;\n}\n//#endregion\n//#region src/utilities/minMax.ts\nfunction minMax(value = 0, min = 0, max = 0) {\n\treturn Math.min(Math.max(value, min), max);\n}\n//#endregion\n//#region src/helpers/resolveFocusPosition.ts\nfunction resolveFocusPosition(doc, position = null) {\n\tif (!position) return null;\n\tconst selectionAtStart = Selection.atStart(doc);\n\tconst selectionAtEnd = Selection.atEnd(doc);\n\tif (position === \"start\" || position === true) return selectionAtStart;\n\tif (position === \"end\") return selectionAtEnd;\n\tconst minPos = selectionAtStart.from;\n\tconst maxPos = selectionAtEnd.to;\n\tif (position === \"all\") return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));\n\treturn TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));\n}\n//#endregion\n//#region src/utilities/isAndroid.ts\nfunction isAndroid() {\n\treturn [\"Android\"].includes(navigator.platform) || /android/i.test(navigator.userAgent);\n}\n//#endregion\n//#region src/utilities/isiOS.ts\nfunction isiOS() {\n\treturn [\n\t\t\"iPad Simulator\",\n\t\t\"iPhone Simulator\",\n\t\t\"iPod Simulator\",\n\t\t\"iPad\",\n\t\t\"iPhone\",\n\t\t\"iPod\"\n\t].includes(navigator.platform) || navigator.userAgent.includes(\"Mac\") && \"ontouchend\" in document;\n}\n//#endregion\n//#region src/utilities/isSafari.ts\n/**\n* Detects if the current browser is Safari (but not iOS Safari or Chrome).\n* @returns `true` if the browser is Safari, `false` otherwise.\n* @example\n* if (isSafari()) {\n* // Safari-specific handling\n* }\n*/\nfunction isSafari() {\n\treturn typeof navigator !== \"undefined\" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;\n}\n//#endregion\n//#region src/commands/focus.ts\nconst focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {\n\toptions = {\n\t\tscrollIntoView: true,\n\t\t...options\n\t};\n\tconst delayedFocus = () => {\n\t\tif (isiOS() || isAndroid()) view.dom.focus();\n\t\tif (isSafari() && !isiOS() && !isAndroid()) view.dom.focus({ preventScroll: true });\n\t\trequestAnimationFrame(() => {\n\t\t\tif (!editor.isDestroyed) {\n\t\t\t\tview.focus();\n\t\t\t\tif (options === null || options === void 0 ? void 0 : options.scrollIntoView) editor.commands.scrollIntoView();\n\t\t\t}\n\t\t});\n\t};\n\ttry {\n\t\tif (view.hasFocus() && position === null || position === false) return true;\n\t} catch {\n\t\treturn false;\n\t}\n\tif (dispatch && position === null && !isTextSelection(editor.state.selection)) {\n\t\tdelayedFocus();\n\t\treturn true;\n\t}\n\tconst selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;\n\tconst isSameSelection = editor.state.selection.eq(selection);\n\tif (dispatch) {\n\t\tif (!isSameSelection) tr.setSelection(selection);\n\t\tif (isSameSelection && tr.storedMarks) tr.setStoredMarks(tr.storedMarks);\n\t\tdelayedFocus();\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/forEach.ts\nconst forEach = (items, fn) => (props) => {\n\treturn items.every((item, index) => fn(item, {\n\t\t...props,\n\t\tindex\n\t}));\n};\n//#endregion\n//#region src/commands/insertContent.ts\nconst insertContent = (value, options) => ({ tr, commands }) => {\n\treturn commands.insertContentAt({\n\t\tfrom: tr.selection.from,\n\t\tto: tr.selection.to\n\t}, value, options);\n};\n//#endregion\n//#region src/utilities/elementFromString.ts\nconst removeWhitespaces = (node) => {\n\tconst children = node.childNodes;\n\tfor (let i = children.length - 1; i >= 0; i -= 1) {\n\t\tconst child = children[i];\n\t\tif (child.nodeType === 3 && child.nodeValue && /^(\\n\\s\\s|\\n)$/.test(child.nodeValue)) node.removeChild(child);\n\t\telse if (child.nodeType === 1) removeWhitespaces(child);\n\t}\n\treturn node;\n};\nfunction elementFromString(value) {\n\tif (typeof window === \"undefined\") throw new Error(\"[tiptap error]: there is no window object available, so this function cannot be used\");\n\tconst wrappedValue = `<body>${value}</body>`;\n\tconst html = new window.DOMParser().parseFromString(wrappedValue, \"text/html\").body;\n\treturn removeWhitespaces(html);\n}\n//#endregion\n//#region src/helpers/isProseMirrorContent.ts\n/**\n* Checks whether a value is already a ProseMirror node or fragment. Looks for the\n* `nodesBetween` method, because `instanceof` fails when prosemirror-model is loaded twice.\n* @param value Any value that could be passed as content\n* @returns True for a node or a fragment, false for JSON, HTML and everything else\n* @example ```js\n* isProseMirrorContent(editor.state.doc)\n* ```\n*/\nfunction isProseMirrorContent(value) {\n\treturn typeof (value === null || value === void 0 ? void 0 : value.nodesBetween) === \"function\";\n}\n//#endregion\n//#region src/helpers/createNodeFromContent.ts\n/**\n* Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.\n* @param content The JSON or HTML content to create the node from\n* @param schema The Prosemirror schema to use for the node\n* @param options Options for the parser\n* @returns The created Prosemirror node or fragment\n*/\nfunction createNodeFromContent(content, schema, options) {\n\tif (isProseMirrorContent(content)) return content;\n\tconst isJSONContent = typeof content === \"object\" && content !== null;\n\toptions = {\n\t\tslice: true,\n\t\tparseOptions: {},\n\t\t...options\n\t};\n\tconst isTextContent = typeof content === \"string\";\n\tif (isJSONContent) try {\n\t\tif (Array.isArray(content) && content.length > 0) return Fragment$1.fromArray(content.map((item) => schema.nodeFromJSON(item)));\n\t\tconst node = schema.nodeFromJSON(content);\n\t\tif (options.errorOnInvalidContent) node.check();\n\t\treturn node;\n\t} catch (error) {\n\t\tif (options.errorOnInvalidContent) throw new Error(\"[tiptap error]: Invalid JSON content\", { cause: error });\n\t\tconsole.warn(\"[tiptap warn]: Invalid content.\", \"Passed value:\", content, \"Error:\", error);\n\t\treturn createNodeFromContent(\"\", schema, options);\n\t}\n\tif (isTextContent) {\n\t\tif (options.errorOnInvalidContent) {\n\t\t\tlet hasInvalidContent = false;\n\t\t\tlet invalidContent = \"\";\n\t\t\tconst contentCheckSchema = new Schema({\n\t\t\t\ttopNode: schema.spec.topNode,\n\t\t\t\tmarks: schema.spec.marks,\n\t\t\t\tnodes: schema.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {\n\t\t\t\t\tcontent: \"inline*\",\n\t\t\t\t\tgroup: \"block\",\n\t\t\t\t\tparseDOM: [{\n\t\t\t\t\t\ttag: \"*\",\n\t\t\t\t\t\tgetAttrs: (e) => {\n\t\t\t\t\t\t\thasInvalidContent = true;\n\t\t\t\t\t\t\tinvalidContent = typeof e === \"string\" ? e : e.outerHTML;\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}]\n\t\t\t\t} })\n\t\t\t});\n\t\t\tif (options.slice) DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);\n\t\t\telse DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);\n\t\t\tif (options.errorOnInvalidContent && hasInvalidContent) throw new Error(\"[tiptap error]: Invalid HTML content\", { cause: /* @__PURE__ */ new Error(`Invalid element found: ${invalidContent}`) });\n\t\t}\n\t\tconst parser = DOMParser.fromSchema(schema);\n\t\tif (options.slice) return parser.parseSlice(elementFromString(content), options.parseOptions).content;\n\t\treturn parser.parse(elementFromString(content), options.parseOptions);\n\t}\n\treturn createNodeFromContent(\"\", schema, options);\n}\n//#endregion\n//#region src/helpers/isFragment.ts\n/**\n* Checks whether a node or fragment is a fragment. Looks for a missing `type` field,\n* because `instanceof` fails when prosemirror-model is loaded twice.\n* @param nodeOrFragment A ProseMirror node or fragment\n* @returns True for a fragment, false for a node\n* @example ```js\n* isFragment(editor.state.doc.content)\n* ```\n*/\nfunction isFragment(nodeOrFragment) {\n\treturn !(\"type\" in nodeOrFragment);\n}\n//#endregion\n//#region src/helpers/selectionToInsertionEnd.ts\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n\tconst last = tr.steps.length - 1;\n\tif (last < startLen) return;\n\tconst step = tr.steps[last];\n\tif (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return;\n\tconst map = tr.mapping.maps[last];\n\tlet end = 0;\n\tmap.forEach((_from, _to, _newFrom, newTo) => {\n\t\tif (end === 0) end = newTo;\n\t});\n\ttr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\n//#endregion\n//#region src/commands/insertContentAt.ts\nconst insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {\n\tif (dispatch) {\n\t\toptions = {\n\t\t\tparseOptions: editor.options.parseOptions,\n\t\t\tupdateSelection: true,\n\t\t\tapplyInputRules: false,\n\t\t\tapplyPasteRules: false,\n\t\t\t...options\n\t\t};\n\t\tlet content;\n\t\tconst emitContentError = (error) => {\n\t\t\teditor.emit(\"contentError\", {\n\t\t\t\teditor,\n\t\t\t\terror,\n\t\t\t\tdisableCollaboration: () => {\n\t\t\t\t\tif (\"collaboration\" in editor.storage && typeof editor.storage.collaboration === \"object\" && editor.storage.collaboration) editor.storage.collaboration.isDisabled = true;\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tconst parseOptions = {\n\t\t\tpreserveWhitespace: \"full\",\n\t\t\t...options.parseOptions\n\t\t};\n\t\tif (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) try {\n\t\t\tcreateNodeFromContent(value, editor.schema, {\n\t\t\t\tparseOptions,\n\t\t\t\terrorOnInvalidContent: true\n\t\t\t});\n\t\t} catch (e) {\n\t\t\temitContentError(e);\n\t\t}\n\t\ttry {\n\t\t\tvar _options$errorOnInval;\n\t\t\tcontent = createNodeFromContent(value, editor.schema, {\n\t\t\t\tparseOptions,\n\t\t\t\terrorOnInvalidContent: (_options$errorOnInval = options.errorOnInvalidContent) !== null && _options$errorOnInval !== void 0 ? _options$errorOnInval : editor.options.enableContentCheck\n\t\t\t});\n\t\t} catch (e) {\n\t\t\temitContentError(e);\n\t\t\treturn false;\n\t\t}\n\t\tlet { from, to } = typeof position === \"number\" ? {\n\t\t\tfrom: position,\n\t\t\tto: position\n\t\t} : {\n\t\t\tfrom: position.from,\n\t\t\tto: position.to\n\t\t};\n\t\tlet isOnlyTextContent = true;\n\t\tlet isOnlyBlockContent = true;\n\t\tconst nodes = isFragment(content) ? content.content : [content];\n\t\tnodes.forEach((node) => {\n\t\t\tnode.check();\n\t\t\tisOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;\n\t\t\tisOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;\n\t\t});\n\t\tif (from === to && isOnlyBlockContent) {\n\t\t\tconst { parent } = tr.doc.resolve(from);\n\t\t\tif (parent.isTextblock && !parent.type.spec.code && !parent.childCount) {\n\t\t\t\tfrom -= 1;\n\t\t\t\tto += 1;\n\t\t\t}\n\t\t}\n\t\tlet newContent;\n\t\tif (isOnlyTextContent) {\n\t\t\tif (Array.isArray(value)) newContent = value.map((item) => item.text || \"\").join(\"\");\n\t\t\telse if (isProseMirrorContent(value)) newContent = nodes.map((node) => {\n\t\t\t\tvar _node$text;\n\t\t\t\treturn (_node$text = node.text) !== null && _node$text !== void 0 ? _node$text : \"\";\n\t\t\t}).join(\"\");\n\t\t\telse if (typeof value === \"object\" && !!value && !!value.text) newContent = value.text;\n\t\t\telse newContent = value;\n\t\t\ttr.insertText(newContent, from, to);\n\t\t} else {\n\t\t\tnewContent = Fragment$1.from(nodes);\n\t\t\tconst $from = tr.doc.resolve(from);\n\t\t\tconst $fromNode = $from.node();\n\t\t\tconst fromSelectionAtStart = $from.parentOffset === 0;\n\t\t\tconst isTextSelection = $fromNode.isText || $fromNode.isTextblock;\n\t\t\tconst hasContent = $fromNode.content.size > 0;\n\t\t\tif (fromSelectionAtStart && isTextSelection && hasContent && isOnlyBlockContent) from = Math.max(0, from - 1);\n\t\t\ttr.replaceWith(from, to, nodes);\n\t\t}\n\t\tif (options.updateSelection) selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n\t\tif (options.applyInputRules) tr.setMeta(\"applyInputRules\", {\n\t\t\tfrom,\n\t\t\ttext: newContent\n\t\t});\n\t\tif (options.applyPasteRules) tr.setMeta(\"applyPasteRules\", {\n\t\t\tfrom,\n\t\t\ttext: newContent\n\t\t});\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/helpers/defaultBlockAt.ts\n/**\n* Gets the default block type at a given match\n* @param match The content match to get the default block type from\n* @returns The default block type or null\n*/\nfunction defaultBlockAt(match) {\n\tfor (let i = 0; i < match.edgeCount; i += 1) {\n\t\tconst { type } = match.edge(i);\n\t\tif (type.isTextblock && !type.hasRequiredAttrs()) return type;\n\t}\n\treturn null;\n}\n//#endregion\n//#region src/commands/insertDefaultBlock.ts\nconst insertDefaultBlock = (options = {}) => ({ tr, dispatch, editor }) => {\n\tconst { pos, attrs, content, updateSelection = true } = options;\n\tlet $pos;\n\tif (typeof pos === \"number\") $pos = tr.doc.resolve(pos);\n\telse if (pos) $pos = pos;\n\telse $pos = tr.selection.$from;\n\tconst defaultType = defaultBlockAt($pos.parent.contentMatchAt($pos.index()));\n\tif (!defaultType) return false;\n\tconst validAttrKeys = Object.keys(defaultType.spec.attrs || {});\n\tconst filteredAttrs = attrs ? Object.fromEntries(Object.entries(attrs).filter(([key]) => validAttrKeys.includes(key))) : {};\n\tlet node;\n\tif (content) {\n\t\tconst parsed = createNodeFromContent(content, editor.schema);\n\t\tnode = defaultType.createAndFill(filteredAttrs, parsed);\n\t} else node = defaultType.createAndFill(filteredAttrs);\n\tif (!node) return false;\n\tif (dispatch) {\n\t\ttr.insert($pos.pos, node);\n\t\tif (updateSelection) selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/join.ts\nconst joinUp$1 = () => ({ state, dispatch }) => {\n\treturn joinUp(state, dispatch);\n};\nconst joinDown$1 = () => ({ state, dispatch }) => {\n\treturn joinDown(state, dispatch);\n};\nconst joinBackward$1 = () => ({ state, dispatch }) => {\n\treturn joinBackward(state, dispatch);\n};\nconst joinForward$1 = () => ({ state, dispatch }) => {\n\treturn joinForward(state, dispatch);\n};\n//#endregion\n//#region src/commands/canJoinItemsAt.ts\nconst canJoinItemsAt = (doc, pos) => {\n\tconst $pos = doc.resolve(pos);\n\tconst before = $pos.nodeBefore;\n\tconst after = $pos.nodeAfter;\n\tif (!before || !after) return false;\n\treturn !before.type.spec.isolating && !after.type.spec.isolating;\n};\n//#endregion\n//#region src/commands/joinItemBackward.ts\nconst joinItemBackward = () => ({ state, dispatch, tr }) => {\n\ttry {\n\t\tconst point = joinPoint(state.doc, state.selection.$from.pos, -1);\n\t\tif (point === null || point === void 0) return false;\n\t\tif (!canJoinItemsAt(state.doc, point)) return false;\n\t\ttr.join(point, 2);\n\t\tif (dispatch) dispatch(tr);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n//#endregion\n//#region src/commands/joinItemForward.ts\nconst joinItemForward = () => ({ state, dispatch, tr }) => {\n\ttry {\n\t\tconst point = joinPoint(state.doc, state.selection.$from.pos, 1);\n\t\tif (point === null || point === void 0) return false;\n\t\tif (!canJoinItemsAt(state.doc, point)) return false;\n\t\ttr.join(point, 2);\n\t\tif (dispatch) dispatch(tr);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n//#endregion\n//#region src/commands/joinTextblockBackward.ts\nconst joinTextblockBackward$1 = () => ({ state, dispatch }) => {\n\treturn joinTextblockBackward(state, dispatch);\n};\n//#endregion\n//#region src/commands/joinTextblockForward.ts\nconst joinTextblockForward$1 = () => ({ state, dispatch }) => {\n\treturn joinTextblockForward(state, dispatch);\n};\n//#endregion\n//#region src/utilities/isMacOS.ts\nfunction isMacOS() {\n\treturn typeof navigator !== \"undefined\" ? /Mac/.test(navigator.platform) : false;\n}\n//#endregion\n//#region src/commands/keyboardShortcut.ts\nfunction normalizeKeyName(name) {\n\tconst parts = name.split(/-(?!$)/);\n\tlet result = parts[parts.length - 1];\n\tif (result === \"Space\") result = \" \";\n\tlet alt;\n\tlet ctrl;\n\tlet shift;\n\tlet meta;\n\tfor (let i = 0; i < parts.length - 1; i += 1) {\n\t\tconst mod = parts[i];\n\t\tif (/^(cmd|meta|m)$/i.test(mod)) meta = true;\n\t\telse if (/^a(lt)?$/i.test(mod)) alt = true;\n\t\telse if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;\n\t\telse if (/^s(hift)?$/i.test(mod)) shift = true;\n\t\telse if (/^mod$/i.test(mod)) {\n\t\t\tif (isiOS() || isMacOS()) meta = true;\n\t\t\telse ctrl = true;\n\t\t} else throw new Error(`Unrecognized modifier name: ${mod}`);\n\t}\n\tif (alt) result = `Alt-${result}`;\n\tif (ctrl) result = `Ctrl-${result}`;\n\tif (meta) result = `Meta-${result}`;\n\tif (shift) result = `Shift-${result}`;\n\treturn result;\n}\nconst keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {\n\tconst keys = normalizeKeyName(name).split(/-(?!$)/);\n\tconst key = keys.find((item) => ![\n\t\t\"Alt\",\n\t\t\"Ctrl\",\n\t\t\"Meta\",\n\t\t\"Shift\"\n\t].includes(item));\n\tconst event = new KeyboardEvent(\"keydown\", {\n\t\tkey: key === \"Space\" ? \" \" : key,\n\t\taltKey: keys.includes(\"Alt\"),\n\t\tctrlKey: keys.includes(\"Ctrl\"),\n\t\tmetaKey: keys.includes(\"Meta\"),\n\t\tshiftKey: keys.includes(\"Shift\"),\n\t\tbubbles: true,\n\t\tcancelable: true\n\t});\n\tconst capturedTransaction = editor.captureTransaction(() => {\n\t\tview.someProp(\"handleKeyDown\", (f) => f(view, event));\n\t});\n\tcapturedTransaction === null || capturedTransaction === void 0 || capturedTransaction.steps.forEach((step) => {\n\t\tconst newStep = step.map(tr.mapping);\n\t\tif (newStep && dispatch) tr.maybeStep(newStep);\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/helpers/isNodeActive.ts\nfunction isNodeActive(state, typeOrName, attributes = {}) {\n\tconst { from, to, empty } = state.selection;\n\tconst type = typeOrName ? getNodeType(typeOrName, state.schema) : null;\n\tconst nodeRanges = [];\n\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (node.isText) return;\n\t\tconst relativeFrom = Math.max(from, pos);\n\t\tconst relativeTo = Math.min(to, pos + node.nodeSize);\n\t\tnodeRanges.push({\n\t\t\tnode,\n\t\t\tfrom: relativeFrom,\n\t\t\tto: relativeTo\n\t\t});\n\t});\n\tconst selectionRange = to - from;\n\tconst matchedNodeRanges = nodeRanges.filter((nodeRange) => {\n\t\tif (!type) return true;\n\t\treturn type.name === nodeRange.node.type.name;\n\t}).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));\n\tif (empty) return !!matchedNodeRanges.length;\n\treturn matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0) >= selectionRange;\n}\n//#endregion\n//#region src/commands/lift.ts\nconst lift$1 = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n\tif (!isNodeActive(state, getNodeType(typeOrName, state.schema), attributes)) return false;\n\treturn lift(state, dispatch);\n};\n//#endregion\n//#region src/commands/liftEmptyBlock.ts\nconst liftEmptyBlock$1 = () => ({ state, dispatch }) => {\n\treturn liftEmptyBlock(state, dispatch);\n};\n//#endregion\n//#region src/commands/liftListItem.ts\nconst liftListItem$1 = (typeOrName) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn liftListItem(type)(state, dispatch);\n};\n//#endregion\n//#region src/commands/newlineInCode.ts\nconst newlineInCode$1 = () => ({ state, dispatch }) => {\n\treturn newlineInCode(state, dispatch);\n};\n//#endregion\n//#region src/helpers/getSchemaTypeNameByName.ts\n/**\n* Get the type of a schema item by its name.\n* @param name The name of the schema item\n* @param schema The Prosemiror schema to search in\n* @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist\n*/\nfunction getSchemaTypeNameByName(name, schema) {\n\tif (schema.nodes[name]) return \"node\";\n\tif (schema.marks[name]) return \"mark\";\n\treturn null;\n}\n//#endregion\n//#region src/utilities/deleteProps.ts\n/**\n* Remove a property or an array of properties from an object\n* @param obj Object\n* @param key Key to remove\n*/\nfunction deleteProps(obj, propOrProps) {\n\tconst props = typeof propOrProps === \"string\" ? [propOrProps] : propOrProps;\n\treturn Object.keys(obj).reduce((newObj, prop) => {\n\t\tif (!props.includes(prop)) newObj[prop] = obj[prop];\n\t\treturn newObj;\n\t}, {});\n}\n//#endregion\n//#region src/commands/resetAttributes.ts\nconst resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {\n\tlet nodeType = null;\n\tlet markType = null;\n\tconst schemaType = getSchemaTypeNameByName(typeof typeOrName === \"string\" ? typeOrName : typeOrName.name, state.schema);\n\tif (!schemaType) return false;\n\tif (schemaType === \"node\") nodeType = getNodeType(typeOrName, state.schema);\n\tif (schemaType === \"mark\") markType = getMarkType(typeOrName, state.schema);\n\tlet canReset = false;\n\ttr.selection.ranges.forEach((range) => {\n\t\tstate.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {\n\t\t\tif (nodeType && nodeType === node.type) {\n\t\t\t\tcanReset = true;\n\t\t\t\tif (dispatch) tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));\n\t\t\t}\n\t\t\tif (markType && node.marks.length) node.marks.forEach((mark) => {\n\t\t\t\tif (markType === mark.type) {\n\t\t\t\t\tcanReset = true;\n\t\t\t\t\tif (dispatch) tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t});\n\treturn canReset;\n};\n//#endregion\n//#region src/commands/scrollIntoView.ts\nconst scrollIntoView = () => ({ tr, dispatch }) => {\n\tif (dispatch) tr.scrollIntoView();\n\treturn true;\n};\n//#endregion\n//#region src/commands/selectAll.ts\nconst selectAll = () => ({ tr, dispatch }) => {\n\tif (dispatch) {\n\t\tconst selection = new AllSelection(tr.doc);\n\t\ttr.setSelection(selection);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/selectNodeBackward.ts\nconst selectNodeBackward$1 = () => ({ state, dispatch }) => {\n\treturn selectNodeBackward(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectNodeForward.ts\nconst selectNodeForward$1 = () => ({ state, dispatch }) => {\n\treturn selectNodeForward(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectParentNode.ts\nconst selectParentNode$1 = () => ({ state, dispatch }) => {\n\treturn selectParentNode(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectTextblockEnd.ts\nconst selectTextblockEnd$1 = () => ({ state, dispatch }) => {\n\treturn selectTextblockEnd(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectTextblockStart.ts\nconst selectTextblockStart$1 = () => ({ state, dispatch }) => {\n\treturn selectTextblockStart(state, dispatch);\n};\n//#endregion\n//#region src/helpers/createDocument.ts\n/**\n* Create a new Prosemirror document node from content.\n* @param content The JSON or HTML content to create the document from\n* @param schema The Prosemirror schema to use for the document\n* @param parseOptions Options for the parser\n* @returns The created Prosemirror document node\n*/\nfunction createDocument(content, schema, parseOptions = {}, options = {}) {\n\treturn createNodeFromContent(content, schema, {\n\t\tslice: false,\n\t\tparseOptions,\n\t\terrorOnInvalidContent: options.errorOnInvalidContent\n\t});\n}\n//#endregion\n//#region src/commands/setContent.ts\nconst setContent = (content, { errorOnInvalidContent, emitUpdate = true, parseOptions = {} } = {}) => ({ editor, tr, dispatch, commands }) => {\n\tconst { doc } = tr;\n\tif (parseOptions.preserveWhitespace !== \"full\") {\n\t\tconst document = createDocument(content, editor.schema, parseOptions, { errorOnInvalidContent: errorOnInvalidContent !== null && errorOnInvalidContent !== void 0 ? errorOnInvalidContent : editor.options.enableContentCheck });\n\t\tif (dispatch) {\n\t\t\tconst nodes = isFragment(document) ? document.content : [document];\n\t\t\ttr.replaceWith(0, doc.content.size, nodes).setMeta(\"preventUpdate\", !emitUpdate);\n\t\t}\n\t\treturn true;\n\t}\n\tif (dispatch) tr.setMeta(\"preventUpdate\", !emitUpdate);\n\treturn commands.insertContentAt({\n\t\tfrom: 0,\n\t\tto: doc.content.size\n\t}, content, {\n\t\tparseOptions,\n\t\terrorOnInvalidContent: errorOnInvalidContent !== null && errorOnInvalidContent !== void 0 ? errorOnInvalidContent : editor.options.enableContentCheck\n\t});\n};\n//#endregion\n//#region src/helpers/getMarkAttributes.ts\nfunction getMarkAttributes(state, typeOrName) {\n\tconst type = getMarkType(typeOrName, state.schema);\n\tconst { from, to, empty } = state.selection;\n\tconst marks = [];\n\tif (empty) {\n\t\tif (state.storedMarks) marks.push(...state.storedMarks);\n\t\tmarks.push(...state.selection.$head.marks());\n\t} else state.doc.nodesBetween(from, to, (node) => {\n\t\tmarks.push(...node.marks);\n\t});\n\tconst mark = marks.find((markItem) => markItem.type.name === type.name);\n\tif (!mark) return {};\n\treturn { ...mark.attrs };\n}\n//#endregion\n//#region src/helpers/combineTransactionSteps.ts\n/**\n* Returns a new `Transform` based on all steps of the passed transactions.\n* @param oldDoc The Prosemirror node to start from\n* @param transactions The transactions to combine\n* @returns A new `Transform` with all steps of the passed transactions\n*/\nfunction combineTransactionSteps(oldDoc, transactions) {\n\tconst transform = new Transform(oldDoc);\n\ttransactions.forEach((transaction) => {\n\t\ttransaction.steps.forEach((step) => {\n\t\t\ttransform.step(step);\n\t\t});\n\t});\n\treturn transform;\n}\n//#endregion\n//#region src/helpers/findChildren.ts\n/**\n* Find children inside a Prosemirror node that match a predicate.\n* @param node The Prosemirror node to search in\n* @param predicate The predicate to match\n* @returns An array of nodes with their positions\n*/\nfunction findChildren(node, predicate) {\n\tconst nodesWithPos = [];\n\tnode.descendants((child, pos) => {\n\t\tif (predicate(child)) nodesWithPos.push({\n\t\t\tnode: child,\n\t\t\tpos\n\t\t});\n\t});\n\treturn nodesWithPos;\n}\n//#endregion\n//#region src/helpers/findChildrenInRange.ts\n/**\n* Same as `findChildren` but searches only within a `range`.\n* @param node The Prosemirror node to search in\n* @param range The range to search in\n* @param predicate The predicate to match\n* @returns An array of nodes with their positions\n*/\nfunction findChildrenInRange(node, range, predicate) {\n\tconst nodesWithPos = [];\n\tnode.nodesBetween(range.from, range.to, (child, pos) => {\n\t\tif (predicate(child)) nodesWithPos.push({\n\t\t\tnode: child,\n\t\t\tpos\n\t\t});\n\t});\n\treturn nodesWithPos;\n}\n//#endregion\n//#region src/helpers/findParentNodeClosestToPos.ts\n/**\n* Finds the closest parent node to a resolved position that matches a predicate.\n* @param $pos The resolved position to search from\n* @param predicate The predicate to match\n* @returns The closest parent node to the resolved position that matches the predicate\n* @example ```js\n* findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')\n* ```\n*/\nfunction findParentNodeClosestToPos($pos, predicate) {\n\tfor (let i = $pos.depth; i > 0; i -= 1) {\n\t\tconst node = $pos.node(i);\n\t\tif (predicate(node)) return {\n\t\t\tpos: i > 0 ? $pos.before(i) : 0,\n\t\t\tstart: $pos.start(i),\n\t\t\tdepth: i,\n\t\t\tnode\n\t\t};\n\t}\n}\n//#endregion\n//#region src/helpers/findParentNode.ts\n/**\n* Finds the closest parent node to the current selection that matches a predicate.\n* @param predicate The predicate to match\n* @returns A command that finds the closest parent node to the current selection that matches the predicate\n* @example ```js\n* findParentNode(node => node.type.name === 'paragraph')\n* ```\n*/\nfunction findParentNode(predicate) {\n\treturn (selection) => findParentNodeClosestToPos(selection.$from, predicate);\n}\n//#endregion\n//#region src/helpers/getExtensionField.ts\n/**\n* Returns a field from an extension\n* @param extension The Tiptap extension\n* @param field The field, for example `renderHTML` or `priority`\n* @param context The context object that should be passed as `this` into the function\n* @returns The field value\n*/\nfunction getExtensionField(extension, field, context) {\n\tif (extension.config[field] === void 0 && extension.parent) return getExtensionField(extension.parent, field, context);\n\tif (typeof extension.config[field] === \"function\") return extension.config[field].bind({\n\t\t...context,\n\t\tparent: extension.parent ? getExtensionField(extension.parent, field, context) : null\n\t});\n\treturn extension.config[field];\n}\n//#endregion\n//#region src/helpers/flattenExtensions.ts\n/**\n* Create a flattened array of extensions by traversing the `addExtensions` field.\n* @param extensions An array of Tiptap extensions\n* @returns A flattened array of Tiptap extensions\n*/\nfunction flattenExtensions(extensions) {\n\treturn extensions.map((extension) => {\n\t\tconst addExtensions = getExtensionField(extension, \"addExtensions\", {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage\n\t\t});\n\t\tif (addExtensions) return [extension, ...flattenExtensions(addExtensions())];\n\t\treturn extension;\n\t}).flat(10);\n}\n//#endregion\n//#region src/helpers/getHTMLFromFragment.ts\nfunction getHTMLFromFragment(fragment, schema) {\n\tconst documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);\n\tconst container = document.implementation.createHTMLDocument().createElement(\"div\");\n\tcontainer.appendChild(documentFragment);\n\treturn container.innerHTML;\n}\n//#endregion\n//#region src/schema/getSchemaAttributes.ts\n/**\n* Combines external attribute structure with local attribute behavior.\n* @param attributes The attributes from resolved local extensions\n* @param schema The schema that defines the allowed attributes\n* @returns Only attributes present in the schema\n*/\nfunction getSchemaAttributes(attributes, schema) {\n\tconst attributesByType = /* @__PURE__ */ new Map();\n\tfor (const attribute of attributes) {\n\t\tvar _attributesByType$get;\n\t\tconst typeAttributes = (_attributesByType$get = attributesByType.get(attribute.type)) !== null && _attributesByType$get !== void 0 ? _attributesByType$get : /* @__PURE__ */ new Map();\n\t\ttypeAttributes.set(attribute.name, attribute);\n\t\tattributesByType.set(attribute.type, typeAttributes);\n\t}\n\treturn [...Object.values(schema.nodes), ...Object.values(schema.marks)].flatMap((type) => {\n\t\tvar _type$spec$attrs;\n\t\treturn Object.entries((_type$spec$attrs = type.spec.attrs) !== null && _type$spec$attrs !== void 0 ? _type$spec$attrs : {}).map(([name, spec]) => {\n\t\t\tvar _attributesByType$get2;\n\t\t\tconst local = (_attributesByType$get2 = attributesByType.get(type.name)) === null || _attributesByType$get2 === void 0 ? void 0 : _attributesByType$get2.get(name);\n\t\t\tconst hasDefault = Object.hasOwn(spec, \"default\");\n\t\t\treturn {\n\t\t\t\ttype: type.name,\n\t\t\t\tname,\n\t\t\t\tattribute: {\n\t\t\t\t\trendered: true,\n\t\t\t\t\trenderHTML: null,\n\t\t\t\t\tparseHTML: null,\n\t\t\t\t\tkeepOnSplit: true,\n\t\t\t\t\t...local === null || local === void 0 ? void 0 : local.attribute,\n\t\t\t\t\tdefault: spec.default,\n\t\t\t\t\tisRequired: !hasDefault,\n\t\t\t\t\tvalidate: spec.validate\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t});\n}\n//#endregion\n//#region src/schema/schemaSpecFields.ts\nconst nodeSchemaFields = {\n\tcontent: \"string\",\n\tmarks: \"string\",\n\tgroup: \"string\",\n\tinline: \"boolean\",\n\tatom: \"boolean\",\n\tselectable: \"boolean\",\n\tdraggable: \"boolean\",\n\tcode: \"boolean\",\n\twhitespace: [\"pre\", \"normal\"],\n\tdefiningAsContext: \"boolean\",\n\tdefiningForContent: \"boolean\",\n\tdefining: \"boolean\",\n\tisolating: \"boolean\",\n\tlinebreakReplacement: \"boolean\"\n};\nconst markSchemaFields = {\n\tinclusive: \"boolean\",\n\texcludes: \"string\",\n\tgroup: \"string\",\n\tspanning: \"boolean\",\n\tcode: \"boolean\"\n};\n//#endregion\n//#region src/schema/mergeSchemaSpec.ts\nfunction structuralFields(spec, fields, path) {\n\treturn Object.fromEntries(Object.entries(fields).flatMap(([name, expected]) => {\n\t\tconst value = spec[name];\n\t\tif (value === void 0) return [];\n\t\tif (!(typeof expected === \"string\" ? typeof value === expected : typeof value === \"string\" && expected.includes(value))) throw new RangeError(`Invalid schemaSpec field '${path}.${name}'`);\n\t\treturn [[name, value]];\n\t}));\n}\nfunction mergeType(name, local, external, fields) {\n\treturn {\n\t\t...Object.fromEntries(Object.entries(local).filter(([key]) => key !== \"attrs\" && !Object.hasOwn(fields, key))),\n\t\t...structuralFields(external, fields, name),\n\t\tattrs: external.attrs\n\t};\n}\nfunction checkTypes(local, external, kind) {\n\tfor (const name of Object.keys(external)) if (!Object.hasOwn(local, name)) throw new RangeError(`schemaSpec requires a local ${kind} extension named '${name}'`);\n\tfor (const name of Object.keys(local)) if (!Object.hasOwn(external, name)) throw new RangeError(`Local ${kind} extension '${name}' is not in schemaSpec`);\n}\n/**\n* Combines external structure with local DOM behavior and extension metadata.\n* @param local The specifications generated by resolved local extensions\n* @param external The schema compiled from the provided specification\n* @returns A specification in the external schema's node and mark order\n*/\nfunction mergeSchemaSpec(local, external) {\n\tcheckTypes(local.nodes, external.nodes, \"node\");\n\tcheckTypes(local.marks, external.marks, \"mark\");\n\tlet nodes = external.spec.nodes;\n\tlet marks = external.spec.marks;\n\texternal.spec.nodes.forEach((name, spec) => {\n\t\tnodes = nodes.update(name, mergeType(name, local.nodes[name], spec, nodeSchemaFields));\n\t});\n\texternal.spec.marks.forEach((name, spec) => {\n\t\tmarks = marks.update(name, mergeType(name, local.marks[name], spec, markSchemaFields));\n\t});\n\treturn {\n\t\ttopNode: external.topNodeType.name,\n\t\tnodes,\n\t\tmarks\n\t};\n}\n//#endregion\n//#region src/utilities/findDuplicates.ts\n/**\n* Find duplicates in an array.\n*/\nfunction findDuplicates(items) {\n\tconst filtered = items.filter((el, index) => items.indexOf(el) !== index);\n\treturn Array.from(new Set(filtered));\n}\n//#endregion\n//#region src/helpers/splitExtensions.ts\nfunction splitExtensions(extensions) {\n\treturn {\n\t\tbaseExtensions: extensions.filter((extension) => extension.type === \"extension\"),\n\t\tnodeExtensions: extensions.filter((extension) => extension.type === \"node\"),\n\t\tmarkExtensions: extensions.filter((extension) => extension.type === \"mark\")\n\t};\n}\n//#endregion\n//#region src/helpers/getAttributesFromExtensions.ts\n/**\n* Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.\n* @param extensions List of extensions\n*/\nfunction getAttributesFromExtensions(extensions) {\n\tconst extensionAttributes = [];\n\tconst { nodeExtensions, markExtensions } = splitExtensions(extensions);\n\tconst nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];\n\tconst defaultAttribute = {\n\t\tdefault: null,\n\t\tvalidate: void 0,\n\t\trendered: true,\n\t\trenderHTML: null,\n\t\tparseHTML: null,\n\t\tkeepOnSplit: true,\n\t\tisRequired: false\n\t};\n\tconst nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== \"text\").map((ext) => ext.name);\n\tconst markExtensionTypes = markExtensions.map((ext) => ext.name);\n\tconst allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];\n\textensions.forEach((extension) => {\n\t\tconst addGlobalAttributes = getExtensionField(extension, \"addGlobalAttributes\", {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage,\n\t\t\textensions: nodeAndMarkExtensions\n\t\t});\n\t\tif (!addGlobalAttributes) return;\n\t\taddGlobalAttributes().forEach((globalAttribute) => {\n\t\t\tlet resolvedTypes;\n\t\t\tif (Array.isArray(globalAttribute.types)) resolvedTypes = globalAttribute.types;\n\t\t\telse if (globalAttribute.types === \"*\") resolvedTypes = allExtensionTypes;\n\t\t\telse if (globalAttribute.types === \"nodes\") resolvedTypes = nodeExtensionTypes;\n\t\t\telse if (globalAttribute.types === \"marks\") resolvedTypes = markExtensionTypes;\n\t\t\telse resolvedTypes = [];\n\t\t\tresolvedTypes.forEach((type) => {\n\t\t\t\tObject.entries(globalAttribute.attributes).forEach(([name, attribute]) => {\n\t\t\t\t\textensionAttributes.push({\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tattribute: {\n\t\t\t\t\t\t\t...defaultAttribute,\n\t\t\t\t\t\t\t...attribute\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\tnodeAndMarkExtensions.forEach((extension) => {\n\t\tconst addAttributes = getExtensionField(extension, \"addAttributes\", {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage\n\t\t});\n\t\tif (!addAttributes) return;\n\t\tconst attributes = addAttributes();\n\t\tObject.entries(attributes).forEach(([name, attribute]) => {\n\t\t\tconst mergedAttr = {\n\t\t\t\t...defaultAttribute,\n\t\t\t\t...attribute\n\t\t\t};\n\t\t\tif (typeof (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === \"function\") mergedAttr.default = mergedAttr.default();\n\t\t\tif ((mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.isRequired) && (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === void 0) delete mergedAttr.default;\n\t\t\textensionAttributes.push({\n\t\t\t\ttype: extension.name,\n\t\t\t\tname,\n\t\t\t\tattribute: mergedAttr\n\t\t\t});\n\t\t});\n\t});\n\treturn extensionAttributes;\n}\n//#endregion\n//#region src/utilities/isFunction.ts\nfunction isFunction(value) {\n\treturn typeof value === \"function\";\n}\n//#endregion\n//#region src/utilities/callOrReturn.ts\n/**\n* Optionally calls `value` as a function.\n* Otherwise it is returned directly.\n* @param value Function or any value.\n* @param context Optional context to bind to function.\n* @param props Optional props to pass to function.\n*/\nfunction callOrReturn(value, context = void 0, ...props) {\n\tif (isFunction(value)) {\n\t\tif (context) return value.bind(context)(...props);\n\t\treturn value(...props);\n\t}\n\treturn value;\n}\n//#endregion\n//#region src/utilities/isEmptyObject.ts\nfunction isEmptyObject(value = {}) {\n\treturn Object.keys(value).length === 0 && value.constructor === Object;\n}\n//#endregion\n//#region src/utilities/mergeAttributes.ts\n/** Splits a CSS style string into declarations, ignoring semicolons inside quotes/parentheses. */\nfunction splitStyleDeclarations(styles) {\n\tconst result = [];\n\tlet current = \"\";\n\tlet inSingleQuote = false;\n\tlet inDoubleQuote = false;\n\tlet parenDepth = 0;\n\tconst length = styles.length;\n\tfor (let i = 0; i < length; i += 1) {\n\t\tconst char = styles[i];\n\t\tif (char === \"'\" && !inDoubleQuote) {\n\t\t\tinSingleQuote = !inSingleQuote;\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\" && !inSingleQuote) {\n\t\t\tinDoubleQuote = !inDoubleQuote;\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!inSingleQuote && !inDoubleQuote) {\n\t\t\tif (char === \"(\") {\n\t\t\t\tparenDepth += 1;\n\t\t\t\tcurrent += char;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \")\" && parenDepth > 0) {\n\t\t\t\tparenDepth -= 1;\n\t\t\t\tcurrent += char;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \";\" && parenDepth === 0) {\n\t\t\t\tresult.push(current);\n\t\t\t\tcurrent = \"\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tcurrent += char;\n\t}\n\tif (current) result.push(current);\n\treturn result;\n}\n/** Yields property/value pairs from a style string. */\nfunction parseStyleEntries(styles) {\n\tconst pairs = [];\n\tconst declarations = splitStyleDeclarations(styles || \"\");\n\tconst numDeclarations = declarations.length;\n\tfor (let i = 0; i < numDeclarations; i += 1) {\n\t\tconst declaration = declarations[i];\n\t\tconst firstColonIndex = declaration.indexOf(\":\");\n\t\tif (firstColonIndex === -1) continue;\n\t\tconst property = declaration.slice(0, firstColonIndex).trim();\n\t\tconst value = declaration.slice(firstColonIndex + 1).trim();\n\t\tif (property && value) pairs.push([property, value]);\n\t}\n\treturn pairs;\n}\nfunction mergeAttributes(...objects) {\n\treturn objects.filter((item) => !!item).reduce((items, item) => {\n\t\tconst mergedAttributes = { ...items };\n\t\tObject.entries(item).forEach(([key, value]) => {\n\t\t\tif (key === \"__proto__\") {\n\t\t\t\tObject.defineProperty(mergedAttributes, key, {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tvalue,\n\t\t\t\t\twritable: true\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mergedAttributes[key]) {\n\t\t\t\tmergedAttributes[key] = value;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (key === \"class\") {\n\t\t\t\tconst valueClasses = value ? String(value).split(\" \") : [];\n\t\t\t\tconst existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(\" \") : [];\n\t\t\t\tconst insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));\n\t\t\t\tmergedAttributes[key] = [...existingClasses, ...insertClasses].join(\" \");\n\t\t\t} else if (key === \"style\") {\n\t\t\t\tconst styleMap = new Map([...parseStyleEntries(mergedAttributes[key]), ...parseStyleEntries(value)]);\n\t\t\t\tmergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join(\"; \");\n\t\t\t} else mergedAttributes[key] = value;\n\t\t});\n\t\treturn mergedAttributes;\n\t}, {});\n}\n//#endregion\n//#region src/helpers/getRenderedAttributes.ts\nfunction getRenderedAttributes(nodeOrMark, extensionAttributes) {\n\treturn extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {\n\t\tif (!item.attribute.renderHTML) return { [item.name]: nodeOrMark.attrs[item.name] };\n\t\treturn item.attribute.renderHTML(nodeOrMark.attrs) || {};\n\t}).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\n//#endregion\n//#region src/utilities/fromString.ts\nfunction fromString(value) {\n\tif (typeof value !== \"string\") return value;\n\tif (value.match(/^[+-]?(?:\\d*\\.)?\\d+$/)) return Number(value);\n\tif (value === \"true\") return true;\n\tif (value === \"false\") return false;\n\treturn value;\n}\n//#endregion\n//#region src/helpers/injectExtensionAttributesToParseRule.ts\n/**\n* This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).\n* Cancels when `getAttrs` returned `false`.\n* @param parseRule ProseMirror ParseRule\n* @param extensionAttributes List of attributes to inject\n*/\nfunction injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {\n\tif (\"style\" in parseRule) return parseRule;\n\treturn {\n\t\t...parseRule,\n\t\tgetAttrs: (node) => {\n\t\t\tconst oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;\n\t\t\tif (oldAttributes === false) return false;\n\t\t\tconst newAttributes = extensionAttributes.reduce((items, item) => {\n\t\t\t\tconst value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));\n\t\t\t\tif (value === null || value === void 0) return items;\n\t\t\t\treturn {\n\t\t\t\t\t...items,\n\t\t\t\t\t[item.name]: value\n\t\t\t\t};\n\t\t\t}, {});\n\t\t\treturn {\n\t\t\t\t...oldAttributes,\n\t\t\t\t...newAttributes\n\t\t\t};\n\t\t}\n\t};\n}\n//#endregion\n//#region src/helpers/getSchemaSpecByResolvedExtensions.ts\nfunction cleanUpSchemaItem(data) {\n\treturn Object.fromEntries(Object.entries(data).filter(([key, value]) => {\n\t\tif (key === \"attrs\" && isEmptyObject(value)) return false;\n\t\treturn value !== null && value !== void 0;\n\t}));\n}\n/**\n* Builds an attribute spec tuple for ProseMirror schema from an extension attribute.\n* @param extensionAttribute The extension attribute to build the spec for\n* @returns A tuple of [attributeName, spec]\n*/\nfunction buildAttributeSpec(extensionAttribute) {\n\tvar _extensionAttribute$a, _extensionAttribute$a2;\n\tconst spec = {};\n\tif (!(extensionAttribute === null || extensionAttribute === void 0 || (_extensionAttribute$a = extensionAttribute.attribute) === null || _extensionAttribute$a === void 0 ? void 0 : _extensionAttribute$a.isRequired) && \"default\" in ((extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) || {})) spec.default = extensionAttribute.attribute.default;\n\tif ((extensionAttribute === null || extensionAttribute === void 0 || (_extensionAttribute$a2 = extensionAttribute.attribute) === null || _extensionAttribute$a2 === void 0 ? void 0 : _extensionAttribute$a2.validate) !== void 0) spec.validate = extensionAttribute.attribute.validate;\n\treturn [extensionAttribute.name, spec];\n}\n/**\n* Builds schema specifications without compiling content expressions.\n* @param extensions An array of Tiptap extensions\n* @param editor The editor instance\n* @param allAttributes The effective attributes used for schema and DOM behavior\n* @returns The node and mark specifications\n*/\nfunction getSchemaSpecByResolvedExtensions(extensions, editor, allAttributes = getAttributesFromExtensions(extensions)) {\n\tvar _nodeExtensions$find;\n\tconst { nodeExtensions, markExtensions } = splitExtensions(extensions);\n\treturn {\n\t\ttopNode: (_nodeExtensions$find = nodeExtensions.find((extension) => getExtensionField(extension, \"topNode\"))) === null || _nodeExtensions$find === void 0 ? void 0 : _nodeExtensions$find.name,\n\t\tnodes: Object.fromEntries(nodeExtensions.map((extension) => {\n\t\t\tconst extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: extension.storage,\n\t\t\t\teditor\n\t\t\t};\n\t\t\tconst schema = cleanUpSchemaItem({\n\t\t\t\t...extensions.reduce((fields, e) => {\n\t\t\t\t\tconst extendNodeSchema = getExtensionField(e, \"extendNodeSchema\", context);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t...extendNodeSchema ? extendNodeSchema(extension) : {}\n\t\t\t\t\t};\n\t\t\t\t}, {}),\n\t\t\t\tcontent: callOrReturn(getExtensionField(extension, \"content\", context)),\n\t\t\t\tmarks: callOrReturn(getExtensionField(extension, \"marks\", context)),\n\t\t\t\tgroup: callOrReturn(getExtensionField(extension, \"group\", context)),\n\t\t\t\tinline: callOrReturn(getExtensionField(extension, \"inline\", context)),\n\t\t\t\tatom: callOrReturn(getExtensionField(extension, \"atom\", context)),\n\t\t\t\tselectable: callOrReturn(getExtensionField(extension, \"selectable\", context)),\n\t\t\t\tdraggable: callOrReturn(getExtensionField(extension, \"draggable\", context)),\n\t\t\t\tcode: callOrReturn(getExtensionField(extension, \"code\", context)),\n\t\t\t\twhitespace: callOrReturn(getExtensionField(extension, \"whitespace\", context)),\n\t\t\t\tlinebreakReplacement: callOrReturn(getExtensionField(extension, \"linebreakReplacement\", context)),\n\t\t\t\tdefining: callOrReturn(getExtensionField(extension, \"defining\", context)),\n\t\t\t\tisolating: callOrReturn(getExtensionField(extension, \"isolating\", context)),\n\t\t\t\tattrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))\n\t\t\t});\n\t\t\tconst parseHTML = callOrReturn(getExtensionField(extension, \"parseHTML\", context));\n\t\t\tif (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n\t\t\tconst renderHTML = getExtensionField(extension, \"renderHTML\", context);\n\t\t\tif (renderHTML) schema.toDOM = (node) => renderHTML({\n\t\t\t\tnode,\n\t\t\t\tHTMLAttributes: getRenderedAttributes(node, extensionAttributes)\n\t\t\t});\n\t\t\tconst renderText = getExtensionField(extension, \"renderText\", context);\n\t\t\tif (renderText) schema.toText = renderText;\n\t\t\treturn [extension.name, schema];\n\t\t})),\n\t\tmarks: Object.fromEntries(markExtensions.map((extension) => {\n\t\t\tconst extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: extension.storage,\n\t\t\t\teditor\n\t\t\t};\n\t\t\tconst schema = cleanUpSchemaItem({\n\t\t\t\t...extensions.reduce((fields, e) => {\n\t\t\t\t\tconst extendMarkSchema = getExtensionField(e, \"extendMarkSchema\", context);\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...fields,\n\t\t\t\t\t\t...extendMarkSchema ? extendMarkSchema(extension) : {}\n\t\t\t\t\t};\n\t\t\t\t}, {}),\n\t\t\t\tinclusive: callOrReturn(getExtensionField(extension, \"inclusive\", context)),\n\t\t\t\texcludes: callOrReturn(getExtensionField(extension, \"excludes\", context)),\n\t\t\t\tgroup: callOrReturn(getExtensionField(extension, \"group\", context)),\n\t\t\t\tspanning: callOrReturn(getExtensionField(extension, \"spanning\", context)),\n\t\t\t\tcode: callOrReturn(getExtensionField(extension, \"code\", context)),\n\t\t\t\tattrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))\n\t\t\t});\n\t\t\tconst parseHTML = callOrReturn(getExtensionField(extension, \"parseHTML\", context));\n\t\t\tif (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n\t\t\tconst renderHTML = getExtensionField(extension, \"renderHTML\", context);\n\t\t\tif (renderHTML) schema.toDOM = (mark) => renderHTML({\n\t\t\t\tmark,\n\t\t\t\tHTMLAttributes: getRenderedAttributes(mark, extensionAttributes)\n\t\t\t});\n\t\t\treturn [extension.name, schema];\n\t\t}))\n\t};\n}\n//#endregion\n//#region src/helpers/getSchemaByResolvedExtensions.ts\n/**\n* Creates a ProseMirror schema from resolved extensions.\n* @param extensions The flattened and sorted extensions\n* @param editor The editor instance\n* @param schemaSpec The external structure to use with local extension behavior\n* @returns A ProseMirror schema\n*/\nfunction getSchemaByResolvedExtensions(extensions, editor, schemaSpec) {\n\tif (schemaSpec === void 0) return new Schema(getSchemaSpecByResolvedExtensions(extensions, editor));\n\tconst duplicates = findDuplicates(extensions.filter((extension) => extension.type !== \"extension\").map((extension) => extension.name));\n\tif (duplicates.length) throw new RangeError(`Duplicate local schema types: ${duplicates.join(\", \")}`);\n\tconst external = new Schema(schemaSpec);\n\tconst local = getSchemaSpecByResolvedExtensions(extensions, editor, getSchemaAttributes(getAttributesFromExtensions(extensions), external));\n\treturn new Schema(mergeSchemaSpec(local, external));\n}\n//#endregion\n//#region src/helpers/sortExtensions.ts\n/**\n* Sort extensions by priority.\n* @param extensions An array of Tiptap extensions\n* @returns A sorted array of Tiptap extensions by priority\n*/\nfunction sortExtensions(extensions) {\n\tconst defaultPriority = 100;\n\treturn extensions.sort((a, b) => {\n\t\tconst priorityA = getExtensionField(a, \"priority\") || defaultPriority;\n\t\tconst priorityB = getExtensionField(b, \"priority\") || defaultPriority;\n\t\tif (priorityA > priorityB) return -1;\n\t\tif (priorityA < priorityB) return 1;\n\t\treturn 0;\n\t});\n}\n//#endregion\n//#region src/helpers/resolveExtensions.ts\n/**\n* Returns a flattened and sorted extension list while\n* also checking for duplicated extensions and warns the user.\n* @param extensions An array of Tiptap extensions\n* @returns An flattened and sorted array of Tiptap extensions\n*/\nfunction resolveExtensions(extensions) {\n\tconst resolvedExtensions = sortExtensions(flattenExtensions(extensions));\n\tconst duplicatedNames = findDuplicates(resolvedExtensions.map((extension) => extension.name));\n\tif (duplicatedNames.length) console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map((item) => `'${item}'`).join(\", \")}]. This can lead to issues.`);\n\treturn resolvedExtensions;\n}\n//#endregion\n//#region src/helpers/getSchema.ts\nfunction getSchema(extensions, editor) {\n\treturn getSchemaByResolvedExtensions(resolveExtensions(extensions), editor);\n}\n//#endregion\n//#region src/helpers/generateHTML.ts\n/**\n* Generate HTML from a JSONContent\n* @param doc The JSONContent to generate HTML from\n* @param extensions The extensions to use for the schema\n* @returns The generated HTML\n*/\nfunction generateHTML(doc, extensions) {\n\tconst schema = getSchema(extensions);\n\treturn getHTMLFromFragment(Node$1.fromJSON(schema, doc).content, schema);\n}\n//#endregion\n//#region src/helpers/generateJSON.ts\n/**\n* Generate JSONContent from HTML\n* @param html The HTML to generate JSONContent from\n* @param extensions The extensions to use for the schema\n* @returns The generated JSONContent\n*/\nfunction generateJSON(html, extensions) {\n\tconst schema = getSchema(extensions);\n\tconst dom = elementFromString(html);\n\treturn DOMParser.fromSchema(schema).parse(dom).toJSON();\n}\n//#endregion\n//#region src/helpers/getTextBetween.ts\n/**\n* Gets the text between two positions in a Prosemirror node\n* and serializes it using the given text serializers and block separator (see getText)\n* @param startNode The Prosemirror node to start from\n* @param range The range of the text to get\n* @param options Options for the text serializer & block separator\n* @returns The text between the two positions\n*/\nfunction getTextBetween(startNode, range, options) {\n\tconst { from, to } = range;\n\tconst { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n\tlet text = \"\";\n\tstartNode.nodesBetween(from, to, (node, pos, parent, index) => {\n\t\tif (node.isBlock && pos > from) text += blockSeparator;\n\t\tconst textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];\n\t\tif (textSerializer) {\n\t\t\tif (parent) text += textSerializer({\n\t\t\t\tnode,\n\t\t\t\tpos,\n\t\t\t\tparent,\n\t\t\t\tindex,\n\t\t\t\trange\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\t\tif (node.isText) {\n\t\t\tvar _node$text;\n\t\t\ttext += node === null || node === void 0 || (_node$text = node.text) === null || _node$text === void 0 ? void 0 : _node$text.slice(Math.max(from, pos) - pos, to - pos);\n\t\t}\n\t});\n\treturn text;\n}\n//#endregion\n//#region src/helpers/getText.ts\n/**\n* Gets the text of a Prosemirror node\n* @param node The Prosemirror node\n* @param options Options for the text serializer & block separator\n* @returns The text of the node\n* @example ```js\n* const text = getText(node, { blockSeparator: '\\n' })\n* ```\n*/\nfunction getText(node, options) {\n\treturn getTextBetween(node, {\n\t\tfrom: 0,\n\t\tto: node.content.size\n\t}, options);\n}\n//#endregion\n//#region src/helpers/getTextSerializersFromSchema.ts\n/**\n* Find text serializers `toText` in a Prosemirror schema\n* @param schema The Prosemirror schema to search in\n* @returns A record of text serializers by node name\n*/\nfunction getTextSerializersFromSchema(schema) {\n\treturn Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));\n}\n//#endregion\n//#region src/helpers/generateText.ts\n/**\n* Generate raw text from a JSONContent\n* @param doc The JSONContent to generate text from\n* @param extensions The extensions to use for the schema\n* @param options Options for the text generation f.e. blockSeparator or textSerializers\n* @returns The generated text\n*/\nfunction generateText(doc, extensions, options) {\n\tconst { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n\tconst schema = getSchema(extensions);\n\treturn getText(Node$1.fromJSON(schema, doc), {\n\t\tblockSeparator,\n\t\ttextSerializers: {\n\t\t\t...getTextSerializersFromSchema(schema),\n\t\t\t...textSerializers\n\t\t}\n\t});\n}\n//#endregion\n//#region src/helpers/getNodeAttributes.ts\nfunction getNodeAttributes(state, typeOrName) {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst { from, to } = state.selection;\n\tconst nodes = [];\n\tstate.doc.nodesBetween(from, to, (node) => {\n\t\tnodes.push(node);\n\t});\n\tconst node = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);\n\tif (!node) return {};\n\treturn { ...node.attrs };\n}\n//#endregion\n//#region src/helpers/getAttributes.ts\n/**\n* Get node or mark attributes by type or name on the current editor state\n* @param state The current editor state\n* @param typeOrName The node or mark type or name\n* @returns The attributes of the node or mark or an empty object\n*/\nfunction getAttributes(state, typeOrName) {\n\tconst schemaType = getSchemaTypeNameByName(typeof typeOrName === \"string\" ? typeOrName : typeOrName.name, state.schema);\n\tif (schemaType === \"node\") return getNodeAttributes(state, typeOrName);\n\tif (schemaType === \"mark\") return getMarkAttributes(state, typeOrName);\n\treturn {};\n}\n//#endregion\n//#region src/utilities/removeDuplicates.ts\n/**\n* Removes duplicated values within an array.\n* Supports numbers, strings and objects.\n*/\nfunction removeDuplicates(array, by = JSON.stringify) {\n\tconst seen = {};\n\treturn array.filter((item) => {\n\t\tconst key = by(item);\n\t\treturn Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;\n\t});\n}\n//#endregion\n//#region src/helpers/getChangedRanges.ts\n/**\n* Removes duplicated ranges and ranges that are\n* fully captured by other ranges.\n*/\nfunction simplifyChangedRanges(changes) {\n\tconst uniqueChanges = removeDuplicates(changes);\n\treturn uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {\n\t\treturn !uniqueChanges.filter((_, i) => i !== index).some((otherChange) => {\n\t\t\treturn change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;\n\t\t});\n\t});\n}\n/**\n* Returns a list of changed ranges\n* based on the first and last state of all steps.\n*/\nfunction getChangedRanges(transform) {\n\tconst { mapping, steps } = transform;\n\tconst changes = [];\n\tconst inverted = mapping.invert();\n\tmapping.maps.forEach((stepMap, index) => {\n\t\tconst ranges = [];\n\t\tif (!stepMap.ranges.length) {\n\t\t\tconst { from, to } = steps[index];\n\t\t\tif (from === void 0 || to === void 0) return;\n\t\t\tranges.push({\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t});\n\t\t} else stepMap.forEach((from, to) => {\n\t\t\tranges.push({\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t});\n\t\t});\n\t\tconst rest = mapping.slice(index);\n\t\tranges.forEach(({ from, to }) => {\n\t\t\tconst newStart = rest.map(from, -1);\n\t\t\tconst newEnd = rest.map(to);\n\t\t\tconst oldStart = inverted.map(newStart, -1);\n\t\t\tconst oldEnd = inverted.map(newEnd);\n\t\t\tchanges.push({\n\t\t\t\toldRange: {\n\t\t\t\t\tfrom: oldStart,\n\t\t\t\t\tto: oldEnd\n\t\t\t\t},\n\t\t\t\tnewRange: {\n\t\t\t\t\tfrom: newStart,\n\t\t\t\t\tto: newEnd\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t});\n\treturn simplifyChangedRanges(changes);\n}\n//#endregion\n//#region src/helpers/getDebugJSON.ts\nfunction getDebugJSON(node, startOffset = 0) {\n\tconst increment = node.type === node.type.schema.topNodeType ? 0 : 1;\n\tconst from = startOffset;\n\tconst to = from + node.nodeSize;\n\tconst marks = node.marks.map((mark) => {\n\t\tconst output = { type: mark.type.name };\n\t\tif (Object.keys(mark.attrs).length) output.attrs = { ...mark.attrs };\n\t\treturn output;\n\t});\n\tconst attrs = { ...node.attrs };\n\tconst output = {\n\t\ttype: node.type.name,\n\t\tfrom,\n\t\tto\n\t};\n\tif (Object.keys(attrs).length) output.attrs = attrs;\n\tif (marks.length) output.marks = marks;\n\tif (node.content.childCount) {\n\t\toutput.content = [];\n\t\tnode.forEach((child, offset) => {\n\t\t\tvar _output$content;\n\t\t\t(_output$content = output.content) === null || _output$content === void 0 || _output$content.push(getDebugJSON(child, startOffset + offset + increment));\n\t\t});\n\t}\n\tif (node.text) output.text = node.text;\n\treturn output;\n}\n//#endregion\n//#region src/helpers/getMarksBetween.ts\nfunction getMarksBetween(from, to, doc) {\n\tconst marks = [];\n\tif (from === to) doc.resolve(from).marks().forEach((mark) => {\n\t\tconst range = getMarkRange(doc.resolve(from), mark.type);\n\t\tif (!range) return;\n\t\tmarks.push({\n\t\t\tmark,\n\t\t\t...range\n\t\t});\n\t});\n\telse doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (!node || (node === null || node === void 0 ? void 0 : node.nodeSize) === void 0) return;\n\t\tmarks.push(...node.marks.map((mark) => ({\n\t\t\tfrom: pos,\n\t\t\tto: pos + node.nodeSize,\n\t\t\tmark\n\t\t})));\n\t});\n\treturn marks;\n}\n//#endregion\n//#region src/helpers/getNodeAtPosition.ts\n/**\n* Finds the first node of a given type or name in the current selection.\n* @param state The editor state.\n* @param typeOrName The node type or name.\n* @param pos The position to start searching from.\n* @param maxDepth The maximum depth to search.\n* @returns The node and the depth as an array.\n*/\nconst getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {\n\tconst $pos = state.doc.resolve(pos);\n\tlet currentDepth = maxDepth;\n\tlet node = null;\n\twhile (currentDepth > 0 && node === null) {\n\t\tconst currentNode = $pos.node(currentDepth);\n\t\tif ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type.name) === typeOrName) node = currentNode;\n\t\telse currentDepth -= 1;\n\t}\n\treturn [node, currentDepth];\n};\n//#endregion\n//#region src/helpers/getPreviousBlockSibling.ts\n/**\n* Returns the block-level sibling immediately before the cursor's textblock\n* (or null when the cursor is at the first child of its block parent).\n*\n* The position does not have to sit inside a textblock: for any resolved\n* position, the result is the sibling immediately before `$pos.parent`. At a\n* GapCursor position this is the sibling before the whole container, not the\n* node before the gap.\n*\n* @param $pos The resolved position to look around\n* @returns The previous block-level sibling, or null\n* @example ```js\n* // Cursor in a top-level paragraph after a list:\n* // <ul><li>A</li></ul><p>|B</p>\n* getPreviousBlockSibling($from) // <ul>\n*\n* // Cursor in the second paragraph of a list item:\n* // <ul><li><p>A</p><p>|B</p></li></ul>\n* getPreviousBlockSibling($from) // <p>A</p>\n*\n* // Cursor in the first child of its block parent:\n* // <doc><p>|A</p></doc>\n* getPreviousBlockSibling($from) // null\n* ```\n*/\nconst getPreviousBlockSibling = ($pos) => {\n\tconst parentDepth = $pos.depth - 1;\n\tif (parentDepth < 0) return null;\n\tconst index = $pos.index(parentDepth);\n\tif (index === 0) return null;\n\treturn $pos.node(parentDepth).child(index - 1);\n};\n//#endregion\n//#region src/helpers/getSchemaTypeByName.ts\n/**\n* Tries to get a node or mark type by its name.\n* @param name The name of the node or mark type\n* @param schema The Prosemiror schema to search in\n* @returns The node or mark type, or null if it doesn't exist\n*/\nfunction getSchemaTypeByName(name, schema) {\n\treturn schema.nodes[name] || schema.marks[name] || null;\n}\n//#endregion\n//#region src/helpers/getSplittedAttributes.ts\n/**\n* Return attributes of an extension that should be splitted by keepOnSplit flag\n* @param extensionAttributes Array of extension attributes\n* @param typeName The type of the extension\n* @param attributes The attributes of the extension\n* @returns The splitted attributes\n*/\nfunction getSplittedAttributes(extensionAttributes, typeName, attributes) {\n\treturn Object.fromEntries(Object.entries(attributes).filter(([name]) => {\n\t\tconst extensionAttribute = extensionAttributes.find((item) => {\n\t\t\treturn item.type === typeName && item.name === name;\n\t\t});\n\t\tif (!extensionAttribute) return false;\n\t\treturn extensionAttribute.attribute.keepOnSplit;\n\t}));\n}\n//#endregion\n//#region src/helpers/getTextContentFromNodes.ts\n/**\n* Returns the text content of a resolved prosemirror position\n* @param $from The resolved position to get the text content from\n* @param maxMatch The maximum number of characters to match\n* @returns The text content\n*/\nconst getTextContentFromNodes = ($from, maxMatch = 500) => {\n\tlet textBefore = \"\";\n\tconst sliceEndPos = $from.parentOffset;\n\t$from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {\n\t\tvar _node$type$spec$toTex, _node$type$spec;\n\t\tconst chunk = ((_node$type$spec$toTex = (_node$type$spec = node.type.spec).toText) === null || _node$type$spec$toTex === void 0 ? void 0 : _node$type$spec$toTex.call(_node$type$spec, {\n\t\t\tnode,\n\t\t\tpos,\n\t\t\tparent,\n\t\t\tindex\n\t\t})) || node.textContent || \"%leaf%\";\n\t\ttextBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));\n\t});\n\treturn textBefore;\n};\n//#endregion\n//#region src/helpers/isMarkActive.ts\nfunction isMarkActive(state, typeOrName, attributes = {}) {\n\tconst { empty, ranges } = state.selection;\n\tconst type = typeOrName ? getMarkType(typeOrName, state.schema) : null;\n\tif (empty) return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {\n\t\tif (!type) return true;\n\t\treturn type.name === mark.type.name;\n\t}).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));\n\tlet selectionRange = 0;\n\tconst markRanges = [];\n\tranges.forEach(({ $from, $to }) => {\n\t\tconst from = $from.pos;\n\t\tconst to = $to.pos;\n\t\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\tif (type && node.inlineContent && !node.type.allowsMarkType(type)) return false;\n\t\t\tif (!node.isText && !node.marks.length) return;\n\t\t\tconst relativeFrom = Math.max(from, pos);\n\t\t\tconst relativeTo = Math.min(to, pos + node.nodeSize);\n\t\t\tconst range = relativeTo - relativeFrom;\n\t\t\tselectionRange += range;\n\t\t\tmarkRanges.push(...node.marks.map((mark) => ({\n\t\t\t\tmark,\n\t\t\t\tfrom: relativeFrom,\n\t\t\t\tto: relativeTo\n\t\t\t})));\n\t\t});\n\t});\n\tif (selectionRange === 0) return false;\n\tconst matchedRange = markRanges.filter((markRange) => {\n\t\tif (!type) return true;\n\t\treturn type.name === markRange.mark.type.name;\n\t}).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n\tconst excludedRange = markRanges.filter((markRange) => {\n\t\tif (!type) return true;\n\t\treturn markRange.mark.type !== type && markRange.mark.type.excludes(type);\n\t}).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n\treturn (matchedRange > 0 ? matchedRange + excludedRange : matchedRange) >= selectionRange;\n}\n//#endregion\n//#region src/helpers/isActive.ts\nfunction isActive(state, name, attributes = {}) {\n\tif (!name) return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);\n\tconst schemaType = getSchemaTypeNameByName(name, state.schema);\n\tif (schemaType === \"node\") return isNodeActive(state, name, attributes);\n\tif (schemaType === \"mark\") return isMarkActive(state, name, attributes);\n\treturn false;\n}\n//#endregion\n//#region src/helpers/isAtEndOfNode.ts\nconst isAtEndOfNode = (state, nodeType) => {\n\tconst { $from, $to, $anchor } = state.selection;\n\tif (nodeType) {\n\t\tconst parentNode = findParentNode((node) => node.type.name === nodeType)(state.selection);\n\t\tif (!parentNode) return false;\n\t\tconst $parentPos = state.doc.resolve(parentNode.pos + 1);\n\t\tif ($anchor.pos + 1 === $parentPos.end()) return true;\n\t\treturn false;\n\t}\n\tif ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) return false;\n\treturn true;\n};\n//#endregion\n//#region src/helpers/isAtStartOfNode.ts\nconst isAtStartOfNode = (state) => {\n\tconst { $from, $to } = state.selection;\n\tif ($from.parentOffset > 0 || $from.pos !== $to.pos) return false;\n\treturn true;\n};\n//#endregion\n//#region src/helpers/isExtensionRulesEnabled.ts\nfunction isExtensionRulesEnabled(extension, enabled) {\n\tif (Array.isArray(enabled)) return enabled.some((enabledExtension) => {\n\t\treturn (typeof enabledExtension === \"string\" ? enabledExtension : enabledExtension.name) === extension.name;\n\t});\n\treturn enabled;\n}\n//#endregion\n//#region src/helpers/isList.ts\nfunction isList(name, extensions) {\n\tconst { nodeExtensions } = splitExtensions(extensions);\n\tconst extension = nodeExtensions.find((item) => item.name === name);\n\tif (!extension) return false;\n\tconst group = callOrReturn(getExtensionField(extension, \"group\", {\n\t\tname: extension.name,\n\t\toptions: extension.options,\n\t\tstorage: extension.storage\n\t}));\n\tif (typeof group !== \"string\") return false;\n\treturn group.split(\" \").includes(\"list\");\n}\n//#endregion\n//#region src/helpers/isNodeEmpty.ts\n/**\n* Returns true if the given prosemirror node is empty.\n*/\nfunction isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false } = {}) {\n\tif (ignoreWhitespace) {\n\t\tif (node.type.name === \"hardBreak\") return true;\n\t\tif (node.isText) {\n\t\t\tvar _node$text;\n\t\t\treturn !/\\S/.test((_node$text = node.text) !== null && _node$text !== void 0 ? _node$text : \"\");\n\t\t}\n\t}\n\tif (node.isText) return !node.text;\n\tif (node.isAtom || node.isLeaf) return false;\n\tif (node.content.childCount === 0) return true;\n\tif (checkChildren) {\n\t\tlet isContentEmpty = true;\n\t\tnode.content.forEach((childNode) => {\n\t\t\tif (isContentEmpty === false) return;\n\t\t\tif (!isNodeEmpty(childNode, {\n\t\t\t\tignoreWhitespace,\n\t\t\t\tcheckChildren\n\t\t\t})) isContentEmpty = false;\n\t\t});\n\t\treturn isContentEmpty;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/helpers/isNodeSelection.ts\nfunction isNodeSelection(value) {\n\treturn value instanceof NodeSelection;\n}\n//#endregion\n//#region src/helpers/isNodeViewSelected.ts\n/**\n* Determines whether a node view should be considered selected for the given\n* editor selection.\n*\n* A node is considered selected when the current selection fully covers it\n* (e.g. a `NodeSelection`). When `selectedOnTextSelection` is enabled, the\n* node is additionally considered selected if a `TextSelection` is fully\n* contained within the node's range.\n*\n* @param selection The current editor selection.\n* @param pos The start position of the node in the document.\n* @param nodeSize The size of the node.\n* @param selectedOnTextSelection When `true`, also treat selections inside the node as selected.\n* @returns `true` if the node view should render as selected.\n*/\nfunction isNodeViewSelected({ selection, pos, nodeSize, selectedOnTextSelection = false }) {\n\tconst { from, to } = selection;\n\tif (from <= pos && to >= pos + nodeSize) return true;\n\tif (selectedOnTextSelection && isTextSelection(selection) && from > pos && to < pos + nodeSize) return true;\n\treturn false;\n}\n//#endregion\n//#region src/helpers/isProseMirrorStep.ts\n/**\n* Checks if a value is a ProseMirror step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror Step\n* @example ```js\n* isProseMirrorStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (typeof step.apply !== \"function\" || typeof step.getMap !== \"function\" || typeof step.invert !== \"function\" || typeof step.map !== \"function\" || typeof step.merge !== \"function\" || typeof step.toJSON !== \"function\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorAddMarkStep.ts\n/**\n* Checks if a value is a ProseMirror add mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror AddMarkStep\n* @example ```js\n* isProseMirrorAddMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorAddMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"addMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorAddNodeMarkStep.ts\n/**\n* Checks if a value is a ProseMirror add node mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror AddNodeMarkStep\n* @example ```js\n* isProseMirrorAddNodeMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorAddNodeMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"addNodeMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorAttrStep.ts\n/**\n* Checks if a value is a ProseMirror attribute step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror AttrStep\n* @example ```js\n* isProseMirrorAttrStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorAttrStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"attr\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorCellSelection.ts\n/**\n* Check whether a selection provides the cell-iteration API.\n*\n* @param selection - Selection to inspect.\n* @returns Whether the selection is a table cell selection.\n* @example ```js\n* isProseMirrorCellSelection(editor.state.selection)\n* ```\n*/\nfunction isProseMirrorCellSelection(selection) {\n\tif (selection === null || typeof selection !== \"object\") return false;\n\treturn \"forEachCell\" in selection && typeof selection.forEachCell === \"function\";\n}\n//#endregion\n//#region src/helpers/isProseMirrorDocAttrStep.ts\n/**\n* Checks if a value is a ProseMirror document attribute step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror DocAttrStep\n* @example ```js\n* isProseMirrorDocAttrStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorDocAttrStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"docAttr\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorFragment.ts\n/**\n* Checks if a value is a ProseMirror fragment by inspecting it\n* @param value The value to check\n* @returns - A boolean, if true the value is a ProseMirror fragment\n* @example ```js\n* isProseMirrorFragment(editor.state.doc.content)\n* ```\n*/\nfunction isProseMirrorFragment(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst fragment = value;\n\tif (!Array.isArray(fragment.content) || typeof fragment.size !== \"number\" || typeof fragment.nodesBetween !== \"function\" || typeof fragment.descendants !== \"function\" || typeof fragment.textBetween !== \"function\" || typeof fragment.append !== \"function\" || typeof fragment.cut !== \"function\" || typeof fragment.eq !== \"function\" || typeof fragment.child !== \"function\" || typeof fragment.forEach !== \"function\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorNodeSelection.ts\n/**\n* Check whether a selection exposes a selected node.\n*\n* @param selection - Selection to inspect.\n* @returns Whether the selection is a node selection.\n* @example ```js\n* isProseMirrorNodeSelection(editor.state.selection)\n* ```\n*/\nfunction isProseMirrorNodeSelection(selection) {\n\tif (selection === null || typeof selection !== \"object\") return false;\n\treturn \"node\" in selection && selection.node != null;\n}\n//#endregion\n//#region src/helpers/isProseMirrorRemoveMarkStep.ts\n/**\n* Checks if a value is a ProseMirror remove mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror RemoveMarkStep\n* @example ```js\n* isProseMirrorRemoveMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorRemoveMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"removeMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorRemoveNodeMarkStep.ts\n/**\n* Checks if a value is a ProseMirror remove node mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror RemoveNodeMarkStep\n* @example ```js\n* isProseMirrorRemoveNodeMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorRemoveNodeMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"removeNodeMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorReplaceAroundStep.ts\n/**\n* Checks if a value is a ProseMirror replace around step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror ReplaceAroundStep\n* @example ```js\n* isProseMirrorReplaceAroundStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorReplaceAroundStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"replaceAround\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorReplaceStep.ts\n/**\n* Checks if a value is a ProseMirror replace step result\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror ReplaceStep\n* @example ```js\n* isProseMirrorReplaceStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorReplaceStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"replace\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorSlice.ts\n/**\n* Checks if a value is a ProseMirror slice by inspecting it\n* @param value The value to check\n* @returns - A boolean, if true the value is a ProseMirror slice\n* @example ```js\n* isProseMirrorSlice(editor.state.doc.content.slice(0, 10))\n* ```\n*/\nfunction isProseMirrorSlice(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst slice = value;\n\tconst openStartIsNumber = Number.isInteger(slice.openStart) && slice.openStart >= 0;\n\tconst openEndIsNumber = Number.isInteger(slice.openEnd) && slice.openEnd >= 0;\n\tconst sliceHasRequiredProperties = typeof slice.size === \"number\" && typeof slice.eq === \"function\" && typeof slice.toJSON === \"function\";\n\tif (!openStartIsNumber || !openEndIsNumber || !sliceHasRequiredProperties) return false;\n\tconst content = slice.content;\n\tif (content === null || typeof content !== \"object\") return false;\n\tif (!isProseMirrorFragment(content)) return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorStepResult.ts\n/**\n* Checks if a value is a ProseMirror step result\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror StepResult\n* @example ```js\n* isProseMirrorStepResult(step.apply(editor.state.doc))\n* ```\n*/\nfunction isProseMirrorStepResult(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst result = value;\n\tconst isValidDoc = result.doc !== null && typeof result.doc === \"object\" && result.failed === null;\n\tconst isValidFailed = typeof result.failed === \"string\" && result.doc === null;\n\tif (!isValidDoc && !isValidFailed) return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/MappablePosition.ts\n/**\n* A class that represents a mappable position in the editor. It can be extended\n* by other extensions to add additional position mapping capabilities.\n*/\nvar MappablePosition = class MappablePosition {\n\tconstructor(position) {\n\t\tthis.position = position;\n\t}\n\t/**\n\t* Creates a MappablePosition from a JSON object.\n\t*/\n\tstatic fromJSON(json) {\n\t\treturn new MappablePosition(json.position);\n\t}\n\t/**\n\t* Converts the MappablePosition to a JSON object.\n\t*/\n\ttoJSON() {\n\t\treturn { position: this.position };\n\t}\n};\n/**\n* Calculates the new position after applying a transaction.\n*\n* @returns The new mappable position and the map result.\n*/\nfunction getUpdatedPosition(position, transaction) {\n\tconst mapResult = transaction.mapping.mapResult(position.position);\n\treturn {\n\t\tposition: new MappablePosition(mapResult.pos),\n\t\tmapResult\n\t};\n}\n/**\n* Creates a MappablePosition from a position number. This is the default\n* implementation for Tiptap core. It can be overridden by other Tiptap\n* extensions.\n*\n* @param position The position (as a number) where the MappablePosition will be created.\n* @returns A new MappablePosition instance at the given position.\n*/\nfunction createMappablePosition(position) {\n\treturn new MappablePosition(position);\n}\n//#endregion\n//#region src/helpers/posToDOMRect.ts\nfunction posToDOMRect(view, from, to) {\n\tconst minPos = 0;\n\tconst maxPos = view.state.doc.content.size;\n\tconst resolvedFrom = minMax(from, minPos, maxPos);\n\tconst resolvedEnd = minMax(to, minPos, maxPos);\n\tconst start = view.coordsAtPos(resolvedFrom);\n\tconst end = view.coordsAtPos(resolvedEnd, -1);\n\tconst top = Math.min(start.top, end.top);\n\tconst bottom = Math.max(start.bottom, end.bottom);\n\tconst left = Math.min(start.left, end.left);\n\tconst right = Math.max(start.right, end.right);\n\tconst data = {\n\t\ttop,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\twidth: right - left,\n\t\theight: bottom - top,\n\t\tx: left,\n\t\ty: top\n\t};\n\treturn {\n\t\t...data,\n\t\ttoJSON: () => data\n\t};\n}\n//#endregion\n//#region src/helpers/rewriteUnknownContent.ts\n/**\n* The actual implementation of the rewriteUnknownContent function\n*/\nfunction rewriteUnknownContentInner({ json, validMarks, validNodes, options, rewrittenContent = [] }) {\n\tif (json.marks && Array.isArray(json.marks)) json.marks = json.marks.filter((mark) => {\n\t\tif (mark === null || mark === void 0) return false;\n\t\tconst name = typeof mark === \"string\" ? mark : mark.type;\n\t\tif (validMarks.has(name)) return true;\n\t\trewrittenContent.push({\n\t\t\toriginal: JSON.parse(JSON.stringify(mark)),\n\t\t\tunsupported: name\n\t\t});\n\t\treturn false;\n\t});\n\tif (json.content && Array.isArray(json.content)) json.content = json.content.map((value) => {\n\t\tif (value === null || value === void 0) return null;\n\t\treturn rewriteUnknownContentInner({\n\t\t\tjson: value,\n\t\t\tvalidMarks,\n\t\t\tvalidNodes,\n\t\t\toptions,\n\t\t\trewrittenContent\n\t\t}).json;\n\t}).filter((a) => a !== null && a !== void 0);\n\tif (json.type && !validNodes.has(json.type)) {\n\t\trewrittenContent.push({\n\t\t\toriginal: JSON.parse(JSON.stringify(json)),\n\t\t\tunsupported: json.type\n\t\t});\n\t\tif (json.content && Array.isArray(json.content) && (options === null || options === void 0 ? void 0 : options.fallbackToParagraph) !== false) {\n\t\t\tjson.type = \"paragraph\";\n\t\t\treturn {\n\t\t\t\tjson,\n\t\t\t\trewrittenContent\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tjson: null,\n\t\t\trewrittenContent\n\t\t};\n\t}\n\treturn {\n\t\tjson,\n\t\trewrittenContent\n\t};\n}\n/**\n* Rewrite unknown nodes and marks within JSON content\n* Allowing for user within the editor\n*/\nfunction rewriteUnknownContent(json, schema, options) {\n\treturn rewriteUnknownContentInner({\n\t\tjson,\n\t\tvalidNodes: new Set(Object.keys(schema.nodes)),\n\t\tvalidMarks: new Set(Object.keys(schema.marks)),\n\t\toptions\n\t});\n}\n//#endregion\n//#region src/commands/setMark.ts\nfunction canSetMark(state, tr, newMarkType) {\n\tconst { selection } = tr;\n\tlet cursor = null;\n\tif (isTextSelection(selection)) cursor = selection.$cursor;\n\tif (cursor) {\n\t\tvar _state$storedMarks;\n\t\tconst currentMarks = (_state$storedMarks = state.storedMarks) !== null && _state$storedMarks !== void 0 ? _state$storedMarks : cursor.marks();\n\t\treturn cursor.parent.type.allowsMarkType(newMarkType) && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));\n\t}\n\tconst { ranges } = selection;\n\treturn ranges.some(({ $from, $to }) => {\n\t\tlet someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;\n\t\tstate.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {\n\t\t\tif (someNodeSupportsMark) return false;\n\t\t\tif (node.isInline) {\n\t\t\t\tconst parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);\n\t\t\t\tconst currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));\n\t\t\t\tsomeNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;\n\t\t\t}\n\t\t\treturn !someNodeSupportsMark;\n\t\t});\n\t\treturn someNodeSupportsMark;\n\t});\n}\nconst setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {\n\tconst { selection } = tr;\n\tconst { empty, ranges } = selection;\n\tconst type = getMarkType(typeOrName, state.schema);\n\tif (dispatch) {\n\t\tif (empty) {\n\t\t\tconst oldAttributes = getMarkAttributes(state, type);\n\t\t\ttr.addStoredMark(type.create({\n\t\t\t\t...oldAttributes,\n\t\t\t\t...attributes\n\t\t\t}));\n\t\t} else ranges.forEach((range) => {\n\t\t\tconst from = range.$from.pos;\n\t\t\tconst to = range.$to.pos;\n\t\t\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\t\tconst trimmedFrom = Math.max(pos, from);\n\t\t\t\tconst trimmedTo = Math.min(pos + node.nodeSize, to);\n\t\t\t\tif (node.marks.find((mark) => mark.type === type)) node.marks.forEach((mark) => {\n\t\t\t\t\tif (type === mark.type) tr.addMark(trimmedFrom, trimmedTo, type.create({\n\t\t\t\t\t\t...mark.attrs,\n\t\t\t\t\t\t...attributes\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t\telse tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));\n\t\t\t});\n\t\t});\n\t}\n\treturn canSetMark(state, tr, type);\n};\n//#endregion\n//#region src/commands/setMeta.ts\nconst setMeta = (key, value) => ({ tr }) => {\n\ttr.setMeta(key, value);\n\treturn true;\n};\n//#endregion\n//#region src/commands/setNode.ts\nconst setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tlet attributesToCopy;\n\tif (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;\n\tif (!type.isTextblock) {\n\t\tconsole.warn(\"[tiptap warn]: Currently \\\"setNode()\\\" only supports text block nodes.\");\n\t\treturn false;\n\t}\n\treturn chain().command(({ commands }) => {\n\t\tif (setBlockType(type, {\n\t\t\t...attributesToCopy,\n\t\t\t...attributes\n\t\t})(state)) return true;\n\t\treturn commands.clearNodes();\n\t}).command(({ state: updatedState }) => {\n\t\treturn setBlockType(type, {\n\t\t\t...attributesToCopy,\n\t\t\t...attributes\n\t\t})(updatedState, dispatch);\n\t}).run();\n};\n//#endregion\n//#region src/commands/setNodeSelection.ts\nconst setNodeSelection = (position) => ({ tr, dispatch }) => {\n\tif (dispatch) {\n\t\tconst { doc } = tr;\n\t\tconst from = minMax(position, 0, doc.content.size);\n\t\tconst selection = NodeSelection.create(doc, from);\n\t\ttr.setSelection(selection);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/setTextDirection.ts\nconst setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {\n\tconst { selection } = state;\n\tlet from;\n\tlet to;\n\tif (typeof position === \"number\") {\n\t\tfrom = position;\n\t\tto = position;\n\t} else if (position && \"from\" in position && \"to\" in position) {\n\t\tfrom = position.from;\n\t\tto = position.to;\n\t} else {\n\t\tfrom = selection.from;\n\t\tto = selection.to;\n\t}\n\tif (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (node.isText) return;\n\t\ttr.setNodeMarkup(pos, void 0, {\n\t\t\t...node.attrs,\n\t\t\tdir: direction\n\t\t});\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/setTextSelection.ts\nconst setTextSelection = (position) => ({ tr, dispatch }) => {\n\tif (dispatch) {\n\t\tconst { doc } = tr;\n\t\tconst { from, to } = typeof position === \"number\" ? {\n\t\t\tfrom: position,\n\t\t\tto: position\n\t\t} : position;\n\t\tconst minPos = TextSelection.atStart(doc).from;\n\t\tconst maxPos = TextSelection.atEnd(doc).to;\n\t\tconst resolvedFrom = minMax(from, minPos, maxPos);\n\t\tconst resolvedEnd = minMax(to, minPos, maxPos);\n\t\tconst selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);\n\t\ttr.setSelection(selection);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/sinkListItem.ts\nconst sinkListItem$1 = (typeOrName) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn sinkListItem(type)(state, dispatch);\n};\n//#endregion\n//#region src/commands/splitBlock.ts\nfunction ensureMarks(state, splittableMarks) {\n\tconst marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n\tif (marks) {\n\t\tconst filteredMarks = marks.filter((mark) => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));\n\t\tstate.tr.ensureMarks(filteredMarks);\n\t}\n}\nconst splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {\n\tconst { selection, doc } = tr;\n\tconst { $from, $to } = selection;\n\tconst extensionAttributes = editor.extensionManager.attributes;\n\tconst newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);\n\tif (selection instanceof NodeSelection && selection.node.isBlock) {\n\t\tif (!$from.parentOffset || !canSplit(doc, $from.pos)) return false;\n\t\tif (dispatch) {\n\t\t\tif (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);\n\t\t\ttr.split($from.pos).scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\tif (!$from.parent.isBlock) return false;\n\tconst atEnd = $to.parentOffset === $to.parent.content.size;\n\tconst deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));\n\tlet types = atEnd && deflt ? [{\n\t\ttype: deflt,\n\t\tattrs: newAttributes\n\t}] : void 0;\n\tconst deletedTr = selection instanceof TextSelection && !selection.empty ? EditorState.create({\n\t\tdoc: tr.doc,\n\t\tselection\n\t}).tr.deleteSelection() : null;\n\tconst splitDoc = deletedTr ? deletedTr.doc : tr.doc;\n\tconst splitPos = deletedTr ? deletedTr.mapping.map($from.pos) : $from.pos;\n\tlet can = canSplit(splitDoc, splitPos, 1, types);\n\tif (!types && !can && canSplit(splitDoc, splitPos, 1, deflt ? [{ type: deflt }] : void 0)) {\n\t\tcan = true;\n\t\ttypes = deflt ? [{\n\t\t\ttype: deflt,\n\t\t\tattrs: newAttributes\n\t\t}] : void 0;\n\t}\n\tif (dispatch) {\n\t\tif (can) {\n\t\t\tconst mapFrom = tr.steps.length;\n\t\t\tif (selection instanceof TextSelection) tr.deleteSelection();\n\t\t\ttr.split(tr.mapping.slice(mapFrom).map($from.pos), 1, types);\n\t\t\tif (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {\n\t\t\t\tconst first = tr.mapping.slice(mapFrom).map($from.before());\n\t\t\t\tconst $first = tr.doc.resolve(first);\n\t\t\t\tif ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.slice(mapFrom).map($from.before()), deflt);\n\t\t\t}\n\t\t}\n\t\tif (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);\n\t\ttr.scrollIntoView();\n\t}\n\treturn can;\n};\n//#endregion\n//#region src/commands/splitListItem.ts\nconst splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst { $from, $to } = state.selection;\n\tconst node = state.selection.node;\n\tif (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;\n\tconst grandParent = $from.node(-1);\n\tif (grandParent.type !== type) return false;\n\tconst extensionAttributes = editor.extensionManager.attributes;\n\tif ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {\n\t\tif ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) return false;\n\t\tif (dispatch) {\n\t\t\tvar _type$contentMatch$de;\n\t\t\tlet wrap = Fragment$1.empty;\n\t\t\tconst depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n\t\t\tfor (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) wrap = Fragment$1.from($from.node(d).copy(wrap));\n\t\t\tconst depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n\t\t\tconst newNextTypeAttributes = {\n\t\t\t\t...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n\t\t\t\t...overrideAttrs\n\t\t\t};\n\t\t\tconst nextType = ((_type$contentMatch$de = type.contentMatch.defaultType) === null || _type$contentMatch$de === void 0 ? void 0 : _type$contentMatch$de.createAndFill(newNextTypeAttributes)) || void 0;\n\t\t\twrap = wrap.append(Fragment$1.from(type.createAndFill(null, nextType) || void 0));\n\t\t\tconst start = $from.before($from.depth - (depthBefore - 1));\n\t\t\ttr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n\t\t\tlet sel = -1;\n\t\t\ttr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {\n\t\t\t\tif (sel > -1) return false;\n\t\t\t\tif (n.isTextblock && n.content.size === 0) sel = pos + 1;\n\t\t\t});\n\t\t\tif (sel > -1) tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));\n\t\t\ttr.scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\tconst nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n\tconst newTypeAttributes = {\n\t\t...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),\n\t\t...overrideAttrs\n\t};\n\tconst newNextTypeAttributes = {\n\t\t...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n\t\t...overrideAttrs\n\t};\n\tconst splitsAtStartOfItem = $from.parentOffset === 0 && $from.index(-1) === 0;\n\tconst itemStart = $from.before(-1);\n\ttr.delete($from.pos, $to.pos);\n\tconst trailingTypeAttributes = splitsAtStartOfItem ? grandParent.attrs : newTypeAttributes;\n\tconst types = nextType ? [{\n\t\ttype,\n\t\tattrs: trailingTypeAttributes\n\t}, {\n\t\ttype: nextType,\n\t\tattrs: newNextTypeAttributes\n\t}] : [{\n\t\ttype,\n\t\tattrs: trailingTypeAttributes\n\t}];\n\tif (!canSplit(tr.doc, $from.pos, 2)) return false;\n\tif (dispatch) {\n\t\tconst { selection, storedMarks } = state;\n\t\tconst { splittableMarks } = editor.extensionManager;\n\t\tconst marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n\t\ttr.split($from.pos, 2, types).scrollIntoView();\n\t\tif (splitsAtStartOfItem) tr.setNodeMarkup(itemStart, void 0, newTypeAttributes);\n\t\tif (!marks || !dispatch) return true;\n\t\tconst filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n\t\ttr.ensureMarks(filteredMarks);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/utils/createNode.ts\n/** Creates a node when its content and required attributes are valid. */\nfunction createNode(type, content, attrs) {\n\tif (!type.validContent(content)) return null;\n\ttry {\n\t\treturn type.create(attrs, content);\n\t} catch {\n\t\treturn null;\n\t}\n}\n//#endregion\n//#region src/commands/utils/flushPendingContent.ts\n/** Converts and appends the content accumulated for the current list item. */\nfunction flushPendingContent(state, itemType) {\n\tif (state.pendingContent.length === 0) return true;\n\tconst item = createNode(itemType, Fragment$1.from(state.pendingContent));\n\tif (!item) return false;\n\tstate.items.push(item);\n\tstate.pendingContent = [];\n\treturn true;\n}\n//#endregion\n//#region src/commands/utils/appendContentNode.ts\n/** Appends a content node to the current item or starts a new item when needed. */\nfunction appendContentNode(node, state, itemType) {\n\tif (itemType.validContent(Fragment$1.from([...state.pendingContent, node]))) {\n\t\tstate.pendingContent.push(node);\n\t\treturn true;\n\t}\n\tif (!flushPendingContent(state, itemType) || !itemType.validContent(Fragment$1.from(node))) return false;\n\tstate.pendingContent.push(node);\n\treturn true;\n}\n//#endregion\n//#region src/commands/utils/appendNestedList.ts\n/** Preserves a nested list when supported or flattens its converted items. */\nfunction appendNestedList(sourceList, state, context, convertListItems) {\n\tconst nestedItems = convertListItems(sourceList, context);\n\tif (!nestedItems) return false;\n\tconst nestedList = createNode(context.listType, Fragment$1.from(nestedItems), sourceList.attrs);\n\tif (!nestedList) return false;\n\tif (context.itemType.validContent(Fragment$1.from([...state.pendingContent, nestedList]))) {\n\t\tstate.pendingContent.push(nestedList);\n\t\treturn true;\n\t}\n\tif (!flushPendingContent(state, context.itemType)) return false;\n\tstate.items.push(...nestedItems);\n\treturn true;\n}\n//#endregion\n//#region src/commands/utils/convertListItem.ts\n/** Converts one source list item into one or more target list items. */\nfunction convertListItem(sourceItem, context, convertListItems) {\n\tconst state = {\n\t\titems: [],\n\t\tpendingContent: []\n\t};\n\tfor (let index = 0; index < sourceItem.childCount; index += 1) {\n\t\tconst child = sourceItem.child(index);\n\t\tif (!(context.isListNode(child) ? appendNestedList(child, state, context, convertListItems) : appendContentNode(child, state, context.itemType))) return null;\n\t}\n\treturn flushPendingContent(state, context.itemType) ? state.items : null;\n}\n//#endregion\n//#region src/commands/utils/convertListItems.ts\n/** Recursively converts all items in a source list to the target list schema. */\nfunction convertListItems(sourceList, context) {\n\tconst convertedItems = [];\n\tfor (let index = 0; index < sourceList.childCount; index += 1) {\n\t\tconst items = convertListItem(sourceList.child(index), context, convertListItems);\n\t\tif (!items) return null;\n\t\tconvertedItems.push(...items);\n\t}\n\treturn convertedItems;\n}\n//#endregion\n//#region src/commands/utils/findNodePosition.ts\n/** Finds a descendant node's position relative to its root node. */\nfunction findNodePosition(root, target) {\n\tlet targetPos = null;\n\troot.descendants((node, pos) => {\n\t\tif (node !== target) return true;\n\t\ttargetPos = pos;\n\t\treturn false;\n\t});\n\treturn targetPos;\n}\n//#endregion\n//#region src/commands/toggleList.ts\n/**\n* Normalise a list type attribute for comparison.\n* Treats null, undefined, and \"1\" as equivalent (the default numeric type).\n*/\nfunction normalizeListType(type) {\n\treturn !type || type === \"1\" ? null : type;\n}\n/**\n* Check if two list type attributes are compatible for joining.\n* Lists can only join when they have the same type (both default, or both the same non-default type).\n*/\nfunction areListTypesCompatible(typeA, typeB) {\n\treturn normalizeListType(typeA) === normalizeListType(typeB);\n}\nconst joinListBackwards = (tr, listType) => {\n\tconst list = findParentNode((node) => node.type === listType)(tr.selection);\n\tif (!list) return true;\n\tconst before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);\n\tif (before === void 0) return true;\n\tconst nodeBefore = tr.doc.nodeAt(before);\n\tif (!(list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos))) return true;\n\tif (!areListTypesCompatible(list.node.attrs.type, nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.attrs.type)) return true;\n\ttr.join(list.pos);\n\treturn true;\n};\nconst joinListForwards = (tr, listType) => {\n\tconst list = findParentNode((node) => node.type === listType)(tr.selection);\n\tif (!list) return true;\n\tconst after = tr.doc.resolve(list.start).after(list.depth);\n\tif (after === void 0) return true;\n\tconst nodeAfter = tr.doc.nodeAt(after);\n\tif (!(list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && canJoin(tr.doc, after))) return true;\n\tif (!areListTypesCompatible(list.node.attrs.type, nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.attrs.type)) return true;\n\ttr.join(after);\n\treturn true;\n};\nfunction createInnerSelectionForWholeDocList(tr) {\n\tconst doc = tr.doc;\n\tconst list = doc.firstChild;\n\tif (!list) return null;\n\tconst $start = doc.resolve(1);\n\tconst $end = doc.resolve(list.nodeSize - 1);\n\treturn TextSelection.between($start, $end);\n}\nconst toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {\n\tconst { extensions, splittableMarks } = editor.extensionManager;\n\tconst listType = getNodeType(listTypeOrName, state.schema);\n\tconst itemType = getNodeType(itemTypeOrName, state.schema);\n\tconst { selection, storedMarks } = state;\n\tconst { $from, $to } = selection;\n\tconst range = $from.blockRange($to);\n\tconst marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n\tif (!range) return false;\n\tconst parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);\n\tconst isAllSelection = selection.from === 0 && selection.to === state.doc.content.size;\n\tconst topLevelNodes = state.doc.content.content;\n\tconst soleTopLevelNode = topLevelNodes.length === 1 ? topLevelNodes[0] : null;\n\tconst allSelectionList = isAllSelection && soleTopLevelNode && isList(soleTopLevelNode.type.name, extensions) ? {\n\t\tnode: soleTopLevelNode,\n\t\tpos: 0,\n\t\tdepth: 0\n\t} : null;\n\tconst currentList = parentList !== null && parentList !== void 0 ? parentList : allSelectionList;\n\tconst isInsideExistingList = !!parentList && range.depth >= 1 && range.depth - parentList.depth <= 1;\n\tconst hasWholeDocSelectedList = !!allSelectionList;\n\tif ((isInsideExistingList || hasWholeDocSelectedList) && currentList) {\n\t\tif (currentList.node.type === listType) {\n\t\t\tif (isAllSelection && hasWholeDocSelectedList) return chain().command(({ tr: trx, dispatch: disp }) => {\n\t\t\t\tconst nextSelection = createInnerSelectionForWholeDocList(trx);\n\t\t\t\tif (!nextSelection) return false;\n\t\t\t\ttrx.setSelection(nextSelection);\n\t\t\t\tif (disp) disp(trx);\n\t\t\t\treturn true;\n\t\t\t}).liftListItem(itemType).run();\n\t\t\treturn commands.liftListItem(itemType);\n\t\t}\n\t\tif (isList(currentList.node.type.name, extensions) && listType.validContent(currentList.node.content)) return chain().command(() => {\n\t\t\ttr.setNodeMarkup(currentList.pos, listType);\n\t\t\treturn true;\n\t\t}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n\t\tif (isList(currentList.node.type.name, extensions)) {\n\t\t\tvar _currentList$node$fir;\n\t\t\tconst currentItemType = (_currentList$node$fir = currentList.node.firstChild) === null || _currentList$node$fir === void 0 ? void 0 : _currentList$node$fir.type;\n\t\t\tif (currentItemType && currentItemType !== itemType) {\n\t\t\t\tconst convertedItems = convertListItems(currentList.node, {\n\t\t\t\t\tlistType,\n\t\t\t\t\titemType,\n\t\t\t\t\tisListNode: (node) => isList(node.type.name, extensions)\n\t\t\t\t});\n\t\t\t\tconst convertedContent = convertedItems ? Fragment$1.from(convertedItems) : null;\n\t\t\t\tif (!convertedContent || !listType.validContent(convertedContent)) return false;\n\t\t\t\treturn chain().command(() => {\n\t\t\t\t\tconst { $anchor, $head } = tr.selection;\n\t\t\t\t\tconst anchorParent = $anchor.parent;\n\t\t\t\t\tconst headParent = $head.parent;\n\t\t\t\t\tconst anchorOffset = $anchor.parentOffset;\n\t\t\t\t\tconst headOffset = $head.parentOffset;\n\t\t\t\t\tlet newList;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnewList = listType.create(attributes, convertedContent);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\ttr.replaceWith(currentList.pos, currentList.pos + currentList.node.nodeSize, newList);\n\t\t\t\t\tif (anchorParent.inlineContent && headParent.inlineContent) {\n\t\t\t\t\t\tconst anchorParentPos = findNodePosition(newList, anchorParent);\n\t\t\t\t\t\tconst headParentPos = findNodePosition(newList, headParent);\n\t\t\t\t\t\tif (anchorParentPos !== null && headParentPos !== null) {\n\t\t\t\t\t\t\tconst anchor = currentList.pos + anchorParentPos + 2 + anchorOffset;\n\t\t\t\t\t\t\tconst head = currentList.pos + headParentPos + 2 + headOffset;\n\t\t\t\t\t\t\ttr.setSelection(TextSelection.create(tr.doc, anchor, head));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n\t\t\t}\n\t\t}\n\t}\n\tif (!keepMarks || !marks || !dispatch) return chain().command(() => {\n\t\tif (can().wrapInList(listType, attributes)) return true;\n\t\treturn commands.clearNodes();\n\t}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n\treturn chain().command(() => {\n\t\tconst canWrapInList = can().wrapInList(listType, attributes);\n\t\tconst filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n\t\ttr.ensureMarks(filteredMarks);\n\t\tif (canWrapInList) return true;\n\t\treturn commands.clearNodes();\n\t}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n};\n//#endregion\n//#region src/commands/toggleMark.ts\nconst toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands }) => {\n\tconst { extendEmptyMarkRange = false } = options;\n\tconst type = getMarkType(typeOrName, state.schema);\n\tif (isMarkActive(state, type, attributes)) return commands.unsetMark(type, { extendEmptyMarkRange });\n\treturn commands.setMark(type, attributes);\n};\n//#endregion\n//#region src/commands/toggleNode.ts\nconst toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst toggleType = getNodeType(toggleTypeOrName, state.schema);\n\tconst isActive = isNodeActive(state, type, attributes);\n\tlet attributesToCopy;\n\tif (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;\n\tif (isActive) return commands.setNode(toggleType, attributesToCopy);\n\treturn commands.setNode(type, {\n\t\t...attributesToCopy,\n\t\t...attributes\n\t});\n};\n//#endregion\n//#region src/commands/toggleWrap.ts\nconst toggleWrap = (typeOrName, attributes = {}) => ({ state, commands }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tif (isNodeActive(state, type, attributes)) return commands.lift(type);\n\treturn commands.wrapIn(type, attributes);\n};\n//#endregion\n//#region src/commands/undoInputRule.ts\nconst undoInputRule = () => ({ state, dispatch }) => {\n\tconst plugins = state.plugins;\n\tfor (let i = 0; i < plugins.length; i += 1) {\n\t\tconst plugin = plugins[i];\n\t\tlet undoable;\n\t\tif (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n\t\t\tif (dispatch) {\n\t\t\t\tconst tr = state.tr;\n\t\t\t\tconst toUndo = undoable.transform;\n\t\t\t\tfor (let j = toUndo.steps.length - 1; j >= 0; j -= 1) tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n\t\t\t\tif (undoable.text) {\n\t\t\t\t\tconst marks = tr.doc.resolve(undoable.from).marks();\n\t\t\t\t\ttr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n\t\t\t\t} else tr.delete(undoable.from, undoable.to);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/commands/unsetAllMarks.ts\nconst unsetAllMarks = (options = {}) => ({ tr, dispatch, editor }) => {\n\tconst { ignoreClearable = false } = options;\n\tconst { selection } = tr;\n\tconst { empty, ranges } = selection;\n\tif (empty) return true;\n\tconst { nonClearableMarks } = editor.extensionManager;\n\tif (dispatch) {\n\t\tconst clearableMarkTypes = Object.values(editor.schema.marks).filter((markType) => ignoreClearable || !nonClearableMarks.includes(markType.name));\n\t\tranges.forEach((range) => {\n\t\t\tfor (const markType of clearableMarkTypes) tr.removeMark(range.$from.pos, range.$to.pos, markType);\n\t\t});\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/unsetMark.ts\nconst unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {\n\tconst { extendEmptyMarkRange = false } = options;\n\tconst { selection } = tr;\n\tconst type = getMarkType(typeOrName, state.schema);\n\tconst { $from, empty, ranges } = selection;\n\tif (!dispatch) return true;\n\tif (empty && extendEmptyMarkRange) {\n\t\tvar _$from$marks$find;\n\t\tlet { from, to } = selection;\n\t\tconst range = getMarkRange($from, type, (_$from$marks$find = $from.marks().find((mark) => mark.type === type)) === null || _$from$marks$find === void 0 ? void 0 : _$from$marks$find.attrs);\n\t\tif (range) {\n\t\t\tfrom = range.from;\n\t\t\tto = range.to;\n\t\t}\n\t\ttr.removeMark(from, to, type);\n\t} else ranges.forEach((range) => {\n\t\ttr.removeMark(range.$from.pos, range.$to.pos, type);\n\t});\n\ttr.removeStoredMark(type);\n\treturn true;\n};\n//#endregion\n//#region src/commands/unsetTextDirection.ts\nconst unsetTextDirection = (position) => ({ tr, state, dispatch }) => {\n\tconst { selection } = state;\n\tlet from;\n\tlet to;\n\tif (typeof position === \"number\") {\n\t\tfrom = position;\n\t\tto = position;\n\t} else if (position && \"from\" in position && \"to\" in position) {\n\t\tfrom = position.from;\n\t\tto = position.to;\n\t} else {\n\t\tfrom = selection.from;\n\t\tto = selection.to;\n\t}\n\tif (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (node.isText) return;\n\t\tconst newAttrs = { ...node.attrs };\n\t\tdelete newAttrs.dir;\n\t\ttr.setNodeMarkup(pos, void 0, newAttrs);\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/updateAttributes.ts\nconst updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {\n\tlet nodeType = null;\n\tlet markType = null;\n\tconst schemaType = getSchemaTypeNameByName(typeof typeOrName === \"string\" ? typeOrName : typeOrName.name, state.schema);\n\tif (!schemaType) return false;\n\tif (schemaType === \"node\") nodeType = getNodeType(typeOrName, state.schema);\n\tif (schemaType === \"mark\") markType = getMarkType(typeOrName, state.schema);\n\tlet canUpdate = false;\n\ttr.selection.ranges.forEach((range) => {\n\t\tconst from = range.$from.pos;\n\t\tconst to = range.$to.pos;\n\t\tlet lastPos;\n\t\tlet lastNode;\n\t\tlet trimmedFrom;\n\t\tlet trimmedTo;\n\t\tif (tr.selection.empty) state.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\tif (nodeType && nodeType === node.type) {\n\t\t\t\tcanUpdate = true;\n\t\t\t\ttrimmedFrom = Math.max(pos, from);\n\t\t\t\ttrimmedTo = Math.min(pos + node.nodeSize, to);\n\t\t\t\tlastPos = pos;\n\t\t\t\tlastNode = node;\n\t\t\t}\n\t\t});\n\t\telse state.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\tif (pos < from && nodeType && nodeType === node.type) {\n\t\t\t\tcanUpdate = true;\n\t\t\t\ttrimmedFrom = Math.max(pos, from);\n\t\t\t\ttrimmedTo = Math.min(pos + node.nodeSize, to);\n\t\t\t\tlastPos = pos;\n\t\t\t\tlastNode = node;\n\t\t\t}\n\t\t\tif (pos >= from && pos <= to) {\n\t\t\t\tif (nodeType && nodeType === node.type) {\n\t\t\t\t\tcanUpdate = true;\n\t\t\t\t\tif (dispatch) tr.setNodeMarkup(pos, void 0, {\n\t\t\t\t\t\t...node.attrs,\n\t\t\t\t\t\t...attributes\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (markType && node.marks.length) node.marks.forEach((mark) => {\n\t\t\t\t\tif (markType === mark.type) {\n\t\t\t\t\t\tcanUpdate = true;\n\t\t\t\t\t\tif (dispatch) {\n\t\t\t\t\t\t\tconst trimmedFrom2 = Math.max(pos, from);\n\t\t\t\t\t\t\tconst trimmedTo2 = Math.min(pos + node.nodeSize, to);\n\t\t\t\t\t\t\ttr.addMark(trimmedFrom2, trimmedTo2, markType.create({\n\t\t\t\t\t\t\t\t...mark.attrs,\n\t\t\t\t\t\t\t\t...attributes\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tif (lastNode) {\n\t\t\tif (lastPos !== void 0 && dispatch) tr.setNodeMarkup(lastPos, void 0, {\n\t\t\t\t...lastNode.attrs,\n\t\t\t\t...attributes\n\t\t\t});\n\t\t\tif (markType && lastNode.marks.length) lastNode.marks.forEach((mark) => {\n\t\t\t\tif (markType === mark.type && dispatch) tr.addMark(trimmedFrom, trimmedTo, markType.create({\n\t\t\t\t\t...mark.attrs,\n\t\t\t\t\t...attributes\n\t\t\t\t}));\n\t\t\t});\n\t\t}\n\t});\n\treturn canUpdate;\n};\nconst DECORATION_MANAGER_PLUGIN_KEY = new PluginKey(\"__tiptap_decorations__\");\n//#endregion\n//#region src/commands/updateDecorations.ts\nconst updateDecorations = (extensionName) => ({ tr, dispatch }) => {\n\tif (dispatch) tr.setMeta(DECORATION_MANAGER_PLUGIN_KEY, {\n\t\ttype: \"force\",\n\t\tname: extensionName\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/wrapIn.ts\nconst wrapIn$1 = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn wrapIn(type, attributes)(state, dispatch);\n};\n//#endregion\n//#region src/commands/wrapInList.ts\nconst wrapInList$1 = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn wrapInList(type, attributes)(state, dispatch);\n};\n//#endregion\n//#region src/commands/index.ts\nvar commands_exports = /* @__PURE__ */ __exportAll({\n\tblur: () => blur,\n\tclearContent: () => clearContent,\n\tclearNodes: () => clearNodes,\n\tcommand: () => command,\n\tcreateParagraphNear: () => createParagraphNear$1,\n\tcut: () => cut,\n\tdeleteCurrentNode: () => deleteCurrentNode,\n\tdeleteNode: () => deleteNode,\n\tdeleteRange: () => deleteRange,\n\tdeleteSelection: () => deleteSelection,\n\tenter: () => enter,\n\texitCode: () => exitCode$1,\n\textendMarkRange: () => extendMarkRange,\n\tfirst: () => first,\n\tfocus: () => focus,\n\tforEach: () => forEach,\n\tinsertContent: () => insertContent,\n\tinsertContentAt: () => insertContentAt,\n\tinsertDefaultBlock: () => insertDefaultBlock,\n\tjoinBackward: () => joinBackward$1,\n\tjoinDown: () => joinDown$1,\n\tjoinForward: () => joinForward$1,\n\tjoinItemBackward: () => joinItemBackward,\n\tjoinItemForward: () => joinItemForward,\n\tjoinTextblockBackward: () => joinTextblockBackward$1,\n\tjoinTextblockForward: () => joinTextblockForward$1,\n\tjoinUp: () => joinUp$1,\n\tkeyboardShortcut: () => keyboardShortcut,\n\tlift: () => lift$1,\n\tliftEmptyBlock: () => liftEmptyBlock$1,\n\tliftListItem: () => liftListItem$1,\n\tnewlineInCode: () => newlineInCode$1,\n\tresetAttributes: () => resetAttributes,\n\tscrollIntoView: () => scrollIntoView,\n\tselectAll: () => selectAll,\n\tselectNodeBackward: () => selectNodeBackward$1,\n\tselectNodeForward: () => selectNodeForward$1,\n\tselectParentNode: () => selectParentNode$1,\n\tselectTextblockEnd: () => selectTextblockEnd$1,\n\tselectTextblockStart: () => selectTextblockStart$1,\n\tsetContent: () => setContent,\n\tsetMark: () => setMark,\n\tsetMeta: () => setMeta,\n\tsetNode: () => setNode,\n\tsetNodeSelection: () => setNodeSelection,\n\tsetTextDirection: () => setTextDirection,\n\tsetTextSelection: () => setTextSelection,\n\tsinkListItem: () => sinkListItem$1,\n\tsplitBlock: () => splitBlock,\n\tsplitListItem: () => splitListItem,\n\ttoggleList: () => toggleList,\n\ttoggleMark: () => toggleMark,\n\ttoggleNode: () => toggleNode,\n\ttoggleWrap: () => toggleWrap,\n\tundoInputRule: () => undoInputRule,\n\tunsetAllMarks: () => unsetAllMarks,\n\tunsetMark: () => unsetMark,\n\tunsetTextDirection: () => unsetTextDirection,\n\tupdateAttributes: () => updateAttributes,\n\tupdateDecorations: () => updateDecorations,\n\twrapIn: () => wrapIn$1,\n\twrapInList: () => wrapInList$1\n});\n//#endregion\n//#region src/decorations/decorationApplyScope.ts\n/**\n* Tracks which editors are running decoration create() callbacks inside state.apply,\n* using a private WeakMap to keep this off the public Editor surface.\n*/\nconst depthByEditor = /* @__PURE__ */ new WeakMap();\n/**\n* Marks callback as decoration-apply work for editor, so editor.state can warn\n* about stale reads. Counts depth to handle nested applies.\n*\n* @param editor The editor the decorations belong to\n* @param callback The work to run inside the scope\n* @returns Whatever `callback` returns\n* @example\n* runInDecorationApplyScope(editor, () => spec.create({ editor, state, view }))\n*/\nfunction runInDecorationApplyScope(editor, callback) {\n\tvar _depthByEditor$get;\n\tdepthByEditor.set(editor, ((_depthByEditor$get = depthByEditor.get(editor)) !== null && _depthByEditor$get !== void 0 ? _depthByEditor$get : 0) + 1);\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tvar _depthByEditor$get2;\n\t\tconst remaining = ((_depthByEditor$get2 = depthByEditor.get(editor)) !== null && _depthByEditor$get2 !== void 0 ? _depthByEditor$get2 : 1) - 1;\n\t\tif (remaining > 0) depthByEditor.set(editor, remaining);\n\t\telse depthByEditor.delete(editor);\n\t}\n}\n/**\n* Whether the editor is currently inside a decoration apply scope.\n*\n* @param editor The editor to check\n* @returns `true` while decoration create() callbacks run\n* @example\n* if (isInDecorationApplyScope(editor)) {\n* // reads of editor.state are stale here\n* }\n*/\nfunction isInDecorationApplyScope(editor) {\n\treturn depthByEditor.has(editor);\n}\n//#endregion\n//#region src/EventEmitter.ts\nvar EventEmitter = class {\n\tconstructor() {\n\t\tthis.callbacks = {};\n\t}\n\ton(event, fn) {\n\t\tif (!this.callbacks[event]) this.callbacks[event] = [];\n\t\tthis.callbacks[event].push(fn);\n\t\treturn this;\n\t}\n\temit(event, ...args) {\n\t\tconst callbacks = this.callbacks[event];\n\t\tif (callbacks) callbacks.forEach((callback) => callback.apply(this, args));\n\t\treturn this;\n\t}\n\toff(event, fn) {\n\t\tconst callbacks = this.callbacks[event];\n\t\tif (callbacks) {\n\t\t\tif (fn) this.callbacks[event] = callbacks.filter((callback) => callback !== fn);\n\t\t\telse delete this.callbacks[event];\n\t\t}\n\t\treturn this;\n\t}\n\tonce(event, fn) {\n\t\tconst onceFn = (...args) => {\n\t\t\tthis.off(event, onceFn);\n\t\t\tfn.apply(this, args);\n\t\t};\n\t\treturn this.on(event, onceFn);\n\t}\n\tremoveAllListeners() {\n\t\tthis.callbacks = {};\n\t}\n};\n//#endregion\n//#region src/utilities/isDev.ts\n/**\n* Whether the editor runs in a development build. Use it to guard warnings so\n* bundlers can drop them from production output.\n*/\nconst isDev = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\";\n//#endregion\n//#region src/decorations/helpers/decorationsToPMDecorations.ts\nfunction isWidgetDecoration(decoration) {\n\treturn decoration.kind === \"widget\";\n}\n/**\n* Converts a list of decorations to ProseMirror decorations.\n* @param decorations The decorations to convert.\n* @param extensionName The name of the extension that created the decorations.\n* @returns The converted decorations and the widget keys.\n*/\nfunction decorationsToPMDecorations(decorations, extensionName) {\n\tconst pmDecorations = [];\n\tconst widgetKeys = /* @__PURE__ */ new Set();\n\tfor (const decoration of decorations) {\n\t\tif (decoration.kind === \"widget\") {\n\t\t\tif (isWidgetDecoration(decoration)) widgetKeys.add(decoration.key);\n\t\t}\n\t\tpmDecorations.push(decoration.toPMDecoration(extensionName));\n\t}\n\treturn {\n\t\tdecorations: pmDecorations,\n\t\twidgetKeys\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/buildDecorationSet.ts\n/**\n* Builds a DecorationSet from a list of decorations.\n* @param doc The document to build the decoration set for.\n* @param decorations The decorations to build the set from.\n* @param extensionName The name of the extension that created the decorations.\n* @returns The built decoration set and the widget keys.\n*/\nfunction buildDecorationSet(doc, decorations, extensionName) {\n\tconst { decorations: pmDecorations, widgetKeys } = decorationsToPMDecorations(decorations, extensionName);\n\treturn {\n\t\tset: DecorationSet.create(doc, pmDecorations),\n\t\twidgetKeys\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/rangeOwnsPosition.ts\n/**\n* Whether the block range `[from, to)` owns a decoration at `position`.\n*\n* `to` is the next block's start, so that block owns it. The last block is the\n* exception: nothing follows it, so it owns the end of the document.\n*\n* @param options The position, the range, and the document size.\n* @returns True when the range owns the position.\n* @example\n* // <p>foo</p><p>bar</p>, blocks [0, 5] and [5, 10]\n* rangeOwnsPosition({ position: 5, from: 0, to: 5, docSize: 10 }) // false, block 2 owns it\n* rangeOwnsPosition({ position: 5, from: 5, to: 10, docSize: 10 }) // true\n* rangeOwnsPosition({ position: 10, from: 5, to: 10, docSize: 10 }) // true, end of document\n*/\nfunction rangeOwnsPosition({ position, from, to, docSize }) {\n\tif (position < from) return false;\n\tif (position < to) return true;\n\treturn position === to && to === docSize;\n}\n//#endregion\n//#region src/decorations/helpers/filterOutOfRangeDecorations.ts\n/**\n* Filter decorations the block range `[from, to)` does not own.\n* Must match the stale sweep in `DecorationManager.rebuildRanges`.\n*\n* @param options The decorations, the range, and the warning bookkeeping.\n* @returns The filtered decorations.\n*/\nfunction filterOutOfRangeDecorations({ decorations, from, to, docSize, extensionName, warnedExtensions }) {\n\treturn decorations.filter((decoration) => {\n\t\tif (rangeOwnsPosition({\n\t\t\tposition: decoration.anchor,\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tdocSize\n\t\t})) return true;\n\t\tif (decoration.anchor === to) return false;\n\t\tif (!warnedExtensions.has(extensionName)) {\n\t\t\twarnedExtensions.add(extensionName);\n\t\t\tconsole.warn(`[tiptap warn]: Extension \"${extensionName}\" returned a decoration outside the requested range [${from}, ${to}). It was ignored.`);\n\t\t}\n\t\treturn false;\n\t});\n}\n//#endregion\n//#region src/decorations/helpers/widgetKeyOf.ts\n/**\n* Extracts the widget key from a decoration spec.\n* @param decoration The decoration to extract the key from.\n* @returns The widget key, or undefined if the decoration has no key.\n*/\nfunction widgetKeyOf(decoration) {\n\tvar _decoration$spec;\n\tconst key = (_decoration$spec = decoration.spec) === null || _decoration$spec === void 0 ? void 0 : _decoration$spec.key;\n\treturn typeof key === \"string\" ? key : void 0;\n}\n//#endregion\n//#region src/decorations/helpers/findDuplicateWidgetKeys.ts\n/**\n* Finds widget keys which are still duplicated in the final decoration set.\n* @param decorationSet The merged decoration set to inspect.\n* @returns The duplicate keys and their producing extensions.\n*/\nfunction findDuplicateWidgetKeys(decorationSet) {\n\tconst extensionsByKey = /* @__PURE__ */ new Map();\n\tconst counts = /* @__PURE__ */ new Map();\n\tfor (const decoration of decorationSet.find()) {\n\t\tvar _extensionName, _extensionsByKey$get, _counts$get;\n\t\tconst key = widgetKeyOf(decoration);\n\t\tif (!key) continue;\n\t\tconst extension = (_extensionName = decoration.spec.extensionName) !== null && _extensionName !== void 0 ? _extensionName : \"unknown\";\n\t\tconst extensions = (_extensionsByKey$get = extensionsByKey.get(key)) !== null && _extensionsByKey$get !== void 0 ? _extensionsByKey$get : /* @__PURE__ */ new Set();\n\t\textensions.add(extension);\n\t\textensionsByKey.set(key, extensions);\n\t\tcounts.set(key, ((_counts$get = counts.get(key)) !== null && _counts$get !== void 0 ? _counts$get : 0) + 1);\n\t}\n\treturn Array.from(extensionsByKey, ([key, extensions]) => ({\n\t\tkey,\n\t\textensions\n\t})).filter(({ key }) => {\n\t\tvar _counts$get2;\n\t\treturn ((_counts$get2 = counts.get(key)) !== null && _counts$get2 !== void 0 ? _counts$get2 : 0) > 1;\n\t});\n}\n//#endregion\n//#region src/decorations/helpers/isAttrStep.ts\n/**\n* Whether a step only sets a node attribute.\n*\n* Matched by `jsonID` rather than `instanceof`, which fails when two copies of\n* prosemirror-transform are loaded.\n*\n* @param step The step to check.\n* @returns `true` for an `AttrStep`, which carries the target node's position.\n* @example\n* if (isAttrStep(step)) {\n* rebuildBlockAt(step.pos)\n* }\n*/\nfunction isAttrStep(step) {\n\treturn step.jsonID === \"attr\";\n}\n//#endregion\n//#region src/decorations/helpers/hasResolvableChangedRange.ts\n/**\n* Check if a step has a resolvable changed range.\n* @param step The step to check.\n* @returns True if the step has a resolvable changed range, false otherwise.\n*/\nfunction hasResolvableChangedRange(step) {\n\tlet hasMappedRange = false;\n\tstep.getMap().forEach(() => {\n\t\thasMappedRange = true;\n\t});\n\tif (hasMappedRange || isAttrStep(step)) return true;\n\tconst positionalStep = step;\n\treturn typeof positionalStep.from === \"number\" && typeof positionalStep.to === \"number\";\n}\n//#endregion\n//#region src/decorations/helpers/getRebuildRanges.ts\n/**\n* Expands a changed range to the top-level blocks it touches. Blocks are\n* ordered, so the walk stops as soon as it passes the range.\n*/\nfunction blockRangeFor(doc, changed) {\n\tlet from = null;\n\tlet to = 0;\n\tlet nodeStart = 0;\n\tfor (let index = 0; index < doc.childCount; index += 1) {\n\t\tif (nodeStart > changed.to) break;\n\t\tconst nodeEnd = nodeStart + doc.child(index).nodeSize;\n\t\tif (nodeEnd >= changed.from) {\n\t\t\tif (from === null) from = nodeStart;\n\t\t\tto = nodeEnd;\n\t\t}\n\t\tnodeStart = nodeEnd;\n\t}\n\treturn from === null ? null : {\n\t\tfrom,\n\t\tto\n\t};\n}\n/**\n* Returns the top-level block ranges to recompute after a transaction,\n* or `{ type: 'full' }` when the whole document must be rebuilt.\n* @param tr The transaction to inspect.\n* @param doc The new document after the transaction.\n* @returns The block ranges to recompute, or a full-recompute signal.\n*/\nfunction getRebuildRanges(tr, doc) {\n\tif (tr.steps.some((step) => !hasResolvableChangedRange(step))) return { type: \"full\" };\n\tconst newRanges = getChangedRanges(tr).map(({ newRange }) => newRange);\n\ttr.steps.forEach((step, index) => {\n\t\tif (!isAttrStep(step)) return;\n\t\tconst mapping = tr.mapping.slice(index);\n\t\tnewRanges.push({\n\t\t\tfrom: mapping.map(step.pos, -1),\n\t\t\tto: mapping.map(step.pos + 1)\n\t\t});\n\t});\n\tconst ranges = [];\n\tfor (const newRange of newRanges) {\n\t\tconst blockRange = blockRangeFor(doc, newRange);\n\t\tif (blockRange) ranges.push(blockRange);\n\t}\n\tranges.sort((a, b) => a.from - b.from);\n\tconst merged = [];\n\tfor (const range of ranges) {\n\t\tconst last = merged[merged.length - 1];\n\t\tif (last && range.from <= last.to) last.to = Math.max(last.to, range.to);\n\t\telse merged.push({ ...range });\n\t}\n\treturn {\n\t\ttype: \"ranges\",\n\t\tranges: merged\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/mapDecorationSet.ts\n/**\n* Maps a decoration set through a mapping and prunes the keys of any widget\n* dropped because its position was deleted.\n* @param set The decoration set to map.\n* @param mapping The mapping to use.\n* @param doc The document to map the set through.\n* @param widgetKeys The set of widget keys to prune.\n* @returns The mapped decoration set.\n*/\nfunction mapDecorationSet(set, mapping, doc, widgetKeys) {\n\treturn set.map(mapping, doc, { onRemove: (removedSpec) => {\n\t\tconst key = removedSpec === null || removedSpec === void 0 ? void 0 : removedSpec.key;\n\t\tif (typeof key === \"string\") widgetKeys.delete(key);\n\t} });\n}\n//#endregion\n//#region src/decorations/helpers/mapDecorations.ts\n/**\n* Moves an extension's existing decorations to their new positions after a\n* transaction, and prunes widget keys for any widget whose position was deleted.\n* @param name The name of the decoration extension.\n* @param previous The previous decoration manager state.\n* @param tr The transaction to map through.\n* @returns The updated decoration set and widget keys.\n*/\nfunction mapDecorations(name, previous, tr) {\n\tvar _previous$decorationS, _previous$widgetKeysB;\n\tconst previousSet = (_previous$decorationS = previous.decorationSetsByExtension[name]) !== null && _previous$decorationS !== void 0 ? _previous$decorationS : DecorationSet.empty;\n\tconst widgetKeys = new Set((_previous$widgetKeysB = previous.widgetKeysByExtension[name]) !== null && _previous$widgetKeysB !== void 0 ? _previous$widgetKeysB : []);\n\treturn {\n\t\tset: mapDecorationSet(previousSet, tr.mapping, tr.doc, widgetKeys),\n\t\twidgetKeys\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/mergeDecorationSets.ts\n/**\n* Merges multiple decoration sets into a single decoration set.\n* @param doc The document to merge the decoration sets for.\n* @param decorationSetsByExtension The decoration sets to merge.\n* @returns The merged decoration set.\n*/\nfunction mergeDecorationSets(doc, decorationSetsByExtension) {\n\tconst allDecorations = Object.values(decorationSetsByExtension).flatMap((set) => set.find());\n\treturn DecorationSet.create(doc, allDecorations);\n}\n//#endregion\n//#region src/decorations/helpers/unionWidgetKeys.ts\n/**\n* Unions all widget keys from multiple extensions into a single set.\n* @param widgetKeysByExtension The widget keys to union.\n* @returns The unioned widget keys.\n*/\nfunction unionWidgetKeys(widgetKeysByExtension) {\n\tconst merged = /* @__PURE__ */ new Set();\n\tfor (const keys of Object.values(widgetKeysByExtension)) for (const key of keys) merged.add(key);\n\treturn merged;\n}\n//#endregion\n//#region src/decorations/helpers/validateDecorationSpec.ts\n/**\n* Validates a decoration spec to ensure it follows the correct pattern for its update strategy.\n* @param name The name of the extension.\n* @param spec The decoration spec to validate\n*/\nfunction validateDecorationSpec(name, spec) {\n\tvar _update;\n\tswitch ((_update = spec.update) !== null && _update !== void 0 ? _update : \"document\") {\n\t\tcase \"document\":\n\t\t\tif (spec.createInRange) throw new Error(`[tiptap error]: Extension \"${name}\" provides createInRange() but does not use the \"changedRanges\" decoration update strategy.`);\n\t\t\treturn;\n\t\tcase \"changedRanges\":\n\t\t\tif (!spec.createInRange) throw new Error(`[tiptap error]: Extension \"${name}\" uses the \"changedRanges\" decoration update strategy but does not provide createInRange().`);\n\t\t\treturn;\n\t\tcase \"manual\":\n\t\t\tif (spec.createInRange) throw new Error(`[tiptap error]: Extension \"${name}\" uses the \"manual\" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the \"changedRanges\" strategy.`);\n\t\t\tif (spec.shouldUpdate) throw new Error(`[tiptap error]: Extension \"${name}\" cannot combine the \"manual\" decoration update strategy with shouldUpdate().`);\n\t\t\treturn;\n\t\tdefault: throw new Error(`[tiptap error]: Extension \"${name}\" uses an unknown decoration update strategy. Expected \"document\", \"changedRanges\", or \"manual\".`);\n\t}\n}\n//#endregion\n//#region src/decorations/helpers/shouldRecomputeDecoration.ts\n/**\n* Decides whether a decoration spec should be recomputed for a transaction.\n* @param spec The decoration spec to check.\n* @param props Properties containing editor, transaction, and state.\n* @param forced Whether recomputation was forced.\n* @returns `true` if the decoration should be recomputed.\n*/\nfunction shouldRecomputeDecoration(spec, props, forced) {\n\tif (forced) return true;\n\tif (spec.update === \"manual\") return false;\n\treturn spec.shouldUpdate ? spec.shouldUpdate(props) : props.tr.docChanged;\n}\n//#endregion\n//#region src/decorations/DecorationManager.ts\nconst EMPTY_KEYS = /* @__PURE__ */ new Set();\nfunction liveWidgetKeys(editor) {\n\tvar _editor$extensionMana, _editor$extensionMana2;\n\treturn (_editor$extensionMana = (_editor$extensionMana2 = editor.extensionManager) === null || _editor$extensionMana2 === void 0 || (_editor$extensionMana2 = _editor$extensionMana2.decorationManager) === null || _editor$extensionMana2 === void 0 ? void 0 : _editor$extensionMana2.liveWidgetKeys()) !== null && _editor$extensionMana !== void 0 ? _editor$extensionMana : EMPTY_KEYS;\n}\nvar DecorationManager = class {\n\tconstructor(options) {\n\t\tthis.warnedWidgetKeys = /* @__PURE__ */ new Set();\n\t\tthis.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set();\n\t\tthis.handleBeforeTransaction = ({ nextState }) => {\n\t\t\tconst state = DECORATION_MANAGER_PLUGIN_KEY.getState(nextState);\n\t\t\tif (state) this.warnDuplicateWidgetKeys(state);\n\t\t};\n\t\tthis.editor = options.editor;\n\t\tthis.entries = this.resolveEntries(options.entries);\n\t\tthis.entries.forEach(({ name, spec }) => validateDecorationSpec(name, spec));\n\t\tthis.plugin = this.entries.length > 0 ? this.createPlugin() : null;\n\t\tthis.editor.on(\"beforeTransaction\", this.handleBeforeTransaction);\n\t}\n\tdestroy() {\n\t\tthis.editor.off(\"beforeTransaction\", this.handleBeforeTransaction);\n\t}\n\t/**\n\t* Returns the set of live widget keys from all decoration extensions.\n\t* @returns A readonly set of widget keys\n\t*/\n\tliveWidgetKeys() {\n\t\tvar _DECORATION_MANAGER_P, _DECORATION_MANAGER_P2;\n\t\treturn (_DECORATION_MANAGER_P = (_DECORATION_MANAGER_P2 = DECORATION_MANAGER_PLUGIN_KEY.getState(this.editor.state)) === null || _DECORATION_MANAGER_P2 === void 0 ? void 0 : _DECORATION_MANAGER_P2.widgetKeys) !== null && _DECORATION_MANAGER_P !== void 0 ? _DECORATION_MANAGER_P : EMPTY_KEYS;\n\t}\n\t/**\n\t* The mounted editor view, or `null` when destroyed. Decoration callbacks\n\t* must never receive the placeholder view `editor.view` falls back to.\n\t* @returns The mounted editor view, or `null`\n\t*/\n\tget mountedView() {\n\t\treturn this.editor.isDestroyed ? null : this.editor.view;\n\t}\n\t/**\n\t* Resolves decoration entries by calling the addDecorations function for each extension entry.\n\t* @param entries The decoration manager entries to resolve\n\t* @returns An array of resolved decoration entries\n\t*/\n\tresolveEntries(entries) {\n\t\tconst resolved = [];\n\t\tfor (const { name, addDecorations } of entries) {\n\t\t\tconst spec = addDecorations();\n\t\t\tif (spec) resolved.push({\n\t\t\t\tname,\n\t\t\t\tspec\n\t\t\t});\n\t\t}\n\t\treturn resolved;\n\t}\n\t/**\n\t* Creates the ProseMirror plugin for managing decorations.\n\t* @returns A ProseMirror plugin with state management\n\t*/\n\tcreatePlugin() {\n\t\tconst { editor, entries } = this;\n\t\treturn new Plugin({\n\t\t\tkey: DECORATION_MANAGER_PLUGIN_KEY,\n\t\t\tstate: {\n\t\t\t\tinit: (_config, state) => {\n\t\t\t\t\tconst decorationSetsByExtension = {};\n\t\t\t\t\tconst widgetKeysByExtension = {};\n\t\t\t\t\tfor (const { name, spec } of entries) {\n\t\t\t\t\t\tconst { set, widgetKeys } = this.buildFullSet(name, spec, state);\n\t\t\t\t\t\tdecorationSetsByExtension[name] = set;\n\t\t\t\t\t\twidgetKeysByExtension[name] = widgetKeys;\n\t\t\t\t\t}\n\t\t\t\t\tconst managerState = {\n\t\t\t\t\t\tdecorationSetsByExtension,\n\t\t\t\t\t\twidgetKeysByExtension,\n\t\t\t\t\t\tmergedDecorationSet: this.buildMergedSet(state.doc, decorationSetsByExtension),\n\t\t\t\t\t\twidgetKeys: unionWidgetKeys(widgetKeysByExtension)\n\t\t\t\t\t};\n\t\t\t\t\tthis.warnDuplicateWidgetKeys(managerState);\n\t\t\t\t\treturn managerState;\n\t\t\t\t},\n\t\t\t\tapply: (tr, previous, oldState, newState) => {\n\t\t\t\t\tconst meta = tr.getMeta(DECORATION_MANAGER_PLUGIN_KEY);\n\t\t\t\t\tconst forceAll = (meta === null || meta === void 0 ? void 0 : meta.type) === \"force\" && !meta.name;\n\t\t\t\t\tconst forceName = (meta === null || meta === void 0 ? void 0 : meta.type) === \"force\" ? meta.name : void 0;\n\t\t\t\t\tconst decorationSetsByExtension = {};\n\t\t\t\t\tconst widgetKeysByExtension = {};\n\t\t\t\t\tconst recomputedNames = /* @__PURE__ */ new Set();\n\t\t\t\t\trunInDecorationApplyScope(editor, () => {\n\t\t\t\t\t\tfor (const { name, spec } of entries) {\n\t\t\t\t\t\t\tconst forced = forceAll || forceName === name;\n\t\t\t\t\t\t\tif (!shouldRecomputeDecoration(spec, {\n\t\t\t\t\t\t\t\teditor,\n\t\t\t\t\t\t\t\ttr,\n\t\t\t\t\t\t\t\toldState,\n\t\t\t\t\t\t\t\tnewState\n\t\t\t\t\t\t\t}, forced)) {\n\t\t\t\t\t\t\t\tconst result = mapDecorations(name, previous, tr);\n\t\t\t\t\t\t\t\tdecorationSetsByExtension[name] = result.set;\n\t\t\t\t\t\t\t\twidgetKeysByExtension[name] = result.widgetKeys;\n\t\t\t\t\t\t\t} else if (spec.update === \"changedRanges\" && tr.docChanged && !forced) {\n\t\t\t\t\t\t\t\tconst result = this.applyChangedRangesRecompute(name, spec, previous, tr, newState);\n\t\t\t\t\t\t\t\tdecorationSetsByExtension[name] = result.set;\n\t\t\t\t\t\t\t\twidgetKeysByExtension[name] = result.widgetKeys;\n\t\t\t\t\t\t\t\trecomputedNames.add(name);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst { set, widgetKeys } = this.buildFullSet(name, spec, newState);\n\t\t\t\t\t\t\t\tdecorationSetsByExtension[name] = set;\n\t\t\t\t\t\t\t\twidgetKeysByExtension[name] = widgetKeys;\n\t\t\t\t\t\t\t\trecomputedNames.add(name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (recomputedNames.size === 0 && !tr.docChanged) return previous;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdecorationSetsByExtension,\n\t\t\t\t\t\twidgetKeysByExtension,\n\t\t\t\t\t\tmergedDecorationSet: this.mergeAfterApply({\n\t\t\t\t\t\t\tentries,\n\t\t\t\t\t\t\tprevious,\n\t\t\t\t\t\t\ttr,\n\t\t\t\t\t\t\tdecorationSetsByExtension,\n\t\t\t\t\t\t\trecomputedNames\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twidgetKeys: unionWidgetKeys(widgetKeysByExtension)\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t\tprops: { decorations(state) {\n\t\t\t\tvar _DECORATION_MANAGER_P3, _DECORATION_MANAGER_P4;\n\t\t\t\treturn (_DECORATION_MANAGER_P3 = (_DECORATION_MANAGER_P4 = DECORATION_MANAGER_PLUGIN_KEY.getState(state)) === null || _DECORATION_MANAGER_P4 === void 0 ? void 0 : _DECORATION_MANAGER_P4.mergedDecorationSet) !== null && _DECORATION_MANAGER_P3 !== void 0 ? _DECORATION_MANAGER_P3 : DecorationSet.empty;\n\t\t\t} }\n\t\t});\n\t}\n\t/**\n\t* Applies changed ranges recomputation to a decoration set, dropping stale decorations and rebuilding only the touched blocks.\n\t* @param name The name of the decoration extension\n\t* @param spec The decoration spec\n\t* @param previous The previous decoration manager state\n\t* @param tr The transaction to apply\n\t* @param newState The new editor state\n\t* @returns The updated decoration set and widget keys\n\t*/\n\tapplyChangedRangesRecompute(name, spec, previous, tr, newState) {\n\t\tconst resolution = getRebuildRanges(tr, newState.doc);\n\t\tif (resolution.type === \"full\") return this.buildFullSet(name, spec, newState);\n\t\treturn this.rebuildRanges(name, spec, previous, tr, newState, resolution.ranges);\n\t}\n\t/**\n\t* Rebuilds decorations for the changed block ranges: maps the previous set\n\t* forward, then for each range removes stale decorations, calls\n\t* `createInRange`, and adds the new ones while syncing widget keys.\n\t* @param name The extension name.\n\t* @param spec The decoration spec.\n\t* @param previous The previous decoration manager state.\n\t* @param tr The transaction to apply.\n\t* @param newState The new editor state.\n\t* @param ranges The block ranges to rebuild.\n\t* @returns The updated decoration set and widget keys.\n\t*/\n\trebuildRanges(name, spec, previous, tr, newState, ranges) {\n\t\tvar _previous$decorationS, _previous$widgetKeysB;\n\t\tconst previousSet = (_previous$decorationS = previous.decorationSetsByExtension[name]) !== null && _previous$decorationS !== void 0 ? _previous$decorationS : DecorationSet.empty;\n\t\tconst widgetKeys = new Set((_previous$widgetKeysB = previous.widgetKeysByExtension[name]) !== null && _previous$widgetKeysB !== void 0 ? _previous$widgetKeysB : []);\n\t\tlet set = mapDecorationSet(previousSet, tr.mapping, tr.doc, widgetKeys);\n\t\tconst docSize = newState.doc.content.size;\n\t\tfor (const { from, to } of ranges) {\n\t\t\tconst stale = set.find(from, to).filter((decoration) => rangeOwnsPosition({\n\t\t\t\tposition: decoration.from,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tdocSize\n\t\t\t}));\n\t\t\tfor (const decoration of stale) {\n\t\t\t\tconst key = widgetKeyOf(decoration);\n\t\t\t\tif (key) widgetKeys.delete(key);\n\t\t\t}\n\t\t\tset = set.remove(stale);\n\t\t\tconst { decorations: pmDecorations, widgetKeys: addedKeys } = decorationsToPMDecorations(filterOutOfRangeDecorations({\n\t\t\t\tdecorations: this.runCreate(name, \"createInRange\", () => spec.createInRange({\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tstate: newState,\n\t\t\t\t\tview: this.mountedView,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto\n\t\t\t\t})),\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tdocSize,\n\t\t\t\textensionName: name,\n\t\t\t\twarnedExtensions: this.warnedOutOfRangeExtensions\n\t\t\t}), name);\n\t\t\tset = set.add(newState.doc, pmDecorations);\n\t\t\tfor (const key of addedKeys) widgetKeys.add(key);\n\t\t}\n\t\treturn {\n\t\t\tset,\n\t\t\twidgetKeys\n\t\t};\n\t}\n\t/**\n\t* Builds a full decoration set for the entire document.\n\t* @param name The name of the decoration extension\n\t* @param spec The decoration spec\n\t* @param state The editor state\n\t* @returns The decoration set and widget keys\n\t*/\n\tbuildFullSet(name, spec, state) {\n\t\tconst decorations = this.runCreate(name, \"create\", () => spec.create({\n\t\t\teditor: this.editor,\n\t\t\tstate,\n\t\t\tview: this.mountedView\n\t\t}));\n\t\treturn buildDecorationSet(state.doc, decorations, name);\n\t}\n\t/**\n\t* Runs a decoration callback and swallows anything it throws. These run inside\n\t* `state.apply`, where an uncaught error would abort the whole transaction.\n\t* @param name The extension name.\n\t* @param method The callback name, used in the error message.\n\t* @param create The callback to run.\n\t* @returns The decorations, or an empty array if the callback threw.\n\t*/\n\trunCreate(name, method, create) {\n\t\ttry {\n\t\t\treturn create();\n\t\t} catch (error) {\n\t\t\tconsole.error(`[tiptap error]: Extension \"${name}\" threw in \\`addDecorations().${method}()\\`. Its decorations were dropped for this update.`, error);\n\t\t\treturn [];\n\t\t}\n\t}\n\twarnDuplicateWidgetKeys(state) {\n\t\tif (!isDev) return;\n\t\tif (state.widgetKeys.size === 0) {\n\t\t\tthis.warnedWidgetKeys.clear();\n\t\t\treturn;\n\t\t}\n\t\tconst duplicateKeys = findDuplicateWidgetKeys(state.mergedDecorationSet);\n\t\tconst nextWarningKeys = new Set(duplicateKeys.map(({ key }) => key));\n\t\tfor (const { key, extensions } of duplicateKeys) {\n\t\t\tif (this.warnedWidgetKeys.has(key)) continue;\n\t\t\tconst names = Array.from(extensions).map((name) => `\"${name}\"`).join(\", \");\n\t\t\tconsole.warn(`[tiptap warn]: Duplicate widget decoration key \"${key}\" in extension${extensions.size === 1 ? \"\" : \"s\"} ${names}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \\`comment-\\${id}\\`).`);\n\t\t}\n\t\tthis.warnedWidgetKeys = nextWarningKeys;\n\t}\n\t/**\n\t* Builds the merged DecorationSet during init. Skips the merge for a\n\t* single extension since its per-extension set is already correct.\n\t* @param doc The document to build the merged set for.\n\t* @param decorationSetsByExtension The per-extension decoration sets.\n\t* @returns The merged decoration set.\n\t*/\n\tbuildMergedSet(doc, decorationSetsByExtension) {\n\t\tconst names = Object.keys(decorationSetsByExtension);\n\t\tif (names.length === 1) return decorationSetsByExtension[names[0]];\n\t\treturn mergeDecorationSets(doc, decorationSetsByExtension);\n\t}\n\t/**\n\t* Computes the merged DecorationSet after apply. Single extension skips the\n\t* merge; nothing recomputed maps the previous merged set forward; otherwise\n\t* the merge is rebuilt from the per-extension sets.\n\t*/\n\tmergeAfterApply({ entries, previous, tr, decorationSetsByExtension, recomputedNames }) {\n\t\tif (entries.length === 1) return decorationSetsByExtension[entries[0].name];\n\t\tif (recomputedNames.size === 0) return previous.mergedDecorationSet.map(tr.mapping, tr.doc);\n\t\treturn mergeDecorationSets(tr.doc, decorationSetsByExtension);\n\t}\n};\n//#endregion\n//#region src/utilities/attrsEqual.ts\n/**\n* Compare two attribute objects for equality.\n* Handles null/undefined and asserts key presence in both objects so that\n* `{ foo: undefined }` and `{ bar: undefined }` are not treated as equal.\n*/\nfunction attrsEqual(a, b) {\n\tif (a === b) return true;\n\tif (!a || !b) return false;\n\tconst keysA = Object.keys(a);\n\tconst keysB = Object.keys(b);\n\tif (keysA.length !== keysB.length) return false;\n\treturn keysA.every((key) => Object.prototype.hasOwnProperty.call(b, key) && Object.is(a[key], b[key]));\n}\n//#endregion\n//#region src/utilities/canInsertNode.ts\nfunction canInsertNode(state, nodeType) {\n\tconst { selection } = state;\n\tconst { $from } = selection;\n\tif (selection instanceof NodeSelection) {\n\t\tconst index = $from.index();\n\t\treturn $from.parent.canReplaceWith(index, index + 1, nodeType);\n\t}\n\tlet depth = $from.depth;\n\twhile (depth >= 0) {\n\t\tconst index = $from.index(depth);\n\t\tif ($from.node(depth).contentMatchAt(index).matchType(nodeType)) return true;\n\t\tdepth -= 1;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/utilities/createStyleTag.ts\nfunction createStyleTag(style, nonce, suffix) {\n\tconst tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : \"\"}]`);\n\tif (tiptapStyleTag !== null) return tiptapStyleTag;\n\tconst styleNode = document.createElement(\"style\");\n\tif (nonce) styleNode.setAttribute(\"nonce\", nonce);\n\tstyleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : \"\"}`, \"\");\n\tstyleNode.innerHTML = style;\n\tdocument.getElementsByTagName(\"head\")[0].appendChild(styleNode);\n\treturn styleNode;\n}\n//#endregion\n//#region src/utilities/escapeForRegEx.ts\nfunction escapeForRegEx(string) {\n\treturn string.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n}\n//#endregion\n//#region src/utilities/getStyleProperty.ts\n/**\n* Read a CSS property value directly from an element's raw inline `style`\n* attribute, bypassing the CSSOM (e.g. `element.style.fontFamily`) which\n* canonicalizes values and can change formatting. The original format is\n* preserved (quotes, hex vs rgb, etc.).\n*\n* When a property is declared more than once, the last declaration wins —\n* this matches CSS cascade order and is useful when nested spans are merged\n* and the child's value should take priority.\n*\n* Property name comparison is case-insensitive.\n*\n* @param element - The element whose `style` attribute should be read.\n* @param propertyName - The CSS property name (e.g. `font-family`).\n* @returns The raw value string, or `null` if the property is not present.\n*\n* @example\n* ```ts\n* parseHTML: element => getStyleProperty(element, 'font-family')\n* ```\n*/\nfunction getStyleProperty(element, propertyName) {\n\tconst styleAttr = element.getAttribute(\"style\");\n\tif (!styleAttr) return null;\n\tconst decls = styleAttr.split(\";\").map((decl) => decl.trim()).filter(Boolean);\n\tconst target = propertyName.toLowerCase();\n\tfor (let i = decls.length - 1; i >= 0; i -= 1) {\n\t\tconst decl = decls[i];\n\t\tconst colonIndex = decl.indexOf(\":\");\n\t\tif (colonIndex === -1) continue;\n\t\tif (decl.slice(0, colonIndex).trim().toLowerCase() === target) return decl.slice(colonIndex + 1).trim();\n\t}\n\treturn null;\n}\n//#endregion\n//#region src/utilities/htmlEntities.ts\nconst NAMED_ENTITIES = {\n\tlt: \"<\",\n\tgt: \">\",\n\tquot: \"\\\"\",\n\tamp: \"&\"\n};\n/**\n* Decode common HTML entities in text content so they display as literal\n* characters inside the editor. Runs as a single pass so a decoded entity\n* (e.g. `&` → `&`) is never re-scanned and decoded again.\n*/\nfunction decodeHtmlEntities(text) {\n\treturn text.replace(/&(?:#(\\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|(lt|gt|quot|amp));/g, (match, dec, hex, name) => {\n\t\tif (dec !== void 0) return decodeCodePoint(Number(dec));\n\t\tif (hex !== void 0) return decodeCodePoint(parseInt(hex, 16));\n\t\treturn NAMED_ENTITIES[name];\n\t});\n}\nconst WINDOWS_1252 = /* @__PURE__ */ new Map([\n\t[128, 8364],\n\t[130, 8218],\n\t[131, 402],\n\t[132, 8222],\n\t[133, 8230],\n\t[134, 8224],\n\t[135, 8225],\n\t[136, 710],\n\t[137, 8240],\n\t[138, 352],\n\t[139, 8249],\n\t[140, 338],\n\t[142, 381],\n\t[145, 8216],\n\t[146, 8217],\n\t[147, 8220],\n\t[148, 8221],\n\t[149, 8226],\n\t[150, 8211],\n\t[151, 8212],\n\t[152, 732],\n\t[153, 8482],\n\t[154, 353],\n\t[155, 8250],\n\t[156, 339],\n\t[158, 382],\n\t[159, 376]\n]);\nfunction decodeCodePoint(codePoint) {\n\tvar _WINDOWS_1252$get;\n\tif (codePoint === 0 || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) return \"�\";\n\treturn String.fromCodePoint((_WINDOWS_1252$get = WINDOWS_1252.get(codePoint)) !== null && _WINDOWS_1252$get !== void 0 ? _WINDOWS_1252$get : codePoint);\n}\n/**\n* Encode HTML special characters so they roundtrip safely through markdown.\n* `&` is encoded **first** to avoid double-encoding the ampersand in other\n* entities (e.g. `<` → `<`, not `&lt;`).\n*\n* Note: `\"` is intentionally NOT encoded here because double quotes are\n* ordinary characters in markdown and do not need escaping. The decode\n* function still handles `"` because the markdown tokenizer may emit it.\n*/\nfunction encodeHtmlEntities(text) {\n\treturn text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n//#endregion\n//#region src/utilities/isFirefox.ts\n/**\n* Detects if the current browser is Firefox.\n* @returns `true` if the browser is Firefox, `false` otherwise.\n* @example\n* if (isFirefox()) {\n* // Firefox-specific handling\n* }\n*/\nfunction isFirefox() {\n\treturn typeof navigator !== \"undefined\" ? /Firefox/.test(navigator.userAgent) : false;\n}\n//#endregion\n//#region src/utilities/isNumber.ts\nfunction isNumber(value) {\n\treturn typeof value === \"number\";\n}\n//#endregion\n//#region src/utilities/isPlainObject.ts\nfunction getType(value) {\n\treturn Object.prototype.toString.call(value).slice(8, -1);\n}\nfunction isPlainObject(value) {\n\tif (getType(value) !== \"Object\") return false;\n\treturn value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;\n}\n//#endregion\n//#region src/utilities/isString.ts\nfunction isString(value) {\n\treturn typeof value === \"string\";\n}\n//#endregion\n//#region src/utilities/isValidCSSStyleValue.ts\n/**\n* Checks whether a value can be inserted into one CSS declaration.\n* @param value - The CSS property value.\n* @returns Whether the value stays inside one declaration.\n*/\nfunction isValidCSSStyleValue(value) {\n\treturn typeof value === \"string\" && value.trim().length > 0 && !/[;{}]/.test(value);\n}\n//#endregion\n//#region src/utilities/markdown/tokenizeAttributes.ts\nfunction isWhitespace(character) {\n\treturn /\\s/.test(character);\n}\nfunction isAsciiLetter(character) {\n\treturn /^[a-zA-Z]$/.test(character);\n}\nfunction isWordCharacter(character) {\n\treturn /^\\w$/.test(character);\n}\nfunction skipWhitespace(input, index) {\n\twhile (index < input.length && isWhitespace(input[index])) index += 1;\n\treturn index;\n}\nfunction skipToWhitespace(input, index) {\n\twhile (index < input.length && !isWhitespace(input[index])) index += 1;\n\treturn index;\n}\nfunction readName(input, index, allowHyphen) {\n\twhile (index < input.length && (isWordCharacter(input[index]) || allowHyphen && input[index] === \"-\")) index += 1;\n\treturn index;\n}\nfunction readShorthand(input, index) {\n\tconst prefix = input[index];\n\tconst nameStart = index + 1;\n\tconst nameEnd = readName(input, nameStart, true);\n\tif (nameEnd === nameStart) return { nextIndex: skipToWhitespace(input, nameEnd) };\n\treturn {\n\t\ttoken: {\n\t\t\ttype: prefix === \".\" ? \"class\" : \"id\",\n\t\t\tname: input.slice(nameStart, nameEnd)\n\t\t},\n\t\tnextIndex: skipToWhitespace(input, nameEnd)\n\t};\n}\nfunction readQuotedSegment(input, index) {\n\tconst closingQuote = input.indexOf(input[index], index + 1);\n\treturn { nextIndex: skipToWhitespace(input, closingQuote === -1 ? index : closingQuote + 1) };\n}\nfunction readKeyValue(input, name, index, allowWhitespace) {\n\tlet valueStart = allowWhitespace ? skipWhitespace(input, index) : index;\n\tif (input[valueStart] !== \"=\") return;\n\tvalueStart = allowWhitespace ? skipWhitespace(input, valueStart + 1) : valueStart + 1;\n\tconst quote = input[valueStart];\n\tif (quote !== \"\\\"\" && quote !== \"'\") return;\n\tconst valueEnd = input.indexOf(quote, valueStart + 1);\n\tif (valueEnd === -1) return;\n\treturn {\n\t\ttoken: {\n\t\t\ttype: \"keyValue\",\n\t\t\tname,\n\t\t\tvalue: input.slice(valueStart + 1, valueEnd)\n\t\t},\n\t\tnextIndex: skipToWhitespace(input, valueEnd + 1)\n\t};\n}\nfunction readNamedAttribute(input, index, syntax) {\n\tconst isPandoc = syntax === \"pandoc\";\n\tconst nameEnd = readName(input, index + 1, isPandoc);\n\tconst name = input.slice(index, nameEnd);\n\tconst keyValue = readKeyValue(input, name, nameEnd, isPandoc);\n\tif (keyValue) return keyValue;\n\tconst isStandalone = nameEnd === input.length || isWhitespace(input[nameEnd]);\n\treturn {\n\t\ttoken: isPandoc && isStandalone ? {\n\t\t\ttype: \"boolean\",\n\t\t\tname\n\t\t} : void 0,\n\t\tnextIndex: syntax === \"shortcode\" ? skipToWhitespace(input, nameEnd) : nameEnd\n\t};\n}\nfunction readAttribute(input, index, syntax) {\n\tconst prefix = input[index];\n\tif (syntax === \"pandoc\" && (prefix === \".\" || prefix === \"#\")) return readShorthand(input, index);\n\tif (prefix === \"\\\"\" || prefix === \"'\") return readQuotedSegment(input, index);\n\tif (syntax === \"pandoc\" ? isAsciiLetter(prefix) : isWordCharacter(prefix)) return readNamedAttribute(input, index, syntax);\n\treturn { nextIndex: skipToWhitespace(input, index) };\n}\nfunction tokenizeAttributes(input, syntax) {\n\tconst tokens = [];\n\tlet index = 0;\n\twhile (index < input.length) {\n\t\tindex = skipWhitespace(input, index);\n\t\tif (index >= input.length) break;\n\t\tconst result = readAttribute(input, index, syntax);\n\t\tif (result.token) tokens.push(result.token);\n\t\tindex = result.nextIndex;\n\t}\n\treturn tokens;\n}\n//#endregion\n//#region src/utilities/markdown/parseAttributes.ts\nfunction applyTokens(tokens) {\n\tconst attributes = {};\n\tconst classes = tokens.filter((token) => token.type === \"class\").map((token) => token.name);\n\tconst id = tokens.find((token) => token.type === \"id\");\n\tif (classes.length > 0) attributes.class = classes.join(\" \");\n\tif (id) attributes.id = id.name;\n\ttokens.forEach((token) => {\n\t\tif (token.type === \"keyValue\") attributes[token.name] = token.value;\n\t});\n\ttokens.forEach((token) => {\n\t\tif (token.type === \"boolean\") attributes[token.name] = true;\n\t});\n\treturn attributes;\n}\n/**\n* Parses a Pandoc-style attribute string into an object.\n*\n* @param attrString - The attribute string to parse\n* @returns Parsed attributes object\n*\n* @example\n* ```ts\n* parseAttributes('.btn #submit disabled type=\"button\"')\n* // { class: 'btn', id: 'submit', disabled: true, type: 'button' }\n* ```\n*/\nfunction parseAttributes(attrString) {\n\tif (!(attrString === null || attrString === void 0 ? void 0 : attrString.trim())) return {};\n\treturn applyTokens(tokenizeAttributes(attrString, \"pandoc\"));\n}\n//#endregion\n//#region src/utilities/markdown/serializeAttributes.ts\n/**\n* Serializes an attributes object to a Pandoc-style attribute string.\n*\n* @param attributes - The attributes object to serialize\n* @returns Serialized attribute string\n*\n* @example\n* ```ts\n* serializeAttributes({ class: 'btn primary', id: 'submit', disabled: true, type: 'button' })\n* // '.btn .primary #submit disabled type=\"button\"'\n* ```\n*/\nfunction serializeAttributes(attributes) {\n\tif (!attributes || Object.keys(attributes).length === 0) return \"\";\n\tconst parts = [];\n\tif (attributes.class) String(attributes.class).split(/\\s+/).filter(Boolean).forEach((className) => parts.push(`.${className}`));\n\tif (attributes.id) parts.push(`#${attributes.id}`);\n\tObject.entries(attributes).forEach(([key, value]) => {\n\t\tif (key === \"class\" || key === \"id\") return;\n\t\tif (value === true) parts.push(key);\n\t\telse if (value !== false && value != null) parts.push(`${key}=\"${String(value)}\"`);\n\t});\n\treturn parts.join(\" \");\n}\n//#endregion\n//#region src/utilities/markdown/createAtomBlockMarkdownSpec.ts\n/**\n* Creates a complete markdown spec for atomic block nodes using Pandoc syntax.\n*\n* The generated spec handles:\n* - Parsing self-closing blocks with `:::blockName {attributes}`\n* - Extracting and parsing attributes\n* - Validating required attributes\n* - Rendering blocks back to markdown\n*\n* @param options - Configuration for the atomic block markdown spec\n* @returns Complete markdown specification object\n*\n* @example\n* ```ts\n* const youtubeSpec = createAtomBlockMarkdownSpec({\n* nodeName: 'youtube',\n* requiredAttributes: ['src'],\n* defaultAttributes: { start: 0 },\n* allowedAttributes: ['src', 'start', 'width', 'height'] // Only these get rendered to markdown\n* })\n*\n* // Usage in extension:\n* export const Youtube = Node.create({\n* // ... other config\n* markdown: youtubeSpec\n* })\n* ```\n*/\nfunction createAtomBlockMarkdownSpec(options) {\n\tconst { nodeName, name: markdownName, parseAttributes: parseAttributes$2 = parseAttributes, serializeAttributes: serializeAttributes$2 = serializeAttributes, defaultAttributes = {}, requiredAttributes = [], allowedAttributes } = options;\n\tconst blockName = markdownName || nodeName;\n\tconst filterAttributes = (attrs) => {\n\t\tif (!allowedAttributes) return attrs;\n\t\tconst filtered = {};\n\t\tallowedAttributes.forEach((key) => {\n\t\t\tif (key in attrs) filtered[key] = attrs[key];\n\t\t});\n\t\treturn filtered;\n\t};\n\treturn {\n\t\tparseMarkdown: (token, h) => {\n\t\t\tconst attrs = {\n\t\t\t\t...defaultAttributes,\n\t\t\t\t...token.attributes\n\t\t\t};\n\t\t\treturn h.createNode(nodeName, attrs, []);\n\t\t},\n\t\tmarkdownTokenizer: {\n\t\t\tname: nodeName,\n\t\t\tlevel: \"block\",\n\t\t\tstart(src) {\n\t\t\t\tvar _src$match;\n\t\t\t\tconst regex = new RegExp(`^ {0,3}:::${blockName}(?:\\\\s|$)`, \"m\");\n\t\t\t\tconst index = (_src$match = src.match(regex)) === null || _src$match === void 0 ? void 0 : _src$match.index;\n\t\t\t\treturn index !== void 0 ? index : -1;\n\t\t\t},\n\t\t\ttokenize(src, _tokens, _lexer) {\n\t\t\t\tconst regex = new RegExp(`^ {0,3}:::${blockName}(?:\\\\s+\\\\{([^}]*)\\\\})?\\\\s*:::(?:\\\\n|$)`);\n\t\t\t\tconst match = src.match(regex);\n\t\t\t\tif (!match) return;\n\t\t\t\tconst attrString = match[1] || \"\";\n\t\t\t\tconst attributes = parseAttributes$2(attrString);\n\t\t\t\tif (requiredAttributes.find((required) => !(required in attributes))) return;\n\t\t\t\treturn {\n\t\t\t\t\ttype: nodeName,\n\t\t\t\t\traw: match[0],\n\t\t\t\t\tattributes\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\trenderMarkdown: (node) => {\n\t\t\tconst filteredAttrs = filterAttributes(node.attrs || {});\n\t\t\tconst attrs = serializeAttributes$2(filteredAttrs);\n\t\t\tconst attrString = attrs ? ` {${attrs}}` : \"\";\n\t\t\treturn `:::${blockName}${attrString} :::`;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/createBlockMarkdownSpec.ts\n/**\n* Creates a complete markdown spec for block-level nodes using Pandoc syntax.\n*\n* The generated spec handles:\n* - Parsing blocks with `:::blockName {attributes}` syntax\n* - Extracting and parsing attributes\n* - Rendering blocks back to markdown with proper formatting\n* - Nested content support\n*\n* @param options - Configuration for the block markdown spec\n* @returns Complete markdown specification object\n*\n* @example\n* ```ts\n* const calloutSpec = createBlockMarkdownSpec({\n* nodeName: 'callout',\n* defaultAttributes: { type: 'info' },\n* allowedAttributes: ['type', 'title'] // Only these get rendered to markdown\n* })\n*\n* // Usage in extension:\n* export const Callout = Node.create({\n* // ... other config\n* markdown: calloutSpec\n* })\n* ```\n*/\nfunction createBlockMarkdownSpec(options) {\n\tconst { nodeName, name: markdownName, getContent, parseAttributes: parseAttributes$1 = parseAttributes, serializeAttributes: serializeAttributes$1 = serializeAttributes, defaultAttributes = {}, content = \"block\", allowedAttributes } = options;\n\tconst blockName = markdownName || nodeName;\n\tconst filterAttributes = (attrs) => {\n\t\tif (!allowedAttributes) return attrs;\n\t\tconst filtered = {};\n\t\tallowedAttributes.forEach((key) => {\n\t\t\tif (key in attrs) filtered[key] = attrs[key];\n\t\t});\n\t\treturn filtered;\n\t};\n\treturn {\n\t\tparseMarkdown: (token, h) => {\n\t\t\tlet nodeContent;\n\t\t\tif (getContent) {\n\t\t\t\tconst contentResult = getContent(token);\n\t\t\t\tnodeContent = typeof contentResult === \"string\" ? [{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: contentResult\n\t\t\t\t}] : contentResult;\n\t\t\t} else if (content === \"block\") nodeContent = h.parseChildren(token.tokens || []);\n\t\t\telse nodeContent = h.parseInline(token.tokens || []);\n\t\t\tconst attrs = {\n\t\t\t\t...defaultAttributes,\n\t\t\t\t...token.attributes\n\t\t\t};\n\t\t\treturn h.createNode(nodeName, attrs, nodeContent);\n\t\t},\n\t\tmarkdownTokenizer: {\n\t\t\tname: nodeName,\n\t\t\tlevel: \"block\",\n\t\t\tstart(src) {\n\t\t\t\tvar _src$match;\n\t\t\t\tconst regex = new RegExp(`^:::${blockName}`, \"m\");\n\t\t\t\tconst index = (_src$match = src.match(regex)) === null || _src$match === void 0 ? void 0 : _src$match.index;\n\t\t\t\treturn index !== void 0 ? index : -1;\n\t\t\t},\n\t\t\ttokenize(src, _tokens, lexer) {\n\t\t\t\tconst openingRegex = new RegExp(`^:::${blockName}(?:\\\\s+\\\\{([^}]*)\\\\})?\\\\s*\\\\n`);\n\t\t\t\tconst openingMatch = src.match(openingRegex);\n\t\t\t\tif (!openingMatch) return;\n\t\t\t\tconst [openingTag, attrString = \"\"] = openingMatch;\n\t\t\t\tconst attributes = parseAttributes$1(attrString);\n\t\t\t\tlet level = 1;\n\t\t\t\tconst position = openingTag.length;\n\t\t\t\tlet matchedContent = \"\";\n\t\t\t\tconst blockPattern = /^:::([\\w-]*)(\\s.*)?/gm;\n\t\t\t\tconst remaining = src.slice(position);\n\t\t\t\tblockPattern.lastIndex = 0;\n\t\t\t\tfor (;;) {\n\t\t\t\t\tvar _match$;\n\t\t\t\t\tconst match = blockPattern.exec(remaining);\n\t\t\t\t\tif (match === null) break;\n\t\t\t\t\tconst matchPos = match.index;\n\t\t\t\t\tconst blockType = match[1];\n\t\t\t\t\tif ((_match$ = match[2]) === null || _match$ === void 0 ? void 0 : _match$.endsWith(\":::\")) continue;\n\t\t\t\t\tif (blockType) level += 1;\n\t\t\t\t\telse {\n\t\t\t\t\t\tlevel -= 1;\n\t\t\t\t\t\tif (level === 0) {\n\t\t\t\t\t\t\tconst rawContent = remaining.slice(0, matchPos);\n\t\t\t\t\t\t\tmatchedContent = rawContent.trim();\n\t\t\t\t\t\t\tconst fullMatch = src.slice(0, position + matchPos + match[0].length);\n\t\t\t\t\t\t\tlet contentTokens = [];\n\t\t\t\t\t\t\tif (matchedContent) {\n\t\t\t\t\t\t\t\tif (content === \"block\") {\n\t\t\t\t\t\t\t\t\tcontentTokens = lexer.blockTokens(rawContent);\n\t\t\t\t\t\t\t\t\tcontentTokens.forEach((token) => {\n\t\t\t\t\t\t\t\t\t\tif (token.text && (!token.tokens || token.tokens.length === 0)) token.tokens = lexer.inlineTokens(token.text);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\twhile (contentTokens.length > 0) {\n\t\t\t\t\t\t\t\t\t\tconst lastToken = contentTokens[contentTokens.length - 1];\n\t\t\t\t\t\t\t\t\t\tif (lastToken.type === \"paragraph\" && (!lastToken.text || lastToken.text.trim() === \"\")) contentTokens.pop();\n\t\t\t\t\t\t\t\t\t\telse break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else contentTokens = lexer.inlineTokens(matchedContent);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\ttype: nodeName,\n\t\t\t\t\t\t\t\traw: fullMatch,\n\t\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\t\tcontent: matchedContent,\n\t\t\t\t\t\t\t\ttokens: contentTokens\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\trenderMarkdown: (node, h) => {\n\t\t\tconst filteredAttrs = filterAttributes(node.attrs || {});\n\t\t\tconst attrs = serializeAttributes$1(filteredAttrs);\n\t\t\tconst attrString = attrs ? ` {${attrs}}` : \"\";\n\t\t\tconst renderedContent = h.renderChildren(node.content || [], \"\\n\\n\");\n\t\t\treturn `:::${blockName}${attrString}\\n\\n${renderedContent}\\n\\n:::`;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/parseShortcodeAttributes.ts\nfunction parseShortcodeAttributes(attrString) {\n\tconst attributes = {};\n\ttokenizeAttributes(attrString, \"shortcode\").forEach((token) => {\n\t\tif (token.type === \"keyValue\") attributes[token.name] = token.value;\n\t});\n\treturn attributes;\n}\n//#endregion\n//#region src/utilities/markdown/createInlineMarkdownSpec.ts\n/**\n* Serialize attributes back to shortcode format\n* Always quotes all values with double quotes\n*/\nfunction serializeShortcodeAttributes(attrs) {\n\treturn Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}=\"${value}\"`).join(\" \");\n}\n/**\n* Creates a complete markdown spec for inline nodes using attribute syntax.\n*\n* The generated spec handles:\n* - Parsing shortcode syntax with `[nodeName attributes]content[/nodeName]` format\n* - Self-closing shortcodes like `[emoji name=party_popper]`\n* - Extracting and parsing attributes from the opening tag\n* - Rendering inline elements back to shortcode markdown\n* - Supporting both content-based and self-closing inline elements\n*\n* @param options - Configuration for the inline markdown spec\n* @returns Complete markdown specification object\n*\n* @example\n* ```ts\n* // Self-closing mention: [mention id=\"madonna\" label=\"Madonna\"]\n* const mentionSpec = createInlineMarkdownSpec({\n* nodeName: 'mention',\n* selfClosing: true,\n* defaultAttributes: { type: 'user' },\n* allowedAttributes: ['id', 'label'] // Only these get rendered to markdown\n* })\n*\n* // Self-closing emoji: [emoji name=\"party_popper\"]\n* const emojiSpec = createInlineMarkdownSpec({\n* nodeName: 'emoji',\n* selfClosing: true,\n* allowedAttributes: ['name']\n* })\n*\n* // With content: [highlight color=\"yellow\"]text[/highlight]\n* const highlightSpec = createInlineMarkdownSpec({\n* nodeName: 'highlight',\n* selfClosing: false,\n* allowedAttributes: ['color', 'style']\n* })\n*\n* // Usage in extension:\n* export const Mention = Node.create({\n* name: 'mention', // Must match nodeName\n* // ... other config\n* markdown: mentionSpec\n* })\n* ```\n*/\nfunction createInlineMarkdownSpec(options) {\n\tconst { nodeName, name: shortcodeName, getContent, parseAttributes = parseShortcodeAttributes, serializeAttributes = serializeShortcodeAttributes, defaultAttributes = {}, selfClosing = false, allowedAttributes } = options;\n\tconst shortcode = shortcodeName || nodeName;\n\tconst filterAttributes = (attrs) => {\n\t\tif (!allowedAttributes) return attrs;\n\t\tconst filtered = {};\n\t\tallowedAttributes.forEach((attr) => {\n\t\t\tconst attrName = typeof attr === \"string\" ? attr : attr.name;\n\t\t\tconst skipIfDefault = typeof attr === \"string\" ? void 0 : attr.skipIfDefault;\n\t\t\tif (attrName in attrs) {\n\t\t\t\tconst value = attrs[attrName];\n\t\t\t\tif (skipIfDefault !== void 0 && value === skipIfDefault) return;\n\t\t\t\tfiltered[attrName] = value;\n\t\t\t}\n\t\t});\n\t\treturn filtered;\n\t};\n\tconst escapedShortcode = shortcode.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\treturn {\n\t\tparseMarkdown: (token, h) => {\n\t\t\tconst attrs = {\n\t\t\t\t...defaultAttributes,\n\t\t\t\t...token.attributes\n\t\t\t};\n\t\t\tif (selfClosing) return h.createNode(nodeName, attrs);\n\t\t\tconst content = getContent ? getContent(token) : token.content || \"\";\n\t\t\tif (content) return h.createNode(nodeName, attrs, [h.createTextNode(content)]);\n\t\t\treturn h.createNode(nodeName, attrs, []);\n\t\t},\n\t\tmarkdownTokenizer: {\n\t\t\tname: nodeName,\n\t\t\tlevel: \"inline\",\n\t\t\tstart(src) {\n\t\t\t\tconst startPattern = selfClosing ? new RegExp(`\\\\[${escapedShortcode}\\\\s*[^\\\\]]*\\\\]`) : new RegExp(`\\\\[${escapedShortcode}\\\\s*[^\\\\]]*\\\\][\\\\s\\\\S]*?\\\\[\\\\/${escapedShortcode}\\\\]`);\n\t\t\t\tconst match = src.match(startPattern);\n\t\t\t\tconst index = match === null || match === void 0 ? void 0 : match.index;\n\t\t\t\treturn index !== void 0 ? index : -1;\n\t\t\t},\n\t\t\ttokenize(src, _tokens, _lexer) {\n\t\t\t\tconst tokenPattern = selfClosing ? new RegExp(`^\\\\[${escapedShortcode}\\\\s*([^\\\\]]*)\\\\]`) : new RegExp(`^\\\\[${escapedShortcode}\\\\s*([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${escapedShortcode}\\\\]`);\n\t\t\t\tconst match = src.match(tokenPattern);\n\t\t\t\tif (!match) return;\n\t\t\t\tlet content = \"\";\n\t\t\t\tlet attrString = \"\";\n\t\t\t\tif (selfClosing) {\n\t\t\t\t\tconst [, attrs] = match;\n\t\t\t\t\tattrString = attrs;\n\t\t\t\t} else {\n\t\t\t\t\tconst [, attrs, contentMatch] = match;\n\t\t\t\t\tattrString = attrs;\n\t\t\t\t\tcontent = contentMatch || \"\";\n\t\t\t\t}\n\t\t\t\tconst attributes = parseAttributes(attrString.trim());\n\t\t\t\treturn {\n\t\t\t\t\ttype: nodeName,\n\t\t\t\t\traw: match[0],\n\t\t\t\t\tcontent: content.trim(),\n\t\t\t\t\tattributes\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\trenderMarkdown: (node) => {\n\t\t\tlet content = \"\";\n\t\t\tif (getContent) content = getContent(node);\n\t\t\telse if (node.content && node.content.length > 0) content = node.content.filter((child) => child.type === \"text\").map((child) => child.text).join(\"\");\n\t\t\tconst filteredAttrs = filterAttributes(node.attrs || {});\n\t\t\tconst attrs = serializeAttributes(filteredAttrs);\n\t\t\tconst attrString = attrs ? ` ${attrs}` : \"\";\n\t\t\tif (selfClosing) return `[${shortcode}${attrString}]`;\n\t\t\treturn `[${shortcode}${attrString}]${content}[/${shortcode}]`;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/parseIndentedBlocks.ts\nfunction dedentLine(line, indentSize) {\n\treturn line.replace(/^[ \\t]*/, (whitespace) => {\n\t\tconst tabSize = 4;\n\t\tlet columns = 0;\n\t\tfor (const character of whitespace) columns += character === \"\t\" ? tabSize - columns % tabSize : 1;\n\t\treturn \" \".repeat(Math.max(0, columns - indentSize));\n\t});\n}\nfunction continuesParagraph(line, blockTokens) {\n\tconst source = `text\\n${line}\\n`;\n\tconst token = blockTokens(source)[0];\n\treturn ((token === null || token === void 0 ? void 0 : token.type) === \"paragraph\" || (token === null || token === void 0 ? void 0 : token.type) === \"text\") && token.raw === source;\n}\n/** Joins paragraph continuation lines and leaves nested blocks for separate parsing. */\nfunction parseContinuation(mainContent, nestedContent, lexer) {\n\tvar _lexer$isParagraphCon;\n\tconst lines = nestedContent.split(\"\\n\");\n\tconst isContinuation = (_lexer$isParagraphCon = lexer.isParagraphContinuation) !== null && _lexer$isParagraphCon !== void 0 ? _lexer$isParagraphCon : ((line) => continuesParagraph(line, lexer.blockTokens));\n\tlet continuationLength = 0;\n\tfor (const line of lines) {\n\t\tif (!line.trim() || !isContinuation(line)) break;\n\t\tcontinuationLength += 1;\n\t}\n\treturn {\n\t\tmainContent: [mainContent, ...lines.slice(0, continuationLength).map((line) => line.trimStart())].join(\"\\n\"),\n\t\tnestedContent: lines.slice(continuationLength).join(\"\\n\")\n\t};\n}\n/**\n* Parses markdown text into hierarchical indented blocks with proper nesting.\n*\n* This utility handles:\n* - Line-by-line parsing with pattern matching\n* - Hierarchical nesting based on indentation levels\n* - Nested content collection and parsing\n* - Empty line handling\n* - Content dedenting for nested blocks\n*\n* The key difference from flat parsing is that this maintains the hierarchical\n* structure where nested items become `nestedTokens` of their parent items,\n* rather than being flattened into a single array.\n*\n* @param src - The markdown source text to parse\n* @param config - Configuration object defining how to parse and create tokens\n* @param lexer - Markdown lexer for parsing nested content\n* @returns Parsed result with hierarchical items, or undefined if no matches\n*\n* @example\n* ```ts\n* const result = parseIndentedBlocks(src, {\n* itemPattern: /^(\\s*)([-+*])\\s+\\[([ xX])\\]\\s+(.*)$/,\n* extractItemData: (match) => ({\n* indentLevel: match[1].length,\n* mainContent: match[4],\n* checked: match[3].toLowerCase() === 'x'\n* }),\n* createToken: (data, nestedTokens) => ({\n* type: 'taskItem',\n* checked: data.checked,\n* text: data.mainContent,\n* nestedTokens\n* })\n* }, lexer)\n* ```\n*/\nfunction parseIndentedBlocks(src, config, lexer) {\n\tconst lines = src.split(\"\\n\");\n\tconst items = [];\n\tlet totalRaw = \"\";\n\tlet i = 0;\n\tconst baseIndentSize = config.baseIndentSize || 2;\n\twhile (i < lines.length) {\n\t\tconst currentLine = lines[i];\n\t\tconst itemMatch = currentLine.match(config.itemPattern);\n\t\tif (!itemMatch) {\n\t\t\tif (items.length > 0) break;\n\t\t\telse if (currentLine.trim() === \"\") {\n\t\t\t\ti += 1;\n\t\t\t\ttotalRaw = `${totalRaw}${currentLine}\\n`;\n\t\t\t\tcontinue;\n\t\t\t} else return;\n\t\t}\n\t\tconst itemData = config.extractItemData(itemMatch);\n\t\tconst { indentLevel, mainContent } = itemData;\n\t\ttotalRaw = `${totalRaw}${currentLine}\\n`;\n\t\tconst itemContent = [mainContent];\n\t\ti += 1;\n\t\twhile (i < lines.length) {\n\t\t\tvar _nextLine$match;\n\t\t\tconst nextLine = lines[i];\n\t\t\tif (nextLine.trim() === \"\") {\n\t\t\t\tvar _nextNonEmpty$match;\n\t\t\t\tconst nextNonEmptyIndex = lines.slice(i + 1).findIndex((l) => l.trim() !== \"\");\n\t\t\t\tif (nextNonEmptyIndex === -1) break;\n\t\t\t\tif ((((_nextNonEmpty$match = lines[i + 1 + nextNonEmptyIndex].match(/^(\\s*)/)) === null || _nextNonEmpty$match === void 0 || (_nextNonEmpty$match = _nextNonEmpty$match[1]) === null || _nextNonEmpty$match === void 0 ? void 0 : _nextNonEmpty$match.length) || 0) > indentLevel) {\n\t\t\t\t\titemContent.push(nextLine);\n\t\t\t\t\ttotalRaw = `${totalRaw}${nextLine}\\n`;\n\t\t\t\t\ti += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t} else break;\n\t\t\t}\n\t\t\tif ((((_nextLine$match = nextLine.match(/^(\\s*)/)) === null || _nextLine$match === void 0 || (_nextLine$match = _nextLine$match[1]) === null || _nextLine$match === void 0 ? void 0 : _nextLine$match.length) || 0) > indentLevel) {\n\t\t\t\titemContent.push(nextLine);\n\t\t\t\ttotalRaw = `${totalRaw}${nextLine}\\n`;\n\t\t\t\ti += 1;\n\t\t\t} else break;\n\t\t}\n\t\tlet nestedTokens;\n\t\tconst nestedContent = itemContent.slice(1);\n\t\tif (nestedContent.length > 0) {\n\t\t\tconst continuation = parseContinuation(mainContent, nestedContent.map((nestedLine) => dedentLine(nestedLine, indentLevel + baseIndentSize)).join(\"\\n\"), lexer);\n\t\t\titemData.mainContent = continuation.mainContent;\n\t\t\tconst dedentedNested = continuation.nestedContent;\n\t\t\tif (dedentedNested.trim()) {\n\t\t\t\tif (config.customNestedParser) nestedTokens = config.customNestedParser(dedentedNested);\n\t\t\t\telse nestedTokens = lexer.blockTokens(dedentedNested);\n\t\t\t}\n\t\t}\n\t\tconst token = config.createToken(itemData, nestedTokens);\n\t\titems.push(token);\n\t}\n\tif (items.length === 0) return;\n\treturn {\n\t\titems,\n\t\traw: totalRaw.slice(0, src.length)\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/renderNestedMarkdownContent.ts\n/**\n* @fileoverview Utility functions for rendering nested content in markdown.\n*\n* This module provides reusable utilities for extensions that need to render\n* content with a prefix on the main line and properly indented nested content.\n*/\n/**\n* Utility function for rendering content with a main line prefix and nested indented content.\n*\n* This function handles the common pattern of rendering content with:\n* 1. A main line with a prefix (like \"- \" for lists, \"> \" for blockquotes, etc.)\n* 2. Nested content that gets indented properly\n*\n* @param node - The ProseMirror node representing the content\n* @param h - The markdown renderer helper\n* @param prefixOrGenerator - Either a string prefix or a function that generates the prefix from context\n* @param ctx - Optional context object (used when prefixOrGenerator is a function)\n* @param options - Optional rendering options\n* @param options.alignNestedToPrefix - Indent nested content to the width of the prefix\n* instead of the configured indent size, when the configured one is narrower\n* @param options.indentMainContent - Indent continuation lines in the opening paragraph\n* @returns The rendered markdown string\n*\n* @example\n* ```ts\n* // For a bullet list item with static prefix\n* return renderNestedMarkdownContent(node, h, '- ')\n*\n* // For a task item with static prefix\n* const prefix = `- [${node.attrs?.checked ? 'x' : ' '}] `\n* return renderNestedMarkdownContent(node, h, prefix)\n*\n* // For an ordered list item, where the nested block has to line up with the marker\n* return renderNestedMarkdownContent(node, h, '10. ', ctx, { alignNestedToPrefix: true })\n*\n* // For a blockquote with static prefix\n* return renderNestedMarkdownContent(node, h, '> ')\n*\n* // For content with dynamic prefix based on context\n* return renderNestedMarkdownContent(node, h, ctx => {\n* if (ctx.parentType === 'orderedList') {\n* return `${ctx.index + 1}. `\n* }\n* return '- '\n* }, ctx)\n*\n* // Custom extension example\n* const CustomContainer = Node.create({\n* name: 'customContainer',\n* // ... other config\n* markdown: {\n* render: (node, h) => {\n* const type = node.attrs?.type || 'info'\n* return renderNestedMarkdownContent(node, h, `[${type}] `)\n* }\n* }\n* })\n* ```\n*/\nconst TAB_STOP = 4;\n/** Width of indentation in Markdown columns, where a tab runs to the next tab stop. */\nfunction columnWidth(text) {\n\tlet width = 0;\n\tfor (const character of text) width = character === \"\t\" ? width + TAB_STOP - width % TAB_STOP : width + 1;\n\treturn width;\n}\nfunction renderNestedMarkdownContent(node, h, prefixOrGenerator, ctx, options) {\n\tif (!node || !Array.isArray(node.content)) return \"\";\n\tconst prefix = typeof prefixOrGenerator === \"function\" ? prefixOrGenerator(ctx) : prefixOrGenerator;\n\tconst [content, ...children] = node.content;\n\tconst mainContent = h.renderChildren([content]);\n\tlet output = `${prefix}${(options === null || options === void 0 ? void 0 : options.indentMainContent) ? mainContent.split(\"\\n\").map((line, index) => index === 0 ? line : h.indent(line)).join(\"\\n\") : mainContent}`;\n\tif (children && children.length > 0) children.forEach((child, index) => {\n\t\tvar _h$renderChild, _h$renderChild2;\n\t\tconst childContent = (_h$renderChild = (_h$renderChild2 = h.renderChild) === null || _h$renderChild2 === void 0 ? void 0 : _h$renderChild2.call(h, child, index + 1)) !== null && _h$renderChild !== void 0 ? _h$renderChild : h.renderChildren([child]);\n\t\tif (childContent !== void 0 && childContent !== null) {\n\t\t\tconst indentLine = (line) => {\n\t\t\t\tif (!(options === null || options === void 0 ? void 0 : options.alignNestedToPrefix)) return h.indent(line);\n\t\t\t\tconst configured = h.indent(\"\");\n\t\t\t\tconst prefixWidth = columnWidth(prefix);\n\t\t\t\treturn (columnWidth(configured) >= prefixWidth ? configured : \" \".repeat(prefixWidth)) + line;\n\t\t\t};\n\t\t\tconst indentedChild = childContent.split(\"\\n\").map((line) => line ? indentLine(line) : indentLine(\"\")).join(\"\\n\");\n\t\t\toutput += child.type === \"paragraph\" ? `\\n\\n${indentedChild}` : `\\n${indentedChild}`;\n\t\t}\n\t});\n\treturn output;\n}\n//#endregion\n//#region src/utilities/markdown/index.ts\nvar markdown_exports = /* @__PURE__ */ __exportAll({\n\tcreateAtomBlockMarkdownSpec: () => createAtomBlockMarkdownSpec,\n\tcreateBlockMarkdownSpec: () => createBlockMarkdownSpec,\n\tcreateInlineMarkdownSpec: () => createInlineMarkdownSpec,\n\tparseAttributes: () => parseAttributes,\n\tparseIndentedBlocks: () => parseIndentedBlocks,\n\trenderNestedMarkdownContent: () => renderNestedMarkdownContent,\n\tserializeAttributes: () => serializeAttributes\n});\n//#endregion\n//#region src/utilities/marksEqual.ts\nfunction markTypeName(mark) {\n\treturn typeof mark.type === \"string\" ? mark.type : mark.type.name;\n}\n/**\n* Compare two arrays of mark objects for equality (order-insensitive).\n* Marks are matched by type name and attributes (via attrsEqual),\n* so key ordering in attrs does not matter, nor does mark array order.\n*/\nfunction marksEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tconst consumed = Array.from({ length: b.length }, () => false);\n\treturn a.every((markA) => {\n\t\tconst nameA = markTypeName(markA);\n\t\tconst idx = b.findIndex((markB, i) => !consumed[i] && nameA === markTypeName(markB) && attrsEqual(markA.attrs, markB.attrs));\n\t\tif (idx === -1) return false;\n\t\tconsumed[idx] = true;\n\t\treturn true;\n\t});\n}\n//#endregion\n//#region src/utilities/mergeDeep.ts\nfunction mergeDeep(target, source) {\n\tconst output = { ...target };\n\tif (isPlainObject(target) && isPlainObject(source)) Object.keys(source).forEach((key) => {\n\t\tif (isPlainObject(source[key]) && isPlainObject(target[key])) output[key] = mergeDeep(target[key], source[key]);\n\t\telse output[key] = source[key];\n\t});\n\treturn output;\n}\n//#endregion\n//#region src/MarkView.ts\nfunction updateMarkViewAttributes(checkMark, editor, attrs = {}) {\n\tconst { state } = editor;\n\tconst { doc, tr } = state;\n\tconst thisMark = checkMark;\n\tdoc.descendants((node, pos) => {\n\t\tconst from = tr.mapping.map(pos);\n\t\tconst to = tr.mapping.map(pos) + node.nodeSize;\n\t\tlet foundMark = null;\n\t\tnode.marks.forEach((mark) => {\n\t\t\tif (mark !== thisMark) return false;\n\t\t\tfoundMark = mark;\n\t\t});\n\t\tif (!foundMark) return;\n\t\tlet needsUpdate = false;\n\t\tObject.keys(attrs).forEach((k) => {\n\t\t\tif (attrs[k] !== foundMark.attrs[k]) needsUpdate = true;\n\t\t});\n\t\tif (needsUpdate) {\n\t\t\tconst updatedMark = checkMark.type.create({\n\t\t\t\t...checkMark.attrs,\n\t\t\t\t...attrs\n\t\t\t});\n\t\t\ttr.removeMark(from, to, checkMark.type);\n\t\t\ttr.addMark(from, to, updatedMark);\n\t\t}\n\t});\n\tif (tr.docChanged) editor.view.dispatch(tr);\n}\nvar MarkView = class {\n\tconstructor(component, props, options) {\n\t\tthis.component = component;\n\t\tthis.editor = props.editor;\n\t\tthis.options = { ...options };\n\t\tthis.mark = props.mark;\n\t\tthis.HTMLAttributes = props.HTMLAttributes;\n\t}\n\tget dom() {\n\t\treturn this.editor.view.dom;\n\t}\n\tget contentDOM() {\n\t\treturn null;\n\t}\n\t/**\n\t* Update the attributes of the mark in the document.\n\t* @param attrs The attributes to update.\n\t*/\n\tupdateAttributes(attrs, checkMark) {\n\t\tupdateMarkViewAttributes(checkMark || this.mark, this.editor, attrs);\n\t}\n\tignoreMutation(mutation) {\n\t\tif (!this.dom || !this.contentDOM) return true;\n\t\tif (typeof this.options.ignoreMutation === \"function\") return this.options.ignoreMutation({ mutation });\n\t\tif (mutation.type === \"selection\") return false;\n\t\tif (this.contentDOM.contains(mutation.target) && mutation.type === \"childList\" && (isiOS() || isAndroid()) && this.editor.isFocused) {\n\t\t\tif ([...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)].every((node) => node.isContentEditable)) return false;\n\t\t}\n\t\tif (this.contentDOM === mutation.target && mutation.type === \"attributes\") return true;\n\t\tif (this.contentDOM.contains(mutation.target)) return false;\n\t\treturn true;\n\t}\n};\n//#endregion\n//#region src/InputRule.ts\nvar InputRule = class {\n\tconstructor(config) {\n\t\tvar _config$undoable;\n\t\tthis.find = config.find;\n\t\tthis.handler = config.handler;\n\t\tthis.undoable = (_config$undoable = config.undoable) !== null && _config$undoable !== void 0 ? _config$undoable : true;\n\t}\n};\nconst inputRuleMatcherHandler = (text, find) => {\n\tif (isRegExp(find)) return find.exec(text);\n\tconst inputRuleMatch = find(text);\n\tif (!inputRuleMatch) return null;\n\tconst result = [inputRuleMatch.text];\n\tresult.index = inputRuleMatch.index;\n\tresult.input = text;\n\tresult.data = inputRuleMatch.data;\n\tif (inputRuleMatch.replaceWith) {\n\t\tif (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) console.warn(\"[tiptap warn]: \\\"inputRuleMatch.replaceWith\\\" must be part of \\\"inputRuleMatch.text\\\".\");\n\t\tresult.push(inputRuleMatch.replaceWith);\n\t}\n\treturn result;\n};\n/**\n* Prepares the typed text so the rule handler can inspect the resulting document.\n*/\nfunction createRuleTransaction(config) {\n\tconst { editor, from, to, text, insertText } = config;\n\tif (!insertText) return {\n\t\tinputTransaction: null,\n\t\ttr: editor.view.state.tr\n\t};\n\tconst inputTransaction = editor.view.state.tr.insertText(text, from, to);\n\treturn {\n\t\tinputTransaction,\n\t\ttr: EditorState.create({\n\t\t\tdoc: inputTransaction.doc,\n\t\t\tselection: inputTransaction.selection,\n\t\t\tstoredMarks: inputTransaction.storedMarks\n\t\t}).tr\n\t};\n}\n/**\n* Runs a matching rule and dispatches the typed text before its conversion.\n*/\nfunction applyRule(config) {\n\tconst { editor, from, to, text, rule, match, plugin, insertText } = config;\n\tconst { view } = editor;\n\tconst { inputTransaction, tr } = createRuleTransaction({\n\t\teditor,\n\t\tfrom,\n\t\tto,\n\t\ttext,\n\t\tinsertText\n\t});\n\tconst inputEnd = inputTransaction ? from + text.length : to;\n\tconst state = createChainableState({\n\t\tstate: view.state,\n\t\ttransaction: tr\n\t});\n\tconst range = {\n\t\tfrom: from - (match[0].length - text.length),\n\t\tto: inputEnd\n\t};\n\tconst { commands, chain, can } = new CommandManager({\n\t\teditor,\n\t\tstate\n\t});\n\tif (rule.handler({\n\t\tstate,\n\t\trange,\n\t\tmatch,\n\t\tcommands,\n\t\tchain,\n\t\tcan\n\t}) === null || !tr.steps.length) return false;\n\tif (inputTransaction) {\n\t\tview.dispatch(inputTransaction);\n\t\tif (!view.state.doc.eq(inputTransaction.doc)) return true;\n\t}\n\tcloseHistory(tr);\n\ttr.setMeta(\"inputRule\", true);\n\tif (rule.undoable) tr.setMeta(plugin, {\n\t\ttransform: tr,\n\t\tfrom,\n\t\tto: inputEnd,\n\t\ttext\n\t});\n\tview.dispatch(tr);\n\treturn true;\n}\n/**\n* Checks that the part of a match already in the document has matching positions.\n*/\nfunction matchesDocument($from, match, text) {\n\tconst matchedDocLength = match[0].length - text.length;\n\tif (matchedDocLength <= 0) return true;\n\tconst matchStartOffset = $from.parentOffset - matchedDocLength;\n\treturn matchStartOffset >= 0 && $from.parent.textBetween(matchStartOffset, $from.parentOffset) === match[0].slice(0, matchedDocLength);\n}\nfunction run$1(config) {\n\tvar _ref;\n\tconst { editor, from, to, text, rules, plugin, insertText } = config;\n\tconst { view } = editor;\n\tif (view.composing) return false;\n\tconst $from = view.state.doc.resolve(from);\n\tif ($from.parent.type.spec.code || !!((_ref = $from.nodeBefore || $from.nodeAfter) === null || _ref === void 0 ? void 0 : _ref.marks.find((mark) => mark.type.spec.code))) return false;\n\tconst textBefore = getTextContentFromNodes($from) + text;\n\tfor (const rule of rules) {\n\t\tconst match = inputRuleMatcherHandler(textBefore, rule.find);\n\t\tif (!match || !matchesDocument($from, match, text)) continue;\n\t\tif (applyRule({\n\t\t\teditor,\n\t\t\tfrom,\n\t\t\tto,\n\t\t\ttext,\n\t\t\trule,\n\t\t\tmatch,\n\t\t\tplugin,\n\t\t\tinsertText\n\t\t})) return true;\n\t}\n\treturn false;\n}\n/**\n* Create an input rules plugin. When enabled, it will cause text\n* input that matches any of the given rules to trigger the rule’s\n* action.\n*/\nfunction inputRulesPlugin(props) {\n\tconst { editor, rules } = props;\n\tconst plugin = new Plugin({\n\t\tstate: {\n\t\t\tinit() {\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\tapply(tr, prev, state) {\n\t\t\t\tconst stored = tr.getMeta(plugin);\n\t\t\t\tif (stored) return stored;\n\t\t\t\tconst simulatedInputMeta = tr.getMeta(\"applyInputRules\");\n\t\t\t\tif (!!simulatedInputMeta) setTimeout(() => {\n\t\t\t\t\tlet { text } = simulatedInputMeta;\n\t\t\t\t\tif (typeof text === \"string\") text = text;\n\t\t\t\t\telse text = getHTMLFromFragment(Fragment$1.from(text), state.schema);\n\t\t\t\t\tconst { from } = simulatedInputMeta;\n\t\t\t\t\tconst to = from + text.length;\n\t\t\t\t\trun$1({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto,\n\t\t\t\t\t\ttext,\n\t\t\t\t\t\trules,\n\t\t\t\t\t\tplugin\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\treturn tr.selectionSet || tr.docChanged ? null : prev;\n\t\t\t}\n\t\t},\n\t\tprops: {\n\t\t\thandleTextInput(view, from, to, text) {\n\t\t\t\treturn run$1({\n\t\t\t\t\teditor,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\ttext,\n\t\t\t\t\trules,\n\t\t\t\t\tplugin,\n\t\t\t\t\tinsertText: true\n\t\t\t\t});\n\t\t\t},\n\t\t\thandleDOMEvents: { compositionend: (view) => {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tconst { $cursor } = view.state.selection;\n\t\t\t\t\tif ($cursor) run$1({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\tfrom: $cursor.pos,\n\t\t\t\t\t\tto: $cursor.pos,\n\t\t\t\t\t\ttext: \"\",\n\t\t\t\t\t\trules,\n\t\t\t\t\t\tplugin\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t} },\n\t\t\thandleKeyDown(view, event) {\n\t\t\t\tif (event.key !== \"Enter\") return false;\n\t\t\t\tconst { $cursor } = view.state.selection;\n\t\t\t\tif ($cursor) return run$1({\n\t\t\t\t\teditor,\n\t\t\t\t\tfrom: $cursor.pos,\n\t\t\t\t\tto: $cursor.pos,\n\t\t\t\t\ttext: \"\\n\",\n\t\t\t\t\trules,\n\t\t\t\t\tplugin\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tisInputRules: true\n\t});\n\treturn plugin;\n}\n//#endregion\n//#region src/Extendable.ts\nvar Extendable = class {\n\tconstructor(config = {}) {\n\t\tthis.type = \"extendable\";\n\t\tthis.parent = null;\n\t\tthis.child = null;\n\t\tthis.name = \"\";\n\t\tthis.config = { name: this.name };\n\t\tthis.config = {\n\t\t\t...this.config,\n\t\t\t...config\n\t\t};\n\t\tthis.name = this.config.name;\n\t}\n\tget options() {\n\t\treturn { ...callOrReturn(getExtensionField(this, \"addOptions\", { name: this.name })) };\n\t}\n\tget storage() {\n\t\treturn { ...callOrReturn(getExtensionField(this, \"addStorage\", {\n\t\t\tname: this.name,\n\t\t\toptions: this.options\n\t\t})) };\n\t}\n\tconfigure(options = {}) {\n\t\tconst extension = this.extend({\n\t\t\t...this.config,\n\t\t\taddOptions: () => {\n\t\t\t\treturn mergeDeep(this.options, options);\n\t\t\t}\n\t\t});\n\t\textension.name = this.name;\n\t\textension.parent = this.parent;\n\t\tthis.child = null;\n\t\treturn extension;\n\t}\n\textend(extendedConfig = {}) {\n\t\tconst extension = new this.constructor({\n\t\t\t...this.config,\n\t\t\t...extendedConfig\n\t\t});\n\t\textension.parent = this;\n\t\tthis.child = extension;\n\t\textension.name = \"name\" in extendedConfig ? extendedConfig.name : extension.parent.name;\n\t\treturn extension;\n\t}\n};\n//#endregion\n//#region src/Mark.ts\n/**\n* The Mark class is used to create custom mark extensions.\n* @see https://tiptap.dev/api/extensions#create-a-new-extension\n*/\nvar Mark = class Mark extends Extendable {\n\tconstructor(..._args) {\n\t\tsuper(..._args);\n\t\tthis.type = \"mark\";\n\t}\n\t/**\n\t* Create a new Mark instance\n\t* @param config - Mark configuration object or a function that returns a configuration object\n\t*/\n\tstatic create(config = {}) {\n\t\tconst resolvedConfig = typeof config === \"function\" ? config() : config;\n\t\treturn new Mark(resolvedConfig);\n\t}\n\tstatic handleExit({ editor, mark }) {\n\t\tconst { tr } = editor.state;\n\t\tconst currentPos = editor.state.selection.$from;\n\t\tif (currentPos.pos === currentPos.end()) {\n\t\t\tconst currentMarks = currentPos.marks();\n\t\t\tif (!!!currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name)) return false;\n\t\t\tconst removeMark = currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);\n\t\t\tif (removeMark) tr.removeStoredMark(removeMark);\n\t\t\ttr.insertText(\" \", currentPos.pos);\n\t\t\teditor.view.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\tconfigure(options) {\n\t\treturn super.configure(options);\n\t}\n\textend(extendedConfig) {\n\t\tconst resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n\t\treturn super.extend(resolvedConfig);\n\t}\n};\n//#endregion\n//#region src/PasteRule.ts\n/**\n* Paste rules are used to react to pasted content.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n*/\nvar PasteRule = class {\n\tconstructor(config) {\n\t\tthis.find = config.find;\n\t\tthis.handler = config.handler;\n\t}\n};\nconst pasteRuleMatcherHandler = (text, find, event) => {\n\tif (isRegExp(find)) return [...text.matchAll(find)];\n\tconst matches = find(text, event);\n\tif (!matches) return [];\n\treturn matches.map((pasteRuleMatch) => {\n\t\tconst result = [pasteRuleMatch.text];\n\t\tresult.index = pasteRuleMatch.index;\n\t\tresult.input = text;\n\t\tresult.data = pasteRuleMatch.data;\n\t\tif (pasteRuleMatch.replaceWith) {\n\t\t\tif (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) console.warn(\"[tiptap warn]: \\\"pasteRuleMatch.replaceWith\\\" must be part of \\\"pasteRuleMatch.text\\\".\");\n\t\t\tresult.push(pasteRuleMatch.replaceWith);\n\t\t}\n\t\treturn result;\n\t});\n};\nfunction run(config) {\n\tconst { editor, state, from, to, rule, pasteEvent, dropEvent } = config;\n\tconst { commands, chain, can } = new CommandManager({\n\t\teditor,\n\t\tstate\n\t});\n\tconst handlers = [];\n\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\tvar _node$type, _ref, _node$content$size, _node$content;\n\t\tif (((_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.code) || !(node.isText || node.isTextblock || node.isInline)) return;\n\t\tconst contentSize = (_ref = (_node$content$size = (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.size) !== null && _node$content$size !== void 0 ? _node$content$size : node.nodeSize) !== null && _ref !== void 0 ? _ref : 0;\n\t\tconst resolvedFrom = Math.max(from, pos);\n\t\tconst resolvedTo = Math.min(to, pos + contentSize);\n\t\tif (resolvedFrom >= resolvedTo) return;\n\t\tconst textToMatch = node.isText ? node.text || \"\" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, \"\");\n\t\tpasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent).forEach((match) => {\n\t\t\tif (match.index === void 0) return;\n\t\t\tconst start = resolvedFrom + match.index + 1;\n\t\t\tconst end = start + match[0].length;\n\t\t\tconst range = {\n\t\t\t\tfrom: state.tr.mapping.map(start),\n\t\t\t\tto: state.tr.mapping.map(end)\n\t\t\t};\n\t\t\tconst handler = rule.handler({\n\t\t\t\tstate,\n\t\t\t\trange,\n\t\t\t\tmatch,\n\t\t\t\tcommands,\n\t\t\t\tchain,\n\t\t\t\tcan,\n\t\t\t\tpasteEvent,\n\t\t\t\tdropEvent\n\t\t\t});\n\t\t\thandlers.push(handler);\n\t\t});\n\t});\n\treturn handlers.every((handler) => handler !== null);\n}\nlet tiptapDragFromOtherEditor = null;\nconst createClipboardPasteEvent = (text) => {\n\tvar _event$clipboardData;\n\tconst event = new ClipboardEvent(\"paste\", { clipboardData: new DataTransfer() });\n\t(_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 || _event$clipboardData.setData(\"text/html\", text);\n\treturn event;\n};\n/**\n* Create an paste rules plugin. When enabled, it will cause pasted\n* text that matches any of the given rules to trigger the rule’s\n* action.\n*/\nfunction pasteRulesPlugin(props) {\n\tconst { editor, rules } = props;\n\tlet dragSourceElement = null;\n\tlet isPastedFromProseMirror = false;\n\tlet isDroppedFromProseMirror = false;\n\tlet pasteEvent = typeof ClipboardEvent !== \"undefined\" ? new ClipboardEvent(\"paste\") : null;\n\tlet dropEvent;\n\ttry {\n\t\tdropEvent = typeof DragEvent !== \"undefined\" ? new DragEvent(\"drop\") : null;\n\t} catch {\n\t\tdropEvent = null;\n\t}\n\tconst processEvent = ({ state, from, to, rule, pasteEvt }) => {\n\t\tconst tr = state.tr;\n\t\tconst chainableState = createChainableState({\n\t\t\tstate,\n\t\t\ttransaction: tr\n\t\t});\n\t\tif (!run({\n\t\t\teditor,\n\t\t\tstate: chainableState,\n\t\t\tfrom: Math.max(from - 1, 0),\n\t\t\tto: to.b - 1,\n\t\t\trule,\n\t\t\tpasteEvent: pasteEvt,\n\t\t\tdropEvent\n\t\t}) || !tr.steps.length) return;\n\t\ttry {\n\t\t\tdropEvent = typeof DragEvent !== \"undefined\" ? new DragEvent(\"drop\") : null;\n\t\t} catch {\n\t\t\tdropEvent = null;\n\t\t}\n\t\tpasteEvent = typeof ClipboardEvent !== \"undefined\" ? new ClipboardEvent(\"paste\") : null;\n\t\treturn tr;\n\t};\n\teditor.on(\"destroy\", () => {\n\t\tif (tiptapDragFromOtherEditor === editor) tiptapDragFromOtherEditor = null;\n\t});\n\treturn rules.map((rule) => {\n\t\treturn new Plugin({\n\t\t\tview(view) {\n\t\t\t\tconst handleDragstart = (event) => {\n\t\t\t\t\tvar _view$dom$parentEleme;\n\t\t\t\t\tdragSourceElement = ((_view$dom$parentEleme = view.dom.parentElement) === null || _view$dom$parentEleme === void 0 ? void 0 : _view$dom$parentEleme.contains(event.target)) ? view.dom.parentElement : null;\n\t\t\t\t\tif (dragSourceElement) tiptapDragFromOtherEditor = editor;\n\t\t\t\t};\n\t\t\t\tconst handleDragend = () => {\n\t\t\t\t\tif (tiptapDragFromOtherEditor) tiptapDragFromOtherEditor = null;\n\t\t\t\t};\n\t\t\t\twindow.addEventListener(\"dragstart\", handleDragstart);\n\t\t\t\twindow.addEventListener(\"dragend\", handleDragend);\n\t\t\t\treturn { destroy() {\n\t\t\t\t\twindow.removeEventListener(\"dragstart\", handleDragstart);\n\t\t\t\t\twindow.removeEventListener(\"dragend\", handleDragend);\n\t\t\t\t} };\n\t\t\t},\n\t\t\tprops: { handleDOMEvents: {\n\t\t\t\tdrop: (view, event) => {\n\t\t\t\t\tisDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;\n\t\t\t\t\tdropEvent = event;\n\t\t\t\t\tif (!isDroppedFromProseMirror) {\n\t\t\t\t\t\tconst dragFromOtherEditor = tiptapDragFromOtherEditor;\n\t\t\t\t\t\tif (dragFromOtherEditor === null || dragFromOtherEditor === void 0 ? void 0 : dragFromOtherEditor.isEditable) setTimeout(() => {\n\t\t\t\t\t\t\tif (dragFromOtherEditor.isDestroyed) return;\n\t\t\t\t\t\t\tconst selection = dragFromOtherEditor.state.selection;\n\t\t\t\t\t\t\tif (selection) dragFromOtherEditor.commands.deleteRange({\n\t\t\t\t\t\t\t\tfrom: selection.from,\n\t\t\t\t\t\t\t\tto: selection.to\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tpaste: (_view, event) => {\n\t\t\t\t\tvar _clipboardData;\n\t\t\t\t\tconst html = (_clipboardData = event.clipboardData) === null || _clipboardData === void 0 ? void 0 : _clipboardData.getData(\"text/html\");\n\t\t\t\t\tpasteEvent = event;\n\t\t\t\t\tisPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes(\"data-pm-slice\"));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} },\n\t\t\tappendTransaction: (transactions, oldState, state) => {\n\t\t\t\tconst transaction = transactions[0];\n\t\t\t\tconst isPaste = transaction.getMeta(\"uiEvent\") === \"paste\" && !isPastedFromProseMirror;\n\t\t\t\tconst isDrop = transaction.getMeta(\"uiEvent\") === \"drop\" && !isDroppedFromProseMirror;\n\t\t\t\tconst simulatedPasteMeta = transaction.getMeta(\"applyPasteRules\");\n\t\t\t\tconst isSimulatedPaste = !!simulatedPasteMeta;\n\t\t\t\tif (!isPaste && !isDrop && !isSimulatedPaste) return;\n\t\t\t\tif (isSimulatedPaste) {\n\t\t\t\t\tlet { text } = simulatedPasteMeta;\n\t\t\t\t\tif (typeof text === \"string\") text = text;\n\t\t\t\t\telse text = getHTMLFromFragment(Fragment$1.from(text), state.schema);\n\t\t\t\t\tconst { from } = simulatedPasteMeta;\n\t\t\t\t\tconst to = from + text.length;\n\t\t\t\t\tconst pasteEvt = createClipboardPasteEvent(text);\n\t\t\t\t\treturn processEvent({\n\t\t\t\t\t\trule,\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto: { b: to },\n\t\t\t\t\t\tpasteEvt\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst from = oldState.doc.content.findDiffStart(state.doc.content);\n\t\t\t\tconst to = oldState.doc.content.findDiffEnd(state.doc.content);\n\t\t\t\tif (!isNumber(from) || !to || from === to.b) return;\n\t\t\t\treturn processEvent({\n\t\t\t\t\trule,\n\t\t\t\t\tstate,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\tpasteEvt: pasteEvent\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n}\n//#endregion\n//#region src/ExtensionManager.ts\nvar ExtensionManager = class {\n\tconstructor(extensions, editor) {\n\t\tthis.splittableMarks = [];\n\t\tthis.nonClearableMarks = [];\n\t\tthis.decorationManager = null;\n\t\tthis.editor = editor;\n\t\tthis.baseExtensions = extensions;\n\t\tthis.extensions = resolveExtensions(extensions);\n\t\tthis.hasSchemaSpec = editor.options.schemaSpec !== void 0;\n\t\tthis.schema = getSchemaByResolvedExtensions(this.extensions, editor, editor.options.schemaSpec);\n\t\tthis.setupExtensions();\n\t}\n\t/**\n\t* Get all commands from the extensions.\n\t* @returns An object with all commands where the key is the command name and the value is the command function\n\t*/\n\tget commands() {\n\t\treturn this.extensions.reduce((commands, extension) => {\n\t\t\tconst addCommands = getExtensionField(extension, \"addCommands\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor: this.editor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addCommands) return commands;\n\t\t\treturn {\n\t\t\t\t...commands,\n\t\t\t\t...addCommands()\n\t\t\t};\n\t\t}, {});\n\t}\n\t/**\n\t* Get all registered Prosemirror plugins from the extensions.\n\t* @returns An array of Prosemirror plugins\n\t*/\n\tget plugins() {\n\t\tconst { editor } = this;\n\t\tconst allPlugins = sortExtensions([...this.extensions].reverse()).flatMap((extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tconst plugins = [];\n\t\t\tconst addKeyboardShortcuts = getExtensionField(extension, \"addKeyboardShortcuts\", context);\n\t\t\tlet defaultBindings = {};\n\t\t\tif (extension.type === \"mark\" && getExtensionField(extension, \"exitable\", context)) defaultBindings.ArrowRight = () => Mark.handleExit({\n\t\t\t\teditor,\n\t\t\t\tmark: extension\n\t\t\t});\n\t\t\tif (addKeyboardShortcuts) {\n\t\t\t\tconst bindings = Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {\n\t\t\t\t\treturn [shortcut, () => method({ editor })];\n\t\t\t\t}));\n\t\t\t\tdefaultBindings = {\n\t\t\t\t\t...defaultBindings,\n\t\t\t\t\t...bindings\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst keyMapPlugin = keymap(defaultBindings);\n\t\t\tplugins.push(keyMapPlugin);\n\t\t\tconst addInputRules = getExtensionField(extension, \"addInputRules\", context);\n\t\t\tif (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {\n\t\t\t\tconst rules = addInputRules();\n\t\t\t\tif (rules && rules.length) {\n\t\t\t\t\tconst inputResult = inputRulesPlugin({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\trules\n\t\t\t\t\t});\n\t\t\t\t\tconst inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];\n\t\t\t\t\tplugins.push(...inputPlugins);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst addPasteRules = getExtensionField(extension, \"addPasteRules\", context);\n\t\t\tif (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {\n\t\t\t\tconst rules = addPasteRules();\n\t\t\t\tif (rules && rules.length) {\n\t\t\t\t\tconst pasteRules = pasteRulesPlugin({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\trules\n\t\t\t\t\t});\n\t\t\t\t\tplugins.push(...pasteRules);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst addProseMirrorPlugins = getExtensionField(extension, \"addProseMirrorPlugins\", context);\n\t\t\tif (addProseMirrorPlugins) {\n\t\t\t\tconst proseMirrorPlugins = addProseMirrorPlugins();\n\t\t\t\tplugins.push(...proseMirrorPlugins);\n\t\t\t}\n\t\t\treturn plugins;\n\t\t});\n\t\tconst decorationPlugin = this.createDecorationPlugin();\n\t\tif (decorationPlugin) allPlugins.push(decorationPlugin);\n\t\treturn allPlugins;\n\t}\n\t/**\n\t* Aggregates decorations from extensions into a single plugin, or returns null\n\t* if none exist. Destroys the previous manager to avoid orphaned listeners.\n\t* @returns A ProseMirror plugin or `null`\n\t* @example\n\t* const plugin = editor.extensionManager.createDecorationPlugin()\n\t*/\n\tcreateDecorationPlugin() {\n\t\tvar _this$decorationManag;\n\t\tconst { editor } = this;\n\t\t(_this$decorationManag = this.decorationManager) === null || _this$decorationManag === void 0 || _this$decorationManag.destroy();\n\t\tconst entries = [];\n\t\tthis.extensions.forEach((extension) => {\n\t\t\tconst addDecorations = getExtensionField(extension, \"addDecorations\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addDecorations) return;\n\t\t\tentries.push({\n\t\t\t\tname: extension.name,\n\t\t\t\taddDecorations\n\t\t\t});\n\t\t});\n\t\tthis.decorationManager = new DecorationManager({\n\t\t\teditor,\n\t\t\tentries\n\t\t});\n\t\treturn this.decorationManager.plugin;\n\t}\n\t/**\n\t* Get all attributes from the extensions.\n\t* @returns An array of attributes\n\t*/\n\tget attributes() {\n\t\tconst attributes = getAttributesFromExtensions(this.extensions);\n\t\treturn this.hasSchemaSpec ? getSchemaAttributes(attributes, this.schema) : attributes;\n\t}\n\t/**\n\t* Get all node views from the extensions.\n\t* @returns An object with all node views where the key is the node name and the value is the node view function\n\t*/\n\tget nodeViews() {\n\t\tconst { editor } = this;\n\t\tconst { nodeExtensions } = splitExtensions(this.extensions);\n\t\treturn Object.fromEntries(nodeExtensions.filter((extension) => !!getExtensionField(extension, \"addNodeView\")).map((extension) => {\n\t\t\tconst extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);\n\t\t\tconst addNodeView = getExtensionField(extension, \"addNodeView\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getNodeType(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addNodeView) return [];\n\t\t\tconst nodeViewResult = addNodeView();\n\t\t\tif (!nodeViewResult) return [];\n\t\t\tconst nodeview = (node, view, getPos, decorations, innerDecorations) => {\n\t\t\t\tconst HTMLAttributes = getRenderedAttributes(node, extensionAttributes);\n\t\t\t\treturn nodeViewResult({\n\t\t\t\t\tnode,\n\t\t\t\t\tview,\n\t\t\t\t\tgetPos,\n\t\t\t\t\tdecorations,\n\t\t\t\t\tinnerDecorations,\n\t\t\t\t\teditor,\n\t\t\t\t\textension,\n\t\t\t\t\tHTMLAttributes\n\t\t\t\t});\n\t\t\t};\n\t\t\treturn [extension.name, nodeview];\n\t\t}));\n\t}\n\t/**\n\t* Get the composed dispatchTransaction function from all extensions.\n\t* @param baseDispatch The base dispatch function (e.g. from the editor or user props)\n\t* @returns A composed dispatch function\n\t*/\n\tdispatchTransaction(baseDispatch) {\n\t\tconst { editor } = this;\n\t\treturn sortExtensions([...this.extensions].reverse()).reduceRight((next, extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tconst dispatchTransaction = getExtensionField(extension, \"dispatchTransaction\", context);\n\t\t\tif (!dispatchTransaction) return next;\n\t\t\treturn (transaction) => {\n\t\t\t\tdispatchTransaction.call(context, {\n\t\t\t\t\ttransaction,\n\t\t\t\t\tnext\n\t\t\t\t});\n\t\t\t};\n\t\t}, baseDispatch);\n\t}\n\t/**\n\t* Get the composed transformPastedHTML function from all extensions.\n\t* @param baseTransform The base transform function (e.g. from the editor props)\n\t* @returns A composed transform function that chains all extension transforms\n\t*/\n\ttransformPastedHTML(baseTransform) {\n\t\tconst { editor } = this;\n\t\treturn sortExtensions([...this.extensions]).reduce((transform, extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tconst extensionTransform = getExtensionField(extension, \"transformPastedHTML\", context);\n\t\t\tif (!extensionTransform) return transform;\n\t\t\treturn (html, view) => {\n\t\t\t\tconst transformedHtml = transform(html, view);\n\t\t\t\treturn extensionTransform.call(context, transformedHtml);\n\t\t\t};\n\t\t}, baseTransform || ((html) => html));\n\t}\n\tget markViews() {\n\t\tconst { editor } = this;\n\t\tconst { markExtensions } = splitExtensions(this.extensions);\n\t\treturn Object.fromEntries(markExtensions.filter((extension) => !!getExtensionField(extension, \"addMarkView\")).map((extension) => {\n\t\t\tconst extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);\n\t\t\tconst addMarkView = getExtensionField(extension, \"addMarkView\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getMarkType(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addMarkView) return [];\n\t\t\tconst markView = (mark, view, inline) => {\n\t\t\t\tconst HTMLAttributes = getRenderedAttributes(mark, extensionAttributes);\n\t\t\t\treturn addMarkView()({\n\t\t\t\t\tmark,\n\t\t\t\t\tview,\n\t\t\t\t\tinline,\n\t\t\t\t\teditor,\n\t\t\t\t\textension,\n\t\t\t\t\tHTMLAttributes,\n\t\t\t\t\tupdateAttributes: (attrs) => {\n\t\t\t\t\t\tupdateMarkViewAttributes(mark, editor, attrs);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t\treturn [extension.name, markView];\n\t\t}));\n\t}\n\t/**\n\t* Destroy the extension manager and clean up all extension references\n\t* to prevent memory leaks through parent/child extension chains.\n\t*\n\t* Walks each extension's full parent chain and nulls every forward\n\t* `parent.child → current` link where the parent still points to the\n\t* current node. This breaks the retention path from module-scope\n\t* singleton roots through deep extend() chains.\n\t*\n\t* Only ancestor `.child` links matching the current chain are cleared.\n\t* The `.parent` pointer on ancestors is never touched — extensions\n\t* may be shared across live editors, so their own backward references\n\t* and non-matching forward links must remain intact.\n\t*/\n\tdestroy() {\n\t\tvar _this$decorationManag2;\n\t\t(_this$decorationManag2 = this.decorationManager) === null || _this$decorationManag2 === void 0 || _this$decorationManag2.destroy();\n\t\tthis.extensions.forEach((extension) => {\n\t\t\tlet current = extension;\n\t\t\twhile (current.parent) {\n\t\t\t\tconst parent = current.parent;\n\t\t\t\tif (parent.child === current) parent.child = null;\n\t\t\t\tcurrent = parent;\n\t\t\t}\n\t\t});\n\t\tthis.extensions = [];\n\t\tthis.baseExtensions = [];\n\t\tthis.decorationManager = null;\n\t\tthis.schema = null;\n\t\tthis.editor = null;\n\t}\n\t/**\n\t* Go through all extensions, create extension storages & setup marks\n\t* & bind editor event listener.\n\t*/\n\tsetupExtensions() {\n\t\tconst extensions = this.extensions;\n\t\tthis.editor.extensionStorage = Object.fromEntries(extensions.map((extension) => [extension.name, extension.storage]));\n\t\textensions.forEach((extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor: this.editor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tif (extension.type === \"mark\") {\n\t\t\t\tvar _callOrReturn, _callOrReturn2;\n\t\t\t\tif ((_callOrReturn = callOrReturn(getExtensionField(extension, \"keepOnSplit\", context))) !== null && _callOrReturn !== void 0 ? _callOrReturn : true) this.splittableMarks.push(extension.name);\n\t\t\t\tif (!((_callOrReturn2 = callOrReturn(getExtensionField(extension, \"clearable\", context))) !== null && _callOrReturn2 !== void 0 ? _callOrReturn2 : true)) this.nonClearableMarks.push(extension.name);\n\t\t\t}\n\t\t\tconst onBeforeCreate = getExtensionField(extension, \"onBeforeCreate\", context);\n\t\t\tconst onCreate = getExtensionField(extension, \"onCreate\", context);\n\t\t\tconst onUpdate = getExtensionField(extension, \"onUpdate\", context);\n\t\t\tconst onSelectionUpdate = getExtensionField(extension, \"onSelectionUpdate\", context);\n\t\t\tconst onTransaction = getExtensionField(extension, \"onTransaction\", context);\n\t\t\tconst onFocus = getExtensionField(extension, \"onFocus\", context);\n\t\t\tconst onBlur = getExtensionField(extension, \"onBlur\", context);\n\t\t\tconst onDestroy = getExtensionField(extension, \"onDestroy\", context);\n\t\t\tif (onBeforeCreate) this.editor.on(\"beforeCreate\", onBeforeCreate);\n\t\t\tif (onCreate) this.editor.on(\"create\", onCreate);\n\t\t\tif (onUpdate) this.editor.on(\"update\", onUpdate);\n\t\t\tif (onSelectionUpdate) this.editor.on(\"selectionUpdate\", onSelectionUpdate);\n\t\t\tif (onTransaction) this.editor.on(\"transaction\", onTransaction);\n\t\t\tif (onFocus) this.editor.on(\"focus\", onFocus);\n\t\t\tif (onBlur) this.editor.on(\"blur\", onBlur);\n\t\t\tif (onDestroy) this.editor.on(\"destroy\", onDestroy);\n\t\t});\n\t}\n};\nExtensionManager.resolve = resolveExtensions;\nExtensionManager.sort = sortExtensions;\nExtensionManager.flatten = flattenExtensions;\n//#endregion\n//#region src/Extension.ts\n/**\n* The Extension class is the base class for all extensions.\n* @see https://tiptap.dev/api/extensions#create-a-new-extension\n*/\nvar Extension = class Extension extends Extendable {\n\tconstructor(..._args) {\n\t\tsuper(..._args);\n\t\tthis.type = \"extension\";\n\t}\n\t/**\n\t* Create a new Extension instance\n\t* @param config - Extension configuration object or a function that returns a configuration object\n\t*/\n\tstatic create(config = {}) {\n\t\tconst resolvedConfig = typeof config === \"function\" ? config() : config;\n\t\treturn new Extension(resolvedConfig);\n\t}\n\tconfigure(options) {\n\t\treturn super.configure(options);\n\t}\n\textend(extendedConfig) {\n\t\tconst resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n\t\treturn super.extend(resolvedConfig);\n\t}\n};\n//#endregion\n//#region src/extensions/clipboardTextSerializer.ts\nconst ClipboardTextSerializer = Extension.create({\n\tname: \"clipboardTextSerializer\",\n\taddOptions() {\n\t\treturn { blockSeparator: void 0 };\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"clipboardTextSerializer\"),\n\t\t\tprops: { clipboardTextSerializer: () => {\n\t\t\t\tconst { editor } = this;\n\t\t\t\tconst { state, schema } = editor;\n\t\t\t\tconst { doc, selection } = state;\n\t\t\t\tconst textSerializers = getTextSerializersFromSchema(schema);\n\t\t\t\tconst { blockSeparator } = this.options;\n\t\t\t\tconst options = {\n\t\t\t\t\t...blockSeparator !== void 0 ? { blockSeparator } : {},\n\t\t\t\t\ttextSerializers\n\t\t\t\t};\n\t\t\t\treturn [...selection.ranges].sort((a, b) => a.$from.pos - b.$from.pos).map(({ $from, $to }) => getTextBetween(doc, {\n\t\t\t\t\tfrom: $from.pos,\n\t\t\t\t\tto: $to.pos\n\t\t\t\t}, options)).join(blockSeparator !== null && blockSeparator !== void 0 ? blockSeparator : \"\\n\\n\");\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/commands.ts\nconst Commands = Extension.create({\n\tname: \"commands\",\n\taddCommands() {\n\t\treturn { ...commands_exports };\n\t}\n});\n//#endregion\n//#region src/extensions/delete.ts\n/**\n* This extension allows you to be notified when the user deletes content you are interested in.\n*/\nconst Delete = Extension.create({\n\tname: \"delete\",\n\tonUpdate({ transaction, appendedTransactions }) {\n\t\tvar _this$editor$options$4, _this$editor$options$5;\n\t\tconst callback = () => {\n\t\t\tvar _this$editor$options$, _this$editor$options$2, _this$editor$options$3;\n\t\t\tif ((_this$editor$options$ = (_this$editor$options$2 = this.editor.options.coreExtensionOptions) === null || _this$editor$options$2 === void 0 || (_this$editor$options$2 = _this$editor$options$2.delete) === null || _this$editor$options$2 === void 0 || (_this$editor$options$3 = _this$editor$options$2.filterTransaction) === null || _this$editor$options$3 === void 0 ? void 0 : _this$editor$options$3.call(_this$editor$options$2, transaction)) !== null && _this$editor$options$ !== void 0 ? _this$editor$options$ : transaction.getMeta(\"y-sync$\")) return;\n\t\t\tconst nextTransaction = combineTransactionSteps(transaction.before, [transaction, ...appendedTransactions]);\n\t\t\tgetChangedRanges(nextTransaction).forEach((change) => {\n\t\t\t\tif (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) nextTransaction.before.nodesBetween(change.oldRange.from, change.oldRange.to, (node, from) => {\n\t\t\t\t\tconst to = from + node.nodeSize - 2;\n\t\t\t\t\tconst isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;\n\t\t\t\t\tthis.editor.emit(\"delete\", {\n\t\t\t\t\t\ttype: \"node\",\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto,\n\t\t\t\t\t\tnewFrom: nextTransaction.mapping.map(from),\n\t\t\t\t\t\tnewTo: nextTransaction.mapping.map(to),\n\t\t\t\t\t\tdeletedRange: change.oldRange,\n\t\t\t\t\t\tnewRange: change.newRange,\n\t\t\t\t\t\tpartial: !isFullyWithinRange,\n\t\t\t\t\t\teditor: this.editor,\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\tcombinedTransform: nextTransaction\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst mapping = nextTransaction.mapping;\n\t\t\tnextTransaction.steps.forEach((step, index) => {\n\t\t\t\tif (step instanceof RemoveMarkStep) {\n\t\t\t\t\tvar _nextTransaction$doc$, _nextTransaction$doc$2;\n\t\t\t\t\tconst newStart = mapping.slice(index).map(step.from, -1);\n\t\t\t\t\tconst newEnd = mapping.slice(index).map(step.to);\n\t\t\t\t\tconst oldStart = mapping.invert().map(newStart, -1);\n\t\t\t\t\tconst oldEnd = mapping.invert().map(newEnd);\n\t\t\t\t\tconst foundBeforeMark = newStart > 0 ? (_nextTransaction$doc$ = nextTransaction.doc.nodeAt(newStart - 1)) === null || _nextTransaction$doc$ === void 0 ? void 0 : _nextTransaction$doc$.marks.some((mark) => mark.eq(step.mark)) : false;\n\t\t\t\t\tconst foundAfterMark = (_nextTransaction$doc$2 = nextTransaction.doc.nodeAt(newEnd)) === null || _nextTransaction$doc$2 === void 0 ? void 0 : _nextTransaction$doc$2.marks.some((mark) => mark.eq(step.mark));\n\t\t\t\t\tthis.editor.emit(\"delete\", {\n\t\t\t\t\t\ttype: \"mark\",\n\t\t\t\t\t\tmark: step.mark,\n\t\t\t\t\t\tfrom: step.from,\n\t\t\t\t\t\tto: step.to,\n\t\t\t\t\t\tdeletedRange: {\n\t\t\t\t\t\t\tfrom: oldStart,\n\t\t\t\t\t\t\tto: oldEnd\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnewRange: {\n\t\t\t\t\t\t\tfrom: newStart,\n\t\t\t\t\t\t\tto: newEnd\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpartial: Boolean(foundAfterMark || foundBeforeMark),\n\t\t\t\t\t\teditor: this.editor,\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\tcombinedTransform: nextTransaction\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tif ((_this$editor$options$4 = (_this$editor$options$5 = this.editor.options.coreExtensionOptions) === null || _this$editor$options$5 === void 0 || (_this$editor$options$5 = _this$editor$options$5.delete) === null || _this$editor$options$5 === void 0 ? void 0 : _this$editor$options$5.async) !== null && _this$editor$options$4 !== void 0 ? _this$editor$options$4 : true) setTimeout(callback, 0);\n\t\telse callback();\n\t}\n});\n//#endregion\n//#region src/extensions/drop.ts\nconst Drop = Extension.create({\n\tname: \"drop\",\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"tiptapDrop\"),\n\t\t\tprops: { handleDrop: (_, e, slice, moved) => {\n\t\t\t\tthis.editor.emit(\"drop\", {\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tevent: e,\n\t\t\t\t\tslice,\n\t\t\t\t\tmoved\n\t\t\t\t});\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/editable.ts\nconst Editable = Extension.create({\n\tname: \"editable\",\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"editable\"),\n\t\t\tprops: { editable: () => this.editor.options.editable }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/focusEvents.ts\nconst focusEventsPluginKey = new PluginKey(\"focusEvents\");\nconst FocusEvents = Extension.create({\n\tname: \"focusEvents\",\n\taddProseMirrorPlugins() {\n\t\tconst { editor } = this;\n\t\treturn [new Plugin({\n\t\t\tkey: focusEventsPluginKey,\n\t\t\tprops: { handleDOMEvents: {\n\t\t\t\tfocus: (view, event) => {\n\t\t\t\t\teditor.isFocused = true;\n\t\t\t\t\tconst transaction = editor.state.tr.setMeta(\"focus\", { event }).setMeta(\"addToHistory\", false);\n\t\t\t\t\tview.dispatch(transaction);\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tblur: (view, event) => {\n\t\t\t\t\teditor.isFocused = false;\n\t\t\t\t\tconst transaction = editor.state.tr.setMeta(\"blur\", { event }).setMeta(\"addToHistory\", false);\n\t\t\t\t\tview.dispatch(transaction);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/keymap.ts\nconst Keymap = Extension.create({\n\tname: \"keymap\",\n\taddKeyboardShortcuts() {\n\t\tconst handleBackspace = () => this.editor.commands.first(({ commands }) => [\n\t\t\t() => commands.undoInputRule(),\n\t\t\t() => commands.command(({ tr }) => {\n\t\t\t\tconst { selection, doc } = tr;\n\t\t\t\tconst { empty, $anchor } = selection;\n\t\t\t\tconst { pos, parent } = $anchor;\n\t\t\t\tconst $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;\n\t\t\t\tconst parentIsIsolating = $parentPos.parent.type.spec.isolating;\n\t\t\t\tconst parentPos = $anchor.pos - $anchor.parentOffset;\n\t\t\t\tconst isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;\n\t\t\t\tif (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === \"paragraph\") return false;\n\t\t\t\treturn commands.clearNodes();\n\t\t\t}),\n\t\t\t() => commands.deleteSelection(),\n\t\t\t() => commands.joinBackward(),\n\t\t\t() => commands.selectNodeBackward()\n\t\t]);\n\t\tconst handleDelete = () => this.editor.commands.first(({ commands }) => [\n\t\t\t() => commands.deleteSelection(),\n\t\t\t() => commands.deleteCurrentNode(),\n\t\t\t() => commands.joinForward(),\n\t\t\t() => commands.selectNodeForward()\n\t\t]);\n\t\tconst handleEnter = () => this.editor.commands.first(({ commands }) => [\n\t\t\t() => commands.newlineInCode(),\n\t\t\t() => commands.createParagraphNear(),\n\t\t\t() => commands.liftEmptyBlock(),\n\t\t\t() => commands.splitBlock()\n\t\t]);\n\t\tconst baseKeymap = {\n\t\t\tEnter: handleEnter,\n\t\t\t\"Mod-Enter\": () => this.editor.commands.exitCode(),\n\t\t\tBackspace: handleBackspace,\n\t\t\t\"Mod-Backspace\": handleBackspace,\n\t\t\t\"Shift-Backspace\": handleBackspace,\n\t\t\tDelete: handleDelete,\n\t\t\t\"Mod-Delete\": handleDelete,\n\t\t\t\"Mod-a\": () => this.editor.commands.selectAll()\n\t\t};\n\t\tconst pcKeymap = { ...baseKeymap };\n\t\tconst macKeymap = {\n\t\t\t...baseKeymap,\n\t\t\t\"Ctrl-h\": handleBackspace,\n\t\t\t\"Alt-Backspace\": handleBackspace,\n\t\t\t\"Ctrl-d\": handleDelete,\n\t\t\t\"Ctrl-Alt-Backspace\": handleDelete,\n\t\t\t\"Alt-Delete\": handleDelete,\n\t\t\t\"Alt-d\": handleDelete,\n\t\t\t\"Ctrl-a\": () => this.editor.commands.selectTextblockStart(),\n\t\t\t\"Ctrl-e\": () => this.editor.commands.selectTextblockEnd()\n\t\t};\n\t\tif (isiOS() || isMacOS()) return macKeymap;\n\t\treturn pcKeymap;\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"clearDocument\"),\n\t\t\tappendTransaction: (transactions, oldState, newState) => {\n\t\t\t\tif (transactions.some((tr) => tr.getMeta(\"composition\"))) return;\n\t\t\t\tconst docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);\n\t\t\t\tconst ignoreTr = transactions.some((transaction) => transaction.getMeta(\"preventClearDocument\"));\n\t\t\t\tif (!docChanges || ignoreTr) return;\n\t\t\t\tconst { empty, from, to } = oldState.selection;\n\t\t\t\tconst allFrom = Selection.atStart(oldState.doc).from;\n\t\t\t\tconst allEnd = Selection.atEnd(oldState.doc).to;\n\t\t\t\tif (empty || !(from === allFrom && to === allEnd)) return;\n\t\t\t\tif (!isNodeEmpty(newState.doc)) return;\n\t\t\t\tconst tr = newState.tr;\n\t\t\t\tconst state = createChainableState({\n\t\t\t\t\tstate: newState,\n\t\t\t\t\ttransaction: tr\n\t\t\t\t});\n\t\t\t\tconst { commands } = new CommandManager({\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tstate\n\t\t\t\t});\n\t\t\t\tcommands.clearNodes();\n\t\t\t\tif (!tr.steps.length) return;\n\t\t\t\treturn tr;\n\t\t\t}\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/paste.ts\nconst Paste = Extension.create({\n\tname: \"paste\",\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"tiptapPaste\"),\n\t\t\tprops: { handlePaste: (_view, e, slice) => {\n\t\t\t\tthis.editor.emit(\"paste\", {\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tevent: e,\n\t\t\t\t\tslice\n\t\t\t\t});\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/tabindex.ts\n/**\n* The Tabindex extension adds a configurable tabindex attribute to the editor.\n*\n* By default, the editor gets tabindex=\"0\" when editable. This can be customized\n* via coreExtensionOptions to support specific focus ordering requirements in forms\n* or to enable focusing on non-editable editors.\n*\n* @example\n* ```ts\n* new Editor({\n* coreExtensionOptions: {\n* tabindex: {\n* value: '-1',\n* },\n* },\n* })\n* ```\n*/\nconst Tabindex = Extension.create({\n\tname: \"tabindex\",\n\taddOptions() {\n\t\treturn { value: void 0 };\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"tabindex\"),\n\t\t\tprops: { attributes: () => {\n\t\t\t\tvar _this$options$value;\n\t\t\t\tif (!this.editor.isEditable && this.options.value === void 0) return {};\n\t\t\t\treturn { tabindex: (_this$options$value = this.options.value) !== null && _this$options$value !== void 0 ? _this$options$value : \"0\" };\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/textDirection.ts\n/**\n* The TextDirection extension adds support for setting text direction (LTR/RTL/auto)\n* on all nodes in the editor.\n*\n* This extension adds a global `dir` attribute to all node types, which can be used\n* to control bidirectional text rendering. The direction can be set globally via\n* editor options or per-node using commands.\n*/\nconst TextDirection = Extension.create({\n\tname: \"textDirection\",\n\taddOptions() {\n\t\treturn { direction: void 0 };\n\t},\n\taddGlobalAttributes() {\n\t\tif (!this.options.direction) return [];\n\t\tconst { nodeExtensions } = splitExtensions(this.extensions);\n\t\treturn [{\n\t\t\ttypes: nodeExtensions.filter((extension) => extension.name !== \"text\").map((extension) => extension.name),\n\t\t\tattributes: { dir: {\n\t\t\t\tdefault: this.options.direction,\n\t\t\t\tparseHTML: (element) => {\n\t\t\t\t\tconst dir = element.getAttribute(\"dir\");\n\t\t\t\t\tif (dir && (dir === \"ltr\" || dir === \"rtl\" || dir === \"auto\")) return dir;\n\t\t\t\t\treturn this.options.direction;\n\t\t\t\t},\n\t\t\t\trenderHTML: (attributes) => {\n\t\t\t\t\tif (!attributes.dir) return {};\n\t\t\t\t\treturn { dir: attributes.dir };\n\t\t\t\t}\n\t\t\t} }\n\t\t}];\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"textDirection\"),\n\t\t\tprops: { attributes: () => {\n\t\t\t\tconst direction = this.options.direction;\n\t\t\t\tif (!direction) return {};\n\t\t\t\treturn { dir: direction };\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/index.ts\nvar extensions_exports = /* @__PURE__ */ __exportAll({\n\tClipboardTextSerializer: () => ClipboardTextSerializer,\n\tCommands: () => Commands,\n\tDelete: () => Delete,\n\tDrop: () => Drop,\n\tEditable: () => Editable,\n\tFocusEvents: () => FocusEvents,\n\tKeymap: () => Keymap,\n\tPaste: () => Paste,\n\tTabindex: () => Tabindex,\n\tTextDirection: () => TextDirection,\n\tfocusEventsPluginKey: () => focusEventsPluginKey\n});\n//#endregion\n//#region src/helpers/warnOnDuplicatedProseMirrorModel.ts\nlet hasChecked = false;\n/**\n* Warns once when prosemirror-model is loaded twice\n* @param schema The editor schema\n* @returns void\n* @example ```js\n* warnOnDuplicatedProseMirrorModel(editor.schema)\n* ```\n*/\nfunction warnOnDuplicatedProseMirrorModel(schema) {\n\tif (hasChecked) return;\n\thasChecked = true;\n\tlet content;\n\ttry {\n\t\tconst step = ReplaceStep.fromJSON(schema, {\n\t\t\tfrom: 0,\n\t\t\tto: 0\n\t\t});\n\t\tif (!isProseMirrorReplaceStep(step)) return;\n\t\tcontent = step.slice.content;\n\t} catch {\n\t\treturn;\n\t}\n\tif (content instanceof Fragment$1) return;\n\tconsole.warn(\"[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.\");\n}\n//#endregion\n//#region src/NodePos.ts\nvar NodePos = class NodePos {\n\tget name() {\n\t\treturn this.node.type.name;\n\t}\n\tconstructor(pos, editor, isBlock = false, node = null) {\n\t\tthis.currentNode = null;\n\t\tthis.actualDepth = null;\n\t\tthis.isBlock = isBlock;\n\t\tthis.resolvedPos = pos;\n\t\tthis.editor = editor;\n\t\tthis.currentNode = node;\n\t}\n\tget node() {\n\t\treturn this.currentNode || this.resolvedPos.node();\n\t}\n\tget element() {\n\t\treturn this.editor.view.domAtPos(this.pos).node;\n\t}\n\tget depth() {\n\t\tvar _this$actualDepth;\n\t\treturn (_this$actualDepth = this.actualDepth) !== null && _this$actualDepth !== void 0 ? _this$actualDepth : this.resolvedPos.depth;\n\t}\n\tget pos() {\n\t\treturn this.resolvedPos.pos;\n\t}\n\tget content() {\n\t\treturn this.node.content;\n\t}\n\tset content(content) {\n\t\tlet from = this.from;\n\t\tlet to = this.to;\n\t\tif (this.isBlock) {\n\t\t\tif (this.content.size === 0) {\n\t\t\t\tconsole.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfrom = this.from + 1;\n\t\t\tto = this.to - 1;\n\t\t}\n\t\tthis.editor.commands.insertContentAt({\n\t\t\tfrom,\n\t\t\tto\n\t\t}, content);\n\t}\n\tget attributes() {\n\t\treturn this.node.attrs;\n\t}\n\tget textContent() {\n\t\treturn this.node.textContent;\n\t}\n\tget size() {\n\t\treturn this.node.nodeSize;\n\t}\n\tget from() {\n\t\tif (this.isBlock) return this.pos;\n\t\treturn this.resolvedPos.start(this.resolvedPos.depth);\n\t}\n\tget range() {\n\t\treturn {\n\t\t\tfrom: this.from,\n\t\t\tto: this.to\n\t\t};\n\t}\n\tget to() {\n\t\tif (this.isBlock) return this.pos + this.size;\n\t\treturn this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);\n\t}\n\tget parent() {\n\t\tif (this.depth === 0) return null;\n\t\tconst parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);\n\t\tconst $pos = this.resolvedPos.doc.resolve(parentPos);\n\t\treturn new NodePos($pos, this.editor);\n\t}\n\tget before() {\n\t\tlet $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));\n\t\tif ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.from - 3);\n\t\treturn new NodePos($pos, this.editor);\n\t}\n\tget after() {\n\t\tlet $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));\n\t\tif ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.to + 3);\n\t\treturn new NodePos($pos, this.editor);\n\t}\n\tget children() {\n\t\tconst children = [];\n\t\tthis.node.content.forEach((node, offset) => {\n\t\t\tconst isBlock = node.isBlock && !node.isTextblock;\n\t\t\tconst isNonTextAtom = node.isAtom && !node.isText;\n\t\t\tconst isInline = node.isInline;\n\t\t\tconst targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);\n\t\t\tif (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) return;\n\t\t\tconst $pos = this.resolvedPos.doc.resolve(targetPos);\n\t\t\tif (!isBlock && !isInline && $pos.depth <= this.depth) return;\n\t\t\tconst childNodePos = new NodePos($pos, this.editor, isBlock, isBlock || isInline ? node : null);\n\t\t\tif (isBlock) childNodePos.actualDepth = this.depth + 1;\n\t\t\tchildren.push(childNodePos);\n\t\t});\n\t\treturn children;\n\t}\n\tget firstChild() {\n\t\treturn this.children[0] || null;\n\t}\n\tget lastChild() {\n\t\tconst children = this.children;\n\t\treturn children[children.length - 1] || null;\n\t}\n\tclosest(selector, attributes = {}) {\n\t\tlet node = null;\n\t\tlet currentNode = this.parent;\n\t\twhile (currentNode && !node) {\n\t\t\tif (currentNode.node.type.name === selector) {\n\t\t\t\tif (Object.keys(attributes).length > 0) {\n\t\t\t\t\tconst nodeAttributes = currentNode.node.attrs;\n\t\t\t\t\tconst attrKeys = Object.keys(attributes);\n\t\t\t\t\tfor (let index = 0; index < attrKeys.length; index += 1) {\n\t\t\t\t\t\tconst key = attrKeys[index];\n\t\t\t\t\t\tif (nodeAttributes[key] !== attributes[key]) break;\n\t\t\t\t\t}\n\t\t\t\t} else node = currentNode;\n\t\t\t}\n\t\t\tcurrentNode = currentNode.parent;\n\t\t}\n\t\treturn node;\n\t}\n\tquerySelector(selector, attributes = {}) {\n\t\treturn this.querySelectorAll(selector, attributes, true)[0] || null;\n\t}\n\tquerySelectorAll(selector, attributes = {}, firstItemOnly = false) {\n\t\tlet nodes = [];\n\t\tif (!this.children || this.children.length === 0) return nodes;\n\t\tconst attrKeys = Object.keys(attributes);\n\t\t/**\n\t\t* Finds all children recursively that match the selector and attributes\n\t\t* If firstItemOnly is true, it will return the first item found\n\t\t*/\n\t\tthis.children.forEach((childPos) => {\n\t\t\tif (firstItemOnly && nodes.length > 0) return;\n\t\t\tif (childPos.node.type.name === selector) {\n\t\t\t\tif (attrKeys.every((key) => attributes[key] === childPos.node.attrs[key])) nodes.push(childPos);\n\t\t\t}\n\t\t\tif (firstItemOnly && nodes.length > 0) return;\n\t\t\tnodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));\n\t\t});\n\t\treturn nodes;\n\t}\n\tsetAttribute(attributes) {\n\t\tconst { tr } = this.editor.state;\n\t\ttr.setNodeMarkup(this.from, void 0, {\n\t\t\t...this.node.attrs,\n\t\t\t...attributes\n\t\t});\n\t\tthis.editor.view.dispatch(tr);\n\t}\n};\n//#endregion\n//#region src/style.ts\nconst style = `.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}`;\n//#endregion\n//#region src/Editor.ts\nvar Editor = class extends EventEmitter {\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tthis.css = null;\n\t\tthis.className = \"tiptap\";\n\t\tthis.editorView = null;\n\t\tthis.isFocused = false;\n\t\tthis.destroyed = false;\n\t\tthis.isInitialized = false;\n\t\tthis.extensionStorage = {};\n\t\tthis.instanceId = Math.random().toString(36).slice(2, 9);\n\t\tthis.hasWarnedStaleDecorationRead = false;\n\t\tthis.options = {\n\t\t\telement: typeof document !== \"undefined\" ? document.createElement(\"div\") : null,\n\t\t\tcontent: \"\",\n\t\t\tinjectCSS: true,\n\t\t\tinjectNonce: void 0,\n\t\t\textensions: [],\n\t\t\tautofocus: false,\n\t\t\teditable: true,\n\t\t\ttextDirection: void 0,\n\t\t\teditorProps: {},\n\t\t\tparseOptions: {},\n\t\t\tcoreExtensionOptions: {},\n\t\t\tenableInputRules: true,\n\t\t\tenablePasteRules: true,\n\t\t\tenableCoreExtensions: true,\n\t\t\tenableContentCheck: false,\n\t\t\temitContentError: false,\n\t\t\tonBeforeCreate: () => null,\n\t\t\tonCreate: () => null,\n\t\t\tonMount: () => null,\n\t\t\tonUnmount: () => null,\n\t\t\tonUpdate: () => null,\n\t\t\tonSelectionUpdate: () => null,\n\t\t\tonTransaction: () => null,\n\t\t\tonFocus: () => null,\n\t\t\tonBlur: () => null,\n\t\t\tonDestroy: () => null,\n\t\t\tonContentError: ({ error }) => {\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t\tonPaste: () => null,\n\t\t\tonDrop: () => null,\n\t\t\tonDelete: () => null,\n\t\t\tenableExtensionDispatchTransaction: true\n\t\t};\n\t\tthis.isCapturingTransaction = false;\n\t\tthis.capturedTransaction = null;\n\t\tthis.utils = {\n\t\t\tgetUpdatedPosition,\n\t\t\tcreateMappablePosition\n\t\t};\n\t\tthis.setOptions(options);\n\t\tthis.createExtensionManager();\n\t\tthis.createCommandManager();\n\t\tthis.createSchema();\n\t\tthis.on(\"beforeCreate\", this.options.onBeforeCreate);\n\t\tthis.emit(\"beforeCreate\", { editor: this });\n\t\tthis.on(\"mount\", this.options.onMount);\n\t\tthis.on(\"unmount\", this.options.onUnmount);\n\t\tthis.on(\"contentError\", this.options.onContentError);\n\t\tthis.on(\"create\", this.options.onCreate);\n\t\tthis.on(\"update\", this.options.onUpdate);\n\t\tthis.on(\"selectionUpdate\", this.options.onSelectionUpdate);\n\t\tthis.on(\"transaction\", this.options.onTransaction);\n\t\tthis.on(\"focus\", this.options.onFocus);\n\t\tthis.on(\"blur\", this.options.onBlur);\n\t\tthis.on(\"destroy\", this.options.onDestroy);\n\t\tthis.on(\"drop\", ({ event, slice, moved }) => this.options.onDrop(event, slice, moved));\n\t\tthis.on(\"paste\", ({ event, slice }) => this.options.onPaste(event, slice));\n\t\tthis.on(\"delete\", this.options.onDelete);\n\t\tconst initialDoc = this.createDoc();\n\t\tif (!this.editorState) {\n\t\t\tconst selection = resolveFocusPosition(initialDoc, this.options.autofocus);\n\t\t\tthis.editorState = EditorState.create({\n\t\t\t\tdoc: initialDoc,\n\t\t\t\tschema: this.schema,\n\t\t\t\tselection: selection || void 0\n\t\t\t});\n\t\t}\n\t\twarnOnDuplicatedProseMirrorModel(this.schema);\n\t\tif (this.options.element) this.mount(this.options.element);\n\t}\n\t/**\n\t* Attach the editor to the DOM, creating a new editor view.\n\t*/\n\tmount(el) {\n\t\tif (typeof document === \"undefined\") throw new Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);\n\t\tthis.createView(el);\n\t\tthis.emit(\"mount\", { editor: this });\n\t\tif (this.css && !document.head.contains(this.css)) document.head.appendChild(this.css);\n\t\twindow.setTimeout(() => {\n\t\t\tif (this.isDestroyed) return;\n\t\t\tif (this.options.autofocus !== false && this.options.autofocus !== null) this.commands.focus(this.options.autofocus);\n\t\t\tthis.emit(\"create\", { editor: this });\n\t\t\tthis.isInitialized = true;\n\t\t}, 0);\n\t}\n\t/**\n\t* Remove the editor from the DOM, but still allow remounting at a different point in time\n\t*/\n\tunmount() {\n\t\tif (this.editorView) {\n\t\t\tthis.editorState = this.editorView.state;\n\t\t\tconst dom = this.editorView.dom;\n\t\t\tif (dom === null || dom === void 0 ? void 0 : dom.editor) delete dom.editor;\n\t\t\tthis.editorView.destroy();\n\t\t}\n\t\tthis.editorView = null;\n\t\tthis.isInitialized = false;\n\t\tif (this.css && !document.querySelectorAll(`.${this.className}`).length) try {\n\t\t\tif (typeof this.css.remove === \"function\") this.css.remove();\n\t\t\telse if (this.css.parentNode) this.css.parentNode.removeChild(this.css);\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"Failed to remove CSS element:\", error);\n\t\t}\n\t\tthis.css = null;\n\t\tthis.emit(\"unmount\", { editor: this });\n\t}\n\t/**\n\t* Returns the editor storage.\n\t*/\n\tget storage() {\n\t\treturn this.extensionStorage;\n\t}\n\t/**\n\t* An object of all registered commands.\n\t*/\n\tget commands() {\n\t\treturn this.commandManager.commands;\n\t}\n\t/**\n\t* Create a command chain to call multiple commands at once.\n\t*/\n\tchain() {\n\t\tif (!this.commandManager) return CommandManager.createFakeChain();\n\t\treturn this.commandManager.chain();\n\t}\n\t/**\n\t* Check if a command or a command chain can be executed. Without executing it.\n\t*/\n\tcan() {\n\t\tif (!this.commandManager) return CommandManager.createFallbackCan();\n\t\treturn this.commandManager.can();\n\t}\n\t/**\n\t* Inject CSS styles.\n\t*/\n\tinjectCSS() {\n\t\tif (this.options.injectCSS && typeof document !== \"undefined\") this.css = createStyleTag(style, this.options.injectNonce);\n\t}\n\t/**\n\t* Update editor options.\n\t*\n\t* @param options A list of options\n\t*/\n\tsetOptions(options = {}) {\n\t\tthis.options = {\n\t\t\t...this.options,\n\t\t\t...options\n\t\t};\n\t\tif (!this.editorView || !this.state || this.isDestroyed) return;\n\t\tif (this.options.editorProps) this.view.setProps({\n\t\t\t...this.options.editorProps,\n\t\t\tattributes: this.getEditorViewAttributes()\n\t\t});\n\t\tthis.view.updateState(this.state);\n\t}\n\t/**\n\t* Update editable state of the editor.\n\t*/\n\tsetEditable(editable, emitUpdate = true) {\n\t\tthis.setOptions({ editable });\n\t\tif (emitUpdate) this.emit(\"update\", {\n\t\t\teditor: this,\n\t\t\ttransaction: this.state.tr,\n\t\t\tappendedTransactions: []\n\t\t});\n\t}\n\t/**\n\t* Returns whether the editor is editable.\n\t*/\n\tget isEditable() {\n\t\treturn this.options.editable && this.view && this.view.editable;\n\t}\n\t/**\n\t* Returns the editor view.\n\t*/\n\tget view() {\n\t\tif (this.editorView) return this.editorView;\n\t\treturn new Proxy({\n\t\t\tstate: this.editorState,\n\t\t\tupdateState: (state) => {\n\t\t\t\tthis.editorState = state;\n\t\t\t},\n\t\t\tdispatch: (tr) => {\n\t\t\t\tthis.dispatchTransaction(tr);\n\t\t\t},\n\t\t\tcomposing: false,\n\t\t\tdragging: null,\n\t\t\teditable: true,\n\t\t\tisDestroyed: false\n\t\t}, { get: (obj, key) => {\n\t\t\tif (this.editorView) return this.editorView[key];\n\t\t\tif (key === \"state\") return this.editorState;\n\t\t\tif (key in obj) return Reflect.get(obj, key);\n\t\t\tthrow new Error(`[tiptap error]: The editor view is not available. Cannot access view['${key}']. The editor may not be mounted yet.`);\n\t\t} });\n\t}\n\t/**\n\t* Returns the editor state.\n\t*/\n\tget state() {\n\t\tif (isDev && !this.hasWarnedStaleDecorationRead && isInDecorationApplyScope(this)) {\n\t\t\tthis.hasWarnedStaleDecorationRead = true;\n\t\t\tconsole.warn(\"[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.\");\n\t\t}\n\t\tif (this.editorView) this.editorState = this.view.state;\n\t\treturn this.editorState;\n\t}\n\t/**\n\t* Register a ProseMirror plugin.\n\t*\n\t* @param plugin A ProseMirror plugin\n\t* @param handlePlugins Control how to merge the plugin into the existing plugins.\n\t* @returns The new editor state\n\t*/\n\tregisterPlugin(plugin, handlePlugins) {\n\t\tconst plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];\n\t\tconst state = this.state.reconfigure({ plugins });\n\t\tthis.view.updateState(state);\n\t\treturn state;\n\t}\n\t/**\n\t* Unregister a ProseMirror plugin.\n\t*\n\t* @param nameOrPluginKeyToRemove The plugins name\n\t* @returns The new editor state or undefined if the editor is destroyed\n\t*/\n\tunregisterPlugin(nameOrPluginKeyToRemove) {\n\t\tif (this.isDestroyed) return;\n\t\tconst prevPlugins = this.state.plugins;\n\t\tlet plugins = prevPlugins;\n\t\t[].concat(nameOrPluginKeyToRemove).forEach((nameOrPluginKey) => {\n\t\t\tconst name = typeof nameOrPluginKey === \"string\" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;\n\t\t\tplugins = plugins.filter((plugin) => !plugin.key.startsWith(name));\n\t\t});\n\t\tif (prevPlugins.length === plugins.length) return;\n\t\tconst state = this.state.reconfigure({ plugins });\n\t\tthis.view.updateState(state);\n\t\treturn state;\n\t}\n\t/**\n\t* Creates an extension manager.\n\t*/\n\tcreateExtensionManager() {\n\t\tvar _this$options$coreExt, _this$options$coreExt2;\n\t\tconst allExtensions = [...this.options.enableCoreExtensions ? [\n\t\t\tEditable,\n\t\t\tClipboardTextSerializer.configure({ blockSeparator: (_this$options$coreExt = this.options.coreExtensionOptions) === null || _this$options$coreExt === void 0 || (_this$options$coreExt = _this$options$coreExt.clipboardTextSerializer) === null || _this$options$coreExt === void 0 ? void 0 : _this$options$coreExt.blockSeparator }),\n\t\t\tCommands,\n\t\t\tFocusEvents,\n\t\t\tKeymap,\n\t\t\tTabindex.configure({ value: (_this$options$coreExt2 = this.options.coreExtensionOptions) === null || _this$options$coreExt2 === void 0 || (_this$options$coreExt2 = _this$options$coreExt2.tabindex) === null || _this$options$coreExt2 === void 0 ? void 0 : _this$options$coreExt2.value }),\n\t\t\tDrop,\n\t\t\tPaste,\n\t\t\tDelete,\n\t\t\tTextDirection.configure({ direction: this.options.textDirection })\n\t\t].filter((ext) => {\n\t\t\tif (typeof this.options.enableCoreExtensions === \"object\") return this.options.enableCoreExtensions[ext.name] !== false;\n\t\t\treturn true;\n\t\t}) : [], ...this.options.extensions].filter((extension) => {\n\t\t\treturn [\n\t\t\t\t\"extension\",\n\t\t\t\t\"node\",\n\t\t\t\t\"mark\"\n\t\t\t].includes(extension === null || extension === void 0 ? void 0 : extension.type);\n\t\t});\n\t\tthis.extensionManager = new ExtensionManager(allExtensions, this);\n\t}\n\t/**\n\t* Creates an command manager.\n\t*/\n\tcreateCommandManager() {\n\t\tthis.commandManager = new CommandManager({ editor: this });\n\t}\n\t/**\n\t* Creates a ProseMirror schema.\n\t*/\n\tcreateSchema() {\n\t\tthis.schema = this.extensionManager.schema;\n\t}\n\t/**\n\t* Creates the initial document.\n\t*/\n\tcreateDoc() {\n\t\tlet doc;\n\t\ttry {\n\t\t\tdoc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });\n\t\t} catch (e) {\n\t\t\tif (!(e instanceof Error) || ![\"[tiptap error]: Invalid JSON content\", \"[tiptap error]: Invalid HTML content\"].includes(e.message)) throw e;\n\t\t\tconst fallbackDoc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });\n\t\t\tthis.editorState = EditorState.create({\n\t\t\t\tdoc: fallbackDoc,\n\t\t\t\tschema: this.schema,\n\t\t\t\tselection: resolveFocusPosition(fallbackDoc, this.options.autofocus) || void 0\n\t\t\t});\n\t\t\tthis.emit(\"contentError\", {\n\t\t\t\teditor: this,\n\t\t\t\terror: e,\n\t\t\t\tdisableCollaboration: () => {\n\t\t\t\t\tif (\"collaboration\" in this.storage && typeof this.storage.collaboration === \"object\" && this.storage.collaboration) this.storage.collaboration.isDisabled = true;\n\t\t\t\t\tthis.options.extensions = this.options.extensions.filter((extension) => extension.name !== \"collaboration\");\n\t\t\t\t\tthis.createExtensionManager();\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn this.editorState.doc;\n\t\t}\n\t\treturn doc;\n\t}\n\t/**\n\t* Returns the attributes for the editor element.\n\t* Merges the default `role=\"textbox\"` with the attributes from `editorProps`,\n\t* so the role is kept no matter when the props are applied.\n\t*/\n\tgetEditorViewAttributes() {\n\t\tvar _this$options$editorP;\n\t\tconst attributes = (_this$options$editorP = this.options.editorProps) === null || _this$options$editorP === void 0 ? void 0 : _this$options$editorP.attributes;\n\t\tif (isFunction(attributes)) return (state) => ({\n\t\t\trole: \"textbox\",\n\t\t\t...attributes(state)\n\t\t});\n\t\treturn {\n\t\t\trole: \"textbox\",\n\t\t\t...attributes\n\t\t};\n\t}\n\t/**\n\t* Creates a ProseMirror view.\n\t*/\n\tcreateView(element) {\n\t\tconst { editorProps, enableExtensionDispatchTransaction } = this.options;\n\t\tconst baseDispatch = editorProps.dispatchTransaction || this.dispatchTransaction.bind(this);\n\t\tconst dispatch = enableExtensionDispatchTransaction ? this.extensionManager.dispatchTransaction(baseDispatch) : baseDispatch;\n\t\tconst baseTransformPastedHTML = editorProps.transformPastedHTML;\n\t\tconst transformPastedHTML = this.extensionManager.transformPastedHTML(baseTransformPastedHTML);\n\t\tthis.editorView = new EditorView(element, {\n\t\t\t...editorProps,\n\t\t\tattributes: this.getEditorViewAttributes(),\n\t\t\tdispatchTransaction: dispatch,\n\t\t\ttransformPastedHTML,\n\t\t\tstate: this.editorState,\n\t\t\tmarkViews: this.extensionManager.markViews,\n\t\t\tnodeViews: this.extensionManager.nodeViews\n\t\t});\n\t\tconst newState = this.state.reconfigure({ plugins: this.extensionManager.plugins });\n\t\tthis.view.updateState(newState);\n\t\tthis.prependClass();\n\t\tthis.injectCSS();\n\t\tconst dom = this.view.dom;\n\t\tdom.editor = this;\n\t}\n\t/**\n\t* Creates all node and mark views.\n\t*/\n\tcreateNodeViews() {\n\t\tif (this.view.isDestroyed) return;\n\t\tthis.view.setProps({\n\t\t\tmarkViews: this.extensionManager.markViews,\n\t\t\tnodeViews: this.extensionManager.nodeViews\n\t\t});\n\t}\n\t/**\n\t* Prepend class name to element.\n\t*/\n\tprependClass() {\n\t\tthis.view.dom.className = `${this.className} ${this.view.dom.className}`;\n\t}\n\tcaptureTransaction(fn) {\n\t\tthis.isCapturingTransaction = true;\n\t\tfn();\n\t\tthis.isCapturingTransaction = false;\n\t\tconst tr = this.capturedTransaction;\n\t\tthis.capturedTransaction = null;\n\t\treturn tr;\n\t}\n\t/**\n\t* The callback over which to send transactions (state updates) produced by the view.\n\t*\n\t* @param transaction An editor state transaction\n\t*/\n\tdispatchTransaction(transaction) {\n\t\tif (this.view.isDestroyed) return;\n\t\tif (this.isCapturingTransaction) {\n\t\t\tif (!this.capturedTransaction) {\n\t\t\t\tthis.capturedTransaction = transaction;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttransaction.steps.forEach((step) => {\n\t\t\t\tvar _this$capturedTransac;\n\t\t\t\treturn (_this$capturedTransac = this.capturedTransaction) === null || _this$capturedTransac === void 0 ? void 0 : _this$capturedTransac.step(step);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst { state, transactions } = this.state.applyTransaction(transaction);\n\t\tconst selectionHasChanged = !this.state.selection.eq(state.selection);\n\t\tconst rootTrWasApplied = transactions.includes(transaction);\n\t\tconst prevState = this.state;\n\t\tthis.emit(\"beforeTransaction\", {\n\t\t\teditor: this,\n\t\t\ttransaction,\n\t\t\tnextState: state\n\t\t});\n\t\tif (!rootTrWasApplied) return;\n\t\tthis.view.updateState(state);\n\t\tthis.emit(\"transaction\", {\n\t\t\teditor: this,\n\t\t\ttransaction,\n\t\t\tappendedTransactions: transactions.slice(1)\n\t\t});\n\t\tif (selectionHasChanged) this.emit(\"selectionUpdate\", {\n\t\t\teditor: this,\n\t\t\ttransaction\n\t\t});\n\t\tconst mostRecentFocusTr = transactions.findLast((tr) => tr.getMeta(\"focus\") || tr.getMeta(\"blur\"));\n\t\tconst focus = mostRecentFocusTr === null || mostRecentFocusTr === void 0 ? void 0 : mostRecentFocusTr.getMeta(\"focus\");\n\t\tconst blur = mostRecentFocusTr === null || mostRecentFocusTr === void 0 ? void 0 : mostRecentFocusTr.getMeta(\"blur\");\n\t\tif (focus) this.emit(\"focus\", {\n\t\t\teditor: this,\n\t\t\tevent: focus.event,\n\t\t\ttransaction: mostRecentFocusTr\n\t\t});\n\t\tif (blur) this.emit(\"blur\", {\n\t\t\teditor: this,\n\t\t\tevent: blur.event,\n\t\t\ttransaction: mostRecentFocusTr\n\t\t});\n\t\tif (transaction.getMeta(\"preventUpdate\") || !transactions.some((tr) => tr.docChanged) || prevState.doc.eq(state.doc)) return;\n\t\tthis.emit(\"update\", {\n\t\t\teditor: this,\n\t\t\ttransaction,\n\t\t\tappendedTransactions: transactions.slice(1)\n\t\t});\n\t}\n\t/**\n\t* Get attributes of the currently selected node or mark.\n\t*/\n\tgetAttributes(nameOrType) {\n\t\treturn getAttributes(this.state, nameOrType);\n\t}\n\tisActive(nameOrAttributes, attributesOrUndefined) {\n\t\tconst name = typeof nameOrAttributes === \"string\" ? nameOrAttributes : null;\n\t\tconst attributes = typeof nameOrAttributes === \"string\" ? attributesOrUndefined : nameOrAttributes;\n\t\treturn isActive(this.state, name, attributes);\n\t}\n\t/**\n\t* Get the document as JSON.\n\t*/\n\tgetJSON() {\n\t\treturn this.state.doc.toJSON();\n\t}\n\t/**\n\t* Get the document as HTML.\n\t*/\n\tgetHTML() {\n\t\treturn getHTMLFromFragment(this.state.doc.content, this.schema);\n\t}\n\t/**\n\t* Get the document as text.\n\t*/\n\tgetText(options) {\n\t\tconst { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n\t\treturn getText(this.state.doc, {\n\t\t\tblockSeparator,\n\t\t\ttextSerializers: {\n\t\t\t\t...getTextSerializersFromSchema(this.schema),\n\t\t\t\t...textSerializers\n\t\t\t}\n\t\t});\n\t}\n\t/**\n\t* Check if there is no content.\n\t*/\n\tget isEmpty() {\n\t\treturn isNodeEmpty(this.state.doc);\n\t}\n\t/**\n\t* Destroy the editor.\n\t*/\n\tdestroy() {\n\t\tif (this.destroyed) return;\n\t\tthis.destroyed = true;\n\t\tthis.emit(\"destroy\");\n\t\tthis.unmount();\n\t\tthis.removeAllListeners();\n\t\tthis.extensionManager.destroy();\n\t\tthis.extensionManager = null;\n\t\tthis.schema = null;\n\t\tthis.commandManager = null;\n\t\tthis.extensionStorage = {};\n\t}\n\t/**\n\t* Check if the editor is already destroyed.\n\t*/\n\tget isDestroyed() {\n\t\tvar _this$editorView$isDe, _this$editorView;\n\t\treturn (_this$editorView$isDe = (_this$editorView = this.editorView) === null || _this$editorView === void 0 ? void 0 : _this$editorView.isDestroyed) !== null && _this$editorView$isDe !== void 0 ? _this$editorView$isDe : true;\n\t}\n\t$node(selector, attributes) {\n\t\tvar _this$$doc;\n\t\treturn ((_this$$doc = this.$doc) === null || _this$$doc === void 0 ? void 0 : _this$$doc.querySelector(selector, attributes)) || null;\n\t}\n\t$nodes(selector, attributes) {\n\t\tvar _this$$doc2;\n\t\treturn ((_this$$doc2 = this.$doc) === null || _this$$doc2 === void 0 ? void 0 : _this$$doc2.querySelectorAll(selector, attributes)) || null;\n\t}\n\t$pos(pos) {\n\t\tconst $pos = this.state.doc.resolve(pos);\n\t\tconst node = pos > 0 && $pos.nodeAfter && !$pos.nodeAfter.isText && $pos.nodeAfter.isAtom ? $pos.nodeAfter : null;\n\t\treturn new NodePos($pos, this, false, node);\n\t}\n\tget $doc() {\n\t\treturn this.$pos(0);\n\t}\n};\n//#endregion\n//#region src/decorations/Decoration.ts\n/**\n* Base class for decorations built in `addDecorations()`. Shadows `Decoration`\n* from `@tiptap/pm/view`, like core's `Node` and `Mark` do, so alias one of them\n* in files that need both.\n*\n* @example\n* import { Decoration } from '@tiptap/core'\n* import { Decoration as PMDecoration } from '@tiptap/pm/view'\n*\n* const highlight = Decoration.Inline(1, 5, { class: 'highlight' })\n*/\nvar Decoration = class {\n\tstatic Inline(from, to, attrs = {}, spec) {\n\t\treturn new InlineDecoration(from, to, attrs, spec);\n\t}\n\tstatic Node(pos, to, attrs = {}, spec) {\n\t\treturn new NodeDecoration(pos, to, attrs, spec);\n\t}\n\t/**\n\t* Creates a widget decoration: a DOM node drawn at a document position.\n\t*\n\t* The `key` is the widget's identity. While it stays the same, ProseMirror\n\t* keeps the widget mounted and only its position tracks the document.\n\t* `render`, `side`, `destroy` and other options are fixed on first mount.\n\t* Change the key to remount with new options.\n\t*\n\t* @param pos The document position where the widget is drawn.\n\t* @param render Called once on first mount. Returns the DOM node.\n\t* @param options Must include a unique `key`. See `WidgetDecorationOptions`.\n\t* @returns The widget decoration.\n\t*/\n\tstatic Widget(pos, render, options) {\n\t\tconst { key, ...spec } = options;\n\t\treturn new WidgetDecoration(pos, render, key, spec);\n\t}\n};\n/**\n* Represents an inline decoration (text-level highlighting, etc.).\n*/\nvar InlineDecoration = class extends Decoration {\n\tconstructor(from, to, attrs = {}, spec) {\n\t\tsuper();\n\t\tthis.kind = \"inline\";\n\t\tthis.from = from;\n\t\tthis.to = to;\n\t\tthis.attrs = attrs;\n\t\tthis.spec = spec;\n\t}\n\tget anchor() {\n\t\treturn this.from;\n\t}\n\ttoPMDecoration(extensionName) {\n\t\tconst spec = extensionName ? {\n\t\t\t...this.spec,\n\t\t\textensionName\n\t\t} : this.spec;\n\t\treturn Decoration$1.inline(this.from, this.to, this.attrs, spec);\n\t}\n};\n/**\n* Represents a node-level decoration (block-level highlights, etc.).\n*/\nvar NodeDecoration = class extends Decoration {\n\tconstructor(pos, to, attrs = {}, spec) {\n\t\tsuper();\n\t\tthis.kind = \"node\";\n\t\tthis.from = pos;\n\t\tthis.to = to;\n\t\tthis.attrs = attrs;\n\t\tthis.spec = spec;\n\t}\n\tget anchor() {\n\t\treturn this.from;\n\t}\n\ttoPMDecoration(extensionName) {\n\t\tconst spec = extensionName ? {\n\t\t\t...this.spec,\n\t\t\textensionName\n\t\t} : this.spec;\n\t\treturn Decoration$1.node(this.from, this.to, this.attrs, spec);\n\t}\n};\n/**\n* Represents a widget decoration (inline widgets, etc.).\n*/\nvar WidgetDecoration = class extends Decoration {\n\tconstructor(pos, render, key, spec) {\n\t\tsuper();\n\t\tthis.kind = \"widget\";\n\t\tthis.pos = pos;\n\t\tthis.render = render;\n\t\tthis.key = key;\n\t\tthis.spec = spec;\n\t}\n\tget anchor() {\n\t\treturn this.pos;\n\t}\n\ttoPMDecoration(extensionName) {\n\t\tconst spec = extensionName ? {\n\t\t\t...this.spec,\n\t\t\tkey: this.key,\n\t\t\textensionName\n\t\t} : {\n\t\t\t...this.spec,\n\t\t\tkey: this.key\n\t\t};\n\t\treturn Decoration$1.widget(this.pos, this.render, spec);\n\t}\n};\n//#endregion\n//#region src/decorations/createWidgetDecoration.ts\nfunction getCache(editor, cacheKey) {\n\tconst host = editor;\n\tlet cache = host[cacheKey];\n\tif (!cache) {\n\t\tcache = {\n\t\t\trenderers: /* @__PURE__ */ new Map(),\n\t\t\tprops: /* @__PURE__ */ new Map(),\n\t\t\tpendingProps: /* @__PURE__ */ new Map(),\n\t\t\tflushScheduled: false\n\t\t};\n\t\thost[cacheKey] = cache;\n\t\tconst sweep = cache;\n\t\teditor.on(\"destroy\", () => {\n\t\t\tsweep.pendingProps.clear();\n\t\t\tsweep.renderers.forEach((renderer) => renderer.destroy());\n\t\t\tsweep.renderers.clear();\n\t\t\tsweep.props.clear();\n\t\t});\n\t}\n\treturn cache;\n}\nfunction flushPendingProps(cache) {\n\tcache.flushScheduled = false;\n\tfor (const [key, props] of cache.pendingProps) {\n\t\tconst renderer = cache.renderers.get(key);\n\t\tif (renderer) {\n\t\t\trenderer.updateProps(props);\n\t\t\tcache.props.set(key, { ...props });\n\t\t}\n\t}\n\tcache.pendingProps.clear();\n}\n/**\n* Builds a widget decoration backed by a framework component renderer.\n*\n* Owns everything that is not framework specific: the per-editor renderer\n* cache, prop diffing, the deferred prop flush, the key reassignment guard and\n* the ProseMirror option pass-through. Framework packages supply only `create`,\n* `context` and `materialize`.\n*\n* @param options The widget options plus the three framework hooks.\n* @returns The widget decoration to return from `addDecorations`.\n* @example\n* createWidgetDecoration<ReactRenderer>({\n* editor, pos, key, props, cacheKey: WIDGET_CACHE,\n* context: getPos => ({ editor, getPos }),\n* create: renderProps => new ReactRenderer(component, { editor, props: renderProps }),\n* materialize: renderer => renderer.element,\n* })\n*/\nfunction createWidgetDecoration(options) {\n\tconst { editor, pos, key, props, cacheKey, context, create, materialize, side, relaxedSide, marks, stopEvent, ignoreSelection, destroy } = options;\n\tconst cache = getCache(editor, cacheKey);\n\tif (cache.renderers.has(key)) {\n\t\tvar _cache$pendingProps$g;\n\t\tconst previous = (_cache$pendingProps$g = cache.pendingProps.get(key)) !== null && _cache$pendingProps$g !== void 0 ? _cache$pendingProps$g : cache.props.get(key);\n\t\tif (!previous || !attrsEqual(previous, props)) {\n\t\t\tcache.pendingProps.set(key, props);\n\t\t\tif (!cache.flushScheduled) {\n\t\t\t\tcache.flushScheduled = true;\n\t\t\t\tqueueMicrotask(() => flushPendingProps(cache));\n\t\t\t}\n\t\t}\n\t}\n\tconst render = (_view, getPos) => {\n\t\tconst renderProps = {\n\t\t\t...props,\n\t\t\t...context(getPos)\n\t\t};\n\t\tlet renderer = cache.renderers.get(key);\n\t\tif (renderer) renderer.updateProps(renderProps);\n\t\telse {\n\t\t\trenderer = create(renderProps);\n\t\t\tcache.renderers.set(key, renderer);\n\t\t\tcache.props.set(key, { ...props });\n\t\t}\n\t\treturn materialize(renderer);\n\t};\n\treturn Decoration.Widget(pos, render, {\n\t\tkey,\n\t\tside,\n\t\trelaxedSide,\n\t\tmarks,\n\t\tstopEvent,\n\t\tignoreSelection,\n\t\tdestroy: (rendererElement) => {\n\t\t\tif (liveWidgetKeys(editor).has(key)) return;\n\t\t\ttry {\n\t\t\t\tvar _cache$renderers$get;\n\t\t\t\t(_cache$renderers$get = cache.renderers.get(key)) === null || _cache$renderers$get === void 0 || _cache$renderers$get.destroy();\n\t\t\t\tcache.renderers.delete(key);\n\t\t\t\tcache.props.delete(key);\n\t\t\t\tcache.pendingProps.delete(key);\n\t\t\t} finally {\n\t\t\t\tdestroy === null || destroy === void 0 || destroy(rendererElement);\n\t\t\t}\n\t\t}\n\t});\n}\n//#endregion\n//#region src/inputRules/markInputRule.ts\n/**\n* Build an input rule that adds a mark when the\n* matched text is typed into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction markInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match);\n\t\t\tif (attributes === false || attributes === null) return null;\n\t\t\tconst { tr } = state;\n\t\t\tconst captureGroup = match[match.length - 1];\n\t\t\tconst fullMatch = match[0];\n\t\t\tif (captureGroup) {\n\t\t\t\tconst startSpaces = fullMatch.search(/\\S/);\n\t\t\t\tconst textStart = range.from + fullMatch.indexOf(captureGroup);\n\t\t\t\tconst textEnd = textStart + captureGroup.length;\n\t\t\t\tif (getMarksBetween(range.from, range.to, state.doc).filter((item) => {\n\t\t\t\t\treturn item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);\n\t\t\t\t}).filter((item) => item.to > textStart).length) return null;\n\t\t\t\tif (textEnd < range.to) tr.delete(textEnd, range.to);\n\t\t\t\tif (textStart > range.from) tr.delete(range.from + startSpaces, textStart);\n\t\t\t\tconst markEnd = range.from + startSpaces + captureGroup.length;\n\t\t\t\ttr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n\t\t\t\ttr.removeStoredMark(config.type);\n\t\t\t}\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/nodeInputRule.ts\n/**\n* Build an input rule that adds a node when the\n* matched text is typed into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction nodeInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n\t\t\tconst { tr } = state;\n\t\t\tconst start = range.from;\n\t\t\tlet end = range.to;\n\t\t\tconst newNode = config.type.create(attributes);\n\t\t\tif (match[1]) {\n\t\t\t\tlet matchStart = start + match[0].lastIndexOf(match[1]);\n\t\t\t\tif (matchStart > end) matchStart = end;\n\t\t\t\telse end = matchStart + match[1].length;\n\t\t\t\tconst lastChar = match[0][match[0].length - 1];\n\t\t\t\ttr.insertText(lastChar, start + match[0].length - 1);\n\t\t\t\ttr.replaceWith(matchStart, end, newNode);\n\t\t\t} else if (match[0]) {\n\t\t\t\tconst insertionStart = config.type.isInline ? start : start - 1;\n\t\t\t\ttr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));\n\t\t\t}\n\t\t\ttr.scrollIntoView();\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/textblockTypeInputRule.ts\n/**\n* Build an input rule that changes the type of a textblock when the\n* matched text is typed into it. When using a regular expresion you’ll\n* probably want the regexp to start with `^`, so that the pattern can\n* only occur at the start of a textblock.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction textblockTypeInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tconst $start = state.doc.resolve(range.from);\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n\t\t\tif (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) return null;\n\t\t\tstate.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/textInputRule.ts\n/**\n* Build an input rule that replaces text when the\n* matched text is typed into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction textInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tlet insert = config.replace;\n\t\t\tlet start = range.from;\n\t\t\tconst end = range.to;\n\t\t\tif (match[1]) {\n\t\t\t\tconst offset = match[0].lastIndexOf(match[1]);\n\t\t\t\tinsert += match[0].slice(offset + match[1].length);\n\t\t\t\tstart += offset;\n\t\t\t\tconst cutOff = start - end;\n\t\t\t\tif (cutOff > 0) {\n\t\t\t\t\tinsert = match[0].slice(offset - cutOff, offset) + insert;\n\t\t\t\t\tstart = end;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstate.tr.insertText(insert, start, end);\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/wrappingInputRule.ts\n/**\n* Build an input rule for automatically wrapping a textblock when a\n* given string is typed. When using a regular expresion you’ll\n* probably want the regexp to start with `^`, so that the pattern can\n* only occur at the start of a textblock.\n*\n* `type` is the type of node to wrap in.\n*\n* By default, if there’s a node with the same type above the newly\n* wrapped node, the rule will try to join those\n* two nodes. You can pass a join predicate, which takes a regular\n* expression match and the node before the wrapped node, and can\n* return a boolean to indicate whether a join should happen.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction wrappingInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match, chain }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n\t\t\tconst tr = state.tr.delete(range.from, range.to);\n\t\t\tconst blockRange = tr.doc.resolve(range.from).blockRange();\n\t\t\tconst wrapping = blockRange && findWrapping(blockRange, config.type, attributes);\n\t\t\tif (!wrapping) return null;\n\t\t\ttr.wrap(blockRange, wrapping);\n\t\t\tif (config.keepMarks && config.editor) {\n\t\t\t\tconst { selection, storedMarks } = state;\n\t\t\t\tconst { splittableMarks } = config.editor.extensionManager;\n\t\t\t\tconst marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n\t\t\t\tif (marks) {\n\t\t\t\t\tconst filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n\t\t\t\t\ttr.ensureMarks(filteredMarks);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (config.keepAttributes) {\n\t\t\t\t/** If the nodeType is `bulletList` or `orderedList` set the `nodeType` as `listItem` */\n\t\t\t\tconst nodeType = config.type.name === \"bulletList\" || config.type.name === \"orderedList\" ? \"listItem\" : \"taskList\";\n\t\t\t\tchain().updateAttributes(nodeType, attributes).run();\n\t\t\t}\n\t\t\tconst before = tr.doc.resolve(range.from - 1).nodeBefore;\n\t\t\tif (before && before.type === config.type && canJoin(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) tr.join(range.from - 1);\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/jsx-runtime.ts\nconst jsxElements = /* @__PURE__ */ new WeakSet();\nconst jsxFragments = /* @__PURE__ */ new WeakSet();\n/** Create a new JSX element from the given spec */\nfunction createJSXElement(spec) {\n\tconst element = spec;\n\tjsxElements.add(element);\n\treturn element;\n}\n/** Check if a spec is a JSX element */\nfunction isJSXElement(value) {\n\treturn Array.isArray(value) && jsxElements.has(value);\n}\nfunction flattenFragmentChildren(children) {\n\treturn children.flatMap((child) => {\n\t\tif (child == null) return [];\n\t\tif (Array.isArray(child) && jsxFragments.has(child) && !isJSXElement(child)) return flattenFragmentChildren(child);\n\t\treturn [child];\n\t});\n}\nfunction Fragment(props) {\n\tjsxFragments.add(props.children);\n\treturn props.children;\n}\nfunction render(tag, attributes) {\n\tif (tag === \"slot\") return 0;\n\tif (tag instanceof Function) {\n\t\tconst result = tag(attributes);\n\t\tif (Array.isArray(result) && !isJSXElement(result) && !jsxFragments.has(result)) return createJSXElement(result);\n\t\treturn result;\n\t}\n\tconst { children, ...rest } = attributes !== null && attributes !== void 0 ? attributes : {};\n\tif (tag === \"svg\") throw new Error(\"SVG elements are not supported in the JSX syntax, use the array syntax instead\");\n\tif (Array.isArray(children)) {\n\t\tif (isJSXElement(children)) return createJSXElement([\n\t\t\ttag,\n\t\t\trest,\n\t\t\tchildren\n\t\t]);\n\t\tif (children.length === 0) return createJSXElement([tag, rest]);\n\t\tconst flattenedChildren = flattenFragmentChildren(children);\n\t\tif (flattenedChildren.length === 0) return createJSXElement([tag, rest]);\n\t\treturn createJSXElement([\n\t\t\ttag,\n\t\t\trest,\n\t\t\t...flattenedChildren\n\t\t]);\n\t}\n\tif (children !== void 0 && children !== null) return createJSXElement([\n\t\ttag,\n\t\trest,\n\t\tchildren\n\t]);\n\treturn createJSXElement([tag, rest]);\n}\nconst h = (tag, attributes) => render(tag, attributes);\n//#endregion\n//#region src/lib/ResizableNodeView.ts\nconst isTouchEvent = (e) => {\n\treturn \"touches\" in e;\n};\n/**\n* A NodeView implementation that adds resize handles to any DOM element.\n*\n* This class creates a resizable node view for Tiptap/ProseMirror editors.\n* It wraps your element with resize handles and manages the resize interaction,\n* including aspect ratio preservation, min/max constraints, and keyboard modifiers.\n*\n* @example\n* ```ts\n* // Basic usage in a Tiptap extension\n* addNodeView() {\n* return ({ node, getPos }) => {\n* const img = document.createElement('img')\n* img.src = node.attrs.src\n*\n* return new ResizableNodeView({\n* element: img,\n* node,\n* getPos,\n* onResize: (width, height) => {\n* img.style.width = `${width}px`\n* img.style.height = `${height}px`\n* },\n* onCommit: (width, height) => {\n* this.editor.commands.updateAttributes('image', { width, height })\n* },\n* onUpdate: () => true,\n* options: {\n* min: { width: 100, height: 100 },\n* preserveAspectRatio: true\n* }\n* })\n* }\n* }\n* ```\n*/\nvar ResizableNodeView = class {\n\t/**\n\t* Creates a new ResizableNodeView instance.\n\t*\n\t* The constructor sets up the resize handles, applies initial sizing from\n\t* node attributes, and configures all resize behavior options.\n\t*\n\t* @param options - Configuration options for the resizable node view\n\t*/\n\tconstructor(options) {\n\t\tvar _options$options, _options$options2, _options$options3, _options$options4, _options$options5, _options$options6;\n\t\tthis.directions = [\n\t\t\t\"bottom-left\",\n\t\t\t\"bottom-right\",\n\t\t\t\"top-left\",\n\t\t\t\"top-right\"\n\t\t];\n\t\tthis.minSize = {\n\t\t\theight: 8,\n\t\t\twidth: 8\n\t\t};\n\t\tthis.preserveAspectRatio = false;\n\t\tthis.classNames = {\n\t\t\tcontainer: \"\",\n\t\t\twrapper: \"\",\n\t\t\thandle: \"\",\n\t\t\tresizing: \"\"\n\t\t};\n\t\tthis.initialWidth = 0;\n\t\tthis.initialHeight = 0;\n\t\tthis.aspectRatio = 1;\n\t\tthis.isResizing = false;\n\t\tthis.activeHandle = null;\n\t\tthis.startX = 0;\n\t\tthis.startY = 0;\n\t\tthis.startWidth = 0;\n\t\tthis.startHeight = 0;\n\t\tthis.isShiftKeyPressed = false;\n\t\tthis.lastEditableState = void 0;\n\t\tthis.handleMap = /* @__PURE__ */ new Map();\n\t\tthis.handleEditorUpdate = () => {\n\t\t\tconst isEditable = this.editor.isEditable;\n\t\t\tif (isEditable === this.lastEditableState) return;\n\t\t\tthis.lastEditableState = isEditable;\n\t\t\tif (!isEditable) this.removeHandles();\n\t\t\telse if (isEditable && this.handleMap.size === 0) this.attachHandles();\n\t\t};\n\t\tthis.handleMouseMove = (event) => {\n\t\t\tif (!this.isResizing || !this.activeHandle) return;\n\t\t\tconst deltaX = event.clientX - this.startX;\n\t\t\tconst deltaY = event.clientY - this.startY;\n\t\t\tthis.handleResize(deltaX, deltaY);\n\t\t};\n\t\tthis.handleTouchMove = (event) => {\n\t\t\tif (!this.isResizing || !this.activeHandle) return;\n\t\t\tconst touch = event.touches[0];\n\t\t\tif (!touch) return;\n\t\t\tconst deltaX = touch.clientX - this.startX;\n\t\t\tconst deltaY = touch.clientY - this.startY;\n\t\t\tthis.handleResize(deltaX, deltaY);\n\t\t};\n\t\tthis.handleMouseUp = () => {\n\t\t\tif (!this.isResizing) return;\n\t\t\tconst finalWidth = this.element.offsetWidth;\n\t\t\tconst finalHeight = this.element.offsetHeight;\n\t\t\tthis.onCommit(finalWidth, finalHeight);\n\t\t\tthis.isResizing = false;\n\t\t\tthis.activeHandle = null;\n\t\t\tthis.container.dataset.resizeState = \"false\";\n\t\t\tif (this.classNames.resizing) this.container.classList.remove(this.classNames.resizing);\n\t\t\tdocument.removeEventListener(\"mousemove\", this.handleMouseMove);\n\t\t\tdocument.removeEventListener(\"mouseup\", this.handleMouseUp);\n\t\t\tdocument.removeEventListener(\"keydown\", this.handleKeyDown);\n\t\t\tdocument.removeEventListener(\"keyup\", this.handleKeyUp);\n\t\t};\n\t\tthis.handleKeyDown = (event) => {\n\t\t\tif (event.key === \"Shift\") this.isShiftKeyPressed = true;\n\t\t};\n\t\tthis.handleKeyUp = (event) => {\n\t\t\tif (event.key === \"Shift\") this.isShiftKeyPressed = false;\n\t\t};\n\t\tthis.node = options.node;\n\t\tthis.editor = options.editor;\n\t\tthis.element = options.element;\n\t\tthis.element.draggable = false;\n\t\tthis.contentElement = options.contentElement;\n\t\tthis.getPos = options.getPos;\n\t\tthis.onResize = options.onResize;\n\t\tthis.onCommit = options.onCommit;\n\t\tthis.onUpdate = options.onUpdate;\n\t\tif ((_options$options = options.options) === null || _options$options === void 0 ? void 0 : _options$options.min) this.minSize = {\n\t\t\t...this.minSize,\n\t\t\t...options.options.min\n\t\t};\n\t\tif ((_options$options2 = options.options) === null || _options$options2 === void 0 ? void 0 : _options$options2.max) this.maxSize = options.options.max;\n\t\tif (options === null || options === void 0 || (_options$options3 = options.options) === null || _options$options3 === void 0 ? void 0 : _options$options3.directions) this.directions = options.options.directions;\n\t\tif ((_options$options4 = options.options) === null || _options$options4 === void 0 ? void 0 : _options$options4.preserveAspectRatio) this.preserveAspectRatio = options.options.preserveAspectRatio;\n\t\tif ((_options$options5 = options.options) === null || _options$options5 === void 0 ? void 0 : _options$options5.className) this.classNames = {\n\t\t\tcontainer: options.options.className.container || \"\",\n\t\t\twrapper: options.options.className.wrapper || \"\",\n\t\t\thandle: options.options.className.handle || \"\",\n\t\t\tresizing: options.options.className.resizing || \"\"\n\t\t};\n\t\tif ((_options$options6 = options.options) === null || _options$options6 === void 0 ? void 0 : _options$options6.createCustomHandle) this.createCustomHandle = options.options.createCustomHandle;\n\t\tthis.wrapper = this.createWrapper();\n\t\tthis.container = this.createContainer();\n\t\tthis.applyInitialSize();\n\t\tthis.attachHandles();\n\t\tthis.editor.on(\"update\", this.handleEditorUpdate);\n\t}\n\t/**\n\t* Returns the top-level DOM node that should be placed in the editor.\n\t*\n\t* This is required by the ProseMirror NodeView interface. The container\n\t* includes the wrapper, handles, and the actual content element.\n\t*\n\t* @returns The container element to be inserted into the editor\n\t*/\n\tget dom() {\n\t\treturn this.container;\n\t}\n\tget contentDOM() {\n\t\tvar _this$contentElement;\n\t\treturn (_this$contentElement = this.contentElement) !== null && _this$contentElement !== void 0 ? _this$contentElement : null;\n\t}\n\t/**\n\t* Called when the node's content or attributes change.\n\t*\n\t* Updates the internal node reference. If a custom `onUpdate` callback\n\t* was provided, it will be called to handle additional update logic.\n\t*\n\t* @param node - The new/updated node\n\t* @param decorations - Node decorations\n\t* @param innerDecorations - Inner decorations\n\t* @returns `false` if the node type has changed (requires full rebuild), otherwise the result of `onUpdate` or `true`\n\t*/\n\tupdate(node, decorations, innerDecorations) {\n\t\tif (node.type !== this.node.type) return false;\n\t\tthis.node = node;\n\t\tif (this.onUpdate) return this.onUpdate(node, decorations, innerDecorations);\n\t\treturn true;\n\t}\n\t/**\n\t* Cleanup method called when the node view is being removed.\n\t*\n\t* Removes all event listeners to prevent memory leaks. This is required\n\t* by the ProseMirror NodeView interface. If a resize is active when\n\t* destroy is called, it will be properly cancelled.\n\t*/\n\tdestroy() {\n\t\tif (this.isResizing) {\n\t\t\tthis.container.dataset.resizeState = \"false\";\n\t\t\tif (this.classNames.resizing) this.container.classList.remove(this.classNames.resizing);\n\t\t\tdocument.removeEventListener(\"mousemove\", this.handleMouseMove);\n\t\t\tdocument.removeEventListener(\"mouseup\", this.handleMouseUp);\n\t\t\tdocument.removeEventListener(\"keydown\", this.handleKeyDown);\n\t\t\tdocument.removeEventListener(\"keyup\", this.handleKeyUp);\n\t\t\tthis.isResizing = false;\n\t\t\tthis.activeHandle = null;\n\t\t}\n\t\tthis.editor.off(\"update\", this.handleEditorUpdate);\n\t\tthis.container.remove();\n\t}\n\t/**\n\t* Creates the outer container element.\n\t*\n\t* The container is the top-level element returned by the NodeView and\n\t* wraps the entire resizable node. It's set up with flexbox to handle\n\t* alignment and includes data attributes for styling and identification.\n\t*\n\t* @returns The container element\n\t*/\n\tcreateContainer() {\n\t\tconst element = document.createElement(\"div\");\n\t\telement.dataset.resizeContainer = \"\";\n\t\telement.dataset.node = this.node.type.name;\n\t\telement.style.display = this.node.type.isInline ? \"inline-flex\" : \"flex\";\n\t\tif (this.classNames.container) element.className = this.classNames.container;\n\t\telement.appendChild(this.wrapper);\n\t\treturn element;\n\t}\n\t/**\n\t* Creates the wrapper element that contains the content and handles.\n\t*\n\t* The wrapper uses relative positioning so that resize handles can be\n\t* positioned absolutely within it. This is the direct parent of the\n\t* content element being made resizable.\n\t*\n\t* @returns The wrapper element\n\t*/\n\tcreateWrapper() {\n\t\tconst element = document.createElement(\"div\");\n\t\telement.style.position = \"relative\";\n\t\telement.style.display = \"block\";\n\t\telement.dataset.resizeWrapper = \"\";\n\t\tif (this.classNames.wrapper) element.className = this.classNames.wrapper;\n\t\telement.appendChild(this.element);\n\t\treturn element;\n\t}\n\t/**\n\t* Creates a resize handle element for a specific direction.\n\t*\n\t* Each handle is absolutely positioned and includes a data attribute\n\t* identifying its direction for styling purposes.\n\t*\n\t* @param direction - The resize direction for this handle\n\t* @returns The handle element\n\t*/\n\tcreateHandle(direction) {\n\t\tconst handle = document.createElement(\"div\");\n\t\thandle.dataset.resizeHandle = direction;\n\t\thandle.style.position = \"absolute\";\n\t\tif (this.classNames.handle) handle.className = this.classNames.handle;\n\t\treturn handle;\n\t}\n\t/**\n\t* Positions a handle element according to its direction.\n\t*\n\t* Corner handles (e.g., 'top-left') are positioned at the intersection\n\t* of two edges. Edge handles (e.g., 'top') span the full width or height.\n\t*\n\t* @param handle - The handle element to position\n\t* @param direction - The direction determining the position\n\t*/\n\tpositionHandle(handle, direction) {\n\t\tconst isTop = direction.includes(\"top\");\n\t\tconst isBottom = direction.includes(\"bottom\");\n\t\tconst isLeft = direction.includes(\"left\");\n\t\tconst isRight = direction.includes(\"right\");\n\t\tif (isTop) handle.style.top = \"0\";\n\t\tif (isBottom) handle.style.bottom = \"0\";\n\t\tif (isLeft) handle.style.left = \"0\";\n\t\tif (isRight) handle.style.right = \"0\";\n\t\tif (direction === \"top\" || direction === \"bottom\") {\n\t\t\thandle.style.left = \"0\";\n\t\t\thandle.style.right = \"0\";\n\t\t}\n\t\tif (direction === \"left\" || direction === \"right\") {\n\t\t\thandle.style.top = \"0\";\n\t\t\thandle.style.bottom = \"0\";\n\t\t}\n\t}\n\t/**\n\t* Creates and attaches all resize handles to the wrapper.\n\t*\n\t* Iterates through the configured directions, creates a handle for each,\n\t* positions it, attaches the mousedown listener, and appends it to the DOM.\n\t*/\n\tattachHandles() {\n\t\tthis.directions.forEach((direction) => {\n\t\t\tlet handle;\n\t\t\tif (this.createCustomHandle) handle = this.createCustomHandle(direction);\n\t\t\telse handle = this.createHandle(direction);\n\t\t\tif (!(handle instanceof HTMLElement)) {\n\t\t\t\tconsole.warn(`[ResizableNodeView] createCustomHandle(\"${direction}\") did not return an HTMLElement. Falling back to default handle.`);\n\t\t\t\thandle = this.createHandle(direction);\n\t\t\t}\n\t\t\tif (!this.createCustomHandle) this.positionHandle(handle, direction);\n\t\t\thandle.addEventListener(\"mousedown\", (event) => this.handleResizeStart(event, direction));\n\t\t\thandle.addEventListener(\"touchstart\", (event) => this.handleResizeStart(event, direction));\n\t\t\tthis.handleMap.set(direction, handle);\n\t\t\tthis.wrapper.appendChild(handle);\n\t\t});\n\t}\n\t/**\n\t* Removes all resize handles from the wrapper.\n\t*\n\t* Cleans up the handle map and removes each handle element from the DOM.\n\t*/\n\tremoveHandles() {\n\t\tthis.handleMap.forEach((el) => el.remove());\n\t\tthis.handleMap.clear();\n\t}\n\t/**\n\t* Applies initial sizing from node attributes to the element.\n\t*\n\t* If width/height attributes exist on the node, they're applied to the element.\n\t* Otherwise, the element's natural/current dimensions are measured. The aspect\n\t* ratio is calculated for later use in aspect-ratio-preserving resizes.\n\t*/\n\tapplyInitialSize() {\n\t\tconst width = this.node.attrs.width;\n\t\tconst height = this.node.attrs.height;\n\t\tif (width) {\n\t\t\tthis.element.style.width = `${width}px`;\n\t\t\tthis.initialWidth = width;\n\t\t} else this.initialWidth = this.element.offsetWidth;\n\t\tif (height) {\n\t\t\tthis.element.style.height = `${height}px`;\n\t\t\tthis.initialHeight = height;\n\t\t} else this.initialHeight = this.element.offsetHeight;\n\t\tif (this.initialWidth > 0 && this.initialHeight > 0) this.aspectRatio = this.initialWidth / this.initialHeight;\n\t}\n\t/**\n\t* Initiates a resize operation when a handle is clicked.\n\t*\n\t* Captures the starting mouse position and element dimensions, sets up\n\t* the resize state, adds the resizing class and state attribute, and\n\t* attaches document-level listeners for mouse movement and keyboard input.\n\t*\n\t* @param event - The mouse down event\n\t* @param direction - The direction of the handle being dragged\n\t*/\n\thandleResizeStart(event, direction) {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\tthis.isResizing = true;\n\t\tthis.activeHandle = direction;\n\t\tif (isTouchEvent(event)) {\n\t\t\tthis.startX = event.touches[0].clientX;\n\t\t\tthis.startY = event.touches[0].clientY;\n\t\t} else {\n\t\t\tthis.startX = event.clientX;\n\t\t\tthis.startY = event.clientY;\n\t\t}\n\t\tthis.startWidth = this.element.offsetWidth;\n\t\tthis.startHeight = this.element.offsetHeight;\n\t\tif (this.startWidth > 0 && this.startHeight > 0) this.aspectRatio = this.startWidth / this.startHeight;\n\t\tif (this.getPos() !== void 0) {}\n\t\tthis.container.dataset.resizeState = \"true\";\n\t\tif (this.classNames.resizing) this.container.classList.add(this.classNames.resizing);\n\t\tdocument.addEventListener(\"mousemove\", this.handleMouseMove);\n\t\tdocument.addEventListener(\"touchmove\", this.handleTouchMove);\n\t\tdocument.addEventListener(\"mouseup\", this.handleMouseUp);\n\t\tdocument.addEventListener(\"keydown\", this.handleKeyDown);\n\t\tdocument.addEventListener(\"keyup\", this.handleKeyUp);\n\t}\n\thandleResize(deltaX, deltaY) {\n\t\tif (!this.activeHandle) return;\n\t\tconst shouldPreserveAspectRatio = this.preserveAspectRatio || this.isShiftKeyPressed;\n\t\tconst { width, height } = this.calculateNewDimensions(this.activeHandle, deltaX, deltaY);\n\t\tconst constrained = this.applyConstraints(width, height, shouldPreserveAspectRatio);\n\t\tthis.element.style.width = `${constrained.width}px`;\n\t\tthis.element.style.height = `${constrained.height}px`;\n\t\tif (this.onResize) this.onResize(constrained.width, constrained.height);\n\t}\n\t/**\n\t* Calculates new dimensions based on mouse delta and resize direction.\n\t*\n\t* Takes the starting dimensions and applies the mouse movement delta\n\t* according to the handle direction. For corner handles, both dimensions\n\t* are affected. For edge handles, only one dimension changes. If aspect\n\t* ratio should be preserved, delegates to applyAspectRatio.\n\t*\n\t* @param direction - The active resize handle direction\n\t* @param deltaX - Horizontal mouse movement since resize start\n\t* @param deltaY - Vertical mouse movement since resize start\n\t* @returns The calculated width and height\n\t*/\n\tcalculateNewDimensions(direction, deltaX, deltaY) {\n\t\tlet newWidth = this.startWidth;\n\t\tlet newHeight = this.startHeight;\n\t\tconst isRight = direction.includes(\"right\");\n\t\tconst isLeft = direction.includes(\"left\");\n\t\tconst isBottom = direction.includes(\"bottom\");\n\t\tconst isTop = direction.includes(\"top\");\n\t\tif (isRight) newWidth = this.startWidth + deltaX;\n\t\telse if (isLeft) newWidth = this.startWidth - deltaX;\n\t\tif (isBottom) newHeight = this.startHeight + deltaY;\n\t\telse if (isTop) newHeight = this.startHeight - deltaY;\n\t\tif (direction === \"right\" || direction === \"left\") newWidth = this.startWidth + (isRight ? deltaX : -deltaX);\n\t\tif (direction === \"top\" || direction === \"bottom\") newHeight = this.startHeight + (isBottom ? deltaY : -deltaY);\n\t\tif (this.preserveAspectRatio || this.isShiftKeyPressed) return this.applyAspectRatio(newWidth, newHeight, direction);\n\t\treturn {\n\t\t\twidth: newWidth,\n\t\t\theight: newHeight\n\t\t};\n\t}\n\t/**\n\t* Applies min/max constraints to dimensions.\n\t*\n\t* When aspect ratio is NOT preserved, constraints are applied independently\n\t* to width and height. When aspect ratio IS preserved, constraints are\n\t* applied while maintaining the aspect ratio—if one dimension hits a limit,\n\t* the other is recalculated proportionally.\n\t*\n\t* This ensures that aspect ratio is never broken when constrained.\n\t*\n\t* @param width - The unconstrained width\n\t* @param height - The unconstrained height\n\t* @param preserveAspectRatio - Whether to maintain aspect ratio while constraining\n\t* @returns The constrained dimensions\n\t*/\n\tapplyConstraints(width, height, preserveAspectRatio) {\n\t\tvar _this$maxSize3, _this$maxSize4;\n\t\tif (!preserveAspectRatio) {\n\t\t\tvar _this$maxSize, _this$maxSize2;\n\t\t\tlet constrainedWidth = Math.max(this.minSize.width, width);\n\t\t\tlet constrainedHeight = Math.max(this.minSize.height, height);\n\t\t\tif ((_this$maxSize = this.maxSize) === null || _this$maxSize === void 0 ? void 0 : _this$maxSize.width) constrainedWidth = Math.min(this.maxSize.width, constrainedWidth);\n\t\t\tif ((_this$maxSize2 = this.maxSize) === null || _this$maxSize2 === void 0 ? void 0 : _this$maxSize2.height) constrainedHeight = Math.min(this.maxSize.height, constrainedHeight);\n\t\t\treturn {\n\t\t\t\twidth: constrainedWidth,\n\t\t\t\theight: constrainedHeight\n\t\t\t};\n\t\t}\n\t\tlet constrainedWidth = width;\n\t\tlet constrainedHeight = height;\n\t\tif (constrainedWidth < this.minSize.width) {\n\t\t\tconstrainedWidth = this.minSize.width;\n\t\t\tconstrainedHeight = constrainedWidth / this.aspectRatio;\n\t\t}\n\t\tif (constrainedHeight < this.minSize.height) {\n\t\t\tconstrainedHeight = this.minSize.height;\n\t\t\tconstrainedWidth = constrainedHeight * this.aspectRatio;\n\t\t}\n\t\tif (((_this$maxSize3 = this.maxSize) === null || _this$maxSize3 === void 0 ? void 0 : _this$maxSize3.width) && constrainedWidth > this.maxSize.width) {\n\t\t\tconstrainedWidth = this.maxSize.width;\n\t\t\tconstrainedHeight = constrainedWidth / this.aspectRatio;\n\t\t}\n\t\tif (((_this$maxSize4 = this.maxSize) === null || _this$maxSize4 === void 0 ? void 0 : _this$maxSize4.height) && constrainedHeight > this.maxSize.height) {\n\t\t\tconstrainedHeight = this.maxSize.height;\n\t\t\tconstrainedWidth = constrainedHeight * this.aspectRatio;\n\t\t}\n\t\treturn {\n\t\t\twidth: constrainedWidth,\n\t\t\theight: constrainedHeight\n\t\t};\n\t}\n\t/**\n\t* Adjusts dimensions to maintain the original aspect ratio.\n\t*\n\t* For horizontal handles (left/right), uses width as the primary dimension\n\t* and calculates height from it. For vertical handles (top/bottom), uses\n\t* height as primary and calculates width. For corner handles, uses width\n\t* as the primary dimension.\n\t*\n\t* @param width - The new width\n\t* @param height - The new height\n\t* @param direction - The active resize direction\n\t* @returns Dimensions adjusted to preserve aspect ratio\n\t*/\n\tapplyAspectRatio(width, height, direction) {\n\t\tconst isHorizontal = direction === \"left\" || direction === \"right\";\n\t\tconst isVertical = direction === \"top\" || direction === \"bottom\";\n\t\tif (isHorizontal) return {\n\t\t\twidth,\n\t\t\theight: width / this.aspectRatio\n\t\t};\n\t\tif (isVertical) return {\n\t\t\twidth: height * this.aspectRatio,\n\t\t\theight\n\t\t};\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: width / this.aspectRatio\n\t\t};\n\t}\n};\n/**\n* Alias for ResizableNodeView to maintain consistent naming.\n* @deprecated Use ResizableNodeView instead - will be removed in future versions.\n*/\nconst ResizableNodeview = ResizableNodeView;\n//#endregion\n//#region src/Node.ts\n/**\n* The Node class is used to create custom node extensions.\n* @see https://tiptap.dev/api/extensions#create-a-new-extension\n*/\nvar Node = class Node extends Extendable {\n\tconstructor(..._args) {\n\t\tsuper(..._args);\n\t\tthis.type = \"node\";\n\t}\n\t/**\n\t* Create a new Node instance\n\t* @param config - Node configuration object or a function that returns a configuration object\n\t*/\n\tstatic create(config = {}) {\n\t\tconst resolvedConfig = typeof config === \"function\" ? config() : config;\n\t\treturn new Node(resolvedConfig);\n\t}\n\tconfigure(options) {\n\t\treturn super.configure(options);\n\t}\n\textend(extendedConfig) {\n\t\tconst resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n\t\treturn super.extend(resolvedConfig);\n\t}\n};\n//#endregion\n//#region src/NodeView.ts\n/**\n* Node views are used to customize the rendered DOM structure of a node.\n* @see https://tiptap.dev/guide/node-views\n*/\nvar NodeView = class {\n\tconstructor(component, props, options) {\n\t\tthis.isDragging = false;\n\t\tthis.component = component;\n\t\tthis.editor = props.editor;\n\t\tthis.options = {\n\t\t\tstopEvent: null,\n\t\t\tignoreMutation: null,\n\t\t\t...options\n\t\t};\n\t\tthis.extension = props.extension;\n\t\tthis.node = props.node;\n\t\tthis.decorations = props.decorations;\n\t\tthis.innerDecorations = props.innerDecorations;\n\t\tthis.view = props.view;\n\t\tthis.HTMLAttributes = props.HTMLAttributes;\n\t\tthis.getPos = () => {\n\t\t\ttry {\n\t\t\t\treturn props.getPos();\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t};\n\t\tthis.mount();\n\t}\n\tmount() {}\n\tget dom() {\n\t\treturn this.editor.view.dom;\n\t}\n\tget contentDOM() {\n\t\treturn null;\n\t}\n\tonDragStart(event) {\n\t\tvar _target$parentElement, _this$contentDOM;\n\t\tconst { view } = this.editor;\n\t\tconst target = event.target;\n\t\tconst dragHandle = target.nodeType === 3 ? (_target$parentElement = target.parentElement) === null || _target$parentElement === void 0 ? void 0 : _target$parentElement.closest(\"[data-drag-handle]\") : target.closest(\"[data-drag-handle]\");\n\t\tif (!this.dom || ((_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 ? void 0 : _this$contentDOM.contains(target)) || !dragHandle) return;\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\tif (this.dom !== dragHandle) {\n\t\t\tvar _event$offsetX, _nativeEvent, _event$offsetY, _nativeEvent2;\n\t\t\tconst domBox = this.dom.getBoundingClientRect();\n\t\t\tconst handleBox = dragHandle.getBoundingClientRect();\n\t\t\tconst offsetX = (_event$offsetX = event.offsetX) !== null && _event$offsetX !== void 0 ? _event$offsetX : (_nativeEvent = event.nativeEvent) === null || _nativeEvent === void 0 ? void 0 : _nativeEvent.offsetX;\n\t\t\tconst offsetY = (_event$offsetY = event.offsetY) !== null && _event$offsetY !== void 0 ? _event$offsetY : (_nativeEvent2 = event.nativeEvent) === null || _nativeEvent2 === void 0 ? void 0 : _nativeEvent2.offsetY;\n\t\t\tx = handleBox.x - domBox.x + offsetX;\n\t\t\ty = handleBox.y - domBox.y + offsetY;\n\t\t}\n\t\tconst clonedNode = this.dom.cloneNode(true);\n\t\ttry {\n\t\t\tconst domBox = this.dom.getBoundingClientRect();\n\t\t\tclonedNode.style.width = `${Math.round(domBox.width)}px`;\n\t\t\tclonedNode.style.height = `${Math.round(domBox.height)}px`;\n\t\t\tclonedNode.style.boxSizing = \"border-box\";\n\t\t\tclonedNode.style.pointerEvents = \"none\";\n\t\t} catch {}\n\t\tlet dragImageWrapper = null;\n\t\ttry {\n\t\t\tvar _event$dataTransfer;\n\t\t\tdragImageWrapper = document.createElement(\"div\");\n\t\t\tdragImageWrapper.style.position = \"absolute\";\n\t\t\tdragImageWrapper.style.top = \"-9999px\";\n\t\t\tdragImageWrapper.style.left = \"-9999px\";\n\t\t\tdragImageWrapper.style.pointerEvents = \"none\";\n\t\t\tdragImageWrapper.appendChild(clonedNode);\n\t\t\tdocument.body.appendChild(dragImageWrapper);\n\t\t\t(_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 || _event$dataTransfer.setDragImage(clonedNode, x, y);\n\t\t} finally {\n\t\t\tif (dragImageWrapper) setTimeout(() => {\n\t\t\t\ttry {\n\t\t\t\t\tdragImageWrapper === null || dragImageWrapper === void 0 || dragImageWrapper.remove();\n\t\t\t\t} catch {}\n\t\t\t}, 0);\n\t\t}\n\t\tconst pos = this.getPos();\n\t\tif (typeof pos !== \"number\") return;\n\t\tconst selection = NodeSelection.create(view.state.doc, pos);\n\t\tconst transaction = view.state.tr.setSelection(selection);\n\t\tview.dispatch(transaction);\n\t}\n\tstopEvent(event) {\n\t\tvar _this$contentDOM2;\n\t\tif (!this.dom) return false;\n\t\tif (typeof this.options.stopEvent === \"function\") return this.options.stopEvent({ event });\n\t\tconst target = event.target;\n\t\tif (!(this.dom.contains(target) && !((_this$contentDOM2 = this.contentDOM) === null || _this$contentDOM2 === void 0 ? void 0 : _this$contentDOM2.contains(target)))) return false;\n\t\tconst isDragEvent = event.type.startsWith(\"drag\");\n\t\tconst isDragOverEnterEvent = event.type === \"dragover\" || event.type === \"dragenter\";\n\t\tconst isDropEvent = event.type === \"drop\";\n\t\tif (([\n\t\t\t\"INPUT\",\n\t\t\t\"BUTTON\",\n\t\t\t\"SELECT\",\n\t\t\t\"TEXTAREA\"\n\t\t].includes(target.tagName) || target.isContentEditable) && !isDropEvent && !isDragEvent) return true;\n\t\tconst { isEditable } = this.editor;\n\t\tconst { isDragging } = this;\n\t\tconst isDraggable = !!this.node.type.spec.draggable;\n\t\tconst isSelectable = NodeSelection.isSelectable(this.node);\n\t\tconst isCopyEvent = event.type === \"copy\";\n\t\tconst isPasteEvent = event.type === \"paste\";\n\t\tconst isCutEvent = event.type === \"cut\";\n\t\tconst isClickEvent = event.type === \"mousedown\";\n\t\tif (!isDraggable && isSelectable && isDragEvent && event.target === this.dom) event.preventDefault();\n\t\tif (isDraggable && isDragEvent && !isDragging && event.target === this.dom) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t\tif (isDraggable && isEditable && !isDragging && isClickEvent) {\n\t\t\tconst dragHandle = target.closest(\"[data-drag-handle]\");\n\t\t\tif (dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle))) {\n\t\t\t\tthis.isDragging = true;\n\t\t\t\tdocument.addEventListener(\"dragend\", () => {\n\t\t\t\t\tthis.isDragging = false;\n\t\t\t\t}, { once: true });\n\t\t\t\tdocument.addEventListener(\"drop\", () => {\n\t\t\t\t\tthis.isDragging = false;\n\t\t\t\t}, { once: true });\n\t\t\t\tdocument.addEventListener(\"mouseup\", () => {\n\t\t\t\t\tthis.isDragging = false;\n\t\t\t\t}, { once: true });\n\t\t\t}\n\t\t}\n\t\tif (isDragging || isDragOverEnterEvent || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) return false;\n\t\treturn true;\n\t}\n\t/**\n\t* Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.\n\t* @return `false` if the editor should re-read the selection or re-parse the range around the mutation\n\t* @return `true` if it can safely be ignored.\n\t*/\n\tignoreMutation(mutation) {\n\t\tif (!this.dom) return true;\n\t\tif (!this.contentDOM) return mutation.type !== \"selection\";\n\t\tif (typeof this.options.ignoreMutation === \"function\") return this.options.ignoreMutation({ mutation });\n\t\tif (this.node.isLeaf || this.node.isAtom) return true;\n\t\tif (mutation.type === \"selection\") return false;\n\t\tif (this.contentDOM.contains(mutation.target) && mutation.type === \"childList\" && (isiOS() || isAndroid()) && this.editor.isFocused) {\n\t\t\tif ([...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)].every((node) => node.isContentEditable)) return false;\n\t\t}\n\t\tif (this.contentDOM === mutation.target && mutation.type === \"attributes\") return true;\n\t\tif (this.contentDOM.contains(mutation.target)) return false;\n\t\treturn true;\n\t}\n\t/**\n\t* Update the attributes of the prosemirror node.\n\t*/\n\tupdateAttributes(attributes) {\n\t\tthis.editor.commands.command(({ tr }) => {\n\t\t\tconst pos = this.getPos();\n\t\t\tif (typeof pos !== \"number\") return false;\n\t\t\ttr.setNodeMarkup(pos, void 0, {\n\t\t\t\t...this.node.attrs,\n\t\t\t\t...attributes\n\t\t\t});\n\t\t\treturn true;\n\t\t});\n\t}\n\t/**\n\t* Delete the node.\n\t*/\n\tdeleteNode() {\n\t\tconst from = this.getPos();\n\t\tif (typeof from !== \"number\") return;\n\t\tconst to = from + this.node.nodeSize;\n\t\tthis.editor.commands.deleteRange({\n\t\t\tfrom,\n\t\t\tto\n\t\t});\n\t}\n};\n//#endregion\n//#region src/pasteRules/markPasteRule.ts\n/**\n* Build an paste rule that adds a mark when the\n* matched text is pasted into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n*/\nfunction markPasteRule(config) {\n\treturn new PasteRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match, pasteEvent }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);\n\t\t\tif (attributes === false || attributes === null) return null;\n\t\t\tconst { tr } = state;\n\t\t\tconst captureGroup = match[match.length - 1];\n\t\t\tconst fullMatch = match[0];\n\t\t\tlet markEnd = range.to;\n\t\t\tif (captureGroup) {\n\t\t\t\tconst startSpaces = fullMatch.search(/\\S/);\n\t\t\t\tconst textStart = range.from + fullMatch.indexOf(captureGroup);\n\t\t\t\tconst textEnd = textStart + captureGroup.length;\n\t\t\t\tif (getMarksBetween(range.from, range.to, state.doc).filter((item) => {\n\t\t\t\t\treturn item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);\n\t\t\t\t}).filter((item) => item.to > textStart).length) return null;\n\t\t\t\tif (textEnd < range.to) tr.delete(textEnd, range.to);\n\t\t\t\tif (textStart > range.from) tr.delete(range.from + startSpaces, textStart);\n\t\t\t\tmarkEnd = range.from + startSpaces + captureGroup.length;\n\t\t\t\ttr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n\t\t\t\tif (!(match.index !== void 0 && match.input !== void 0 && match.index + match[0].length >= match.input.length)) tr.removeStoredMark(config.type);\n\t\t\t}\n\t\t}\n\t});\n}\n//#endregion\n//#region src/pasteRules/nodePasteRule.ts\n/**\n* Build an paste rule that adds a node when the\n* matched text is pasted into it.\n* @see https://tiptap.dev/docs/editor/api/paste-rules\n*/\nfunction nodePasteRule(config) {\n\treturn new PasteRule({\n\t\tfind: config.find,\n\t\thandler({ match, chain, range, pasteEvent }) {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);\n\t\t\tconst content = callOrReturn(config.getContent, void 0, attributes);\n\t\t\tif (attributes === false || attributes === null) return null;\n\t\t\tconst node = {\n\t\t\t\ttype: config.type.name,\n\t\t\t\tattrs: attributes\n\t\t\t};\n\t\t\tif (content) node.content = content;\n\t\t\tif (match.input) chain().deleteRange(range).insertContentAt(range.from, node);\n\t\t}\n\t});\n}\n//#endregion\n//#region src/pasteRules/textPasteRule.ts\n/**\n* Build an paste rule that replaces text when the\n* matched text is pasted into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n*/\nfunction textPasteRule(config) {\n\treturn new PasteRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tlet insert = config.replace;\n\t\t\tlet start = range.from;\n\t\t\tconst end = range.to;\n\t\t\tif (match[1]) {\n\t\t\t\tconst offset = match[0].lastIndexOf(match[1]);\n\t\t\t\tinsert += match[0].slice(offset + match[1].length);\n\t\t\t\tstart += offset;\n\t\t\t\tconst cutOff = start - end;\n\t\t\t\tif (cutOff > 0) {\n\t\t\t\t\tinsert = match[0].slice(offset - cutOff, offset) + insert;\n\t\t\t\t\tstart = end;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstate.tr.insertText(insert, start, end);\n\t\t}\n\t});\n}\n//#endregion\n//#region src/Tracker.ts\nvar Tracker = class {\n\tconstructor(transaction) {\n\t\tthis.transaction = transaction;\n\t\tthis.currentStep = this.transaction.steps.length;\n\t}\n\tmap(position) {\n\t\tlet deleted = false;\n\t\treturn {\n\t\t\tposition: this.transaction.steps.slice(this.currentStep).reduce((newPosition, step) => {\n\t\t\t\tconst mapResult = step.getMap().mapResult(newPosition);\n\t\t\t\tif (mapResult.deleted) deleted = true;\n\t\t\t\treturn mapResult.pos;\n\t\t\t}, position),\n\t\t\tdeleted\n\t\t};\n\t}\n};\n//#endregion\nexport { CommandManager, DECORATION_MANAGER_PLUGIN_KEY, Decoration, DecorationManager, Editor, Extendable, Extension, Fragment, InlineDecoration, InputRule, MappablePosition, Mark, MarkView, Node, NodeDecoration, NodePos, NodeView, PasteRule, ResizableNodeView, ResizableNodeview, Tracker, WidgetDecoration, attrsEqual, callOrReturn, canInsertNode, combineTransactionSteps, commands_exports as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, h, createInlineMarkdownSpec, createMappablePosition, createNodeFromContent, createStyleTag, createWidgetDecoration, decodeHtmlEntities, defaultBlockAt, deleteProps, elementFromString, encodeHtmlEntities, escapeForRegEx, extensions_exports as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getPreviousBlockSibling, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getStyleProperty, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getUpdatedPosition, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFirefox, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNodeViewSelected, isNumber, isPlainObject, isProseMirrorAddMarkStep, isProseMirrorAddNodeMarkStep, isProseMirrorAttrStep, isProseMirrorCellSelection, isProseMirrorDocAttrStep, isProseMirrorFragment, isProseMirrorNodeSelection, isProseMirrorRemoveMarkStep, isProseMirrorRemoveNodeMarkStep, isProseMirrorReplaceAroundStep, isProseMirrorReplaceStep, isProseMirrorSlice, isProseMirrorStep, isProseMirrorStepResult, isRegExp, isSafari, isString, isTextSelection, isValidCSSStyleValue, isiOS, liveWidgetKeys, markInputRule, markPasteRule, markdown_exports as markdown, marksEqual, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, pasteRulesPlugin, posToDOMRect, removeDuplicates, renderNestedMarkdownContent, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, serializeAttributes, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, updateMarkViewAttributes, wrappingInputRule };\n\n//# sourceMappingURL=index.js.map"],"ignoreList":[0],"mappings":";;;;;;;;;;AAeA,SAASE,EAAqB,GAAQ;CACrC,IAAM,EAAE,UAAO,mBAAgBC,GAC3B,EAAE,iBAAcC,GAChB,EAAE,WAAQA,GACV,EAAE,mBAAgBA;CACtB,OAAO;EACN,GAAGC;EACH,OAAOA,EAAM,MAAM,KAAKA,CAAK;EAC7B,kBAAkBA,EAAM,iBAAiB,KAAKA,CAAK;EACnD,SAASA,EAAM;EACf,QAAQA,EAAM;EACd,aAAaA,EAAM,YAAY,KAAKA,CAAK;EACzC,QAAQA,EAAM,OAAO,KAAKA,CAAK;EAC/B,IAAI,cAAc;GACjB,OAAOC;EACR;EACA,IAAI,YAAY;GACf,OAAOC;EACR;EACA,IAAI,MAAM;GACT,OAAOC;EACR;EACA,IAAI,KAAK;GAIR,OAHA,IAAYJ,EAAY,WACxB,IAAMA,EAAY,KAClB,IAAcA,EAAY,aACnBA;EACR;CACD;AACD;AAGA,IAAIK,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